/* Kraken Subsea · Offshore Log — app screens */
:root {
  --navy: #10253F;
  --navy-2: #1F497D;
  --blue: #3A6EA5;
  --orange: #F79623;
  --orange-text: #8A4B00;
  --orange-soft: #FDEBD3;
  --blue-soft: #DCE6F2;
  --bg: #F3F5F8;
  --card: #FFFFFF;
  --line: #DCE2EA;
  --field: #C3CDD9;
  --muted: #4A5B70;
  --faint: #8796A8;
  --ok: #1B6E3A;
  --bad: #B3261E;
  --radius: 12px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--navy); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
a { color: var(--navy-2); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; max-width: 760px; margin: 0 auto; background: var(--bg); }
.topbar { background: var(--navy); color: #fff; padding: calc(12px + env(safe-area-inset-top)) 18px 14px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; z-index: 20; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar .logo { height: 30px; width: auto; display: block; }
.topbar .back { width: 44px; height: 44px; margin-left: -10px; display: inline-flex; align-items: center; justify-content: center; color: #fff; border-radius: 10px; }
.topbar .back:hover { background: rgba(255,255,255,.08); }
.topbar h1 { margin: 0; font-size: 18px; font-weight: 700; }
.topbar .sub { font-size: 12px; color: #C9D3E0; }
.proj-eyebrow { font-size: 12px; font-weight: 700; color: var(--orange); letter-spacing: .06em; text-transform: uppercase; }
.proj-title { font-size: 20px; font-weight: 700; margin: 2px 0; }
.proj-meta { font-size: 13px; color: #C9D3E0; }
.sync-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.12); color: #fff; padding: 7px 11px; border-radius: 999px; border: 0; cursor: pointer; text-decoration: none; min-height: 32px; }
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #7FD69B; }
.sync-pill.offline .dot, .sync-pill.pending .dot { background: var(--orange); }
.sync-pill.error .dot { background: #FF8A80; }

.content { flex: 1; padding: 14px 14px 110px; display: flex; flex-direction: column; gap: 12px; }
.content.narrow { padding-bottom: 32px; }

.bottomnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(10px + env(safe-area-inset-bottom)); }
.bottomnav .inner { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 52px; justify-content: center; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 10px; }
.bottomnav a svg { width: 22px; height: 22px; }
.bottomnav a.active { color: var(--navy); font-weight: 800; }
.bottomnav a.active::before { content: ""; width: 22px; height: 3px; border-radius: 2px; background: var(--orange); margin-bottom: 1px; }

/* ---------- building blocks ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 2px rgba(16,37,63,.08); }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .02em; text-transform: uppercase; }
.h2 { font-size: 17px; font-weight: 800; margin: 0; }
.h3 { font-size: 15px; font-weight: 700; margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; font-size: 14px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 2px 0; }

.avatar { width: 36px; height: 36px; border-radius: 999px; background: var(--orange); color: var(--navy); font-weight: 800; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar.alt { background: var(--blue-soft); }
.avatar.lg { width: 44px; height: 44px; font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--blue-soft); color: var(--navy); white-space: nowrap; }
.chip.orange { background: var(--orange-soft); color: var(--orange-text); }
.chip.green { background: #DDF1E4; color: var(--ok); }
.chip.red { background: #FBE3E1; color: var(--bad); }
.tag { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--orange-text); background: var(--orange-soft); border-radius: 4px; padding: 2px 6px; text-transform: uppercase; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field > .label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.input, select.input, textarea.input {
  width: 100%; background: #fff; border: 1px solid var(--field); border-radius: 10px; padding: 11px 12px; min-height: 48px; font-size: 16px; color: var(--navy);
}
textarea.input { resize: vertical; line-height: 1.45; min-height: 110px; }
.input:focus, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid rgba(247,150,35,.55); outline-offset: 1px; }
.input.big { font-size: 20px; font-weight: 800; }
.hint { font-size: 12px; color: var(--muted); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 8px; border: 1.5px solid var(--field); background: #fff; font-size: 13px; font-weight: 700; text-align: center; padding: 4px; }
.seg input:checked + span { background: var(--navy); color: #fff; border-color: var(--navy); }
.seg input:focus-visible + span { outline: 3px solid rgba(247,150,35,.55); }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; }
.check input { width: 26px; height: 26px; accent-color: var(--navy); flex-shrink: 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--navy); background: var(--navy); color: #fff; font-weight: 800; font-size: 15px; text-decoration: none; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.orange { background: var(--orange); border-color: var(--orange); color: var(--navy); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--navy); }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.fab { position: fixed; right: max(18px, calc(50vw - 362px)); bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 15; background: var(--orange); color: var(--navy); font-weight: 800; font-size: 15px; text-decoration: none; border-radius: 999px; padding: 15px 20px; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 6px 16px rgba(16,37,63,.3); }
.fab svg { width: 18px; height: 18px; }
.actionbar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; margin: 0 -14px -110px; z-index: 5; }
.actionbar .grid2 .btn { width: 100%; }
.content.narrow .actionbar { margin-bottom: -32px; }

/* ---------- log ---------- */
.shiftbar { background: #fff; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border-radius: var(--radius); }
.shiftbar .names { display: flex; flex-direction: column; min-width: 0; }
.daynav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.daynav .icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: inline-flex; align-items: center; justify-content: center; color: var(--navy); text-decoration: none; }
.daynav .icon-btn svg { width: 20px; height: 20px; }
.daynav input[type=date] { border: 0; background: transparent; font-weight: 800; font-size: 17px; color: var(--navy); min-height: 44px; padding: 0; width: 100%; }
.entry { background: #fff; border-radius: var(--radius); padding: 12px; display: flex; gap: 12px; box-shadow: 0 1px 2px rgba(16,37,63,.08); text-decoration: none; color: inherit; }
.entry .when { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 48px; flex-shrink: 0; }
.entry .time { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.entry .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.entry .text { font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry.note { background: #FFF7EC; }
.entry.note .text { color: var(--orange-text); font-weight: 600; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumb { width: 72px; height: 54px; border-radius: 6px; object-fit: cover; background: var(--blue); display: block; }
.thumb.ph { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 10px; }
.pending-dot { font-size: 11px; color: var(--orange-text); font-weight: 700; }

.photo-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-picker .ph { position: relative; width: 88px; height: 88px; border-radius: 10px; overflow: hidden; background: var(--blue); }
.photo-picker .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-picker .ph button { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 999px; border: 0; background: rgba(16,37,63,.8); color: #fff; font-weight: 800; cursor: pointer; }
.photo-add { width: 88px; height: 88px; border-radius: 10px; border: 2px dashed var(--faint); background: #fff; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--navy); cursor: pointer; }
.photo-add svg { width: 24px; height: 24px; }
.photo-add input { display: none; }

/* ---------- lists ---------- */
.list { background: #fff; border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.list > a, .list > div.li, .list > label.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; border-bottom: 1px solid #EEF1F5; text-decoration: none; color: inherit; }
.list > :last-child { border-bottom: 0; }
.list .chev { color: var(--faint); width: 18px; height: 18px; flex-shrink: 0; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; }

/* ---------- toolbox talk ---------- */
.yn { display: flex; gap: 6px; flex-shrink: 0; }
.yn label { position: relative; }
.yn input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.yn span { width: 46px; height: 44px; border-radius: 8px; border: 1.5px solid var(--field); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; background: #fff; }
.yn input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.yn input.n:checked + span { background: var(--bad); border-color: var(--bad); }
.yn input:focus-visible + span { outline: 3px solid rgba(247,150,35,.55); }
.q { background: #fff; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.q .qrow { display: flex; align-items: center; gap: 10px; }
.q .n { font-size: 12px; font-weight: 800; color: var(--muted); width: 20px; flex-shrink: 0; }
.q .qt { flex: 1; font-size: 14px; line-height: 1.35; }
.q .qc { font-size: 14px; min-height: 40px; padding: 8px 10px; }
.notebox { font-size: 13px; line-height: 1.4; padding: 10px 12px; border-radius: 10px; background: var(--orange-soft); color: var(--orange-text); font-weight: 600; }
.progress { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress > div { height: 8px; background: var(--orange); }

/* ---------- signature ---------- */
.sigpad { position: relative; border: 1.5px dashed var(--faint); border-radius: 10px; background: #fff; touch-action: none; }
.sigpad canvas { display: block; width: 100%; height: 160px; border-radius: 10px; cursor: crosshair; }
.sigpad .sigline { position: absolute; left: 16px; right: 16px; bottom: 36px; border-bottom: 1px solid var(--field); pointer-events: none; }
.sigpad .sighint { position: absolute; left: 16px; bottom: 12px; font-size: 12px; color: var(--faint); pointer-events: none; }
.sig-img { height: 44px; max-width: 160px; object-fit: contain; display: block; }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); color: var(--navy); }
dialog::backdrop { background: rgba(16,37,63,.55); }
dialog .dlg { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
dialog .dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.viewer img { width: 100%; height: auto; display: block; border-radius: 10px; }

/* ---------- table (timesheet / mapping) ---------- */
.tablewrap { overflow-x: auto; background: #fff; border-radius: var(--radius); }
table.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
table.grid th, table.grid td { padding: 8px; border-bottom: 1px solid #EEF1F5; text-align: left; white-space: nowrap; }
table.grid th { background: var(--navy); color: #fff; font-weight: 700; position: sticky; top: 0; }
table.grid td.day { font-weight: 700; }
table.grid tr.weekend td { background: #FAFBFD; }
table.grid select { min-height: 38px; border: 1px solid var(--field); border-radius: 8px; background: #fff; padding: 4px 6px; font-size: 13px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; background: var(--navy); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 22px; }
.auth .logo { width: 220px; height: auto; }
.auth .card { width: min(420px, 100%); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.auth h1 { margin: 0; font-size: 20px; }
.auth .switch { font-size: 14px; text-align: center; }
.err { color: var(--bad); font-size: 14px; font-weight: 600; }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 12px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 16px rgba(16,37,63,.3); }
.toast-error { background: var(--bad); }
.toast-ok { background: var(--ok); }

@media (min-width: 700px) {
  .content { padding: 18px 18px 110px; }
}
