/* Molinoteq Vessel Tracking prototype
   Shape rule: cards 14px, controls (buttons, inputs, segments) 9px, chips and pills fully round. */

@font-face { font-family: "Geist"; src: url("../fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --bg: #f2f3f5;
  --surface: #fcfcfd;
  --surface-2: #f6f7f8;
  --surface-3: #eceef1;
  --line: #e2e5e9;
  --line-strong: #cfd4da;
  --ink: #15181c;
  --ink-2: #39404a;
  --muted: #646c76;
  --accent: #8a6d4c;
  --accent-strong: #725a3f;
  --accent-soft: #f3ede5;
  --accent-ink: #6b5238;
  --on-accent: #ffffff;
  --warn: #a8530a;
  --warn-bg: #fff2dc;
  --warn-line: #f2c27f;
  --warn-strong: #e08a17;
  --ok: #1f7a4d;
  --ok-bg: #e4f3ea;
  --ok-line: #a9d6bb;
  --danger: #b42318;
  --danger-bg: #fdebe9;
  --danger-line: #f3b8b2;
  --water: #e3e9ee;
  --land: #f6f7f8;
  --land-line: #c9d1d8;
  --border-line: #d9dfe4;
  --river: #6f9fbd;
  --grat: rgba(84, 104, 122, 0.08);
  --route: #8a6d4c;
  --shadow-sm: 0 1px 2px rgba(21, 24, 28, 0.05);
  --shadow: 0 1px 2px rgba(21, 24, 28, 0.05), 0 10px 30px -18px rgba(38, 44, 54, 0.35);
  --shadow-lg: 0 24px 60px -24px rgba(21, 24, 28, 0.45);
  --sidebar: #14171b;
  --sidebar-2: #1c2026;
  --sidebar-line: #262b32;
  --sidebar-ink: #d4d7dc;
  --sidebar-muted: #8b929b;
  --r-card: 14px;
  --r-ctl: 9px;
  --topbar-h: 64px;
  --side-w: 248px;
  --z-sidebar: 30;
  --z-topbar: 20;
  --z-drawer: 50;
  --z-pop: 60;
  --z-modal: 70;
  --z-tour: 80;
  --z-toast: 90;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1114; --surface: #15191e; --surface-2: #1a1f25; --surface-3: #222830; --line: #262c34; --line-strong: #353d47;
    --ink: #e8eaed; --ink-2: #c4c9cf; --muted: #929aa4;
    --accent: #c9a77f; --accent-strong: #d8b994; --accent-soft: rgba(201, 167, 127, 0.13); --accent-ink: #dcbf9b; --on-accent: #17130e;
    --warn: #f3a945; --warn-bg: rgba(243, 169, 69, 0.13); --warn-line: rgba(243, 169, 69, 0.42); --warn-strong: #f3a945;
    --ok: #5cc98f; --ok-bg: rgba(92, 201, 143, 0.12); --ok-line: rgba(92, 201, 143, 0.38);
    --danger: #f2756a; --danger-bg: rgba(242, 117, 106, 0.13); --danger-line: rgba(242, 117, 106, 0.4);
    --water: #10161c; --land: #1d242c; --land-line: #2c353f; --border-line: #2a323b; --river: #4f86a8; --grat: rgba(160, 180, 200, 0.05); --route: #c9a77f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -18px rgba(0, 0, 0, 0.7); --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
    --sidebar: #0b0d10; --sidebar-2: #13161a; --sidebar-line: #1f242a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1114; --surface: #15191e; --surface-2: #1a1f25; --surface-3: #222830; --line: #262c34; --line-strong: #353d47;
  --ink: #e8eaed; --ink-2: #c4c9cf; --muted: #929aa4;
  --accent: #c9a77f; --accent-strong: #d8b994; --accent-soft: rgba(201, 167, 127, 0.13); --accent-ink: #dcbf9b; --on-accent: #17130e;
  --warn: #f3a945; --warn-bg: rgba(243, 169, 69, 0.13); --warn-line: rgba(243, 169, 69, 0.42); --warn-strong: #f3a945;
  --ok: #5cc98f; --ok-bg: rgba(92, 201, 143, 0.12); --ok-line: rgba(92, 201, 143, 0.38);
  --danger: #f2756a; --danger-bg: rgba(242, 117, 106, 0.13); --danger-line: rgba(242, 117, 106, 0.4);
  --water: #10161c; --land: #1d242c; --land-line: #2c353f; --border-line: #2a323b; --river: #4f86a8; --grat: rgba(160, 180, 200, 0.05); --route: #c9a77f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -18px rgba(0, 0, 0, 0.7); --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
  --sidebar: #0b0d10; --sidebar-2: #13161a; --sidebar-line: #1f242a;
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5;
  font-feature-settings: "ss01", "cv11"; -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: -0.01em; }
.strong { font-weight: 600; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.ph { font-size: 1.15em; line-height: 1; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: var(--r-ctl); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 550; font-size: 13.5px; white-space: nowrap; transition: background .18s, border-color .18s, transform .12s, box-shadow .18s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; gap: 6px; }
.btn.lg { height: 46px; font-size: 15px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn .ph { font-size: 16px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-ctl); color: var(--ink-2);
  transition: background .18s, color .18s; position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn .ph { font-size: 19px; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ph { font-size: 17px; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; background: none; }
.link { display: inline-flex; align-items: center; gap: 5px; color: var(--accent-ink); font-weight: 550; text-decoration: none; font-size: 13px; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link .ph { font-size: 14px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 550;
  background: var(--surface-3); color: var(--ink-2); white-space: nowrap; border: 1px solid transparent;
}
.chip .ph { font-size: 13px; }
.chip.xs { height: 20px; padding: 0 7px; font-size: 11px; }
.chip.tone-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.chip.tone-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.chip.tone-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.chip.tone-accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.chip-btn { cursor: pointer; transition: border-color .15s, background .15s; }
.chip-btn:hover { border-color: var(--line-strong); background: var(--surface-2); }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r-ctl); }
.seg button { height: 28px; padding: 0 11px; border-radius: 7px; font-size: 12.5px; font-weight: 550; color: var(--muted); transition: background .15s, color .15s; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field-label { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  height: 38px; padding: 0 12px; border-radius: var(--r-ctl); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  width: 100%; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; line-height: 1.55; resize: vertical; }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-ico { position: relative; }
.input-ico .ph { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-ico input { padding-left: 34px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); }
.hint .ph { margin-top: 2px; }
.form-error { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger-line); padding: 8px 11px; border-radius: var(--r-ctl); }

.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ app layout */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; background: var(--sidebar); color: var(--sidebar-ink); display: flex; flex-direction: column;
  padding: 18px 12px 12px; z-index: var(--z-sidebar); overflow-y: auto;
}
.brand { padding: 4px 10px 0; }
.brand img { width: 148px; height: auto; }
.brand-product { display: block; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: #bc9b77; letter-spacing: .02em; }
.tenant { margin: 16px 4px 12px; padding: 9px 10px; border-radius: var(--r-ctl); background: var(--sidebar-2); border: 1px solid var(--sidebar-line); display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 550; }
.tenant .ph { color: var(--sidebar-muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 11.5px; font-weight: 600; color: var(--sidebar-muted); padding: 14px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 12px; border-radius: var(--r-ctl); text-decoration: none;
  color: var(--sidebar-ink); font-weight: 500; transition: background .15s, color .15s; position: relative;
}
.nav-link .ph { font-size: 18px; color: var(--sidebar-muted); transition: color .15s; }
.nav-link:hover { background: var(--sidebar-2); }
.nav-link.is-active { background: rgba(188, 155, 119, 0.14); color: #f1e6d8; }
.nav-link.is-active .ph { color: #cfae88; }
.nav-link.is-active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #bc9b77; }
.nav-badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-strong); color: #1b1206; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; font-family: var(--mono); }
.side-sync { margin: auto 4px 10px; padding: 12px; border-radius: var(--r-ctl); background: var(--sidebar-2); border: 1px solid var(--sidebar-line); font-size: 12px; }
.side-sync-title { display: flex; align-items: center; gap: 7px; color: var(--sidebar-muted); font-weight: 550; }
.side-sync-title .ph { color: #6fcf97; }
.side-sync-time { margin-top: 4px; font-size: 13.5px; font-weight: 600; color: #f1f2f4; }
.side-sync-src { color: var(--sidebar-muted); margin-top: 2px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-ctl); text-align: left; color: var(--sidebar-ink); transition: background .15s; }
.side-user:hover { background: var(--sidebar-2); }
.side-user-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.side-user-text strong { font-size: 13px; font-weight: 600; }
.side-user-text span { font-size: 12px; color: var(--sidebar-muted); }
.side-user .ph { color: var(--sidebar-muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 12.5px; flex-shrink: 0; letter-spacing: .02em; }
.avatar.sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.hue-0 { background: #e9dccb; color: #5c4630; }
.avatar.hue-1 { background: #d6e3ea; color: #2d4a5c; }
.avatar.hue-2 { background: #dfe6d6; color: #3d4f2b; }
.avatar.hue-3 { background: #e7d9dc; color: #5c3540; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar); height: var(--topbar-h); display: flex; align-items: center; gap: 14px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 560px; }
.search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; pointer-events: none; }
.search input { height: 42px; padding-left: 40px; padding-right: 40px; border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-sm); }
.search input::-webkit-search-cancel-button { display: none; }
.search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 11.5px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 6px; }
.search-pop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: var(--z-pop); max-height: min(520px, 70vh); overflow-y: auto;
}
.search-empty { padding: 12px 12px 10px; color: var(--muted); font-size: 13px; }
.search-try { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.search-try > span { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-right: 2px; }
.search-item { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; transition: background .12s; }
.search-item:hover, .search-item.is-active { background: var(--surface-2); }
.si-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.si-top .mono { font-weight: 600; }
.si-goods { font-weight: 550; }
.si-n { color: var(--muted); font-size: 12.5px; }
.si-answer { color: var(--ink-2); font-size: 13px; line-height: 1.45; }
.demo-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 600; white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.sync-btn.is-busy .ph { animation: spin 1s linear infinite; }
.lang-switch { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r-ctl); }
.lang-switch button { width: 34px; height: 28px; border-radius: 7px; font-size: 12px; font-weight: 650; color: var(--muted); font-family: var(--mono); }
.lang-switch button:hover { color: var(--ink); }
.lang-switch button.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.lang-switch.on-dark { background: rgba(255, 255, 255, 0.06); }
.bell-count { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--warn-strong); color: #1b1206; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; font-family: var(--mono); border: 2px solid var(--bg); box-sizing: content-box; }

.view { padding: 26px 28px 80px; width: 100%; max-width: 1560px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.2; }
.page-head p { color: var(--muted); margin-top: 5px; max-width: 72ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; min-height: 56px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 620; letter-spacing: -0.01em; }
.card-head.pad { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-head-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--muted); padding: 0 18px 14px; font-size: 13px; }
.card-foot { padding: 12px 18px 16px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.count-pill { min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; font-family: var(--mono); }
.count-pill.tone-warn { background: var(--warn-bg); color: var(--warn); }
.tab-count { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 650; display: inline-grid; place-items: center; font-family: var(--mono); }
.section-title { font-size: 14px; font-weight: 620; margin: 26px 0 12px; color: var(--ink-2); }
.section-title:first-child { margin-top: 0; }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 40px 20px; color: var(--muted); }
.empty-state > .ph { font-size: 30px; color: var(--ok); }
.empty-state h3 { color: var(--ink); font-size: 15px; font-weight: 600; }
.empty-state p { max-width: 42ch; }
.empty-state.small { padding: 28px 20px; }

/* ------------------------------------------------------------ overview */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 15px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); box-shadow: var(--shadow); transition: border-color .18s, transform .18s;
}
.kpi:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.kpi-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 550; color: var(--ink-2); }
.kpi-label .ph { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); font-size: 16px; }
.kpi-value { font-size: 34px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12.5px; color: var(--muted); }
.kpi-danger .kpi-label .ph { background: var(--danger-bg); color: var(--danger); }
.kpi-warn .kpi-label .ph { background: var(--warn-bg); color: var(--warn); }
.kpi-warn { border-color: var(--warn-line); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(320px, 1fr); gap: 14px; margin-bottom: 14px; }
.dash-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.map-card { display: flex; flex-direction: column; overflow: hidden; }
.map-card .map-box { flex: 1 0 auto; min-height: 380px; height: clamp(380px, 60vh, 620px); border-top: 1px solid var(--line); }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ok); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: livePulse 2.2s ease-out infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 11px 18px; font-size: 12.5px; color: var(--ink-2); border-top: 1px solid var(--line); background: var(--surface); }
.map-legend span { display: inline-flex; align-items: center; gap: 7px; }
.lgd { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.lgd-onTime { background: var(--accent); }
.lgd-delayed { background: var(--danger); }
.lgd-arrived { background: var(--ok); }
.lgd-barge { width: 14px; height: 8px; border-radius: 2px 5px 5px 2px; background: var(--ink-2); }

.changes-card { display: flex; flex-direction: column; }
.mini-changes { display: flex; flex-direction: column; padding: 0 10px; flex: 1; }
.mini-chg { display: flex; align-items: flex-start; gap: 12px; padding: 12px 8px; border-top: 1px solid var(--line); }
.mini-changes > .mini-chg:first-child { border-top: 0; }
.mini-chg-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--warn-bg); color: var(--warn); }
.mini-chg-ico .ph { font-size: 17px; }
.mini-chg-ico.type-ata, .mini-chg-ico.type-bargeArrival, .mini-chg-ico.type-gateOut { background: var(--ok-bg); color: var(--ok); }
.mini-chg-ico.type-terminal { background: var(--accent-soft); color: var(--accent-ink); }
.mini-chg-body { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.mini-chg-body strong { color: var(--ink); font-weight: 600; font-size: 13.5px; }
.delta { color: var(--danger); font-weight: 600; }
.mini-chg-diff, .chg-diff, .mail-diff { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); flex-wrap: wrap; }
.mini-chg-diff s, .chg-diff s, .mail-diff s { color: var(--muted); }
.mini-chg-diff .ph, .chg-diff .ph, .mail-diff .ph { font-size: 13px; color: var(--muted); }
.mini-chg .btn { flex-shrink: 0; align-self: center; }

