:root {
  --bg: #f8fafc;
  --card: rgba(255, 255, 255, 0.92);
  --navy-950: #0d1525;
  --navy-900: #14213b;
  --navy-800: #1a2b4b;
  --navy-700: #243b66;
  --emerald-700: #047857;
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --slate-50: #f8fafc;
  --slate-100: #e2e8f0;
  --slate-200: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-3xl: 24px;
  --radius-4xl: 32px;
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Manrope, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #0f172a;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.auth-bg, .app-bg {
  background:
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.05) 0%, transparent 35%),
    radial-gradient(circle at bottom left, rgba(26, 43, 75, 0.05) 0%, transparent 35%),
    var(--bg);
}

.auth-shell, .wizard-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card, .wizard-card, .panel, .metric-card, .table-card {
  background: var(--card);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.auth-card {
  width: min(540px, 100%);
  padding: 48px;
  text-align: center;
}

.auth-mark {
  width: 84px;
  height: 84px;
  margin: 0 auto 24px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background: var(--navy-900);
  color: #34d399;
  font-size: 36px;
  font-weight: 900;
  box-shadow: 0 20px 40px rgba(20, 33, 59, 0.18);
}

.auth-card h1, .wizard-head h1, .hero h1, .topbar h2 {
  margin: 0;
  color: var(--navy-800);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.auth-card p, .wizard-head p, .hero p, .topbar p {
  color: var(--slate-500);
  margin: 8px 0 0;
  font-weight: 700;
}

.auth-form, .wizard-form {
  margin-top: 32px;
  display: grid;
  gap: 16px;
}

.auth-form label, .wizard-form label {
  display: grid;
  gap: 8px;
  text-align: left;
  color: var(--navy-800);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.auth-form input, .auth-form select, .auth-form textarea,
.wizard-form input, .wizard-form select, .wizard-form textarea {
  border: 1px solid var(--slate-100);
  background: #f8fafc;
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--navy-800);
  font-weight: 700;
  outline: none;
}

.auth-form input:focus, .auth-form select:focus, .auth-form textarea:focus,
.wizard-form input:focus, .wizard-form select:focus, .wizard-form textarea:focus {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.08);
  background: white;
}

.auth-form button, .primary, .secondary, .logout {
  border: 0;
  cursor: pointer;
  border-radius: 18px;
  padding: 16px 20px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.auth-flash {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}
.auth-flash-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.auth-flash-success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #bbf7d0;
}

.twofactor-box {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 20px;
  align-items: center;
}
.qr-placeholder {
  width: 180px;
  height: 180px;
  border-radius: 24px;
  background:
    linear-gradient(45deg, rgba(20,33,59,0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(20,33,59,0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(20,33,59,0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(20,33,59,0.08) 75%);
  background-size: 32px 32px;
  background-position: 0 0, 0 16px, 16px -16px, -16px 0px;
  border: 8px solid white;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
  display: grid;
  place-items: center;
  color: var(--navy-900);
  font-weight: 900;
  letter-spacing: 0.3em;
}
.twofactor-details {
  text-align: left;
  display: grid;
  gap: 10px;
  font-size: 13px;
  color: var(--navy-800);
  font-weight: 700;
}
.twofactor-details code {
  display: block;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--slate-100);
  font-size: 12px;
  word-break: break-all;
}

.auth-form button, .primary {
  background: var(--emerald-500);
  color: white;
  box-shadow: 0 18px 30px rgba(16, 185, 129, 0.18);
}

.auth-links { margin-top: 20px; font-size: 12px; font-weight: 900; color: var(--slate-400); }

.wizard-card {
  width: min(920px, 100%);
  padding: 40px;
}

.wizard-head {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}

.wizard-head .auth-mark { margin: 0; width: 72px; height: 72px; font-size: 30px; border-radius: 24px; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.wizard-section {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
}

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

.radio-grid label, .checkbox {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--slate-100);
  background: #f8fafc;
  font-size: 13px;
  letter-spacing: normal;
  text-transform: none;
}

.checkbox input { margin-right: 10px; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 256px 1fr;
}

.sidebar {
  background: white;
  border-right: 1px solid var(--slate-100);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 24px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--emerald-600);
  color: white;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(5, 150, 105, 0.14);
}

.brand h1 { margin: 0; color: var(--navy-800); font-size: 20px; }
.brand p { margin: 4px 0 0; font-size: 10px; color: var(--slate-400); font-weight: 900; letter-spacing: 0.16em; }

.sidebar-nav {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  flex: 1;
}

.nav-item {
  position: relative;
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--slate-500);
  font-size: 14px;
  font-weight: 900;
}

.nav-item.active {
  color: var(--emerald-600);
  background: rgba(236, 253, 245, 0.9);
}

.sidebar-footer {
  display: grid;
  gap: 12px;
}

.profile-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid var(--slate-100);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--navy-900);
  color: #34d399;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.profile-card strong { display: block; color: var(--navy-800); font-size: 13px; }
