/* LIFT — phone-first, high-contrast for reading in sunlight on the water. */

:root {
    --navy: #0b3d61;
    --navy-dark: #072a44;
    --ink: #14202b;
    --muted: #5b6b7a;
    --line: #d7dfe6;
    --bg: #f2f5f8;
    --card: #ffffff;
    --accent: #0e7490;
    --ok: #15803d;
    --warn: #b45309;
    --err: #b91c1c;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
}

.shell { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 64px; }

/* ---------- chrome ---------- */
.topbar {
    display: flex; align-items: baseline; gap: 10px;
    background: var(--navy); color: #fff;
    padding: 10px 14px;
    position: sticky; top: 0; z-index: 30;
}
.brand { color: #fff; font-weight: 800; font-size: 1.15rem; text-decoration: none; letter-spacing: .5px; }
.topbar-sub { font-size: .78rem; opacity: .85; flex: 1; }
.logout-form { margin: 0; }
.linkish {
    background: none; border: none; color: #cfe3f5; font-size: .8rem;
    cursor: pointer; text-decoration: underline; padding: 0;
}

.content { flex: 1; padding: 12px; max-width: 1100px; width: 100%; margin: 0 auto; }

.bottomnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    display: flex; justify-content: space-around;
    background: var(--navy-dark);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottomnav a {
    color: #9fb8cc; text-decoration: none; font-size: .78rem; font-weight: 600;
    padding: 6px 5px; border-radius: 8px;
}
.bottomnav a.active { color: #fff; background: rgba(255, 255, 255, .14); }

.foot {
    text-align: center; color: var(--muted); font-size: .7rem;
    padding: 10px 12px 84px;
}

/* ---------- shared bits ---------- */
.page { display: flex; flex-direction: column; gap: 12px; }
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    padding: 12px; overflow: hidden;
}
.card-title { font-weight: 700; font-size: .92rem; margin-bottom: 8px; color: var(--navy); }
.controls-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.controls-row input[type="date"], select {
    font-size: 1rem; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.inline-label { font-size: .82rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.tiny { font-size: .72rem; }
.scenario {
    background: #e0f2fe; color: #075985; border-radius: 999px;
    font-size: .78rem; font-weight: 600; padding: 4px 10px; text-decoration: none;
}
a.scenario:hover { background: #bae6fd; }
.empty-state {
    background: #fff8e6; border: 1px solid #f0dfae; border-radius: 12px;
    padding: 14px; font-size: .92rem;
}
.honesty-note {
    background: #eef6ff; border: 1px solid #cfe3f5; border-radius: 12px;
    padding: 10px 12px; font-size: .84rem; color: #123a5c;
}
.btn {
    background: #eef3f7; color: var(--navy); border: 1px solid var(--line);
    padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: .85rem; cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn-warn { background: #fef3c7; border-color: #f2ce69; color: #92400e; }
.tiny-btn { padding: 3px 8px; font-size: .75rem; }
.btn-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.job-output {
    background: #0f1c28; color: #bfe3c0; padding: 10px; border-radius: 8px;
    font-size: .75rem; white-space: pre-wrap; word-break: break-word; margin: 10px 0 0;
}

/* ---------- login ---------- */
.login-shell {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #0b3d61, #072a44);
    padding: 20px;
}
.login-card {
    background: #fff; border-radius: 14px; padding: 26px; width: 100%; max-width: 360px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.login-brand { font-size: 1.6rem; color: var(--navy); }
.login-tag { color: var(--muted); font-size: .82rem; margin: 4px 0 18px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card label { font-size: .82rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.login-card input {
    font-size: 1rem; padding: 10px; border: 1px solid var(--line); border-radius: 8px;
}
.login-card .btn-primary { padding: 11px; font-size: 1rem; border-radius: 8px; border: none; cursor: pointer; }
.login-error { background: #fee2e2; color: #991b1b; border-radius: 8px; padding: 8px 10px; font-size: .85rem; }

/* ---------- obs strip ---------- */
.obs-strip {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
    background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.obs-station { font-size: .72rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.obs-main { display: flex; align-items: center; gap: 10px; }
.obs-dir { font-size: 1.5rem; font-weight: 800; }
.obs-dir small { font-size: .85rem; color: var(--muted); font-weight: 600; }
.obs-speed { font-size: 1.9rem; font-weight: 800; color: var(--navy); }
.obs-speed small { font-size: .9rem; color: var(--muted); }
.obs-gust { font-size: 1rem; font-weight: 700; color: var(--warn); }
.obs-age { font-size: .72rem; color: var(--muted); }
.obs-compare { font-size: .8rem; margin-top: 2px; }
.obs-spark svg { display: block; }
.spark-label { font-size: 9px; fill: var(--muted); }

/* ---------- timeline chart ---------- */
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.timeline-chart { display: block; }
.timeline-chart .grid-v { stroke: #e3eaf0; stroke-width: 1; }
.timeline-chart .grid-h { stroke: #eef2f6; stroke-width: 1; }
.timeline-chart .axis-label { font-size: 10px; fill: var(--muted); }
.timeline-chart .deg-label { font-size: 9.5px; fill: #33475a; font-weight: 600; }
.timeline-chart .band { fill: rgba(14, 116, 144, .16); stroke: none; }
.timeline-chart .speed-line { fill: none; stroke: var(--navy); stroke-width: 2.4; }
.timeline-chart .gust-line { fill: none; stroke: #64748b; stroke-width: 1.4; stroke-dasharray: 4 3; }
.timeline-chart .risk-dot { fill: var(--err); }
.timeline-chart .warn-line { stroke: var(--warn); stroke-width: 1.6; stroke-dasharray: 5 3; }
.timeline-chart .warn-label { font-size: 9px; fill: var(--warn); font-weight: 700; }
.timeline-chart .now-line { stroke: #2563eb; stroke-width: 1.4; }
.timeline-chart .now-label { font-size: 9px; fill: #2563eb; font-weight: 700; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .74rem; color: var(--muted); margin-top: 8px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; }
.swatch.risk { background: var(--err); border-radius: 50%; }

/* ---------- compare table ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.compare-table { border-collapse: collapse; font-size: .78rem; }
.compare-table th, .compare-table td { padding: 4px 5px; text-align: center; border-bottom: 1px solid var(--line); }
.compare-table .sticky-col {
    position: sticky; left: 0; background: var(--card); text-align: left;
    min-width: 120px; z-index: 2; border-right: 1px solid var(--line);
}
.cell-speed { font-size: .74rem; font-weight: 700; margin-top: -2px; }
.w-none { background: #f6f8fa; }
.w0 { background: #f1f5f9; }
.w1 { background: #dbeafe; }
.w2 { background: #bbf7d0; }
.w3 { background: #fde68a; }
.w4 { background: #fdba74; }
.w5 { background: #fca5a5; }
.ensemble-row td { border-top: 2px solid var(--navy); }

/* ---------- skill/sides/admin tables ---------- */
.skill-table, .sides-table, .admin-table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.skill-table th, .skill-table td,
.sides-table th, .sides-table td,
.admin-table th, .admin-table td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--line); }
.skill-table th, .sides-table th, .admin-table th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
.left { text-align: left !important; }
.delta-row td { background: #f0f9ff; }
.delta-strong { background: #fef3c7; font-weight: 700; }
.row-disabled { opacity: .5; }
.ok-badge { background: #dcfce7; color: #166534; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.err-badge { background: #fee2e2; color: #991b1b; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.err-text { color: var(--err); }
.err-detail-row td { background: #fff5f5; }
.note-text { max-width: 420px; }
.num-input { width: 64px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; }
.num-input.wide { width: 92px; }
.text-input { width: 100%; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: .85rem; }
.stat-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: .85rem; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.settings-grid label { font-size: .78rem; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.settings-grid input { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: .95rem; }

.product-text {
    white-space: pre-wrap; word-break: break-word; font-size: .78rem; line-height: 1.45;
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    background: #f8fafc; border-radius: 8px; padding: 10px; margin: 8px 0 0;
    max-height: 420px; overflow-y: auto;
}
details.card summary { cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--navy); }

/* ---------- playbook chart page ---------- */
.chart-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.toolbar-spacer { flex: 1; }
.chart-image-scroll {
    overflow: auto; -webkit-overflow-scrolling: touch;
    max-height: calc(100dvh - 300px); min-height: 240px;
    border: 1px solid var(--line); border-radius: 8px; background: #fdfaf1;
}
.chart-image-scroll img { display: block; }
.scenario-table { border-collapse: collapse; width: 100%; font-size: .88rem; }
.scenario-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
.scenario-table tr:last-child td { border-bottom: none; }
.scenario-letter { font-weight: 800; font-size: 1.05rem; width: 30px; }
.ref-list { margin: 0; padding-left: 20px; font-size: .88rem; line-height: 1.55; }
.ref-list li { margin-bottom: 6px; }

/* ---------- wind map ---------- */
.map-wrap {
    height: calc(100dvh - 320px);
    min-height: 360px;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    z-index: 0; /* keep Leaflet's high pane z-indexes inside this stacking context */
}
.map-controls { padding: 10px 12px; }
.map-time-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.map-slider { flex: 1; min-width: 140px; accent-color: var(--navy); }
.map-time-label { font-weight: 800; color: var(--navy); font-size: 1.05rem; min-width: 86px; }
.grid-toggle { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.leaflet-container { font: inherit; }

@media (min-width: 800px) {
    .bottomnav { position: static; border-radius: 0; }
    .shell { padding-bottom: 0; }
    .foot { padding-bottom: 12px; }
}