.timeline { display: flex; flex-direction: column; padding: 0 10px 10px; }
.tl-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 11px 8px; border-radius: 10px; text-align: left; transition: background .12s; }
.tl-row:hover { background: var(--surface-2); }
.timeline li + li .tl-row { border-top: 1px solid var(--line); border-radius: 0; }
.timeline li + li .tl-row:hover { border-radius: 10px; border-top-color: transparent; }
.tl-date { width: 92px; flex-shrink: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tl-date strong { font-size: 13.5px; font-weight: 620; }
.tl-date span { font-size: 12px; color: var(--muted); }
.tl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.tl-main strong { font-weight: 580; font-size: 13.5px; }
.tl-main > span { font-size: 12.5px; color: var(--muted); }

/* ------------------------------------------------------------ shipments */
.toolbar { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(150px, 1fr)) auto; gap: 12px; padding: 14px 16px; align-items: end; margin-bottom: 12px; }
.table-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin: 0 2px 10px; }
.legend-inline { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.sw { width: 22px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; font-size: 12px; }
.sw-1 { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }
.sw-2 { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line); margin-left: 8px; }
.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr[data-action] { cursor: pointer; transition: background .12s; }
table.data tbody tr[data-action]:hover td { background: var(--surface-2); }
table.data td .sub { display: block; padding-left: 2px; font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; }
table.data.compact td, table.data.compact th { padding: 8px 14px; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: inherit; font-size: 12px; }
.th-sort .ph { font-size: 12px; opacity: .55; }
.th-sort.is-on { color: var(--ink); }
.th-sort.is-on .ph { opacity: 1; }
td.cell-flag { padding: 4px 6px !important; cursor: pointer; }
.flag-in { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; border: 1px solid transparent; white-space: nowrap; transition: transform .12s, background .15s; }
td.cell-flag.f1 .flag-in { background: var(--warn-bg); border-color: var(--warn-line); color: var(--ink); font-weight: 600; }
td.cell-flag.f1 .flag-ico { color: var(--warn-strong); }
td.cell-flag.f2 .flag-in { background: var(--ok-bg); border-color: var(--ok-line); }
td.cell-flag.f2 .flag-ico { color: var(--ok); }
td.cell-flag:hover .flag-in { transform: translateY(-1px); }
td.cell-flag .flag-in > span { display: inline-flex; align-items: center; gap: 5px; }
s.old { color: var(--muted); font-weight: 400; font-size: 12px; }
.delay { display: inline-flex; align-items: center; gap: 4px; color: var(--danger); font-weight: 600; white-space: nowrap; }
.route-arrow { color: var(--muted); font-size: 12px; vertical-align: -1px; }
td.state { color: var(--ink-2); }
td.state .ph { color: var(--muted); margin-right: 5px; vertical-align: -2px; }
td.actions { text-align: right; width: 1%; white-space: nowrap; }
tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