.profile-card span { display: block; color: var(--slate-400); font-size: 11px; margin-top: 4px; }

.logout, .secondary {
  background: #f8fafc;
  color: var(--navy-800);
  border: 1px solid var(--slate-100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.main {
  min-width: 0;
}

.topbar {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  background: rgba(248, 250, 252, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  z-index: 5;
}

.topbar-actions { display: flex; gap: 10px; align-items: center; }
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--slate-100);
  background: white;
  font-size: 12px;
  font-weight: 900;
}
.pill-success { background: rgba(236, 253, 245, 0.9); color: var(--emerald-700); }
.pill-warning { background: rgba(255, 247, 237, 0.95); color: #9a3412; }

.content { padding: 32px; }
.page-stack { display: grid; gap: 24px; }
.hero h1 { font-size: 40px; }
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}
.pill-row { display: flex; gap: 10px; flex-wrap: wrap; }
.pill-dark { background: var(--navy-800); color: white; }

.metric-grid, .content-grid {
  display: grid;
  gap: 24px;
}
.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.content-grid { grid-template-columns: 2fr 1fr; align-items: start; }

.metric-card, .panel, .table-card {
  padding: 28px;
}

.metric-card span, .panel p, .panel-head p {
  display: block;
  color: var(--slate-400);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  color: var(--navy-800);
  font-size: 28px;
  font-weight: 900;
}
.metric-card-accent {
  background: var(--emerald-600);
}
.metric-card-accent span,
.metric-card-accent small,
.metric-card-accent strong { color: white; }

.metric-card small {
  display: block;
  margin-top: 10px;
  color: var(--emerald-600);
  font-size: 12px;
  font-weight: 900;
}

.panel-wide { min-height: 360px; }
.panel-dark {
  background: var(--navy-900);
  color: white;
}
.panel-dark h3, .panel-dark p {
  color: white;
}

.panel-head h3, .panel h3 {
  margin: 0;
  color: var(--navy-800);
  font-size: 22px;
  font-weight: 900;
}
.panel-head-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.panel-head-inline p { margin: 0; }

.chart-placeholder {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 18px;
  align-items: end;
  height: 220px;
  margin-top: 24px;
}
.chart-placeholder div {
  border-radius: 14px 14px 4px 4px;
  background: linear-gradient(180deg, var(--emerald-500), rgba(5, 150, 105, 0.2));
}
.chart-placeholder div:nth-child(1) { height: 40%; }
.chart-placeholder div:nth-child(2) { height: 62%; background: rgba(226, 232, 240, 0.95); }
.chart-placeholder div:nth-child(3) { height: 48%; }
.chart-placeholder div:nth-child(4) { height: 74%; background: rgba(226, 232, 240, 0.95); }
.chart-placeholder div:nth-child(5) { height: 60%; }
.chart-placeholder div:nth-child(6) { height: 82%; background: rgba(226, 232, 240, 0.95); }

.table-card { overflow: auto; }
.align-right { text-align: right; }
.text-success { color: var(--emerald-600); }
.text-warn { color: #b45309; }
table { width: 100%; border-collapse: collapse; }
thead th {
  color: var(--slate-400);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  text-align: left;
  padding: 16px 12px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}
tbody td {
  padding: 18px 12px;
  border-bottom: 1px solid rgba(241, 245, 249, 0.9);
  font-size: 14px;
  font-weight: 700;
}

.upload-panel { min-height: 420px; }
.upload-zone {
  margin-top: 20px;
  height: 280px;
  border: 1px dashed var(--slate-100);
  border-radius: 28px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
}
.upload-form {
  height: auto;
  flex-direction: column;
  gap: 16px;
}
.upload-dropzone {
  width: 100%;
  min-height: 220px;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-align: center;
}

.camera-shell {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.camera-preview {
  width: 100%;
  max-height: 320px;
  border-radius: 24px;
  background: #020617;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

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

.camera-hint {
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  line-height: 1.5;
}

.upload-dropzone input[type="file"] {
  display: block;
  width: 100%;
  margin-bottom: 16px;
}
.upload-dropzone input[type="file"] {
  display: none;
}
.upload-icon {
  width: 84px;
  height: 84px;
  border-radius: 999px;
  background: rgba(236, 253, 245, 0.95);
  color: var(--emerald-600);
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 900;
  margin-bottom: 20px;
}
.upload-zone h4 {
  margin: 0;
  color: var(--navy-800);
  font-size: 24px;
  font-weight: 900;
}
.upload-zone p { margin-top: 10px; color: var(--slate-500); font-weight: 700; font-size: 14px; text-transform: none; letter-spacing: normal; }

.scan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.scan-card {
  padding: 18px;
  border-radius: 24px;
  background: white;
  border: 1px solid var(--slate-100);
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.scan-card span {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(16,185,129,0.08);
  color: var(--emerald-600);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
}
.scan-card strong {
  color: var(--navy-800);
  font-size: 16px;
}
.scan-card small {
  color: var(--slate-400);
  font-size: 11px;
  font-weight: 800;
}
.scan-card-add { display: grid; place-items: center; text-align: center; border-style: dashed; color: var(--slate-400); }
.scan-card-add strong { font-size: 48px; color: var(--slate-300); }

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.panel form {
  margin-top: 18px;
}
.panel input, .panel select, .panel textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--slate-100);
  background: #f8fafc;
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--navy-800);
  font-weight: 700;
}
.panel label {
  display: grid;
  gap: 8px;
  color: var(--navy-800);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.mini-card {
  padding: 18px;
  border-radius: 22px;
  background: #f8fafc;
  border: 1px solid var(--slate-100);
}
.mini-card strong, .mini-card p {
  display: block;
  margin: 0;
  color: var(--navy-800);
}
.mini-card p { margin-top: 8px; color: var(--slate-500); }
.mini-card.success { background: rgba(236,253,245,0.85); }

.settings-form {
  display: grid;
  gap: 22px;
}

.settings-section {
  display: grid;
  gap: 16px;
  padding-top: 6px;
}

.settings-grid {
  grid-template-columns: 2fr 1fr;
  align-items: start;
}

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

.settings-side .mini-card + .mini-card {
  margin-top: 14px;
}

.logo-preview {
  display: block;
  margin-top: 14px;
  max-width: 100%;
  max-height: 140px;
  border-radius: 18px;
  background: white;
  border: 1px solid var(--slate-100);
  padding: 12px;
  object-fit: contain;
}

.panel select, .auth-form select, .wizard-form select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--slate-400) 50%), linear-gradient(135deg, var(--slate-400) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(1em + 2px), calc(100% - 12px) calc(1em + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.swatch-row { display: flex; gap: 10px; margin-top: 12px; }
.swatch { width: 40px; height: 40px; border-radius: 12px; border: 4px solid white; box-shadow: 0 8px 16px rgba(15,23,42,0.08); }
.swatch-emerald { background: var(--emerald-500); }
.swatch-navy { background: var(--navy-800); }
.swatch-blue { background: #3b82f6; }
.swatch-amber { background: #f59e0b; }

.status-badge {
  padding: 12px 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--slate-100);
  color: var(--navy-800);
  font-weight: 900;
  width: fit-content;
  margin-top: 12px;
}

.wizard-steps { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 24px; }
.wizard-step {
  padding: 10px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--slate-100);
  font-size: 12px;
  font-weight: 900;
  color: var(--slate-400);
}
.wizard-step.active { color: var(--emerald-600); background: rgba(236,253,245,0.9); }
.panel-grid { display: grid; gap: 16px; }
.panel-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 24px;
  align-items: stretch;
}
.dashboard-grid-lower {
  grid-template-columns: 8fr 4fr;
}
.panel-large-balance {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--slate-400);
}
.panel-large-balance h2 {
  margin: 18px 0 12px;
  font-size: 56px;
  line-height: 1;
  color: var(--navy-800);
  font-weight: 900;
}
.trend {
  color: var(--emerald-600);
  font-weight: 900;
  font-size: 15px;
}
.trend span { color: var(--slate-400); font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; margin-left: 8px; }
.deadline-list { display: grid; gap: 12px; }
.deadline-item {
  padding: 16px 18px;
  border-radius: 20px;
  background: #f8fafc;
  border: 1px solid var(--slate-100);
}
.deadline-item strong { display: block; color: var(--navy-800); font-size: 14px; font-weight: 900; }
.deadline-item span { display: block; margin-top: 6px; color: var(--slate-400); font-size: 12px; font-weight: 700; }
.deadline-item-critical { background: #fff1f2; border-color: #fecdd3; }
.deadline-item-success { background: #ecfdf5; border-color: #bbf7d0; }
.badge-soft {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  font-weight: 900;
  margin-bottom: 18px;
}
.fab {
  position: fixed;
  right: 32px;
  bottom: 32px;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  background: var(--emerald-700);
  color: white;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 24px 36px rgba(4, 120, 87, 0.28);
}

.contacts-grid { align-items: start; }
.contact-list { display: grid; gap: 10px; }
.contact-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  background: #f8fafc;
  border: 1px solid var(--slate-100);
}
.contact-item strong {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--navy-900);
  color: white;
  display: grid;
  place-items: center;
  font-size: 16px;
}
.contact-item span, .contact-item small {
  display: block;
}
.contact-item span {
  color: var(--navy-800);
  font-weight: 900;
}
.contact-item small {
  color: var(--slate-400);
  margin-top: 4px;
}
.contact-item.active { background: rgba(236,253,245,0.9); }

.app-shell .panel-dark .secondary {
  background: white;
  color: var(--navy-900);
}

.secondary { margin-top: 18px; }

@media (max-width: 1100px) {
  .metric-grid, .content-grid, .grid-2 { grid-template-columns: 1fr 1fr; }
  .scan-grid, .panel-grid.four, .two-column, .twofactor-box { grid-template-columns: 1fr 1fr; }
  .dashboard-grid, .dashboard-grid-lower { grid-template-columns: 1fr; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
}

@media (max-width: 760px) {
  .auth-card, .wizard-card, .content, .topbar { padding-left: 18px; padding-right: 18px; }
  .auth-card, .wizard-card { padding-top: 28px; padding-bottom: 28px; }
  .grid-2, .radio-grid, .metric-grid, .content-grid { grid-template-columns: 1fr; }
  .scan-grid, .panel-grid.four, .two-column, .twofactor-box { grid-template-columns: 1fr; }
  .dashboard-grid, .dashboard-grid-lower { grid-template-columns: 1fr; }
  .hero h1 { font-size: 30px; }
  .topbar { height: auto; padding-top: 18px; padding-bottom: 18px; gap: 12px; flex-direction: column; align-items: flex-start; }
}
