:root{--navy:#154360;--blue:#2e86c1;--blue-soft:#ebf5fb;--teal:#0c5460;--amber:#f39c12;--red:#e74c3c;--green:#27ae60;--cream:#ffeaa7;--ink:#2c3e50;--bg:#f8f9fa;--touch:44px}
*{box-sizing:border-box}
body{margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:var(--bg);color:var(--ink)}
.topnav{display:flex;justify-content:space-between;align-items:center;background:var(--navy);padding:0 16px;min-height:var(--touch)}
.topnav .brand{color:#fff;font-weight:700;text-decoration:none;font-size:18px}
.topnav .who{color:#cfe3f2;font-size:13px}
main{padding:16px;max-width:1100px;margin:0 auto}
h1{font-size:20px;color:var(--navy)}
h2{font-size:16px;color:var(--teal)}
.mapwrap{position:relative}
#map{height:42vh;min-height:260px;border-radius:10px;border:1px solid #d5e3ee;background:var(--blue-soft)}
.banner{position:absolute;top:8px;left:8px;background:var(--red);color:#fff;padding:6px 10px;border-radius:6px;font-size:13px;z-index:900}
.tablewrap{overflow-x:auto}
table{border-collapse:collapse;width:100%;background:#fff;border-radius:10px;overflow:hidden;box-shadow:0 1px 3px rgba(0,0,0,.08)}
th,td{padding:10px 12px;text-align:left;border-bottom:1px solid #eef3f7;font-size:14px;vertical-align:top}
th{background:var(--navy);color:#fff;font-weight:600}
tr:last-child td{border-bottom:none}
a{color:var(--blue)}
.dim{color:#7f8c9b;font-size:12px}
.err{color:var(--red);font-weight:600}
.card{background:#fff;border-radius:10px;padding:16px;margin-bottom:16px;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.card.narrow{max-width:380px;margin:40px auto}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px}
label{display:block;margin:10px 0;font-size:14px}
input{width:100%;min-height:var(--touch);padding:8px;border:1px solid #cdd8e3;border-radius:8px;font-size:16px}
button{min-height:var(--touch);background:var(--blue);color:#fff;border:none;border-radius:8px;padding:10px 18px;font-size:16px;cursor:pointer}
.sit{max-width:380px}

/* ---- D2/D3: nav tabs ---- */
.tabs{display:flex;gap:4px;background:var(--navy);padding:0 8px;border-top:1px solid #1d5a80;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.tabs::-webkit-scrollbar{display:none}
.tabs a{color:#cfe3f2;text-decoration:none;padding:10px 14px;min-height:var(--touch);display:flex;align-items:center;font-size:14px;font-weight:600;flex:0 0 auto;white-space:nowrap}
.tabs a:hover{color:#fff;background:#1d5a80;border-radius:6px}
/* D5 polish (d) + D6/D7 nit (b): active tab = pill only — the inset underline
   had square corners that fought the pill radius; the pill alone reads cleaner. */
.tabs a.active{color:#fff;background:#1d5a80;border-radius:6px}
/* D7a: nav bell + unacked-alert count */
.tabs a .bell-count{display:inline-block;background:var(--red);color:#fff;border-radius:999px;min-width:18px;height:18px;line-height:18px;text-align:center;font-size:11px;font-weight:800;margin-left:6px;padding:0 4px}
.qbadge{display:none;background:var(--amber);color:#1c2833;border-radius:999px;min-width:18px;height:18px;line-height:18px;text-align:center;font-size:11px;font-weight:800;margin-left:6px;padding:0 4px;cursor:pointer}

/* ---- D2: badges ---- */
.badge{display:inline-block;padding:4px 10px;border-radius:999px;font-size:12px;font-weight:700;white-space:nowrap}
.b-red{background:var(--red);color:#fff}
.b-amber{background:var(--amber);color:#fff}
.b-green{background:var(--green);color:#fff}
.b-grey{background:#95a5a6;color:#fff}

/* ---- D2: buttons ---- */
.btn{display:inline-block;background:var(--blue);color:#fff;text-decoration:none;border-radius:8px;padding:10px 18px;min-height:var(--touch);font-weight:600}
.btn-s{display:inline-block;background:var(--blue-soft);color:var(--navy);text-decoration:none;border-radius:8px;padding:8px 14px;min-height:36px;font-size:14px;font-weight:600}
select,textarea{width:100%;min-height:var(--touch);padding:8px;border:1px solid #cdd8e3;border-radius:8px;font-size:16px;background:#fff}
select[multiple]{min-height:120px}

/* ---- D3: URGENT inbox ---- */
.urgent{border-left:6px solid var(--red)}
.urgentlist{list-style:none;margin:0;padding:0}
.urgentlist li{padding:10px 0;border-bottom:1px solid #eef3f7;display:flex;flex-wrap:wrap;gap:8px;align-items:baseline}
.urgentlist li:last-child{border-bottom:none}
.urgentlist a{font-weight:700;color:var(--navy)}
.urgent-cert a{color:var(--red)}

/* ---- D3: 30-day calendar ---- */
.calpage main{max-width:none}
/* D6/D7 nit (f): the date range is one non-wrapping unit — no dangling dash */
.calpage h1 .range{white-space:nowrap}
.cal-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:8px}
/* D5 polish (c) + D6/D7 nit (c): soft right-edge fade — starts late and only
   fades the last 20px so the final column stays readable */
.cal-scroll{position:relative;mask-image:linear-gradient(to right,#000 0,#000 calc(100% - 20px),rgba(0,0,0,.35) 100%);-webkit-mask-image:linear-gradient(to right,#000 0,#000 calc(100% - 20px),rgba(0,0,0,.35) 100%)}
.cal-grid{display:grid;gap:2px;width:max-content}
.cal-vessel{position:sticky;left:0;z-index:2;background:var(--navy);color:#fff;padding:8px;font-size:13px;font-weight:700;display:flex;flex-direction:column;justify-content:center;min-height:var(--touch);border-radius:4px}
.cal-vessel a{color:#fff;text-decoration:none}
.cal-vessel .dim{color:#cfe3f2}
.cal-day{background:var(--navy);color:#fff;text-align:center;padding:6px 2px;font-size:12px;border-radius:4px;display:flex;flex-direction:column;min-height:44px}
.cal-day .dow{font-size:10px;opacity:.8}
.cal-day .dom{font-size:15px;font-weight:700}
.cal-day.today{background:var(--amber);color:#fff}
/* D6/D7 nit (e): every cell gets a visible border so the empty grid has structure */
.cal-cell{background:#fff;border:1px solid #d5e3ee;border-radius:4px;min-height:var(--touch);min-width:44px;display:flex;flex-direction:column;gap:2px;padding:2px;align-content:flex-start}
/* D6/D7 nit (a): today column = one soft tint only — no per-cell amber border */
.cal-cell.today{background:#fff3cd;border-color:#d5e3ee}
.chip{display:flex;align-items:center;justify-content:center;min-height:22px;border-radius:4px;font-size:9px;font-weight:800;text-decoration:none;color:#fff;padding:1px 2px}
.chip-t{letter-spacing:.02em}
.chip-cert{background:var(--red)}
.chip-survey{background:var(--blue)}
.chip-dock{background:#8e44ad}
.chip-crew{background:var(--teal)}
.chip-bunk{background:var(--green)}
.legend{display:flex;flex-wrap:wrap;gap:10px;margin:8px 0;font-size:12px;color:var(--ink)}
.legend .chip{color:#fff;min-height:20px;padding:2px 6px;gap:6px}
.legend .chip-urgent{color:var(--red)}
/* D5 polish (a) + D6/D7 nit (a): legend 'today' swatch matches the soft column tint exactly */
.legend-today{display:inline-flex;align-items:center;gap:6px;font-weight:700;color:var(--ink)}
.legend-today::before{content:"";display:inline-block;width:14px;height:14px;border-radius:4px;background:#fff3cd;border:1px solid #d5e3ee;box-shadow:inset 0 0 0 1px rgba(243,156,18,.35)}
/* D6/D7 nit (g): URGENT outline chip — stronger contrast in the legend too */
.chip-urgent{background:#fff;color:var(--red);border:2px solid var(--red);box-shadow:0 0 0 1px #f6c9c3}
/* D6/D7 nit (d): no scrollbar artifact at the header-row top right — the mask
   makes the container a paint layer; keep any stray bar from showing there */
.cal-scroll{scrollbar-gutter:stable}
.cal-scroll::-webkit-scrollbar-corner{background:transparent}
/* D5 polish (f) + D6/D7 nit (h): the horizontal scrollbar belongs to the day
   area — full-width thumb styling under the scrollable region */
.cal-scroll::-webkit-scrollbar{height:10px}
.cal-scroll::-webkit-scrollbar-thumb{background:#5d7794;border-radius:6px;border:2px solid var(--bg)}
.cal-scroll::-webkit-scrollbar-track{background:#e3ecf4;border-radius:6px}
.cal-scroll{scrollbar-width:thin;scrollbar-color:#5d7794 #e3ecf4}
@media (max-width:480px){
  main{padding:10px}
  th,td{padding:8px;font-size:13px}
  .cal-grid{grid-template-columns:112px repeat(30,46px)!important}
  .cal-vessel{font-size:12px}
}
/* kiosk: no chrome, big type */
body.kiosk{background:#0b1c2c}
body.kiosk main{max-width:none;padding:10px}
body.kiosk h1{color:#fff;font-size:26px}
body.kiosk .dim{color:#9fb8cc}
body.kiosk .cal-vessel{font-size:15px;min-height:56px}
body.kiosk .cal-cell{min-height:56px;background:#12293e;border-color:#1d3c57}
body.kiosk .cal-cell.today{background:#fff3cd14;background:rgba(243,156,18,.14);border-color:#1d3c57}
body.kiosk .legend{color:#cfe3f2}
body.kiosk .legend-today{color:#cfe3f2}
body.kiosk .legend-today::before{background:rgba(243,156,18,.14)}
body.kiosk .chip-urgent{background:#12293e;box-shadow:0 0 0 1px rgba(231,76,60,.5)}

/* ---- D6: invite code + join page ---- */
.invite-code{font-family:ui-monospace,monospace;letter-spacing:.15em;background:var(--blue-soft);padding:2px 8px;border-radius:6px}

/* ---- D7a: alerts page ---- */
table .acked{opacity:.55}
table form.inline{display:inline;margin:0}

/* ---- D7b: OCR proposal card ---- */
.ocr-card{border-left:6px solid var(--amber)}
.ocr-card table{box-shadow:none}
.btn-confirm{background:var(--green)}
.ocr-card form.inline{display:inline-block;margin:8px 8px 0 0}

/* ---- D4: crew Report screen ---- */
.card.narrowform{max-width:560px}
.previews{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0}
.rthumb{width:72px;height:72px;object-fit:cover;border-radius:8px;border:1px solid #cdd8e3;display:inline-block;vertical-align:middle}
.rthumbs{max-width:240px}
.ok{color:var(--green);font-weight:700}
.warn{color:var(--amber);font-weight:700}
#gps-status .btn-s{margin-left:6px}

/* ---- D5: unfiled inbox ---- */
.inbox-actions{min-width:280px}
.inbox-actions form.inline{display:inline-flex;gap:6px;flex-wrap:wrap;align-items:center;margin:0 0 6px}
.inbox-actions select,.inbox-actions input{width:auto;min-height:38px;min-width:110px;font-size:13px;padding:6px}
.inbox-actions input[name="situation_text"]{min-width:150px}
.btn-ignore{background:#eef3f7;color:#7f8c9b}
.pager{display:flex;gap:6px;flex-wrap:wrap}
.pager .pg{padding:6px 12px;border-radius:8px;background:#fff;border:1px solid #cdd8e3;text-decoration:none;font-size:13px;font-weight:600}
.pager .pg.on{background:var(--navy);color:#fff;border-color:var(--navy)}

