:root {
  --ink: #edf7f4;
  --muted: #9fb2bb;
  --paper: #020a0f;
  --surface: #0b1821;
  --line: #203641;
  --navy: #06131a;
  --teal: #087f78;
  --teal-soft: rgba(8, 127, 120, 0.18);
  --lime: #bedb39;
  --amber: #f4b84a;
  --amber-soft: rgba(244, 184, 74, 0.14);
  --red: #f36c6c;
  --red-soft: rgba(243, 108, 108, 0.14);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 95% 5%, rgba(190, 219, 57, 0.12), transparent 24rem),
    radial-gradient(circle at 10% 95%, rgba(8, 127, 120, 0.12), transparent 26rem),
    var(--paper);
  font-family: Inter, Aptos, "Segoe UI", sans-serif;
  font-size: 14px;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(8, 127, 120, 0.24);
  outline-offset: 2px;
}
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(340px, 560px) 1fr;
  background: var(--surface);
}
.login-panel {
  padding: clamp(32px, 6vw, 84px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 13px;
  height: 36px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--lime), var(--teal));
  box-shadow: 8px 0 0 rgba(8, 127, 120, 0.18);
}
.brand strong { display: block; letter-spacing: 0.13em; font-size: 13px; }
.brand span { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.brand-large { margin-bottom: clamp(56px, 10vh, 120px); }
.login-copy { max-width: 450px; }
.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(29px, 4vw, 46px); line-height: 1.08; letter-spacing: -0.035em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -0.02em; }
h3 { margin: 4px 0 8px; font-size: 17px; }
.login-copy > p:last-child, .subtitle { color: var(--muted); line-height: 1.65; }
.login-form { margin-top: 34px; max-width: 420px; display: grid; gap: 18px; }
label { color: var(--ink); font-size: 12px; font-weight: 700; }
input, select {
  width: 100%;
  margin-top: 7px;
  padding: 12px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
input:hover, select:hover { border-color: #53707b; }
.button {
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
}
.button:disabled { cursor: not-allowed; opacity: 0.45; }
.button-primary { color: #fff; background: var(--teal); }
.button-primary:hover:not(:disabled) { background: #056a65; }
.button-secondary { color: #b8f2ec; background: var(--surface); border-color: #2d6f6a; }
.button-quiet { color: var(--muted); background: transparent; border-color: var(--line); }
.button-wide { width: 100%; justify-content: center; }
.form-error { min-height: 18px; margin: -7px 0 0; color: var(--red); font-size: 12px; }
.security-note { margin: 25px 0 0; max-width: 420px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.login-visual {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
    var(--navy);
  background-size: 40px 40px;
}
.signal { position: absolute; border: 1px solid rgba(190, 219, 57, 0.22); border-radius: 50%; }
.signal-one { width: 580px; height: 580px; }
.signal-two { width: 340px; height: 340px; }
.visual-card {
  position: relative;
  width: min(360px, 70%);
  padding: 28px;
  color: #fff;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
}
.visual-card > span { color: #a9c1ca; font-size: 12px; }
.visual-card > strong { display: block; margin: 9px 0 28px; font-size: 23px; line-height: 1.25; }
.visual-line { display: flex; gap: 8px; }
.visual-line i { display: block; height: 5px; flex: 1; background: var(--lime); border-radius: 9px; }

.app-shell { min-height: 100vh; }
.topbar {
  height: 72px;
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  align-items: center;
  padding: 0 28px;
  color: #fff;
  background: var(--navy);
}
.topbar .brand span, .user-copy span { color: #9fb2bb; }
.main-nav { height: 100%; display: flex; justify-content: center; gap: 6px; }
.nav-button {
  position: relative;
  padding: 0 16px;
  color: #9fb2bb;
  background: transparent;
  border: 0;
  font-weight: 700;
}
.nav-button:hover, .nav-button.active { color: #fff; }
.nav-button.active::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 0;
  left: 16px;
  height: 3px;
  background: var(--lime);
}
.user-area { display: flex; justify-content: flex-end; align-items: center; gap: 14px; }
.user-copy { text-align: right; }
.user-copy strong, .user-copy span { display: block; }
.user-copy span { margin-top: 2px; font-size: 11px; }
.topbar .button-quiet { color: #d9e3e6; border-color: #405765; }
.context-bar {
  min-height: 69px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px max(28px, calc((100vw - 1380px) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.context-bar label { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.context-bar select { width: auto; min-width: 210px; margin: 0; padding: 8px 34px 8px 10px; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-published, .status-secure { margin-left: auto; color: #b8f2ec; background: rgba(8, 127, 120, 0.18); }
.content { max-width: 1380px; margin: 0 auto; padding: 40px 28px 70px; }
.view { display: none; }
.view.active { display: block; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin-bottom: 5px; font-size: 32px; }
.page-heading .subtitle { margin-bottom: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 20px; }
.kpi-card {
  min-height: 150px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 7px 22px rgba(0,0,0,0.22);
}
.kpi-card.primary { color: #fff; background: var(--navy); border-color: var(--navy); }
.kpi-card .label { min-height: 30px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.kpi-card.primary .label { color: #9fb2bb; }
.kpi-card .value { margin: 16px 0 7px; font-size: 26px; font-weight: 800; letter-spacing: -0.04em; }
.kpi-card .detail { color: var(--muted); font-size: 11px; line-height: 1.45; }
.kpi-card.primary .detail { color: #b8c8cf; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 20px; }
.feature-grid { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(280px, 0.8fr); gap: 20px; }
.feature-grid .panel-wide { grid-column: 1 / -1; }
.summary-panel { align-self: start; }
.metric-list { padding: 8px 22px 16px; }
.metric-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.metric-list > div:last-child { border-bottom: 0; }
.metric-list span { color: var(--muted); }
.metric-list strong { text-align: right; font-size: 16px; }
.risk-list { padding: 10px 22px 18px; }
.risk-item { padding: 15px 0; border-bottom: 1px solid var(--line); }
.risk-item:last-child { border-bottom: 0; }
.risk-item span { display: block; color: var(--teal); font-size: 10px; font-weight: 900; letter-spacing: 0.09em; text-transform: uppercase; }
.risk-item strong { display: block; margin-top: 5px; font-size: 18px; }
.risk-item p { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }
.bar-list { padding: 12px 22px 18px; }
.bar-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.bar-row:last-child { border-bottom: 0; }
.bar-row-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.bar-row-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row-head span { flex: 0 0 auto; font-weight: 850; }
.bar-track { height: 8px; margin-top: 8px; overflow: hidden; background: #152833; border-radius: 99px; }
.bar-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--lime)); border-radius: inherit; }
.bar-row.risk .bar-track i, .bar-list-risk .bar-row .bar-track i { background: linear-gradient(90deg, var(--amber), var(--red)); }
.bar-row small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.35; }
.commercial-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.comparison-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 20px; }
.comparison-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 7px 22px rgba(0,0,0,0.22);
}
.comparison-card span, .comparison-card strong, .comparison-card small { display: block; }
.comparison-card span { min-height: 30px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.comparison-card strong { margin: 14px 0 8px; font-size: 24px; letter-spacing: -0.03em; }
.comparison-card small { color: var(--teal); font-weight: 750; line-height: 1.4; }
.panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-heading { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.panel-heading .eyebrow { margin-bottom: 4px; }
.muted { color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); background: #09151d; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(8, 127, 120, 0.08); }
.customer-list { padding: 8px 22px 14px; }
.customer-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.customer-row:last-child { border-bottom: 0; }
.customer-rank { width: 24px; height: 24px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); border-radius: 50%; font-size: 10px; font-weight: 800; }
.customer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.customer-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.customer-value { text-align: right; font-weight: 800; }
.empty-state { padding: 64px 30px; text-align: center; background: var(--surface); border: 1px dashed #3c5862; border-radius: var(--radius); }
.empty-state strong { font-size: 20px; }
.empty-state p { max-width: 560px; margin: 10px auto 0; color: var(--muted); line-height: 1.6; }

.ask-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 0.75fr); gap: 20px; }
.chat-panel { min-height: 590px; display: flex; flex-direction: column; }
.chat-messages { flex: 1; max-height: 470px; overflow-y: auto; padding: 26px; }
.message { max-width: 75%; margin-bottom: 17px; padding: 15px 17px; border-radius: 14px; line-height: 1.55; }
.message p { margin: 5px 0 0; }
.message-system, .message-answer { background: #10252f; border-bottom-left-radius: 3px; }
.message-user { margin-left: auto; color: #fff; background: var(--navy); border-bottom-right-radius: 3px; }
.message-source { display: block; margin-top: 10px; color: var(--muted); font-size: 10px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 26px 18px; }
.suggestion {
  padding: 7px 10px;
  color: var(--teal);
  background: var(--surface);
  border: 1px solid #2d6f6a;
  border-radius: 99px;
  font-size: 11px;
}
.ask-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 18px 22px; border-top: 1px solid var(--line); }
.ask-form input { margin: 0; }
.methodology { padding: 28px; }
.methodology p { color: var(--muted); line-height: 1.65; }
.methodology ul { margin: 25px 0 0; padding: 0; list-style: none; }
.methodology li { padding: 12px 0 12px 24px; border-top: 1px solid var(--line); position: relative; }
.methodology li::before { content: "✓"; position: absolute; left: 1px; color: var(--teal); font-weight: 900; }

.workflow { display: flex; align-items: center; margin: -8px 0 28px; color: var(--muted); }
.workflow-step { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 12px; }
.workflow-step b { width: 25px; height: 25px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); border-radius: 50%; }
.workflow-line { width: 42px; height: 1px; margin: 0 10px; background: var(--line); }
.data-grid { display: grid; gap: 20px; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 22px; }
.upload-card { position: relative; padding: 20px; border: 1px solid var(--line); border-radius: 14px; }
.upload-card p:not(.eyebrow) { min-height: 39px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.file-type { position: absolute; right: 18px; top: 18px; padding: 5px 7px; color: var(--teal); background: var(--teal-soft); border-radius: 5px; font-size: 9px; font-weight: 900; }
.file-picker { display: block; margin: 18px 0 10px; padding: 14px; color: #b8f2ec; background: #07141b; border: 1px dashed #2d6f6a; border-radius: 9px; text-align: center; }
.file-picker input { margin: 10px 0 0; padding: 0; border: 0; font-size: 11px; }
.upload-list { padding: 0 22px 14px; }
.upload-item { display: grid; grid-template-columns: 1.3fr 1fr 0.7fr auto; align-items: center; gap: 14px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.upload-item:last-child { border-bottom: 0; }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 750; }
.upload-name span, .upload-stats { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.status-ready { color: #b8f2ec; background: rgba(8, 127, 120, 0.18); }
.status-review { color: var(--amber); background: var(--amber-soft); }
.status-rejected { color: var(--red); background: var(--red-soft); }
.issue-list { grid-column: 1 / -1; padding: 11px; color: var(--amber); background: var(--amber-soft); border-radius: 8px; font-size: 11px; }
.issue-list div + div { margin-top: 5px; }
.empty-compact { padding: 30px 0; color: var(--muted); text-align: center; }
dialog { width: min(460px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 24px 80px rgba(16,43,58,0.28); }
dialog::backdrop { background: rgba(8, 29, 40, 0.58); backdrop-filter: blur(3px); }
.dialog-form { padding: 25px; }
.dialog-heading { display: flex; justify-content: space-between; margin-bottom: 24px; }
.dialog-form > label { display: block; margin-top: 15px; }
.icon-button { width: 34px; height: 34px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 50%; font-size: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 380px;
  padding: 13px 16px;
  color: #fff;
  background: var(--navy);
  border-radius: 10px;
  box-shadow: var(--shadow);
  transform: translateY(90px);
  opacity: 0;
  transition: 180ms ease;
}
.toast.visible { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--red); }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 230px 1fr auto; }
  .user-copy { display: none; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .dashboard-grid, .ask-layout, .feature-grid { grid-template-columns: 1fr; }
  .commercial-strip, .comparison-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .login-shell { display: block; }
  .login-panel { min-height: 100vh; }
  .login-visual { display: none; }
  .topbar { height: auto; grid-template-columns: 1fr auto; padding: 16px; }
  .topbar .brand span { display: none; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; order: 3; justify-content: flex-start; overflow-x: auto; margin-top: 12px; }
  .nav-button { min-height: 42px; padding: 0 10px; white-space: nowrap; }
  .nav-button.active::after { right: 10px; left: 10px; }
  .context-bar { align-items: stretch; flex-direction: column; padding: 14px 16px; }
  .context-bar label { justify-content: space-between; }
  .context-bar select { width: 65%; min-width: 0; }
  .status-published { margin-left: 0; align-self: flex-start; }
  .content { padding: 28px 16px 50px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .button { align-self: flex-start; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .commercial-strip, .comparison-grid { grid-template-columns: 1fr; }
  .upload-grid { grid-template-columns: 1fr; }
  .upload-item { grid-template-columns: 1fr auto; }
  .upload-stats { grid-column: 1; }
  .workflow-line { width: 12px; margin: 0 4px; }
  .workflow-step { font-size: 0; }
  .workflow-step b { font-size: 12px; }
}
@media (max-width: 430px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .ask-form { grid-template-columns: 1fr; }
  .message { max-width: 90%; }
}