/* ------------------------------------------------------------ vessels */
.vessel-list { display: flex; flex-direction: column; gap: 10px; }
.vessel { overflow: hidden; }
.vessel-main { display: grid; grid-template-columns: minmax(200px, 1.1fr) minmax(260px, 2fr) minmax(140px, .8fr) auto; gap: 24px; align-items: center; padding: 16px 18px; }
.vessel-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.vessel-id h3 { font-size: 15px; font-weight: 620; }
.vessel-id p { font-size: 12.5px; color: var(--muted); }
.vessel-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex-shrink: 0; }
.vessel-ico .ph { font-size: 20px; }
.vessel.st-delayed .vessel-ico { background: var(--danger-bg); color: var(--danger); }
.vessel.st-arrived .vessel-ico { background: var(--ok-bg); color: var(--ok); }
.vr-ports { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.vr-line { position: relative; height: 2px; margin: 0 4px; background-image: linear-gradient(90deg, var(--line-strong) 50%, transparent 50%); background-size: 8px 2px; }
.vr-done { position: absolute; left: 0; top: 0; height: 2px; width: var(--p); background: var(--accent); }
.vessel.st-delayed .vr-done { background: var(--danger); }
.vessel.st-arrived .vr-done { background: var(--ok); }
.vr-ship { position: absolute; top: 50%; left: var(--p); transform: translate(-50%, -50%); width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--accent); display: grid; place-items: center; color: var(--accent-ink); }
.vr-ship .ph { font-size: 12px; transform: rotate(90deg); }
.vessel.st-delayed .vr-ship { border-color: var(--danger); color: var(--danger); }
.vessel.st-arrived .vr-ship { border-color: var(--ok); color: var(--ok); }
.vr-meta { font-size: 12px; color: var(--muted); margin-top: 9px; }
.vessel-eta { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.vessel-eta strong { font-size: 13.5px; font-weight: 600; }
.vessel-actions { display: flex; gap: 8px; }
.vessel-containers { border-top: 1px solid var(--line); background: var(--surface-2); padding: 12px 18px 14px; }
.vc-title { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.vc-row { display: grid; grid-template-columns: 140px 110px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; font-size: 13px; }
.vc-row:hover { background: var(--surface); }

/* ------------------------------------------------------------ live map page */
.map-page { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: max(560px, calc(100dvh - var(--topbar-h) - 150px)); overflow: hidden; }
.map-side { border-right: 1px solid var(--line); overflow-y: auto; padding: 10px; }
.map-side-group { font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 8px 6px; }
.ms-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 8px; border-radius: 9px; text-align: left; transition: background .12s; }
.ms-item:hover { background: var(--surface-2); }
.ms-item.is-on { background: var(--accent-soft); }
.ms-item > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.ms-item strong { font-weight: 600; font-size: 13.5px; }
.ms-item span span { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.ms-item .ph { font-size: 11px; }
.ms-eta { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.map-main { position: relative; display: flex; flex-direction: column; min-width: 0; }
.map-full { flex: 1; min-height: 0; }
.map-ctrl { position: absolute; top: 14px; right: 14px; display: flex; gap: 8px; align-items: flex-start; }
.map-ctrl .seg { background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); }
.map-ctrl .seg button.is-on { background: var(--surface-3); box-shadow: none; }
.zoom-btns { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); box-shadow: var(--shadow); overflow: hidden; }
.zoom-btns .icon-btn { border-radius: 0; width: 36px; height: 34px; }
.zoom-btns .icon-btn + .icon-btn { border-top: 1px solid var(--line); }
.map-hint { position: absolute; top: 16px; left: 16px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 5px 10px; border-radius: 999px; pointer-events: none; }
.map-info { position: absolute; left: 16px; bottom: 60px; width: 300px; padding: 14px; z-index: 2; }
.mi-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.mi-head h3 { font-size: 16px; font-weight: 640; }
.mi-head p { font-size: 12.5px; color: var(--muted); }
.mi-facts { display: grid; gap: 8px; margin-bottom: 12px; font-size: 13px; }
.mi-facts > div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; align-items: center; }
.mi-facts dt { color: var(--muted); font-size: 12.5px; }
.mi-facts dd { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 550; }
.mi-facts dd .ph { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------ map component */
.mt-wrap { position: relative; overflow: hidden; background: var(--water); user-select: none; -webkit-user-select: none; touch-action: none; }
.map-box.mt-wrap:not(.mt-interactive) { touch-action: pan-y; }
.mt-svg { display: block; width: 100%; height: 100%; }
.mt-interactive { cursor: grab; }
.mt-interactive.is-dragging { cursor: grabbing; }
.mt-water { fill: var(--water); }
.mt-grat { fill: none; stroke: var(--grat); stroke-width: 1; vector-effect: non-scaling-stroke; }
.mt-land { fill: var(--land); stroke: var(--land-line); stroke-width: 0.7; }
.mt-borders { fill: none; stroke: var(--border-line); stroke-width: 0.6; }
.mt-beu { display: none; }
.mt-zoomed .mt-bw { display: none; }
.mt-zoomed .mt-beu { display: inline; stroke-width: 0.9; }
.mt-river { fill: none; stroke: var(--river); stroke-width: 1.2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.mt-zoomed .mt-river { stroke-width: 2.6; }
.mt-route path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.mt-done { stroke: var(--route); stroke-width: 1.8; opacity: .85; }
.mt-rest { stroke: var(--route); stroke-width: 1.3; stroke-dasharray: 3 4; opacity: .55; }
.mt-route.st-delayed .mt-done, .mt-route.st-delayed .mt-rest { stroke: var(--danger); }
.mt-route.st-arrived .mt-done { stroke: var(--ok); }
.mt-route.is-dim { opacity: .2; }
.mt-route.is-sel .mt-done { stroke-width: 2.8; opacity: 1; }
.mt-route.is-sel .mt-rest { stroke-width: 2; opacity: .85; }
.mt-port circle { fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.4; }
.mt-port text, .mt-vl text { font-family: var(--font); font-size: 11px; font-weight: 600; fill: var(--ink-2); paint-order: stroke; stroke: var(--water); stroke-width: 3px; stroke-linejoin: round; }
.mt-port.no-label text { display: none; }
.mt-v { cursor: pointer; outline: none; }
.mt-v-hit { fill: transparent; }
.mt-v-ship { fill: var(--accent); stroke: var(--surface); stroke-width: 1.4; stroke-linejoin: round; }
.mt-v.st-delayed .mt-v-ship { fill: var(--danger); }
.mt-v.st-arrived .mt-v-ship { fill: var(--ok); }
.mt-v-pulse { fill: var(--accent); opacity: 0; transform-box: fill-box; transform-origin: center; }
.mt-v.st-delayed .mt-v-pulse { fill: var(--danger); }
.mt-v.st-onTime .mt-v-pulse, .mt-v.st-delayed .mt-v-pulse { animation: vPulse 2.6s ease-out infinite; }
@keyframes vPulse { 0% { opacity: .35; transform: scale(.4); } 80%, 100% { opacity: 0; transform: scale(1.5); } }
.mt-v:hover .mt-v-ship, .mt-v:focus-visible .mt-v-ship, .mt-v.is-sel .mt-v-ship { stroke: var(--ink); stroke-width: 1.8; }
.mt-v.is-dim { opacity: .45; }
.mt-vl { pointer-events: none; }
.mt-vl text { font-size: 11.5px; fill: var(--ink); }
.mt-vl { display: none; }
.mt-vl.is-on { display: inline; }
.mt-tip { position: absolute; left: 0; top: 0; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 9px 11px; display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; color: var(--muted); min-width: 180px; z-index: 3; }
.mt-tip strong { color: var(--ink); font-size: 13.5px; font-weight: 620; }
.tip-st { color: var(--ink-2); font-weight: 550; }
.tip-st.st-delayed { color: var(--danger); }
.tip-st.st-arrived { color: var(--ok); }

/* ------------------------------------------------------------ changes */
.changes-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px; font-weight: 550; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.is-on { color: var(--ink); border-bottom-color: var(--accent); }
.chg-list { display: flex; flex-direction: column; gap: 10px; }
.chg-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; padding: 16px 18px; }
.chg-card.is-open { border-left: 3px solid var(--warn-strong); }
.chg-card.is-done { opacity: .82; }
.chg-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--warn-bg); color: var(--warn); }
.chg-ico .ph { font-size: 19px; }
.chg-card.is-done .chg-ico { background: var(--surface-3); color: var(--muted); }
.chg-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.chg-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chg-top h3 { font-size: 15px; font-weight: 620; margin-right: 2px; }
.chg-what { color: var(--ink-2); }
.chg-diff { font-size: 13.5px; }
.chg-reason { margin-left: 4px; padding-left: 10px; border-left: 1px solid var(--line-strong); color: var(--muted); }
.chg-affected { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.chg-affected > span { margin-right: 2px; }
.chg-meta { font-size: 12px; color: var(--muted); }
.chg-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.notif-card { position: sticky; top: calc(var(--topbar-h) + 18px); padding-bottom: 16px; }
.switches { display: flex; flex-direction: column; padding: 0 18px; margin-bottom: 14px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.switch-row:first-child { border-top: 0; }
.switch { appearance: none; -webkit-appearance: none; width: 36px; height: 21px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; flex-shrink: 0; transition: background .18s; border: 0; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2.5px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .18s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(14px); }
.notif-card .field-label { display: block; padding: 0 18px 8px; }
.recipients { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 16px; }
.notif-card > .btn { margin: 0 18px; width: calc(100% - 36px); }

/* ------------------------------------------------------------ availability */
.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin-bottom: 16px; background: var(--accent-soft); border-radius: var(--r-card); overflow: hidden; }
.role { display: flex; gap: 12px; align-items: center; padding: 16px 18px; }
.role + .role { border-left: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.role .ph { font-size: 22px; color: var(--accent-ink); }
.role p { font-weight: 550; color: var(--ink); line-height: 1.4; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.board-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px; min-height: 240px; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 2px 4px 12px; }
.board-head h2 { font-size: 14px; font-weight: 620; }
.board-head p { width: 100%; font-size: 12px; color: var(--muted); }
.board-items { display: flex; flex-direction: column; gap: 8px; }
.av-card { display: flex; flex-direction: column; gap: 4px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 12px; box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s; }
.av-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.av-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.av-card strong { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.av-sup { font-size: 12px; color: var(--muted); }
.av-foot { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.av-foot span { display: inline-flex; align-items: center; gap: 4px; }
.av-foot .ph { color: var(--muted); }
.board-empty { font-size: 12.5px; color: var(--muted); padding: 18px 6px; text-align: center; }

/* ------------------------------------------------------------ integrations */
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.int-tile { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.int-head { display: flex; gap: 12px; align-items: flex-start; }
.int-head h3 { font-size: 14.5px; font-weight: 620; margin-bottom: 4px; }
.mono-badge { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-family: var(--mono); font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--ink-2); flex-shrink: 0; letter-spacing: -.02em; }
.int-tile > p { font-size: 13px; color: var(--ink-2); }
.int-meta { font-size: 12px !important; color: var(--muted) !important; margin-top: auto; }
.int-tile .btn { align-self: flex-start; }
.int-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 14px; margin-top: 26px; }
.dropzone { margin: 0 18px 18px; border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 26px 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; transition: border-color .18s, background .18s; }
.dropzone.is-over, .dropzone.is-pulse { border-color: var(--accent); background: var(--accent-soft); }
.dz-ico { font-size: 34px; color: var(--accent-ink); margin-bottom: 4px; }
.dz-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.dz-actions label { cursor: pointer; }
.ok-text { display: inline-flex; align-items: center; gap: 5px; color: var(--ok); font-weight: 550; }

/* ------------------------------------------------------------ security */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell > span:last-child { display: flex; flex-direction: column; }
.sec-bottom { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; align-items: start; }
.prot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; padding: 0 8px 8px; }
.prot { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; padding: 14px 10px; align-items: flex-start; border-top: 1px solid var(--line); }
.prot:nth-child(-n+2) { border-top: 0; }
.prot > .ph { font-size: 21px; color: var(--accent-ink); margin-top: 1px; }
.prot h3 { font-size: 13.5px; font-weight: 620; }
.prot p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.audit { padding: 0 18px 14px; display: flex; flex-direction: column; }
.audit li { display: grid; grid-template-columns: 112px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.audit li:first-child { border-top: 0; }
.audit-time { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* ------------------------------------------------------------ drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(12, 14, 17, .38); z-index: var(--z-drawer); opacity: 0; transition: opacity .25s; }
.drawer-backdrop.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: calc(var(--z-drawer) + 1);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(104%); transition: transform .32s cubic-bezier(.16, 1, .3, 1);
  border-left: 1px solid var(--line);
}
.drawer.is-open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.drawer-kicker { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.drawer-head h2 { font-size: 21px; font-weight: 650; margin: 2px 0 8px; }
.drawer-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 24px; }
.answer { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); margin-bottom: 14px; }
.answer .ph { font-size: 20px; color: var(--accent-ink); margin-top: 1px; }
.answer p { font-weight: 550; line-height: 1.5; }
.drawer-map { height: 210px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 16px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; padding: 4px 0 6px; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { font-weight: 550; font-size: 13.5px; word-break: break-word; }
.facts dd .muted { font-weight: 400; font-size: 12.5px; }
.drawer-h { font-size: 14px; font-weight: 620; margin: 22px 0 10px; }
.milestones { position: relative; }
.milestones li { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: start; padding-bottom: 14px; position: relative; }
.milestones li::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: -2px; width: 2px; background: var(--line); }
.milestones li:last-child::before { display: none; }
.milestones li.is-done::before { background: var(--ok); opacity: .55; }
.ms-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; color: #fff; position: relative; z-index: 1; }
.ms-dot .ph { font-size: 12px; }
.is-done .ms-dot { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.is-current .ms-dot { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.ms-label { font-weight: 550; display: flex; flex-direction: column; gap: 2px; padding-top: 1px; }
.milestones li:not(.is-done) .ms-label { color: var(--ink-2); font-weight: 500; }
.is-current .ms-label { color: var(--ink) !important; font-weight: 620 !important; }
.ms-extra { font-size: 12px; color: var(--danger); font-weight: 550; }
.ms-extra .muted { color: var(--muted); font-weight: 400; }
td .sub.delay { font-size: 12px; margin-top: 3px; }
.ms-extra s { color: var(--muted); }
.ms-date { font-size: 12.5px; text-align: right; color: var(--ink-2); display: flex; flex-direction: column; padding-top: 2px; white-space: nowrap; }
.ms-plan { font-size: 11px; color: var(--muted); }
.history { display: flex; flex-direction: column; }
.history li { display: grid; grid-template-columns: 110px 1fr; gap: 2px 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.history li:first-child { border-top: 0; }
.h-time { color: var(--muted); font-size: 12.5px; grid-row: span 2; }
.h-src { grid-column: 2; font-size: 12px; color: var(--muted); }
.drawer-foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; background: var(--surface); }

/* ------------------------------------------------------------ modal, popover, toast */
.modal-root { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity .2s; }
.modal-root.is-open { opacity: 1; }
.modal-root:not(.is-open) { pointer-events: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(12, 14, 17, .48); }
.modal { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); transform: translateY(8px) scale(.985); transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
.modal.is-wide { width: min(680px, 100%); }
.modal-root.is-open .modal { transform: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px 12px 22px; }
.modal-head h2 { font-size: 17px; font-weight: 640; }
.modal-body { padding: 4px 22px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.modal-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.steps { display: flex; flex-direction: column; gap: 4px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 9px 0; color: var(--muted); transition: color .2s; }
.step-ico { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex-shrink: 0; }
.step-ico .spinner { opacity: 0; width: 13px; height: 13px; }
.steps li.is-active { color: var(--ink); }
.steps li.is-active .spinner { opacity: 1; color: var(--accent); }
.steps li.is-done { color: var(--ink); }
.steps li.is-done .step-ico { background: var(--ok-bg); color: var(--ok); }
.steps-result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.result-ok { display: flex; align-items: center; gap: 9px; font-size: 14.5px; }
.result-ok .ph { font-size: 20px; color: var(--ok); }
.steps-result .mini-changes { padding: 6px 0 0; }
.steps-result .mini-chg { padding: 10px 0; }
.file-line { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-ctl); }
.file-line .ph { color: var(--accent-ink); font-size: 20px; }
.new-list { margin-top: 12px; display: flex; flex-direction: column; }
.new-list li { display: grid; grid-template-columns: 130px 100px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.mail-meta { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-bottom: 14px; }
.mail-meta span { display: inline-block; width: 64px; color: var(--muted); }
.mail { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #ffffff; color: #1d2126; }
.mail-brand { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 3px solid #bc9b77; }
.mail-brand span { font-weight: 600; color: #6b5238; font-size: 13px; }
.mail-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.mail-table { width: 100%; border-collapse: collapse; }
.mail-table td { padding: 10px 0; border-top: 1px solid #e6e8eb; vertical-align: top; font-size: 13.5px; }
.mail-table td span { color: #646c76; font-size: 12.5px; }
.mail-table .mail-diff { text-align: right; justify-content: flex-end; display: table-cell; }
.mail-table s { color: #8a9099; }
.mail-cta { display: inline-block; background: #8a6d4c; color: #fff; padding: 10px 18px; border-radius: 8px; font-weight: 600; font-size: 13.5px; }
.mail-foot { font-size: 12px; color: #7a818a; border-top: 1px solid #e6e8eb; padding-top: 12px; }
.popover { position: fixed; z-index: var(--z-pop); width: 300px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.pop-head { font-weight: 620; padding: 8px 10px 6px; }
.pop-list { display: flex; flex-direction: column; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 9px; font-size: 13.5px; }
.pop-item:hover { background: var(--surface-2); }
.pop-item > span:last-child { display: flex; flex-direction: column; line-height: 1.35; }
.pop-item > span:last-child span { font-size: 12px; color: var(--muted); }
.pop-item .mini-chg-ico { width: 30px; height: 30px; }
.pop-foot { padding: 8px 10px 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.pop-empty { padding: 8px 10px 12px; color: var(--muted); font-size: 13px; }
.toasts { position: fixed; right: 18px; bottom: 74px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 11px 12px 11px 14px; background: var(--ink); color: var(--bg); border-radius: 11px; box-shadow: var(--shadow-lg); font-size: 13.5px; opacity: 0; transform: translateY(8px); transition: opacity .22s, transform .22s; }
.toast.is-in { opacity: 1; transform: none; }
.toast > .ph { font-size: 18px; }
.toast.tone-ok > .ph { color: #6fcf97; }
.toast.tone-warn > .ph { color: #f5b04f; }
.toast-act { margin-left: 6px; padding: 5px 10px; border-radius: 7px; background: rgba(255, 255, 255, .14); color: inherit; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
:root[data-theme="dark"] .toast-act { background: rgba(0, 0, 0, .1); }

.tour-fab { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px 0 13px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-lg); transition: transform .15s; }
.tour-fab:hover { transform: translateY(-1px); }
.tour-fab .ph { font-size: 20px; color: #d9bb94; }
:root[data-theme="dark"] .tour-fab .ph { color: #8a6d4c; }

/* skeleton */
.skel-wrap .kpis, .skel-wrap .dash-grid { margin-top: 16px; }
.skel { border-radius: var(--r-card); background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; }
.skel-title { height: 28px; width: 320px; max-width: 70%; border-radius: 8px; }
.skel-line { height: 16px; width: 460px; max-width: 90%; margin-top: 10px; border-radius: 6px; }
.skel-kpi { height: 112px; }
.skel-map { height: 440px; }
.skel-side { height: 440px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ------------------------------------------------------------ login */
.login { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(400px, 1fr); min-height: 100dvh; background: var(--surface); }
.login-art { position: relative; background: #101317; color: #eef0f2; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 36px 44px 44px; isolation: isolate; }
.login-map { position: absolute; inset: 0; z-index: -1; opacity: .9; }
.login-map.mt-wrap { background: #101317; --water: #101317; --land: #222830; --land-line: #303842; --border-line: #222930; --river: #3e6b87; --grat: rgba(255, 255, 255, .025); --route: #bc9b77; --ink-2: #c4c9cf; --surface: #101317; --ok: #5cc98f; --danger: #f2756a; --accent: #bc9b77; }
.login-art::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(16, 19, 23, .55) 0%, rgba(16, 19, 23, 0) 30%, rgba(16, 19, 23, .2) 55%, rgba(16, 19, 23, .94) 100%); pointer-events: none; }
.login-art-top img { width: 170px; }
.login-art-top .brand-product { font-size: 13.5px; }
.login-copy { max-width: 560px; }
.login-copy h1 { font-size: clamp(28px, 3.2vw, 42px); font-weight: 650; letter-spacing: -0.03em; line-height: 1.12; }
.login-copy > p { margin-top: 14px; font-size: 16px; color: #b7bdc4; max-width: 46ch; }
.login-stats { display: flex; gap: 34px; margin-top: 28px; }
.login-stats dt { font-size: 26px; font-weight: 620; font-family: var(--mono); color: #e6d2b8; letter-spacing: -0.03em; }
.login-stats dd { font-size: 13px; color: #9aa1a9; }
.login-panel { display: flex; flex-direction: column; padding: 28px 40px; }
.login-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.login-top .lang-switch { background: var(--surface-3); }
.login-form { width: 100%; max-width: 380px; margin: auto; display: flex; flex-direction: column; gap: 16px; padding: 30px 0; }
.login-form h2 { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.login-form > .muted { margin-top: -8px; }
.login-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.login-links .link { font-size: 13px; }
.login-links .link.muted { color: var(--muted); }
.twofa-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; }
.twofa-ico .ph { font-size: 24px; }
.code-inputs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.code-inputs input { height: 54px; padding: 0; text-align: center; font-size: 22px; font-weight: 620; font-family: var(--mono); border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface); width: 100%; transition: border-color .15s, background .15s, transform .15s; }
.code-inputs input.is-filled { border-color: var(--accent); background: var(--accent-soft); }
.code-inputs input.is-error { border-color: var(--danger); animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.login-secure { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.mail-toast { position: fixed; top: 18px; right: 18px; z-index: var(--z-toast); width: 330px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 10px; transform: translateY(-14px); opacity: 0; transition: transform .3s cubic-bezier(.16, 1, .3, 1), opacity .3s; }
.mail-toast.is-in { transform: none; opacity: 1; }
.mail-toast-head { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.mail-toast-head > .ph { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-size: 17px; }
.mail-toast-head > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; line-height: 1.35; }
.mail-toast-head > span:nth-child(2) span { color: var(--muted); }
.mail-toast-head .muted { font-size: 12px; }
.mail-code { font-family: var(--mono); font-size: 28px; font-weight: 640; letter-spacing: .08em; text-align: center; padding: 6px 0; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1280px) {
  .demo-pill { display: none; }
  .login-top .demo-pill { display: inline-flex; }
  .vessel-main { grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.6fr) auto; }
  .vessel-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: 1fr; }
  .changes-layout { grid-template-columns: 1fr; }
  .notif-card { position: static; }
  .toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar .field.grow { grid-column: 1 / -1; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .int-bottom, .sec-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .28s cubic-bezier(.16, 1, .3, 1); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(12, 14, 17, .4); z-index: calc(var(--z-sidebar) - 1); }
  .menu-btn { display: inline-grid; margin-left: -8px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .sync-btn span { display: none; }
  .sync-btn { width: 38px; padding: 0; }
  .view { padding: 20px 16px 90px; }
  .tour-fab { right: 16px; bottom: 16px; }
  .map-page { grid-template-columns: 1fr; height: auto; }
  .map-side { display: none; }
  .map-full { height: 62vh; flex: none; }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 360px; padding: 26px 22px 30px; }
  .login-panel { padding: 22px 20px 30px; }
}
@media (max-width: 700px) {
  .search kbd, .search-kbd { display: none; }
  .search input { padding-right: 12px; font-size: 14px; }
  .search input::placeholder { color: transparent; }
  .top-actions .icon-btn[data-action="theme"] { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi-value { font-size: 28px; }
  .dash-grid-2 { grid-template-columns: 1fr; }
  .card-head .seg { overflow-x: auto; max-width: 100%; }
  .card-head-end { margin-left: 0; width: 100%; }
  .map-card .card-head-end { order: 3; }
  .toolbar { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 21px; }
  .page-actions, .page-head > .seg { width: 100%; }
  .page-head > .seg, .page-actions .seg { overflow-x: auto; }
  .vessel-main { grid-template-columns: 1fr; gap: 14px; }
  .vessel-actions { justify-content: stretch; }
  .vessel-actions .btn { flex: 1; }
  .vc-row { grid-template-columns: 1fr auto; gap: 4px 10px; }
  .vc-row > span:nth-child(3) { grid-column: 1 / -1; }
  .roles { grid-template-columns: 1fr; }
  .role + .role { border-left: 0; border-top: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
  .board { grid-template-columns: repeat(4, 82%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .board-col { scroll-snap-align: start; }
  .chg-card { grid-template-columns: auto minmax(0, 1fr); }
  .chg-actions { grid-column: 1 / -1; flex-direction: row; }
  .prot-grid { grid-template-columns: 1fr; }
  .prot:nth-child(2) { border-top: 1px solid var(--line); }
  .facts { grid-template-columns: 1fr 1fr; }
  .history li { grid-template-columns: 1fr; }
  .h-time { grid-row: auto; }
  .h-src { grid-column: 1; }
  .map-info { left: 10px; right: 10px; width: auto; bottom: 56px; }
  .map-ctrl { left: 10px; right: 10px; top: 10px; justify-content: space-between; }
  .map-hint { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .login-stats { gap: 22px; }
  .login-copy h1 { font-size: 26px; }
  .mail-toast { left: 12px; right: 12px; width: auto; }
  .toasts { left: 12px; right: 12px; align-items: stretch; }
  .new-list li { grid-template-columns: 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .mt-v-pulse { display: none; }
}
@media (forced-colors: active) {
  td.cell-flag .flag-in { border: 1px solid CanvasText; }
}

/* ------------------------------------------------------------ guided tour */
.tour { position: fixed; inset: 0; z-index: var(--z-tour); pointer-events: none; }
.tour-blocker { position: fixed; inset: 0; pointer-events: auto; }
.tour-spot { position: fixed; left: 0; top: 0; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(10, 12, 15, 0.58); outline: 2px solid #bc9b77; outline-offset: 0; transition: transform .38s cubic-bezier(.16, 1, .3, 1), width .38s cubic-bezier(.16, 1, .3, 1), height .38s cubic-bezier(.16, 1, .3, 1), opacity .2s; pointer-events: none; }
.tour-tip { position: fixed; left: 0; top: 0; pointer-events: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 16px 18px 14px; transition: transform .38s cubic-bezier(.16, 1, .3, 1), opacity .2s; }
.tour.is-moving .tour-tip { opacity: .0; }
.tour-tip-head { display: flex; justify-content: space-between; align-items: center; margin: -4px -6px 6px 0; }
.tour-badge { font-size: 12px; font-weight: 600; color: var(--accent-ink); }
.tour-tip h3 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 6px; }
.tour-tip p { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.tour-progress { display: flex; gap: 4px; margin: 14px 0 12px; }
.tour-progress span { height: 3px; flex: 1; border-radius: 3px; background: var(--surface-3); }
.tour-progress span.is-on { background: var(--accent); }
.tour-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tour-nav { display: flex; gap: 6px; }
body.tour-on .search-pop { z-index: calc(var(--z-tour) - 1); }
