:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --surface: #ffffff;
  --surface-2: #eef5f6;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe4e8;
  --accent: #0f766e;
  --accent-2: #0e7490;
  --ink: #101828;
  --success: #15803d;
  --danger: #b91c1c;
  --warning: #b45309;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea {
  font: inherit;
}
button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}
.is-authenticated .app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}
.sidebar {
  display: none;
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  flex-direction: column;
  gap: 26px;
}
.is-authenticated .sidebar {
  display: flex;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ecfeff;
  font-weight: 900;
}
.nav-groups {
  display: grid;
  gap: 24px;
}
.nav-group p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}
.nav-item {
  display: flex;
  align-items: center;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 12px;
  color: #334155;
  font-weight: 650;
}
.nav-item:hover,
.nav-item.active {
  background: #e7f4f4;
  color: var(--accent);
}
.sidebar-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
}

.main {
  min-width: 0;
  padding: 24px 30px 42px;
}
.is-guest .main {
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px 28px 56px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}
.is-guest .topbar {
  margin-bottom: 18px;
}
.crumb {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}
h1, h2, h3, p {
  margin-top: 0;
}
h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.2;
}
h2 {
  font-size: 19px;
  margin-bottom: 12px;
}
h3 {
  font-size: 16px;
}
.top-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 44px;
  color: var(--muted);
}
.top-account button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  min-height: 38px;
  padding: 0 14px;
}
.top-login-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--accent);
  font-weight: 850;
}

.guest-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
}
.guest-copy {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbfb 48%, #e8f8f5 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 56px 48px;
  box-shadow: var(--shadow);
}
.guest-copy::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.99) 0%, rgba(255,255,255,0.94) 48%, rgba(255,255,255,0.28) 76%, rgba(255,255,255,0) 100%);
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 560px;
}
.guest-copy h2 {
  max-width: 620px;
  font-size: clamp(36px, 4.5vw, 60px);
  line-height: 1.02;
  margin: 0 0 22px;
  letter-spacing: 0;
}
.guest-copy p {
  max-width: 600px;
  color: #475569;
  line-height: 1.72;
  font-size: 17px;
  margin-bottom: 0;
}
.hero-visual {
  position: absolute;
  z-index: 0;
  right: -190px;
  top: -10px;
  width: 74%;
  height: calc(100% + 20px);
  object-fit: cover;
  object-position: right center;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}
.primary-link,
.secondary-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 850;
}
.primary-link {
  background: var(--accent);
  color: #ffffff;
}
.secondary-link {
  border: 1px solid #b9dadd;
  background: rgba(255,255,255,0.76);
  color: #155e75;
}
.user-promises {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.user-promises span {
  border: 1px solid #b9dadd;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 750;
  color: #155e75;
}
.auth-card,
.panel,
.quick-panel,
.account-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.auth-card {
  padding: 28px;
  position: sticky;
  top: 24px;
}
.auth-intro {
  margin: -4px 0 18px;
  color: var(--muted);
  line-height: 1.5;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.tab {
  border: 0;
  background: transparent;
  min-height: 42px;
  color: var(--muted);
  font-weight: 800;
}
.tab.active {
  color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}
.form-grid {
  display: grid;
  gap: 14px;
}
label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 12px;
  outline: none;
}
textarea {
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}
.primary,
.inline-form button,
.admin-action {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 800;
}
.form-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.form-message.error {
  color: var(--danger);
}
.form-message.success {
  color: var(--success);
}
.payment-result {
  margin-top: 14px;
  border: 1px solid #b9dadd;
  background: #fbfdfe;
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 12px;
  color: #334155;
  line-height: 1.5;
}
.payment-result strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}
.payment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pay-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 0 14px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 800;
}
.payment-qr {
  width: 180px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}
.context-box {
  margin-bottom: 16px;
  border: 1px solid #99f6e4;
  background: #ecfeff;
  border-radius: 8px;
  padding: 12px 14px;
  color: #134e4a;
  display: grid;
  gap: 6px;
  line-height: 1.5;
}
.context-box strong {
  color: #0f766e;
}
.return-link {
  color: #0e7490;
  font-weight: 800;
}

