/* SeaVentory — marine management UI: navy sidebar, light workspace, dense data grids. */
:root {
  --navy-900: #071a33;
  --navy-800: #0b2545;
  --navy-700: #13315c;
  --navy-600: #1d4477;
  --sea-500: #1f7ae0;
  --sea-400: #4b9bf0;
  --sea-50: #eaf3fd;
  --bg: #f2f5f9;
  --surface: #ffffff;
  --line: #dde4ee;
  --line-strong: #c6d1df;
  --text: #17243a;
  --muted: #5d6b82;
  --ok: #1e8e5a;
  --ok-bg: #e5f5ed;
  --warn: #b26a00;
  --warn-bg: #fff4e0;
  --bad: #c0392b;
  --bad-bg: #fdecea;
  --info-bg: #eaf3fd;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(10, 30, 60, .06), 0 2px 8px rgba(10, 30, 60, .05);
  --sidebar-w: 236px;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text); background: var(--bg); line-height: 1.45;
}
a { color: var(--sea-500); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  align-self: flex-start;
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  color: #c9d6ea; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; }
.brand-mark { width: 40px; height: 34px; border-radius: 8px; background: #fff; display: grid; place-items: center; padding: 3px; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-logo { text-align: center; padding: 0 0 18px; }
.brand-logo img { width: 200px; max-width: 70%; height: auto; display: block; margin: 0 auto 2px; }
.brand-logo .brand-sub { color: var(--muted); }
.brand-name { font-weight: 700; font-size: 1rem; line-height: 1.1; }
.brand-sub { font-size: .72rem; color: #8ea6c8; text-transform: uppercase; letter-spacing: .08em; }
.client-chip {
  margin: 4px 14px 12px; padding: 9px 12px; border-radius: 6px; background: rgba(255,255,255,.07);
  font-size: .8rem; color: #dfe8f5; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.client-chip b { color: #fff; }
.client-chip a { color: var(--sea-400); font-size: .75rem; }
.nav { list-style: none; margin: 0; padding: 6px 10px; flex: 1; overflow-y: auto; }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #6f88ab; padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 6px; color: #c9d6ea; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active { background: var(--sea-500); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; }
.sidebar-foot .who { color: #fff; font-weight: 600; }
.sidebar-foot a, .sidebar-foot button { color: #9fb6d6; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.sidebar-foot a:hover, .sidebar-foot button:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 28px; display: flex;
  align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 5;
}
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: 2px; }
.crumbs a { color: var(--muted); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 22px 28px 40px; }
.btn.menu-toggle { display: none; }

/* ---------- cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 13px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-body { padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.stack > * + * { margin-top: 16px; }

.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.kpi-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--sea-50); color: var(--sea-500); }
.kpi-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.kpi-icon.warn { background: var(--warn-bg); color: var(--warn); }
.kpi-icon.bad { background: var(--bad-bg); color: var(--bad); }
.kpi-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: .8rem; }
a.kpi:hover { text-decoration: none; background: #fafcff; }
a.kpi { color: inherit; }

.vessel-card { padding: 16px; display: block; color: inherit; border-left: 4px solid var(--sea-500); }
.vessel-card:hover { text-decoration: none; box-shadow: 0 3px 14px rgba(10,30,60,.1); }
.vessel-card .meta { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.vessel-card .stats { display: flex; gap: 18px; margin-top: 12px; font-size: .85rem; }
.vessel-card .stats b { font-size: 1.1rem; display: block; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th {
  text-align: left; background: #f6f8fb; color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase;
  letter-spacing: .04em; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0;
}
table.data th a { color: var(--muted); }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover { background: #f7faff; }
table.data tr.clickable { cursor: pointer; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; background: #e9eef5; display: block; }
.thumb.empty { display: grid; place-items: center; color: #a8b6c9; }
.empty-state { padding: 36px 16px; text-align: center; color: var(--muted); }

/* ---------- pills ---------- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; background: #edf1f6; color: var(--muted); }
.pill.in_stock, .pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.in_use, .pill.info { background: var(--info-bg); color: var(--sea-500); }
.pill.destroyed, .pill.bad, .pill.expired { background: var(--bad-bg); color: var(--bad); }
.pill.lost, .pill.warn, .pill.soon { background: var(--warn-bg); color: var(--warn); }
.qty-low { color: var(--bad); font-weight: 700; }
.change-pos { color: var(--ok); font-weight: 600; }
.change-neg { color: var(--bad); font-weight: 600; }

/* ---------- forms & buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .86rem; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; background: #f4f7fb; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.btn-primary { background: var(--sea-500); border-color: var(--sea-500); color: #fff; }
.btn-primary:hover { background: #166bcb; }
.btn-danger { color: var(--bad); border-color: #efc2bd; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-ghost { border-color: transparent; background: transparent; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: .82rem; }
.field .help { font-size: .76rem; color: var(--muted); }
.field .errors { color: var(--bad); font-size: .8rem; }
.input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; background: #fff; color: var(--text);
}
.input:focus { outline: 2px solid rgba(31,122,224,.25); border-color: var(--sea-500); }
textarea.input { resize: vertical; }
.check { width: 16px; height: 16px; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.filters .input { width: auto; min-width: 140px; padding: 7px 9px; }
.filters .search { flex: 1 1 220px; }

/* ---------- misc ---------- */
.messages { list-style: none; margin: 0 0 16px; padding: 0; }
.messages li { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; background: var(--info-bg); border: 1px solid #cfe2f8; }
.messages li.success { background: var(--ok-bg); border-color: #bfe5d0; }
.messages li.error { background: var(--bad-bg); border-color: #f3c6c1; }
.messages li.warning { background: var(--warn-bg); border-color: #f2d9a8; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; font-size: .9rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.item-photo { width: 100%; max-height: 300px; object-fit: contain; border-radius: 6px; background: #eef2f7; }
.big-qty { font-size: 2.1rem; font-weight: 700; line-height: 1; }
.pagination { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: .85rem; color: var(--muted); }
.bar { height: 8px; background: #e8eef6; border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--sea-500); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 9px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.list-plain li:last-child { border-bottom: 0; }
.tabs-inline { display: flex; gap: 6px; flex-wrap: wrap; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy-900), var(--navy-600)); padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 12px; padding: 30px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card .brand { color: var(--navy-800); padding: 0 0 20px; }
.login-card .brand-sub { color: var(--muted); }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .sidebar { position: fixed; left: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .btn.menu-toggle { display: inline-flex; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .content { padding: 16px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 110px 1fr; }
  .hide-sm { display: none; }
}
@media print {
  .sidebar, .topbar .top-actions, .filters, .pagination, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
svg.ico { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.brand-mark svg.ico { color: #fff; stroke-width: 2; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 6px; }
.check-list label { display: flex; gap: 7px; align-items: center; font-weight: 500; font-size: .88rem; }
/* sign-in & security pages (django-allauth) */
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.aa-h1 { font-size: 1.2rem; margin: 0 0 12px; }
.aa p { margin: 0 0 12px; }
.aa label { display: block; font-weight: 600; font-size: .82rem; margin-bottom: 4px; }
.aa input[type=text], .aa input[type=password], .aa input[type=email], .aa input[type=number], .aa input:not([type]), .aa textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 6px; font: inherit; background: #fff;
}
.aa input[type=checkbox] { width: 16px; height: 16px; vertical-align: middle; margin-right: 6px; }
.aa input[type=checkbox] + label, .aa label:has(input[type=checkbox]) { display: inline; font-weight: 500; }
.aa .errorlist { color: var(--bad); font-size: .82rem; list-style: none; padding: 0; margin: 0 0 6px; }
.aa-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.aa-actions.vertical { flex-direction: column; }
.aa hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.aa-manage img { max-width: 220px; height: auto; display: block; margin: 8px 0; background: #fff; padding: 8px; border-radius: 8px; }
.aa-manage pre, .aa-manage code { background: #f6f8fb; padding: 2px 6px; border-radius: 4px; }
/* stock pop-up */
.dialog { border: 0; border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.3); color: var(--text); }
.dialog::backdrop { background: rgba(7, 26, 51, .45); }
.dialog form { padding: 18px 20px 16px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 9px 6px; font: inherit; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on[data-kind=use] { background: var(--bad-bg); color: var(--bad); }
.seg button.on[data-kind=add] { background: var(--ok-bg); color: var(--ok); }
.seg button.on[data-kind=adjust] { background: var(--warn-bg); color: var(--warn); }
[hidden] { display: none !important; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .82rem; font-weight: 500; cursor: pointer; }
.chip input { margin: 0; }
.chip:has(input:checked) { border-color: var(--sea-500); background: var(--sea-50); color: var(--sea-500); }
.qty-btns { display: inline-flex; gap: 4px; margin-left: 8px; vertical-align: middle; }
.qty-btns button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line-strong); background: #fff; font-weight: 700; cursor: pointer; line-height: 1; }
.qty-btns button:hover { background: var(--sea-50); }
.stock-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.reason-tag { display: inline-block; font-size: .74rem; padding: 1px 7px; border-radius: 999px; background: #edf1f6; color: var(--muted); margin-right: 4px; }
/* global search */
.gsearch { position: relative; flex: 1 1 320px; max-width: 460px; }
.gsearch input { width: 100%; padding: 8px 10px 8px 34px; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; background: #f6f8fb; }
.gsearch input:focus { background: #fff; outline: 2px solid rgba(31,122,224,.25); border-color: var(--sea-500); }
.gsearch .gs-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.gs-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 40px rgba(10,30,60,.18); z-index: 30; overflow: hidden; }
.gs-results a { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; color: var(--text); border-bottom: 1px solid var(--line); }
.gs-results a:last-child { border-bottom: 0; }
.gs-results a:hover, .gs-results a.sel { background: var(--sea-50); text-decoration: none; }
.gs-results .gs-meta { color: var(--muted); font-size: .8rem; }
.gs-results .gs-qty { white-space: nowrap; font-weight: 600; font-size: .85rem; }
.gs-results .gs-all { justify-content: center; color: var(--sea-500); font-weight: 600; font-size: .85rem; }
.gs-results mark { background: #fff1b8; color: inherit; padding: 0; }
@media (max-width: 800px) { .gsearch { order: 3; flex-basis: 100%; max-width: none; } }

/* Deck plans and location pins */
.plan { position: relative; display: block; max-width: 100%; line-height: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.plan img { width: 100%; height: auto; display: block; }
.plan.picker { cursor: crosshair; }
.pin { position: absolute; width: 24px; height: 24px; margin: -24px 0 0 -12px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--sea-500); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(10, 30, 60, .35); display: grid; place-items: center; line-height: 1; text-decoration: none; transition: transform .12s; }
.pin span { transform: rotate(45deg); color: #fff; font-size: 11px; font-weight: 700; }
.pin.active { background: #e0452b; }
.pin.hl, .pin:hover { transform: rotate(-45deg) scale(1.25); background: #e0452b; z-index: 2; }
.pin-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--sea-500); color: #fff; font-size: 11px; font-weight: 700; }
.pin-num.off { background: var(--line); color: var(--muted); }
tr.hl td { background: var(--sea-50, #eef5fd); }
.deck-split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 900px) { .deck-split { grid-template-columns: 1fr; } }

/* Categories (SeaVentory Classification System) */
svg.cat-ico { color: var(--sea-500); stroke-width: 1.8; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.cat-tile { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.cat-tile:hover { border-color: var(--sea-500); box-shadow: 0 4px 14px rgba(8, 45, 78, .08); }
.cat-tile.off { opacity: .55; }
.cat-tile-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--sea-50); display: grid; place-items: center; margin-bottom: 6px; }
.cat-tile-name { font-weight: 650; line-height: 1.25; }
.cat-tile-meta { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cat-tile-count { margin-top: auto; padding-top: 8px; font-size: .85rem; color: var(--muted); }
.cat-tile-count b { color: var(--ink, inherit); font-size: 1.05rem; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; background: #edf1f6; color: var(--muted); padding: 1px 6px; border-radius: 5px; font-weight: 500; }
.cat-head { display: inline-flex; align-items: center; gap: 10px; }
.cat-cell { width: 44px; }
.cat-inline { display: inline-flex; align-items: center; gap: 6px; }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; max-height: 260px; overflow: auto; padding: 4px; border: 1px solid var(--line); border-radius: 10px; }
.icon-picker label { cursor: pointer; margin: 0; }
.icon-picker input { position: absolute; opacity: 0; pointer-events: none; }
.icon-picker span { display: grid; place-items: center; height: 40px; border-radius: 8px; border: 1px solid transparent; color: var(--muted); }
.icon-picker label:hover span { background: var(--sea-50); }
.icon-picker input:checked + span { border-color: var(--sea-500); background: var(--sea-50); }
.icon-picker input:focus-visible + span { outline: 2px solid var(--sea-500); }
.cat-inline svg { flex-shrink: 0; }

/* Item card */
.item-card { padding: 18px 20px; }
.item-card-head { display: flex; gap: 18px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.item-card-photo { width: 96px; height: 96px; flex-shrink: 0; border-radius: 14px; border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; background: #fff; }
.item-card-photo img { width: 100%; height: 100%; object-fit: contain; }
.item-card-photo.empty { background: var(--sea-50); }
.item-card-title { font-size: 1.5rem; margin: 0 0 2px; }
.item-card-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.item-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; margin: 0; padding: 16px 0; border-bottom: 1px solid var(--line); }
.item-facts dt { color: var(--muted); font-size: .82rem; }
.item-facts dd { margin: 2px 0 0; font-weight: 600; }
.item-card-section { padding-top: 14px; }
.item-card-section + .item-card-section { border-top: 1px solid var(--line); margin-top: 14px; }
.item-card-section h3 { font-size: .95rem; margin: 0 0 8px; }
.stock-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.stock-row:last-child { border-bottom: 0; }
.stock-bar { position: relative; height: 10px; border-radius: 999px; background: #edf1f6; margin: 8px 0 6px; }
.stock-bar span { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--ok); }
.stock-bar.low span { background: var(--bad); }
.stock-bar i { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--muted); }
.stock-bar-legend { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); }
@media (max-width: 600px) { .item-facts { grid-template-columns: 1fr; } .item-card-head { align-items: flex-start; } }

/* Searchable select */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow: auto; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 10px 30px rgba(8, 45, 78, .14); padding: 4px; }
.combo-group { font-size: .86rem; font-weight: 700; color: var(--navy-800); padding: 9px 10px 3px; }
.combo-opt { padding: 6px 10px 6px 28px; border-radius: 7px; cursor: pointer; font-size: .9rem; }
.combo-opt.muted { padding-left: 10px; }
.combo-opt:hover, .combo-opt.act { background: var(--sea-50); }
.combo-opt.sel { font-weight: 600; color: var(--sea-500); }
.combo-empty { padding: 10px; }

/* Equipment pop-up */
#equip-dialog { width: min(640px, calc(100vw - 32px)); padding: 18px 20px 16px; }
#equip-open { width: auto; align-self: flex-start; }
.equip-list { max-height: 50vh; overflow: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px; }
.equip-group { font-size: .78rem; font-weight: 700; color: var(--muted); padding: 10px 2px 4px; border-top: 1px solid var(--line); }
.equip-group:first-child { border-top: 0; }
.equip-opt { display: flex; gap: 10px; align-items: center; padding: 7px 4px; margin: 0; cursor: pointer; border-radius: 7px; font-weight: 400; }
.equip-opt:hover { background: var(--sea-50); }
.equip-opt input { margin: 0; }
.chip.on { border-color: var(--sea-500); background: var(--sea-50); color: var(--sea-500); cursor: default; }
.chip-x { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 4px; font-size: .8rem; }

/* Item photo with preview */
.photo-field { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.photo-preview { width: 140px; height: 140px; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #f6f9fc; flex: none; }
.photo-preview.empty { border-style: dashed; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-controls { flex: 1; min-width: 200px; }

/* Deck plan zoom on the item page */
.plan-zoomable { cursor: zoom-in; }
button.pin { padding: 0; cursor: pointer; }
.plan-zoom-hint { position: absolute; right: 8px; bottom: 8px; display: inline-flex; gap: 4px; align-items: center; line-height: 1; padding: 5px 8px; border-radius: 6px; background: rgba(7, 26, 51, .72); color: #fff; font-size: .78rem; }
.plan-zoom-hint svg { width: 14px; height: 14px; }
.plan-dialog { width: min(1100px, calc(100vw - 24px)); }
.plan-dialog-head { padding: 14px 16px 0; }
.plan-dialog-head h2 { margin: 0; }
.plan-zoom-btns { display: flex; gap: 6px; align-items: center; }
.plan-zoom-btns .muted { min-width: 42px; text-align: center; }
.plan-viewport { height: min(70vh, 640px); overflow: hidden; margin: 0 16px; border: 1px solid var(--line); border-radius: 8px; background: #f6f9fc; cursor: grab; touch-action: none; }
.plan-viewport.dragging { cursor: grabbing; }
.plan-big { border: 0; border-radius: 0; max-width: none; }
.plan-big img { user-select: none; pointer-events: none; }
.plan-dialog-foot { padding: 8px 16px 14px; }

/* Photos and manuals */
.att-h { display: flex; align-items: center; gap: 6px; font-size: .9rem; margin: 0 0 8px; }
.att-h svg { width: 16px; height: 16px; }
.att-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.att-photo { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f6f9fc; }
.att-photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.att-photo figcaption { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 2px 4px 2px 8px; font-size: .78rem; }
.att-photo figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.att-photo form, .att-list form { margin: 0; }
.att-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.att-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.att-ext { flex: none; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; background: var(--sea-50); color: var(--sea-500); font-size: .7rem; font-weight: 700; letter-spacing: .03em; }
.att-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.att-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 14px; border-top: 1px solid var(--line); }
.att-upload input[type=file] { flex: 1 1 220px; min-width: 0; }
.att-upload input[name=title] { flex: 1 1 180px; min-width: 0; }
.att-kinds { display: flex; gap: 6px; }

/* Note shown when a pin is clicked */
.pin-note { position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 32px)); min-width: 110px; max-width: 220px; padding: 8px 10px;
  background: #fffbe6; color: var(--navy-800); border: 1px solid #e8d98a; border-radius: 6px; box-shadow: 0 6px 18px rgba(8, 45, 78, .18);
  line-height: 1.3; font-size: .85rem; display: grid; gap: 2px; cursor: default; text-align: left; }
.pin-note b { font-size: .9rem; }
.pin-note span { color: var(--muted); font-size: .78rem; }
.pin-note a { font-size: .8rem; margin-top: 2px; }
.pin-note::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; background: inherit; border: inherit; border-width: 0 1px 1px 0; transform: translateX(-50%) rotate(45deg); }
.pin-note.left { transform: translate(calc(-100% + 24px), calc(-100% - 32px)); }
.pin-note.left::after { left: calc(100% - 24px); }
.pin-note.below { transform: translate(-50%, 12px); }
.pin-note.below::after { bottom: auto; top: -6px; border-width: 1px 0 0 1px; }
.pin-note.left.below { transform: translate(calc(-100% + 24px), 12px); }
.pin.noted { background: #e0452b; transform: rotate(-45deg) scale(1.25); z-index: 3; }
.plan:not(.plan-big) { overflow: visible; }
.plan:not(.plan-big) > img { border-radius: 8px; }
.link-btn { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: var(--sea-500); font: inherit; cursor: pointer; text-align: left; }
.link-btn:hover b { text-decoration: underline; }
.link-btn svg { width: 15px; height: 15px; flex: none; }

.field-with-btn { display: flex; gap: 8px; align-items: flex-start; }
.field-with-btn > .combo, .field-with-btn > select { flex: 1; min-width: 0; }
.field-with-btn > .btn { flex: none; }
#mf-dialog { width: min(620px, calc(100vw - 32px)); }

/* Reports */
.month-chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; height: 220px; align-items: end; }
.month-col { display: grid; grid-template-rows: 18px 1fr auto; height: 100%; text-align: center; min-width: 0; }
.month-n { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; align-self: end; }
.month-bar { align-self: end; width: 100%; min-height: 2px; background: var(--sea-500); border-radius: 4px 4px 0 0; opacity: .85; }
.month-col:hover .month-bar { opacity: 1; }
.month-label { font-size: .74rem; padding-top: 6px; border-top: 1px solid var(--line); line-height: 1.25; }
.value-total { font-size: 1.7rem; font-weight: 700; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.value-rows { display: grid; gap: 8px; }
.value-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .88rem; }
.value-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.value-bar { height: 8px; border-radius: 4px; background: var(--sea-50); overflow: hidden; }
.value-bar span { display: block; height: 100%; background: var(--sea-500); }
.value-amt { font-variant-numeric: tabular-nums; text-align: right; }
@media (max-width: 560px) { .month-chart { gap: 2px; } .month-label { font-size: .64rem; } }
/* Equipment list: "+" opens the items fitted to that equipment */
.parts-toggle { padding: 2px 6px; margin-right: 6px; vertical-align: middle; }
.parts-toggle.open .v { display: none; }  /* "+" becomes "−" while the list is open */
table.data .parts-row > td { background: var(--bg, #f5f8fb); padding: 6px 12px 10px 48px; }
.parts-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.parts-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-bottom: 1px solid var(--line, #e3e9f0); }
.parts-list li:last-child { border-bottom: 0; }
.parts-list .pill { margin-left: auto; }
