:root {
  color-scheme: light;
  --bg: #edf5fb;
  --surface: #ffffff;
  --surface-soft: #f1f7ff;
  --ink: #102033;
  --muted: #617084;
  --line: #d7e3ee;
  --brand: #0f8f83;
  --brand-dark: #0a665f;
  --accent: #f59e0b;
  --accent-2: #2563eb;
  --accent-3: #e11d48;
  --danger: #dc2626;
  --success: #16a34a;
  --shadow: 0 22px 55px rgba(15, 32, 51, 0.16);
  --shadow-soft: 0 12px 30px rgba(15, 32, 51, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(239, 248, 255, 0.92), rgba(255, 247, 237, 0.9)),
    url("https://images.unsplash.com/photo-1554224155-6726b3ff858f?auto=format&fit=crop&w=1800&q=80");
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 460px;
}

.setup-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.05fr);
  background:
    linear-gradient(120deg, rgba(15, 32, 51, 0.94), rgba(15, 143, 131, 0.82), rgba(245, 158, 11, 0.58)),
    url("https://images.unsplash.com/photo-1554224154-22dec7ec8818?auto=format&fit=crop&w=1800&q=80");
  background-size: cover;
  background-position: center;
}

.setup-hero,
.setup-panel {
  padding: clamp(24px, 5vw, 72px);
}

.setup-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
}

.setup-hero h1 {
  max-width: 640px;
  margin: 18px 0;
  font-size: clamp(44px, 7vw, 84px);
  line-height: 0.95;
}

.setup-hero p {
  max-width: 600px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 18px;
  line-height: 1.6;
}

.setup-kicker {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.setup-panel {
  display: grid;
  align-content: center;
  gap: 16px;
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(18px);
}

.setup-card,
.setup-error {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 20px;
  box-shadow: 0 14px 32px rgba(25, 44, 70, 0.1);
}

.setup-card h2 {
  margin: 0 0 12px;
}

.setup-card ol {
  margin: 0;
  padding-left: 20px;
  color: #34495e;
  line-height: 1.7;
}

.setup-error {
  background: #fff7ed;
  color: var(--danger);
  border-color: #fed7c7;
  overflow-wrap: anywhere;
}

.auth-hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px clamp(24px, 6vw, 78px);
  color: #10202d;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(224, 242, 254, 0.82), rgba(255, 247, 237, 0.78));
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--accent-2));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(15, 143, 131, 0.28);
}

.hero-copy {
  max-width: 680px;
}

.hero-copy h1 {
  margin: 0 0 18px;
  font-size: clamp(44px, 7vw, 82px);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 620px;
  margin: 0;
  color: #34495e;
  font-size: 19px;
  line-height: 1.65;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: 720px;
  margin-top: 42px;
}

.metric {
  padding: 18px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(236, 253, 245, 0.8));
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}

.metric strong {
  display: block;
  font-size: 26px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.auth-panel {
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 28px;
  background: rgba(255, 255, 255, 0.86);
  border-left: 1px solid rgba(220, 229, 238, 0.82);
  backdrop-filter: blur(16px);
}

.auth-card {
  width: 100%;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  background: var(--surface-soft);
  border-radius: var(--radius);
  gap: 4px;
}

.segmented button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segmented button.active {
  background: var(--surface);
  color: var(--brand-dark);
  box-shadow: 0 4px 14px rgba(24, 35, 50, 0.08);
}

.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.is-hidden {
  display: none;
}

.field label {
  color: #34495e;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d8e6f2;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 14px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--accent-2));
  color: #fff;
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-dark), #1d4ed8);
}

.btn-ghost {
  border-color: rgba(37, 99, 235, 0.18);
  background: #f8fbff;
  color: #1e3a8a;
}

.btn-danger {
  background: #fff2ed;
  color: var(--danger);
  border-color: #fed7c7;
}

.compact-btn {
  min-height: 30px;
  margin-top: 6px;
  padding: 5px 9px;
  font-size: 12px;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

td .hint {
  display: inline-block;
  margin-top: 4px;
  font-size: 12px;
}

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid #a7f3d0;
  background: linear-gradient(135deg, #ecfdf5, #eff6ff);
  color: #0f5e56;
  font-size: 14px;
}

.alert.error {
  border-color: #fed7c7;
  background: #fff7ed;
  color: var(--danger);
}

.support-link {
  flex: 0 0 auto;
  border: 1px solid rgba(194, 65, 12, 0.22);
  border-radius: 999px;
  background: #fff;
  color: #9a3412;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.dashboard {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(239, 246, 255, 0.95), rgba(236, 253, 245, 0.74), rgba(255, 247, 237, 0.86)),
    var(--bg);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px;
  background:
    linear-gradient(180deg, #071426 0%, #0f2f4f 42%, #0f766e 72%, #92400e 100%);
  color: #fff;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar .brand-row {
  flex: 0 0 auto;
}

.nav {
  display: grid;
  gap: 7px;
  flex: 1 1 auto;
  align-content: start;
  padding-bottom: 8px;
}

.nav button,
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #b9c5d2;
  padding: 10px 12px;
  text-align: left;
  font-weight: 800;
  text-decoration: none;
  position: relative;
  line-height: 1.2;
}

.nav button.active,
.nav button:hover,
.nav a.active,
.nav a:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(125, 211, 252, 0.12));
  color: #fff;
  box-shadow: inset 3px 0 0 #fbbf24;
}

.nav a span,
.nav button span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #d6e4ef;
  font-size: 11px;
  font-weight: 900;
}

