:root {
  --portal-bg: #f4f7fb;
  --portal-ink: #0f172a;
  --portal-muted: #64748b;
  --portal-line: #dbe3ee;
  --portal-navy: #0d1528;
  --portal-red: #fa2637;
  --portal-red-dark: #d91f2d;
  --portal-green: #00a878;
  --portal-blue: #1d4ed8;
  --portal-card: #ffffff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--portal-bg);
  color: var(--portal-ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.portal-nav {
  position: sticky;
  top: 18px;
  z-index: 20;
  width: min(1160px, calc(100% - 48px));
  height: 78px;
  margin: 18px auto 0;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-radius: 999px;
  background: #252c3b;
  box-shadow: 0 18px 36px rgba(15, 23, 42, .16);
}

.portal-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.portal-logo img {
  width: auto;
  height: 48px;
  max-width: 170px;
  object-fit: contain;
  border-radius: 8px;
}

.portal-menu {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #1c2333;
}

.portal-menu a {
  min-width: 82px;
  padding: 12px 14px;
  border-radius: 999px;
  color: #d1d5dd;
  font-weight: 800;
  text-align: center;
}

.portal-menu a:hover,
.portal-menu a.active {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

.portal-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 24px;
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
  background: linear-gradient(135deg, #ff6a00, #ee000b);
  box-shadow: 0 14px 28px rgba(255, 79, 0, .28);
  transition: transform .2s ease, box-shadow .2s ease;
}

.portal-login:hover,
.primary-action:hover,
.ghost-action:hover,
.danger-action:hover {
  transform: translateY(-2px);
}

.portal-login:hover,
.primary-action:hover {
  box-shadow: 0 18px 34px rgba(255, 79, 0, .34);
}

.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 35%, rgba(255, 106, 0, .08), transparent 26%),
    radial-gradient(circle at 92% 55%, rgba(29, 78, 216, .09), transparent 30%),
    #f7fafc;
}

.auth-page footer {
  min-height: 132px;
  padding: 28px max(24px, calc((100vw - 980px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #94a3b8;
  background: #0d1528;
}

.auth-page footer img {
  width: 210px;
  max-height: 72px;
  object-fit: contain;
  border-radius: 10px;
}

.auth-page footer p {
  margin: 0;
  font-weight: 800;
}

.auth-wrap {
  width: min(450px, calc(100% - 32px));
  margin: 62px auto 88px;
}

.auth-card {
  padding: 32px;
  border: 1px solid var(--portal-line);
  border-radius: 14px;
  background: var(--portal-card);
  box-shadow: 0 22px 38px rgba(15, 23, 42, .12);
}

.auth-card h1 {
  margin: 0 0 28px;
  text-align: center;
  font-size: 24px;
  line-height: 1.2;
}

.field {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.field label {
  font-size: 14px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid #cfdae8;
  border-radius: 11px;
  color: var(--portal-ink);
  background: #fff;
  outline: none;
}

.field textarea {
  min-height: 86px;
  padding-top: 14px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 4px rgba(37, 44, 59, .08);
}

.date-field {
  position: relative;
}

.date-field::after {
  content: attr(data-placeholder);
  position: absolute;
  left: 16px;
  top: 50%;
  color: #8a97ad;
  pointer-events: none;
  transform: translateY(-50%);
}

.date-field.has-value::after {
  display: none;
}

.date-field:not(.has-value) input[type="date"] {
  color: transparent;
}

.date-field input[type="date"]:focus {
  color: var(--portal-ink);
}

.password-field-wrap {
  position: relative;
  width: 100%;
}

.password-field-wrap input {
  padding-right: 78px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  min-width: 58px;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: var(--portal-ink);
  background: #edf2f7;
  font-size: 12px;
  font-weight: 900;
  transform: translateY(-50%);
}

.password-toggle:hover {
  background: #dbe3ee;
}

.form-message {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  color: #991b1b;
  background: #fee2e2;
  font-weight: 800;
}

.form-message[data-type="success"] {
  color: #047857;
  background: #d1fae5;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.forgot {
  display: block;
  margin: -8px 0 26px;
  color: #e11d2e;
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.primary-action,
.ghost-action,
.danger-action {
  min-height: 54px;
  border: 0;
  border-radius: 11px;
  font-weight: 900;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.primary-action {
  width: 100%;
  color: #fff;
  background: var(--portal-navy);
  box-shadow: 0 10px 18px rgba(15, 23, 42, .16);
}

.primary-action:disabled,
.primary-action.is-disabled {
  cursor: not-allowed;
  color: #94a3b8;
  background: #e2e8f0;
  box-shadow: none;
  transform: none;
}

.primary-action:disabled:hover,
.primary-action.is-disabled:hover {
  box-shadow: none;
  transform: none;
}

.primary-action.red {
  background: linear-gradient(135deg, var(--portal-red), var(--portal-red-dark));
}

.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid #c8d4e4;
  color: var(--portal-ink);
  background: #fff;
}

.danger-action {
  color: #e11d2e;
  background: #fff0f1;
}

.auth-note {
  margin: 26px 0 0;
  color: #334155;
  text-align: center;
}

.auth-note a {
  color: #e11d2e;
  font-weight: 900;
}

.strength {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf1;
}

.strength span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #ef4444;
  transition: width .2s ease, background .2s ease;
}

.strength span[data-score="2"],
.strength span[data-score="3"] {
  background: #f59e0b;
}

.strength span[data-score="4"] {
  background: #22c55e;
}

#password-strength-text {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 258px 1fr;
  background: #f4f7fb;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: #0d1528;
  color: #cbd5e1;
}

.side-brand {
  min-height: 98px;
  padding: 18px 26px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.side-brand img {
  width: auto;
  height: 52px;
  max-width: 138px;
  object-fit: contain;
  border-radius: 8px;
}

.side-nav {
  padding: 26px 16px;
}

.side-label {
  margin: 0 0 16px 8px;
  color: #64748b;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.side-link {
  min-height: 48px;
  margin-bottom: 12px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-radius: 12px;
  font-weight: 900;
  color: #cbd5e1;
}

.side-link:hover,
.side-link.active {
  color: #fff;
  background: var(--portal-red);
}

.side-footer {
  padding: 24px 18px;
  border-top: 1px solid rgba(255, 255, 255, .06);
}

.sign-out {
  color: #ff6b72;
  font-weight: 900;
}

.app-main {
  min-width: 0;
}

.topbar {
  height: 66px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #dbe3ee;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .08);
}

.app-shell .topbar {
  display: none;
}

.side-refresh {
  width: 100%;
  min-height: 40px;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  font-weight: 900;
}

.topbar h1 {
  margin: 0;
  font-size: 23px;
}

.status-cluster {
  display: flex;
  gap: 14px;
}

.pill-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #dbe3ee;
  background: #f8fafc;
  color: #334155;
  font-weight: 900;
}

.pill-status.synced {
  color: #008a62;
  border-color: #9af0cf;
  background: #edfff8;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--portal-green);
}

.content {
  width: min(1104px, calc(100% - 48px));
  margin: 24px auto 80px;
}

.hero-balance {
  padding: 28px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--portal-red), #dc1f2c);
  box-shadow: 0 8px 18px rgba(220, 31, 44, .22);
}

.hero-balance small,
.hero-balance span {
  display: block;
}

.hero-balance small {
  margin-bottom: 12px;
  font-weight: 900;
}

.hero-balance strong {
  display: block;
  margin-bottom: 28px;
  font-size: 40px;
  line-height: 1;
}

.balance-chip {
  width: min(520px, 100%);
  padding: 16px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .14);
}

.dashboard-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.summary-card,
.panel,
.form-card,
.table-card,
.empty-card {
  border: 1px solid var(--portal-line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .08);
}

.summary-card {
  min-height: 112px;
  padding: 24px;
}

.summary-card span {
  display: block;
  margin-bottom: 8px;
  color: #64748b;
  font-weight: 900;
}

.summary-card strong {
  font-size: 32px;
}

.quick-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.quick-card {
  min-height: 104px;
  padding: 26px;
  display: flex;
  align-items: center;
  gap: 18px;
  border: 2px dashed #c9d6e8;
  border-radius: 14px;
  background: transparent;
}

.quick-card h3 {
  margin: 0 0 4px;
}

.quick-card p {
  margin: 0;
  color: #64748b;
}

.page-head {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-head h2 {
  margin: 0;
  font-size: 28px;
}

.wallet-strip {
  margin: 0 auto 24px;
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  border: 1px solid #fecaca;
  border-radius: 12px;
  background: #fff7f7;
  font-weight: 900;
}

.tabs {
  width: min(386px, 100%);
  margin-bottom: 24px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #d6e0ed;
  border-radius: 12px;
  background: #e9eef5;
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-weight: 900;
}

.tab.active {
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .12);
}

.notice {
  margin-bottom: 24px;
  padding: 18px 22px;
  display: flex;
  gap: 14px;
  border: 1px solid #facc15;
  border-radius: 12px;
  color: #92400e;
  background: #fffbeb;
}

.notice strong {
  display: block;
  margin-bottom: 6px;
  color: #7c2d12;
}

.form-card {
  padding: 24px;
  margin-bottom: 24px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr .75fr .75fr .85fr;
  gap: 16px;
}

.inline-form .field {
  margin: 0;
}

.inline-actions {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.medical-extra {
  display: grid;
  margin-top: 18px;
}

.form-submit-row {
  justify-content: flex-end;
}

.submit-reason {
  margin: 10px 0 0;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.table-card {
  overflow: hidden;
}

.secure-bar {
  margin-top: 18px;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: #fff7f7;
}

.secure-bar strong,
.secure-bar span {
  display: block;
}

.secure-bar strong {
  margin-bottom: 4px;
  font-size: 22px;
}

.secure-bar span {
  color: #64748b;
  font-weight: 800;
}

.roster-table {
  width: 100%;
  border-collapse: collapse;
}

.roster-table th,
.roster-table td {
  padding: 18px;
  border-bottom: 1px solid #e5edf6;
  text-align: left;
}

.roster-table th {
  color: #64748b;
  font-size: 13px;
  text-transform: uppercase;
}

.roster-table tr:last-child td {
  border-bottom: 0;
}

.roster-table tbody tr {
  cursor: pointer;
}

.roster-table tbody tr:hover {
  background: #f8fafc;
}

.roster-table tbody tr.selected,
.admin-table tbody tr.selected {
  background: #eef4ff;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.badge.blue {
  color: #1d4ed8;
  background: #dbeafe;
}

.badge.gold {
  color: #92400e;
  background: #fef3c7;
}

.badge.red {
  color: #b91c1c;
  background: #fee2e2;
}

.empty-card {
  min-height: 230px;
  display: grid;
  place-items: center;
  border-style: dashed;
  text-align: center;
}

.empty-card h3 {
  margin: 0 0 10px;
}

.empty-card p {
  margin: 0;
  color: #64748b;
}

.wallet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.icon-button {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid #d6e0ed;
  border-radius: 12px;
  color: #475569;
  background: #fff;
}

.fund-panel {
  padding: 24px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: #fff;
}

.bank-box {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
}

.bank-box h3 {
  margin: 0 0 14px;
  color: #1e40af;
}

.fund-note {
  margin: 0 0 14px;
  color: #475569;
  font-weight: 800;
  line-height: 1.5;
}

.bank-details {
  padding: 18px;
  border-radius: 8px;
  color: #0b37bd;
  background: rgba(255, 255, 255, .62);
  font-family: Consolas, "Courier New", monospace;
  font-weight: 900;
  line-height: 1.9;
}

.whatsapp-action {
  width: 100%;
  margin-top: 18px;
  color: #047857;
  border-color: #86efac;
  background: #ecfdf5;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  background: rgba(2, 6, 23, .62);
  backdrop-filter: blur(6px);
}

.overlay.open {
  display: block;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(380px, 100%);
  height: 100vh;
  display: none;
  grid-template-rows: auto 1fr auto;
  background: #f8fafc;
  box-shadow: -20px 0 40px rgba(15, 23, 42, .2);
}

.drawer.open {
  display: grid;
}

.drawer-head {
  padding: 28px 24px;
  color: #fff;
  background: #0d1528;
}

.drawer-head h2 {
  margin: 0 0 8px;
}

.drawer-actions {
  position: absolute;
  top: 18px;
  right: 16px;
  display: flex;
  gap: 8px;
}

.drawer-actions button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, .12);
}

.drawer-body {
  padding: 24px;
  overflow: auto;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-box {
  padding: 14px;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  text-align: center;
  background: #fff;
  font-weight: 900;
}

.drawer-section {
  margin-top: 24px;
}

.drawer-section h3 {
  margin: 0 0 10px;
  color: #94a3b8;
  font-size: 13px;
  text-transform: uppercase;
}

.soft-box {
  padding: 16px;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  color: #64748b;
  background: #f1f5f9;
  text-align: center;
}

.success-box {
  padding: 16px;
  border: 1px solid #86efac;
  border-radius: 10px;
  color: #047857;
  background: #ecfdf5;
  font-weight: 900;
}

.drawer-foot {
  padding: 18px 24px;
  border-top: 1px solid #dbe3ee;
  background: #fff;
}

.drawer-foot .danger-action,
.drawer-foot .primary-action,
.drawer-foot .ghost-action {
  width: 100%;
}

.drawer-foot.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 900px) {
  .portal-nav {
    position: static;
    width: calc(100% - 28px);
    height: auto;
    flex-wrap: wrap;
    border-radius: 24px;
    padding: 12px;
  }

  .portal-logo {
    min-width: 0;
  }

  .portal-menu {
    order: 3;
    width: 100%;
    justify-content: space-between;
  }

  .portal-menu a {
    min-width: 0;
    flex: 1;
    font-size: 13px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .side-nav {
    padding: 14px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .side-label {
    display: none;
  }

  .side-footer {
    padding: 0 14px 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    border-top: 0;
  }

  .side-refresh {
    min-height: 44px;
    margin: 0;
  }

  .sign-out {
    min-height: 44px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255, 107, 114, .12);
  }

  .side-link {
    margin: 0;
    justify-content: center;
  }

  .topbar {
    padding: 0 18px;
  }

  .content {
    width: calc(100% - 28px);
  }

  .dashboard-grid,
  .quick-grid {
    grid-template-columns: 1fr;
  }

  .inline-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .portal-logo img {
    height: 38px;
    max-width: 136px;
  }

  .portal-login {
    min-height: 42px;
    padding: 0 15px;
    font-size: 13px;
  }

  .auth-card {
    padding: 24px 18px;
  }

  .field-row,
  .inline-form,
  .drawer-foot.split {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    min-height: 66px;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .status-cluster {
    flex-wrap: wrap;
  }

  .side-nav {
    grid-template-columns: 1fr;
  }

  .side-footer {
    grid-template-columns: 1fr;
  }

  .wallet-strip,
  .page-head,
  .inline-actions,
  .wallet-actions,
  .secure-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .roster-table {
    min-width: 640px;
  }

  .table-card {
    overflow-x: auto;
  }

  .auth-page footer {
    flex-direction: column;
    text-align: center;
  }
}