.dashboard {
  display: grid;
  gap: 18px;
}
.summary-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 0.8fr) minmax(280px, 0.8fr);
  gap: 18px;
}
.balance-panel {
  min-height: 180px;
  border-radius: 8px;
  padding: 26px;
  color: #ecfeff;
  background: linear-gradient(135deg, #0f766e 0%, #0e7490 100%);
  box-shadow: var(--shadow);
}
.balance-panel p {
  margin-bottom: 12px;
  color: #ccfbf1;
  font-weight: 750;
}
.balance-panel strong {
  display: block;
  font-size: 42px;
  line-height: 1;
  margin-bottom: 30px;
}
.balance-panel div {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(236, 254, 255, 0.25);
  padding-top: 14px;
}
.balance-panel small {
  display: block;
  margin-top: 12px;
  color: #bff7ed;
  font-weight: 700;
}
.quick-panel,
.account-panel,
.panel {
  padding: 22px;
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.quick-actions a {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #155e75;
  font-weight: 800;
  background: #fbfdfe;
}
dl {
  margin: 0;
  display: grid;
  gap: 12px;
}
dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}
.work-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(480px, 1.18fr);
  gap: 18px;
}
.lower-grid {
  grid-template-columns: 1fr 1fr;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-heading h2 {
  margin-bottom: 0;
}
.panel-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.amount-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.amount-buttons button {
  border: 1px solid var(--line);
  background: #fbfdfe;
  border-radius: 8px;
  min-height: 36px;
  color: #155e75;
  font-weight: 800;
}
.inline-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(170px, 0.8fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}
.token-box {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #99f6e4;
  background: #ecfeff;
  color: #134e4a;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-wrap: anywhere;
}
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 14px;
}
th, td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}
tr:last-child td {
  border-bottom: 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  min-height: 24px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 850;
  background: #e2e8f0;
  color: #334155;
}
.badge.active,
.badge.approved {
  background: #dcfce7;
  color: #166534;
}
.badge.pending {
  background: #fef3c7;
  color: #92400e;
}
.badge.paying {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge.rejected,
.badge.disabled {
  background: #fee2e2;
  color: #991b1b;
}
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.service-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdfe;
}
.service-card h3 {
  margin-bottom: 8px;
}
.service-card p {
  color: var(--muted);
  line-height: 1.55;
  min-height: 48px;
}
.service-card a {
  color: var(--accent-2);
  font-weight: 800;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}
.admin-action {
  min-height: 32px;
  margin-right: 6px;
}
.admin-action.reject {
  background: #991b1b;
}
.empty {
  color: var(--muted);
  padding: 18px;
}
.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .is-authenticated .app-shell {
    grid-template-columns: 1fr;
  }
  .is-authenticated .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }
  .nav-groups {
    display: flex;
  }
  .nav-group {
    min-width: 170px;
  }
  .sidebar-foot {
    margin-left: auto;
  }
  .guest-layout,
  .summary-grid,
  .work-grid,
  .lower-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .services-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .guest-copy {
    min-height: 520px;
  }
  .auth-card {
    position: static;
  }
  .hero-visual {
    right: -170px;
    width: 84%;
  }
}

@media (max-width: 680px) {
  .main {
    padding: 18px 14px 34px;
  }
  .is-guest .main {
    padding: 18px 14px 34px;
  }
  .topbar {
    align-items: start;
    flex-direction: column;
  }
  .guest-copy,
  .auth-card,
  .panel,
  .quick-panel,
  .account-panel {
    padding: 18px;
  }
  .guest-copy h2 {
    font-size: 36px;
  }
  .guest-copy {
    min-height: auto;
    padding: 24px 18px 260px;
  }
  .guest-copy::after {
    background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(255,255,255,0.96) 48%, rgba(255,255,255,0.18) 76%, rgba(255,255,255,0) 100%);
  }
  .hero-visual {
    top: auto;
    bottom: -45px;
    right: -80px;
    width: 135%;
    height: 330px;
    object-position: right bottom;
  }
  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .inline-form,
  .amount-buttons,
  .quick-actions,
  .services-grid {
    grid-template-columns: 1fr;
  }
  .is-authenticated .sidebar {
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .nav-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .nav-group {
    min-width: 0;
  }
  .nav-item {
    min-height: 34px;
    padding: 0 10px;
  }
  .sidebar-foot {
    display: none;
  }
}