.nav a.active span,
.nav a:hover span,
.nav button.active span,
.nav button:hover span {
  background: linear-gradient(135deg, #fff, #dbeafe);
  color: #1d4ed8;
}

.sidebar-foot {
  position: static;
  flex: 0 0 auto;
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.user-chip {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(125, 211, 252, 0.1));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.user-chip strong,
.user-chip span {
  display: block;
}

.user-chip span {
  margin-top: 3px;
  color: #b9c5d2;
  font-size: 12px;
}

.main {
  padding: 26px clamp(18px, 4vw, 44px);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  border: 1px solid rgba(191, 219, 254, 0.72);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(239, 246, 255, 0.9), rgba(255, 251, 235, 0.86));
  padding: 18px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.topbar h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.stat,
.table-wrap {
  border: 1px solid rgba(215, 227, 238, 0.92);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.panel {
  position: relative;
  padding: 20px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 255, 0.96));
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent-2), var(--accent), var(--accent-3));
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
  color: #102033;
}

.stat {
  position: relative;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(135deg, #ffffff 0%, #eff6ff 58%, #fff7ed 100%);
}

.grid.three .stat:nth-child(1) {
  background: linear-gradient(135deg, #ffffff, #ecfdf5 58%, #ccfbf1);
}

.grid.three .stat:nth-child(2) {
  background: linear-gradient(135deg, #ffffff, #eff6ff 58%, #dbeafe);
}

.grid.three .stat:nth-child(3) {
  background: linear-gradient(135deg, #ffffff, #fff7ed 58%, #ffedd5);
}

.stat::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 82px;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--accent-2), var(--accent));
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 7px;
  font-size: 30px;
  color: #0f2f4f;
}

.table-wrap {
  overflow: hidden;
}

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

.matrix-table {
  min-width: 720px;
}

.matrix-table input,
.matrix-table select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

.matrix-actions {
  margin-top: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  background: linear-gradient(135deg, #eff6ff, #ecfdf5);
  color: #274060;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

tbody tr:hover td {
  background: #f8fbff;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ccfbf1, #dbeafe);
  color: #0f4f67;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.warn {
  background: linear-gradient(135deg, #fef3c7, #ffe4e6);
  color: #9a3412;
}

.badge.done {
  background: linear-gradient(135deg, #dcfce7, #ccfbf1);
  color: var(--success);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.approve-pan-form {
  align-items: center;
}

.approve-pan-form input[name="pan"] {
  width: 150px;
  min-height: 42px;
  border: 1px solid #d8e6f2;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  color: var(--ink);
  padding: 9px 11px;
  font-weight: 900;
  text-transform: uppercase;
  outline: none;
}

.approve-pan-form input[name="pan"]:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.pan-service-form .inline-fields {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.role-map {
  display: grid;
  gap: 10px;
}

.role-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 86px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #ffffff, #f0f9ff);
  box-shadow: 0 8px 20px rgba(15, 32, 51, 0.06);
}

.role-step .number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--accent-2));
  color: #fff;
  font-weight: 900;
}

.role-step strong,
.role-step span {
  display: block;
}

.role-step span {
  color: var(--muted);
  font-size: 12px;
}

.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.status-console {
  background:
    linear-gradient(135deg, rgba(15, 143, 131, 0.14), rgba(37, 99, 235, 0.1), rgba(245, 158, 11, 0.1)),
    var(--surface);
}

.fund-panel {
  background:
    linear-gradient(135deg, rgba(220, 252, 231, 0.92), rgba(239, 246, 255, 0.92)),
    var(--surface);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.status-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(191, 219, 254, 0.82);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, #ffffff, #f8fbff 52%, #fff7ed);
  padding: 18px;
  box-shadow: 0 10px 26px rgba(25, 44, 70, 0.07);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.status-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(25, 44, 70, 0.11);
}

.status-card h3,
.status-card p {
  margin: 0;
}

.status-card p {
  color: var(--muted);
  line-height: 1.5;
}

.status-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #eff6ff, #ecfdf5);
  border: 1px solid rgba(191, 219, 254, 0.7);
}

.status-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-shell {
  border: 1px solid rgba(191, 219, 254, 0.9);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.report-head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 22px;
  background: linear-gradient(135deg, #0f172a, #1d4ed8 45%, #0f8f83);
  color: #fff;
}

.report-head h2,
.report-head p {
  margin: 0;
}

.report-head p {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.76);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: #d7e3ee;
}

.report-grid div {
  min-height: 96px;
  display: grid;
  align-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #ffffff, #f8fbff);
  padding: 18px;
}

.report-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.report-grid strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.report-note {
  padding: 18px 22px;
  background: linear-gradient(135deg, #f8fbff, #fff7ed);
  color: #34495e;
}

.report-actions {
  margin-top: 16px;
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .alert,
  .report-actions {
    display: none !important;
  }

  .dashboard {
    display: block;
    min-height: auto;
    background: #fff;
  }

  .main {
    padding: 0;
  }

  .report-shell {
    box-shadow: none;
    border: 1px solid #cbd5e1;
  }
}

@media (max-width: 980px) {
  .auth-page,
  .setup-page,
  .dashboard,
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-panel {
    border-left: 0;
  }

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

  .sidebar-foot {
    position: static;
    margin-top: 22px;
  }
}

@media (max-width: 620px) {
  .auth-hero {
    padding: 24px 18px;
  }

  .auth-panel,
  .setup-hero,
  .setup-panel,
  .main {
    padding: 18px;
  }

  .hero-metrics,
  .inline-fields {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .alert {
    display: grid;
  }

  .support-link {
    width: fit-content;
  }

  th,
  td {
    padding: 10px 8px;
    font-size: 12px;
  }

  .report-head,
  .report-grid {
    grid-template-columns: 1fr;
  }
}
