:root {
  --paper: #f6f9fc;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe7f1;
  --accent: #08a9d6;
  --accent-2: #1e4fa3;
  --accent-ink: #ffffff;
  --warn: #0e7490;
  --danger: #b91c1c;
  --nav: #07111f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 10%, rgba(8,169,214,.12), transparent 26%),
    linear-gradient(135deg, #f6f9fc 0%, #eef7fb 48%, #ffffff 100%);
  font-family: "Aptos", "Segoe UI", sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; font-weight: 700; }
button, .primary-link {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}
.primary, .primary-link {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: 0 12px 24px rgba(8,169,214,.18);
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 264px;
  padding: 22px 18px;
  background:
    linear-gradient(180deg, rgba(8,169,214,.18), transparent 28%),
    var(--nav);
  color: #f8fbff;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 4px 2px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-shield {
  width: 52px !important;
  height: 52px !important;
  max-width: 52px !important;
  object-fit: contain;
  flex: 0 0 52px;
  display: block;
}
.brand-copy { min-width: 0; }
.brand-copy strong {
  display: block;
  color: #ffffff;
  font-size: 17px;
  line-height: 1.1;
  white-space: nowrap;
}
.brand-copy small {
  display: block;
  color: #9edcef;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.25;
  margin-top: 4px;
}
nav { display: grid; gap: 6px; }
nav a, .logout button {
  color: #f8fbff;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 11px 10px;
  text-align: left;
}
nav a:hover, .logout button:hover { background: rgba(8,169,214,.14); }
.logout { margin-top: auto; }
.session-card {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}
.session-card strong, .session-card span { display: block; }
.session-card span { color: #9edcef; font-size: 12px; text-transform: uppercase; font-weight: 900; }
.app-main { margin-left: 264px; padding: 28px; }
.auth-main { padding: 32px; min-height: 100vh; display: grid; place-items: center; }
.page-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}
h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { font-size: 34px; }
h2 { font-size: 20px; margin-bottom: 14px; }
.eyebrow {
  color: var(--warn);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.panel, .install-panel {
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 18px 45px rgba(15,35,55,.08);
  margin-bottom: 20px;
}
.install-panel { max-width: 980px; width: 100%; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 360px);
  gap: 24px;
  align-items: center;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(8,169,214,.12), rgba(255,255,255,.96) 42%),
    #ffffff;
  box-shadow: 0 18px 45px rgba(15,35,55,.08);
  overflow: hidden;
}
.dashboard-hero h2 {
  font-size: 28px;
  margin-bottom: 10px;
}
.dashboard-hero p {
  color: var(--muted);
  max-width: 760px;
  line-height: 1.6;
  margin: 0;
}
.dashboard-hero img {
  width: 100%;
  max-height: 118px;
  object-fit: contain;
  object-position: right center;
}
.quick-modules {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.quick-modules a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15,35,55,.06);
}
.quick-modules strong, .quick-modules span { display: block; }
.quick-modules strong { color: #0b1d35; }
.quick-modules span { color: var(--muted); margin-top: 6px; font-weight: 600; }
.metrics article {
  background: linear-gradient(180deg, #ffffff, #f8fcff);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.metrics small { color: var(--muted); display: block; margin-bottom: 10px; }
.metrics strong { font-size: 28px; }
.grid-two {
  display: grid;
  grid-template-columns: minmax(320px, .8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.form-grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid h2 { grid-column: 1 / -1; margin-top: 8px; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 800; font-size: 13px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; }
.check { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.check input { width: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  background: #e7f4ef;
  color: #075f4e;
  font-weight: 800;
  font-size: 12px;
}
.badge.muted { background: #f1eadc; color: var(--muted); }
.alert { border-left: 4px solid var(--danger); background: #fff1f2; padding: 12px; border-radius: 6px; margin: 12px 0; }
.alert.success { border-left-color: var(--accent); background: #ecfdf5; }
.login-shell { max-width: 1050px; display: grid; grid-template-columns: 1.1fr .8fr; gap: 0; width: 100%; }
.login-panel {
  background:
    linear-gradient(135deg, rgba(8,169,214,.2), transparent 42%),
    #050a12;
  color: #f8fbff;
  border-radius: 8px 0 0 8px;
  padding: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-brand-stack {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}
.login-brand-stack p {
  margin: 8px 0 0;
  color: #f8fbff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.25;
}
.login-brand-stack span {
  color: #8fdaf1;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.login-panel p { color: #b8d8ea; font-size: 18px; line-height: 1.6; }
.login-logo {
  width: min(420px, 100%);
  max-height: 160px;
  object-fit: contain;
  object-position: center;
  margin: 0;
  display: block;
}
.login-logo-dark {
  width: min(300px, 100%);
  max-height: 92px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 18px;
  display: block;
}
.login-form {
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  padding: 48px;
  display: grid;
  gap: 16px;
}
.form-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.table-scroll { overflow-x: auto; }
.document-form table input { min-width: 110px; }
.center { text-align: center; }
.actions { display: flex; gap: 10px; align-items: center; }
.invoice-sheet {
  background: #fff;
  max-width: 920px;
  margin: 0 auto 22px;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.invoice-top, .invoice-customer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  margin-bottom: 24px;
}
.invoice-box {
  border: 2px solid var(--danger);
  color: var(--danger);
  border-radius: 6px;
  padding: 16px;
  min-width: 190px;
  display: grid;
  text-align: center;
}
.invoice-customer { grid-template-columns: repeat(4, 1fr); background: #f2f8fc; padding: 14px; border-radius: 6px; }
.invoice-customer strong, .invoice-customer span { display: block; }
.invoice-customer strong { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.totals { margin-left: auto; margin-top: 20px; width: min(360px, 100%); display: grid; gap: 8px; }
.totals div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 8px 0; }
.totals .grand { font-size: 22px; border-bottom: 0; }
.filters { display: flex; align-items: end; gap: 12px; }
.panel-heading-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.market-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.market-strip article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fcff;
}
.market-strip small, .market-strip strong { display: block; }
.market-strip small { color: var(--muted); min-height: 32px; }
.market-strip strong { font-size: 20px; margin: 4px 0; }
.market-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.market-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.market-var {
  font-weight: 900;
}
.market-var.up { color: #059669; }
.market-var.down { color: #dc2626; }
.market-var.flat { color: #64748b; }
.market-table td:nth-child(2),
.market-table td:nth-child(3),
.market-table th:nth-child(2),
.market-table th:nth-child(3) {
  text-align: right;
}
.accounting-grid {
  grid-template-columns: 1.3fr .9fr;
}
.statement-block {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}
.statement-block > div,
.statement-total,
.statement-net {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.statement-total {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-weight: 900;
}
.statement-net {
  border-top: 2px solid var(--ink);
  padding-top: 12px;
  font-size: 18px;
}
.secret-box {
  border: 1px dashed var(--accent);
  border-radius: 8px;
  padding: 14px;
  background: #eefbff;
  color: #0b1d35;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .08em;
  word-break: break-all;
}
.mfa-setup {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 18px;
  align-items: start;
  margin: 16px 0;
}
.mfa-qr {
  width: 210px;
  min-height: 210px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15,35,55,.08);
}
.mfa-qr canvas {
  width: 184px !important;
  height: 184px !important;
}
.muted-copy {
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}
.role-list { display: grid; gap: 10px; }
.role-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fcff;
}
.role-list strong, .role-list span { display: block; }
.role-list span { color: var(--muted); margin-top: 4px; }
.users-grid { grid-template-columns: minmax(320px, .7fr) minmax(320px, 1fr); }
.module-hero {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 360px);
  gap: 24px;
  align-items: center;
  overflow: hidden;
}
.module-hero h2 {
  font-size: 30px;
  margin-bottom: 10px;
}
.module-hero p {
  color: var(--muted);
  max-width: 760px;
  line-height: 1.65;
}
.module-hero img { width: 100%; height: auto; }
.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.module-section {
  background: rgba(255,255,255,.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 18px 45px rgba(15,35,55,.07);
}
.module-section h2 {
  color: #0f2340;
  font-size: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.module-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid #eef4f8;
}
.module-item:last-child { border-bottom: 0; }
.module-item strong { display: block; color: #0b1d35; }
.module-item p { margin: 5px 0 0; color: #29415e; line-height: 1.55; }
.module-item span {
  align-self: start;
  border-radius: 999px;
  padding: 5px 9px;
  background: #e7f7fb;
  color: #087ca0;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.module-detail p {
  max-width: 850px;
  color: var(--muted);
  line-height: 1.65;
}
.capability-cards {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.capability-cards article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, #fff, #f5fbff);
}
.capability-cards strong, .capability-cards span { display: block; }
.capability-cards span { color: var(--muted); margin-top: 8px; line-height: 1.5; }

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; }
  .app-main { margin-left: 0; padding: 18px; }
  .metrics, .grid-two, .login-shell, .form-row, .form-grid.wide, .invoice-customer, .module-hero, .module-grid, .capability-cards, .dashboard-hero, .quick-modules, .mfa-setup, .market-strip { grid-template-columns: 1fr; }
  .login-panel, .login-form { border-radius: 8px; border: 1px solid var(--line); }
  .page-header { align-items: flex-start; flex-direction: column; }
}

@media print {
  body { background: #fff; }
  .sidebar, .no-print { display: none !important; }
  .app-main { margin: 0; padding: 0; }
  .invoice-sheet { border: 0; box-shadow: none; max-width: none; }
}
