:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-alt: #eef3ff;
  --surface-deep: #e6efff;
  --text: #172033;
  --muted: #6b7485;
  --line: #d9e0ec;
  --primary: #1d4ed8;
  --primary-strong: #173ea8;
  --secondary: #0f766e;
  --danger: #c2410c;
  --warning: #d97706;
  --success: #15803d;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.05);
  --radius: 22px;
  --radius-sm: 16px;
  --content-width: 1440px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, 0.10), transparent 30%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 24%),
    var(--bg);
}
body.nav-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
.shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #0f172a, #172554);
  color: #fff;
  padding: 24px 22px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 40;
}
.sidebar-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sidebar-close {
  display: none;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 12px;
  padding: 10px 12px;
}
.sidebar-footer { margin-top: auto; }
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 30;
}
body.nav-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #34d399);
  color: #0f172a;
}
.brand span, .muted { color: var(--muted); }
.sidebar .brand span { color: rgba(255,255,255,0.7); display: block; margin-top: 4px; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav-link {
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(255,255,255,0.78);
  transition: .2s ease;
}
.nav-link.active, .nav-link:hover { background: rgba(255,255,255,0.12); color: #fff; }
.main {
  padding: 30px;
  width: min(100%, var(--content-width));
}
.main > section + section { margin-top: 24px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 30px;
}
.topbar-primary { display: flex; align-items: flex-start; gap: 14px; }
.mobile-nav-toggle {
  display: none;
  border: 0;
  border-radius: 14px;
  background: #dbeafe;
  color: #1e3a8a;
  padding: 12px 14px;
  font-weight: 700;
}
.eyebrow { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--primary); font-weight: 700; }
h1, h2 { margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.user-chip {
  background: rgba(255,255,255,0.88);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-soft);
  min-width: 140px;
}
.card {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(217,224,236,0.8);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.cards-grid, .grid { display: grid; gap: 22px; }
.four-up { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards-six-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fixed-left { grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); }
.narrow-card { max-width: 1040px; }
.report-cards-gap { margin-top: 0 !important; }
.stat-card span { display: block; color: var(--muted); font-size: 14px; }
.stat-card strong { display: block; font-size: 32px; margin: 12px 0 8px; line-height: 1.1; }
.stat-card small { color: var(--muted); }
.section-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 20px; }
.section-heading p { margin: 0; color: var(--muted); }
.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .18s ease, opacity .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-ghost { background: #edf2ff; color: #1e3a8a; }
.btn-small { padding: 8px 12px; border-radius: 12px; font-size: 13px; }
.full-width { width: 100%; }
.flash {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.flash-success { background: #ecfdf3; border-color: #86efac; color: #166534; }
.flash-error { background: #fff1f2; border-color: #fda4af; color: #9f1239; }
.flash-info { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
label { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: #364152; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(29,78,216,.16); border-color: var(--primary); }
.stack-form { display: grid; gap: 18px; }
.two-column-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.full-span { grid-column: 1 / -1; }
.toolbar-form, .multi-toolbar { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; }
.toolbar-form .grow { flex: 1 1 280px; }
.toolbar-buttons, .action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; border-radius: 16px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 15px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 700; }
.badge-add { background: #dcfce7; color: #166534; }
.badge-sale { background: #fef3c7; color: #92400e; }
.badge-remove { background: #fee2e2; color: #991b1b; }
.badge-neutral { background: #e2e8f0; color: #334155; }
.timeline { display: grid; gap: 12px; }
.timeline-item { padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-alt); }
.timeline-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.public-topbar { display: flex; justify-content: flex-end; padding: 18px 24px 0; }
.login-shell { display: grid; grid-template-columns: 1.1fr .9fr; gap: 24px; max-width: 1120px; width: min(100%, 1120px); }
.single-panel { grid-template-columns: minmax(0, 560px); justify-content: center; }
.login-panel {
  background: rgba(255,255,255,0.94);
  border: 1px solid rgba(217,224,236,0.8);
  border-radius: 28px;
  padding: 38px;
  box-shadow: var(--shadow);
}
.brand-panel {
  background: linear-gradient(160deg, #0f172a, #1d4ed8 60%, #0f766e);
  color: #fff;
}
.brand-panel .eyebrow, .brand-panel p { color: rgba(255,255,255,0.84); }
.feature-list { margin: 26px 0 0; padding-left: 18px; display: grid; gap: 10px; }
.info-box {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-alt);
}
.checkbox-line { flex-direction: row; align-items: center; gap: 10px; }
.checkbox-line input { width: auto; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.chart {
  min-height: 280px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(238,243,255,.9), rgba(255,255,255,.92));
  border: 1px solid var(--line);
  padding: 18px;
}
.chart svg { width: 100%; height: 240px; overflow: visible; }
.chart-legend { display: grid; gap: 8px; margin-top: 16px; }
.chart-legend div { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 14px; }
.chart-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.88);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  color: var(--muted);
  flex-wrap: wrap;
}
.language-switcher.stacked {
  width: 100%;
  border-radius: 18px;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  border-color: rgba(255,255,255,0.12);
  box-shadow: none;
}
.desktop-only { display: inline-flex; }
.lang-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  color: inherit;
}
.lang-pill.active {
  background: var(--primary);
  color: #fff;
}
@media (max-width: 1280px) {
  .cards-six-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .four-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .fixed-left, .two-col, .login-shell { grid-template-columns: 1fr; }
  .main { padding: 24px; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: min(88vw, 320px);
    transform: translateX(-110%);
    transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .sidebar-close, .mobile-nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .desktop-only { display: none; }
  .topbar { flex-direction: column; margin-bottom: 24px; }
  .topbar-actions { width: 100%; justify-content: space-between; }
  .main { width: 100%; }
}
@media (max-width: 720px) {
  .two-column-form, .four-up, .cards-six-up { grid-template-columns: 1fr; }
  .card { padding: 20px; border-radius: 20px; }
  .section-heading { flex-direction: column; align-items: flex-start; }
  .login-panel { padding: 28px; }
  .public-topbar { padding: 16px 16px 0; }
  .main { padding: 18px 16px 28px; }
  .topbar-primary { width: 100%; }
  .topbar-actions { align-items: stretch; }
  .language-switcher { width: 100%; justify-content: center; border-radius: 18px; }
  table { min-width: 640px; }
}
