/* Demo: standalone stylesheet (does not depend on landing.css).
   Warm light/dark palette, IBM Plex Sans body, Newsreader headings, IBM Plex Mono numbers. */

:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
:root {
  --bg: light-dark(#f4f1ea, #15120f);
  --fg: light-dark(#1f1b17, #ece6dc);
  --fg-2: light-dark(#4f4841, #b8afa4);
  --muted: light-dark(#6e665d, #9a9188);
  --faint: light-dark(#9a9188, #6e665d);
  --line: light-dark(#e3ddd2, #2b2520);
  --line-2: light-dark(#d8d1c5, #3a332c);
  --dash: light-dark(#c0b8aa, #4a4038);
  --card: light-dark(#fbf9f5, #1d1915);
  --big: #d6453a;
  --medium: #3aa864;
  --ok-fg: light-dark(#2f6b45, #8fcaa3);
  --ok-line: light-dark(#bfd9c7, #2f4a38);
  --ok-dot: light-dark(#2f8f55, #5fc083);
  --warn-fg: light-dark(#8a5a12, #e0b35c);
  --warn-line: light-dark(#e6d3a8, #5a4722);
  --bad-fg: light-dark(#a33a30, #e07b70);
  --bad-line: light-dark(#e8c3bf, #5c2f2a);
  --serif: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

html, body { margin: 0; padding: 0; }
body { font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: 14px; line-height: 1.45; background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--muted); }
button, select, input { font-family: inherit; font-size: inherit; color: inherit; }
[hidden] { display: none !important; }
.demo-app { min-height: 100vh; display: flex; flex-direction: column; }
.eyebrow { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); }
h1, h2 { font-family: var(--serif); font-weight: 400; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { background: var(--card); }
.btn--pill { border-radius: 999px; }
.btn--primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn--primary:hover { background: var(--fg-2); color: var(--bg); }
.btn--link { padding: 0; border: 0; border-radius: 0; border-bottom: 1px solid currentColor; color: var(--muted); font-size: 12px; background: none; }
.btn--link:hover { background: none; color: var(--fg); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Header ---- */
.hdr { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 40px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.hdr-home { display: flex; align-items: center; gap: 10px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; font-weight: 500; }
.hdr-nav { display: flex; align-items: center; gap: 22px; font-size: 13px; }
.hdr-user { color: var(--muted); }
.hdr-link { letter-spacing: .06em; text-transform: uppercase; background: none; border: 0; padding: 0; cursor: pointer; }
.hdr-link:hover { color: var(--muted); }
.lang { display: flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; font-size: 12px; letter-spacing: .06em; }
.lang button { padding: 5px 10px; border: 0; background: transparent; cursor: pointer; }
.lang button[disabled] { background: var(--fg); color: var(--bg); cursor: default; }
.theme-btn { width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.theme-btn span { width: 12px; height: 12px; border-radius: 999px; background: var(--fg); box-shadow: inset -4px -2px 0 0 var(--bg); }
@media (max-width: 700px) { .hdr { padding: 16px 20px; } .hdr-nav { gap: 14px; } }

/* ---- Pills (quota) ---- */
.pill { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .02em; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; white-space: nowrap; color: var(--muted); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.pill--ok { color: var(--ok-fg); border-color: var(--ok-line); }
.pill--ok::before { background: var(--ok-dot); }
.pill--demo { color: var(--warn-fg); border-color: var(--warn-line); }
.pill--empty { color: var(--bad-fg); border-color: var(--bad-line); }

/* ---- Upload screen ---- */
.screen { width: 100%; margin: 0 auto; box-sizing: border-box; display: flex; flex-direction: column; }
.screen--upload { max-width: 1100px; padding: 56px 40px 96px; gap: 40px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: end; }
.hero-text { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.hero h1 { font-size: 56px; line-height: 1; letter-spacing: -.01em; }
.hero p { margin: 0; font-size: 17px; line-height: 1.5; color: var(--fg-2); text-wrap: pretty; }
.upload-card { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.upload-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; aspect-ratio: 1; padding: 24px; border: 1px dashed var(--dash); border-radius: 12px; text-align: center; cursor: pointer; background: var(--bg); box-sizing: border-box; transition: border-color .15s; }
.dropzone:hover, .dropzone.dragover { border-color: var(--fg); }
.dropzone input { display: none; }
.dropzone-icon { width: 48px; height: 48px; border-radius: 999px; border: 1px solid var(--dash); display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--muted); margin-bottom: 6px; }
.dropzone-title { font-size: 17px; font-weight: 500; }
.dropzone-sub { font-size: 14px; color: var(--muted); }
.dropzone-hint { font-size: 12px; color: var(--faint); margin-top: 8px; }
.presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 12px; flex: 1; }
.preset { padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #000; aspect-ratio: 1; overflow: hidden; cursor: pointer; position: relative; display: block; }
.preset:hover { border-color: var(--fg); }
.preset img { width: 100%; height: 100%; object-fit: cover; display: block; }
.model-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.select-wrap { position: relative; display: inline-flex; }
.select-wrap select { appearance: none; -webkit-appearance: none; padding: 8px 32px 8px 12px; font-size: 13px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--card); color: var(--fg); max-width: 280px; }
.select-wrap::after { content: "\25BC"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; font-size: 10px; }
.notice { padding: 10px 14px; border: 1px solid var(--bad-line); color: var(--bad-fg); border-radius: 8px; font-size: 13px; }

/* History */
.history { display: flex; flex-direction: column; gap: 12px; }
.history-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.history-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.history-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 20px; align-items: center; padding: 12px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; font-size: 14px; cursor: pointer; }
.history-item:hover { background: var(--card); }
.history-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-sum { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.history-date { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---- Result screen ---- */
.screen--result { max-width: 1440px; padding: 28px 20px 96px; gap: 28px; }
.result-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.result-top-l { display: flex; align-items: center; gap: 20px; min-width: 0; }
.result-top h1 { font-size: 30px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-pick { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 700px) { .cards { grid-template-columns: 1fr; } }
.card { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.card-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1; }
.stat span { font-size: 11px; color: var(--muted); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.swatch--big, .dot--big { background: var(--big); }
.swatch--medium, .dot--medium { background: var(--medium); }

.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 24px; align-items: start; }
.result-grid[data-focus] { grid-template-columns: 1fr; }
.result-grid[data-focus="image"] .panel, .result-grid[data-focus="table"] .stage-box { display: none; }
.btn-label-alt { display: none; }
.result-grid[data-focus="image"] [data-focus-image] .btn-label, .result-grid[data-focus="table"] [data-focus-table] .btn-label { display: none; }
.result-grid[data-focus="image"] [data-focus-image] .btn-label-alt, .result-grid[data-focus="table"] [data-focus-table] .btn-label-alt { display: inline; }

/* Stage */
.stage-box { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--card); position: sticky; top: 24px; min-width: 0; }
.stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; font-size: 13px; }
.stage-bar-l, .stage-bar-r { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.cls-toggle { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; cursor: pointer; }
.cls-toggle .dot { width: 9px; height: 9px; }
.cls-toggle[aria-pressed="false"] { opacity: .4; }
.opacity { display: flex; align-items: center; gap: 10px; margin-left: 12px; color: var(--muted); }
.opacity input { width: 120px; accent-color: light-dark(#404040, #ece6dc); }
.stage { position: relative; aspect-ratio: 4 / 3; background: #0a0908; width: 100%; box-sizing: border-box; overflow: hidden; cursor: grab; touch-action: none; }
.result-grid[data-focus="image"] .stage { aspect-ratio: 16 / 9; }
.stage--empty { aspect-ratio: 16 / 9; max-height: 480px; }
.stage:active { cursor: grabbing; }
.stage-hint { position: absolute; right: 12px; bottom: 10px; z-index: 2; pointer-events: none; font-size: 11px; color: #8a8178; background: rgba(10, 9, 8, .6); padding: 3px 8px; border-radius: 6px; }
.stage-svg { width: 100%; height: 100%; display: block; }
.vessel { fill: var(--big); fill-opacity: var(--vessel-opacity, .6); stroke: none; cursor: pointer; transition: fill .15s; }
.vessel--medium { fill: var(--medium); }
.vessel.selected { fill: #fff; stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.vessel.hovered, .vessel:hover { fill: #5bc8e8; stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.stage-box[data-hide-big] .vessel--big, .stage-box[data-hide-medium] .vessel--medium { display: none; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #cfc7bb; text-align: center; padding: 24px; background: rgba(10, 9, 8, .8); z-index: 3; }
.overlay-note { font-size: 12px; color: #8a8178; max-width: 420px; }
.overlay-title { font-size: 15px; font-weight: 500; }
.overlay-btns { display: flex; gap: 10px; margin-top: 6px; }
.overlay .btn { color: #ece6dc; border-color: #4a4038; }
.overlay .btn--primary { background: #ece6dc; color: #15120f; }
.spinner { width: 36px; height: 36px; border-radius: 999px; border: 2px solid #3a332c; border-top-color: #ece6dc; animation: spin .9s linear infinite; }
.bang { width: 40px; height: 40px; border-radius: 999px; border: 1px solid #c2574c; color: #e07b70; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 22px; }
.tooltip { position: absolute; z-index: 4; pointer-events: none; padding: 6px 10px; background: rgba(10, 9, 8, .9); color: #ece6dc; font-size: 12px; line-height: 18px; white-space: nowrap; border-radius: 6px; border: 1px solid #3a332c; }
.tooltip b { font-family: var(--mono); font-weight: 500; }

/* Metrics panel */
.panel { display: flex; flex-direction: column; min-width: 0; }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.panel-head-l { display: flex; align-items: flex-end; gap: 28px; }
.panel-head h2 { margin: 0 0 10px; font-size: 28px; line-height: 1; }
.tabs { display: flex; gap: 20px; }
.tab { padding: 10px 4px 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; cursor: pointer; opacity: .55; display: flex; gap: 8px; align-items: baseline; }
.tab.active { opacity: 1; border-bottom-color: var(--fg); }
.tab-count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.panel-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.sort-hint { display: block; padding: 12px 0 4px; font-size: 12px; color: var(--muted); }
.table-scroll { max-height: 520px; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; text-align: left; padding: 14px 12px 10px; vertical-align: bottom; line-height: 1.3; }
.table td { padding: 12px; border-top: 1px solid var(--line); }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .num { text-align: right; font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.table .name { color: var(--fg-2); }
.table--vessels { table-layout: fixed; }
.table--vessels th, .table--vessels td { box-sizing: border-box; }
.table--vessels th { position: sticky; top: 0; background: var(--bg); padding: 12px 6px 10px; cursor: pointer; white-space: normal; }
.table--vessels th:hover, .table--vessels th[aria-sort] { color: var(--fg); }
.table--vessels th[aria-sort="ascending"]::after { content: " \2191"; }
.table--vessels th[aria-sort="descending"]::after { content: " \2193"; }
.table--vessels td { padding: 11px 6px; font-size: 13px; }
.table--vessels td.id { font-family: var(--mono); font-size: 12px; color: var(--fg-2); overflow-wrap: anywhere; }
.table--vessels td.num { font-size: 12px; }
.table--vessels .cls { display: inline-flex; align-items: center; gap: 6px; }
.table--vessels tbody tr { cursor: pointer; }
.table--vessels tbody tr:hover, .table--vessels tbody tr.hovered { background: color-mix(in srgb, #5bc8e8 14%, transparent); }
.table--vessels tbody tr.selected { background: color-mix(in srgb, var(--fg) 8%, transparent); }

/* ---- Login ---- */
.screen--login { max-width: 480px; padding: 72px 24px 96px; gap: 24px; }
.screen--login h1 { font-size: 44px; line-height: 1; }
.screen--login p { margin: 0; color: var(--fg-2); font-size: 15px; line-height: 1.5; }
.login-form { display: flex; flex-direction: column; gap: 14px; padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.input { padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); color: var(--fg); }
.input:focus { outline: none; border-color: var(--fg); }

@media (max-width: 700px) {
  .screen--upload { padding: 36px 20px 72px; gap: 28px; }
  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero h1 { font-size: 40px; }
  .result-top-l { flex-wrap: wrap; }
  .result-top h1 { white-space: normal; }
  .stage-box { position: static; }
}
