/* AKC Coal — styles v2. Same design system as AKC Ash Loading Control. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
* { box-sizing: border-box; margin: 0; }
:root {
  --navy: #142F4E; --navy-deep: #0C1E35; --navy-line: rgba(255,255,255,.09);
  --gold: #A9842C; --gold-bright: #D4A62E; --gold-soft: #F7EFD9;
  --canvas: #EFF2F6; --bg: #EFF2F6; --card: #FFFFFF; --ink: #17222E; --muted: #66727F; --line: #E1E6EC;
  --ok: #157347; --ok-bg: #E7F4ED; --warn: #94640B; --warn-bg: #FBF2DD; --fail: #B0271E; --fail-bg: #FBEAE8;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(12,30,53,.06);
  --shadow-md: 0 3px 12px rgba(12,30,53,.08);
}
html, body { min-height: 100%; background: var(--canvas); }
body { font-family: 'Inter', system-ui, sans-serif; color: var(--ink); font-size: 14px; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font-family: inherit; color: inherit; }
a { color: var(--navy); }
.hidden { display: none !important; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mb10 { margin-bottom: 10px; } .ta-r { text-align: right; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.center { text-align: center; }

/* ---------- load screen (splash) ---------- */
.loadscreen { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; color: var(--muted);
  background: radial-gradient(1200px 700px at 20% -10%, #23507F 0%, var(--navy) 45%, var(--navy-deep) 100%); }
.loadbox { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; max-width: 520px; color: rgba(255,255,255,.75); }
.loadbox .login-logo { animation: fadeUp .35s ease both; }
.loadbox .spinner { border-color: rgba(255,255,255,.2); border-top-color: var(--gold-bright); }
.loadtext { font-size: 13.5px; }
.loadtext.err { color: #FFD6D2; text-align: left; white-space: pre-wrap; font-size: 12.5px; background: rgba(0,0,0,.25); padding: 12px 14px; border-radius: 10px; }
.loadbox .row { gap: 8px; }

/* ---------- responsive shell ---------- */
.shell { display: none; }
.shell.on { display: block; }
.sidebar { display: none; }
.pagehead { display: none; }
.desktop-only { display: none; }
.mobile-only { display: block; }
nav.tabs.mobile-only { display: flex; }
@media (min-width: 900px) {
  .shell.on { display: flex; min-height: 100vh; }
  .sidebar { display: flex; flex-direction: column; width: 248px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
    background: linear-gradient(175deg, var(--navy) 0%, var(--navy-deep) 90%); color: #fff; padding: 22px 14px 18px; }
  .content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .pagehead { display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.85); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line); padding: 0 30px; height: 60px; position: sticky; top: 0; z-index: 15; }
  .desktop-only { display: block; }
  header.pagehead.desktop-only { display: flex; }
  .mobile-only { display: none !important; }
  .main { max-width: 1160px; margin: 0; padding: 26px 30px 56px; }
  .screen-title { display: none; }
  .stats { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- sidebar ---------- */
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; border-bottom: 1px solid var(--navy-line); }
.sidebar-logo { height: 42px; width: auto; background: #fff; border-radius: 9px; padding: 5px 8px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.sidebar-name { font-weight: 800; font-size: 16px; letter-spacing: .14em; }
.sidebar-tag { font-size: 11px; opacity: .6; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.sidebar-caption { font-size: 10px; text-transform: uppercase; letter-spacing: .16em; opacity: .45; padding: 18px 12px 8px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar-item { display: flex; align-items: center; justify-content: space-between; width: 100%; background: none; border: none; text-decoration: none;
  color: rgba(255,255,255,.72); font-size: 13.5px; font-weight: 500; padding: 10px 12px; border-radius: 8px; cursor: pointer; text-align: left; transition: background .12s, color .12s; }
.sidebar-item-main { display: flex; align-items: center; gap: 11px; }
.navicon { width: 17px; height: 17px; opacity: .8; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-item-active { background: linear-gradient(90deg, rgba(212,166,46,.18), rgba(212,166,46,.05)); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--gold-bright); }
.sidebar-item-active .navicon { opacity: 1; color: var(--gold-bright); }
.sidebar-badge { background: var(--gold-bright); color: var(--navy-deep); font-size: 11px; font-weight: 800; border-radius: 99px; padding: 1px 8px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--navy-line); padding-top: 14px; }
.sidebar-user-name { font-weight: 600; font-size: 13.5px; }
.sidebar-user-meta { font-size: 11.5px; opacity: .55; margin-top: 1px; }
.sidebar-logout { margin-top: 10px; width: 100%; background: rgba(255,255,255,.07); border: 1px solid var(--navy-line); color: #fff; border-radius: 8px; padding: 8px;
  font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .12s; text-decoration: none; display: block; text-align: center; }
.sidebar-logout:hover { background: rgba(255,255,255,.14); }
.sidebar-company { font-size: 10px; opacity: .4; margin-top: 12px; line-height: 1.4; }

/* ---------- page head (desktop) ---------- */
.pagehead-title { font-size: 17.5px; font-weight: 800; letter-spacing: -.015em; color: var(--navy); }
.pagehead-meta { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--muted); }
.pagehead-chip { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 5px 13px; font-weight: 600; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- mobile topbar / tabs ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: linear-gradient(90deg, var(--navy), var(--navy-deep)); color: #fff;
  display: flex; align-items: center; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; }
.topbar-brand { font-weight: 700; font-size: 15px; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-logo { height: 30px; width: auto; background: #fff; border-radius: 6px; padding: 3px 6px; flex-shrink: 0; }
.topbar-projname { font-size: 11px; opacity: .7; font-weight: 500; }
.topbar-user { background: rgba(255,255,255,.1); border: none; color: #fff; border-radius: 7px; padding: 6px 10px; font-size: 12px; cursor: pointer; flex-shrink: 0; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--line); justify-content: center; gap: 3px;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); z-index: 20; box-shadow: 0 -2px 12px rgba(12,30,53,.06); }
.tab { flex: 1; max-width: 110px; background: none; border: none; border-radius: 8px; padding: 9px 3px; font-size: 11px; font-weight: 600; color: var(--muted); cursor: pointer; text-decoration: none; text-align: center; }
.tab-active { background: var(--navy); color: #fff; }

/* ---------- layout & typography ---------- */
.main { max-width: 620px; margin: 0 auto; padding: 16px 16px 92px; }
.screen { animation: fadeUp .28s ease both; }
.screen-title { font-size: 21px; font-weight: 800; letter-spacing: -.01em; color: var(--navy); }
.screen-sub { color: var(--muted); font-size: 13px; margin: 4px 0 16px; line-height: 1.55; max-width: 680px; }
@media (min-width: 900px) { .screen-sub { margin-top: 0; } }
.backlink { margin-bottom: 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm); overflow: hidden; }
.card-title { font-weight: 700; font-size: 12.5px; margin-bottom: 12px; color: var(--navy); text-transform: uppercase; letter-spacing: .07em; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head .card-title { margin-bottom: 0; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; min-width: 0; }
.field-label { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .06em; }
.req { color: var(--fail); }
.opt { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.input { width: 100%; max-width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 14.5px; background: #fff; color: var(--ink); transition: border-color .12s, box-shadow .12s; }
.input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(20,47,78,.12); }
.input:disabled { background: #F4F6F9; color: var(--muted); }
input[type="date"], input[type="time"], input[type="datetime-local"] { -webkit-appearance: none; appearance: none; min-width: 0; width: 100%; max-width: 100%; text-align: left; display: block; }
select.input { -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2366727F' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px; }
.input-num { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.input-veh { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; font-size: 20px; text-align: center; }
textarea.input { resize: vertical; min-height: 70px; }
.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
.grid2 > *, .grid3 > * { min-width: 0; }

.btn { width: 100%; border: none; border-radius: 8px; padding: 12px 16px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-shrink: 0;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease, background .12s ease; }
.btn:disabled { background: #EDEFF3 !important; color: #9AA4B2 !important; box-shadow: none !important; border-color: #E1E5EB !important; cursor: not-allowed; transform: none !important; }
.btn-primary { background: linear-gradient(180deg, #1F4470, var(--navy-deep)); color: #fff; box-shadow: 0 1px 2px rgba(12,30,53,.28), 0 4px 12px rgba(12,30,53,.18); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 10px rgba(12,30,53,.3); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 2px rgba(12,30,53,.3); }
.btn-gold { background: linear-gradient(180deg, #E0B43C, var(--gold)); color: var(--navy-deep); box-shadow: 0 1px 2px rgba(12,30,53,.2), 0 4px 12px rgba(169,132,44,.25); }
.btn-gold:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.btn-outline { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
.btn-outline:not(:disabled):hover { background: var(--canvas); }
.btn-danger { background: var(--fail-bg); color: var(--fail); border: 1px solid rgba(176,39,30,.35); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-sm { width: auto; padding: 8px 14px; font-size: 13px; }
.btn-half { flex: 1; padding: 10px; font-size: 13.5px; }
@media (min-width: 900px) { .btn { width: auto; min-width: 230px; } .btn-half { min-width: 0; } .btn-sm { min-width: 0; } }
.btn:focus-visible, .input:focus-visible, .linkbtn:focus-visible, .tab:focus-visible, .sidebar-item:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.linkbtn { background: none; border: none; color: var(--navy); font-size: 13px; font-weight: 600; padding: 6px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; flex-shrink: 0; white-space: nowrap; }
.linkbtn-danger { color: var(--fail); }
.failactions { display: flex; flex-wrap: wrap; flex-direction: column; gap: 8px; }
.actions2 { display: flex; gap: 10px; }
@media (min-width: 900px) { .failactions { flex-direction: row; } }

/* ---------- messages / chips ---------- */
.checks { margin: 4px 0 14px; display: flex; flex-direction: column; gap: 6px; }
.checkrow { display: flex; flex-wrap: wrap; gap: 10px; padding: 9px 12px; border-radius: 8px; font-size: 13px; align-items: flex-start; }
.checkrow-ok { background: var(--ok-bg); color: var(--ok); }
.checkrow-warn { background: var(--warn-bg); color: var(--warn); }
.checkrow-fail { background: var(--fail-bg); color: var(--fail); }
.checkrow-muted { background: var(--canvas); color: var(--muted); }
.checkrow-icon { font-weight: 700; width: 16px; }
.checkrow-label { font-weight: 600; }
.checkrow-detail { font-size: 12px; opacity: .85; margin-top: 2px; width: 100%; }
.extract { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.extract-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 13px; font-size: 13.5px; border-bottom: 1px solid var(--line); gap: 12px; }
.extract-row:last-child { border-bottom: none; }
.extract-row:nth-child(even) { background: #FAFBFC; }
.extract-row span { color: var(--muted); }
.extract-row strong { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.rowline { border-top: 2px solid var(--navy); background: var(--gold-soft) !important; }
.errbox { background: var(--fail-bg); color: var(--fail); border-radius: 8px; padding: 11px 13px; font-size: 13px; margin-bottom: 14px; border: 1px solid rgba(176,39,30,.18); }
.errbox:empty { display: none; }
.okbox { background: var(--ok-bg); color: var(--ok); border-radius: 8px; padding: 11px 13px; font-size: 13px; font-weight: 600; margin-bottom: 14px; border: 1px solid rgba(21,115,71,.18); }
.okbox.big { font-size: 15px; text-align: center; }
.warnbox { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 11px 13px; font-size: 13px; margin-bottom: 14px; border: 1px solid rgba(148,100,11,.2); }
.infobox { background: var(--canvas); color: var(--muted); border-radius: 8px; padding: 11px 13px; font-size: 13px; margin-bottom: 14px; border: 1px solid var(--line); }
.chip { font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 5px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; display: inline-block; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-fail { background: var(--fail-bg); color: var(--fail); }
.chip-muted { background: #EAEEF3; color: var(--muted); }
.chip-navy { background: var(--navy); color: #fff; }
.empty { background: var(--card); border: 1px dashed #C9D2DC; border-radius: var(--radius); padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }
.empty strong { display: block; color: var(--ink); margin-bottom: 3px; }
.empty-inline { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* ---------- KPI stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; text-decoration: none; color: inherit; display: block; }
.stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--navy), #2A5586); }
.stat-gold::before { background: linear-gradient(90deg, var(--gold-bright), #E7C25C); }
.stat-num { font-size: 24px; font-weight: 800; line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-num small { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.stat-label { font-size: 10.5px; color: var(--muted); margin-top: 5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

.pipeline { display: flex; gap: 10px; flex-wrap: wrap; }
.pipe { flex: 1; min-width: 110px; background: var(--canvas); border: 1px solid var(--line); border-radius: 8px; padding: 11px; text-align: center; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.pipe-num { display: block; font-size: 22px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.pipe-transit { background: var(--gold-soft); border-color: #E4D3A0; }
.pipe-transit .pipe-num { color: var(--gold); }

/* ---------- 7-day chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 8px; padding-top: 4px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; min-width: 0; }
.chart-track { width: 100%; height: 140px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 2px solid var(--line); }
.chart-val { font-size: 11.5px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; min-height: 15px; }
.chart-count { font-size: 10.5px; color: var(--muted); min-height: 13px; }
.chart-bar { width: 100%; max-width: 44px; background: linear-gradient(180deg, var(--gold-bright), #B98F1E); border-radius: 6px 6px 0 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); transition: height .35s ease; }
.chart-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.chart-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 599px) { .chart-track { height: 108px; } .chart { gap: 5px; } .chart-bar { max-width: 30px; } .chart-foot { flex-direction: column; gap: 3px; } }

.tatbar { background: var(--canvas); border-radius: 99px; height: 8px; overflow: hidden; border: 1px solid var(--line); }
.tatbar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-bright), #E7C25C); border-radius: 99px; }

.flagcard { border-left: 3px solid var(--warn); }
.flagrow { width: 100%; background: var(--warn-bg); border: none; border-radius: 8px; padding: 10px 13px; margin-bottom: 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: 13px; cursor: pointer; color: var(--ink); text-align: left; text-decoration: none; transition: filter .12s; }
.flagrow:last-child { margin-bottom: 0; }
.flagrow:hover { filter: brightness(.97); }
.flagrow-fail { background: var(--fail-bg); }
.flagrow-why { color: var(--warn); font-size: 12px; }
.flagrow-fail .flagrow-why { color: var(--fail); }

/* ---------- rows & lists ---------- */
.triprow { width: 100%; background: none; border: none; border-bottom: 1px solid var(--line); padding: 12px 2px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  cursor: pointer; text-align: left; color: var(--ink); text-decoration: none; }
.triprow:last-of-type, .triprow:last-child { border-bottom: none; }
.triprow-static { cursor: default; }
.triprow-main { min-width: 0; flex: 1; }
.triprow-veh { font-weight: 600; font-size: 14px; }
.triprow-id { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.triprow-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.triprow-side { text-align: right; flex-shrink: 0; }
.triprow-num { font-weight: 700; font-size: 14.5px; font-variant-numeric: tabular-nums; color: var(--navy); }
.triprow-arrow { color: var(--muted); font-size: 18px; flex-shrink: 0; }
.triprow-on { background: var(--gold-soft); border-radius: 8px; padding-left: 10px; padding-right: 10px; }
.masterrow { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding: 12px 2px; gap: 12px; text-decoration: none; color: inherit; }
.masterrow:last-child { border-bottom: none; }
.logrow { display: flex; gap: 12px; font-size: 12.5px; padding: 7px 0; border-bottom: 1px solid var(--line); }

/* ---------- gallery / photos ---------- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 900px) { .gallery { grid-template-columns: repeat(6, 1fr); } }
.gallery-item { background: none; border: none; padding: 0; cursor: pointer; text-align: center; text-decoration: none; }
.gallery-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); transition: transform .12s, border-color .12s; display: block; }
.gallery-item:hover .gallery-img { border-color: var(--gold-bright); transform: scale(1.03); }
.gallery-label { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px; }
.photo { position: relative; aspect-ratio: 1; border: 1px dashed #C9D2DC; border-radius: 8px; background: #FAFBFC; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer; text-align: center; padding: 6px; }
.photo span { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.photo svg { width: 24px; height: 24px; stroke: var(--muted); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo.has { border-style: solid; border-color: var(--ok); }
.photo.has::after { content: attr(data-label); position: absolute; left: 0; right: 0; bottom: 0; background: rgba(12,30,53,.78); color: #fff; font-size: 10.5px; padding: 3px 4px; }
.photo.busy::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.7); z-index: 1; }
.photo .pbar { position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--gold-bright); transform-origin: left; z-index: 2; }
.photo.req span::after { content: ' *'; color: var(--fail); }
.photo input { display: none; }

/* ---------- section tabs / pills ---------- */
.wtabs { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; padding-bottom: 2px; }
.wtabs::-webkit-scrollbar { display: none; }
.wtab { background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 8px 16px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; flex: 0 0 auto; transition: all .12s; text-decoration: none; }
.wtab:hover { border-color: var(--navy); color: var(--navy); }
.wtab-on { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 2px 6px rgba(12,30,53,.22); }
.suggest { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-md); background: #fff; }
.suggest .triprow { padding-left: 12px; padding-right: 12px; }
.suggest .triprow:hover { background: var(--gold-soft); }

/* ---------- weighbridge net line ---------- */
.rail-total { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); display: flex; justify-content: space-between; align-items: baseline; }
.rail-total strong { color: var(--navy); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rail-total strong small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 4px; }

/* ---------- login ---------- */
.login { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh;
  padding: calc(40px + env(safe-area-inset-top)) 20px calc(40px + env(safe-area-inset-bottom));
  background: radial-gradient(1200px 700px at 20% -10%, #23507F 0%, var(--navy) 45%, var(--navy-deep) 100%); }
.login-brand { text-align: center; color: #fff; margin-bottom: 26px; animation: fadeUp .35s ease both; }
.login-logo { height: 88px; width: auto; object-fit: contain; border-radius: 14px; box-shadow: 0 8px 26px rgba(0,0,0,.35); background: #fff; padding: 10px 16px; }
.login-title { font-size: 22px; font-weight: 800; letter-spacing: .01em; margin-top: 16px; }
.login-sub { opacity: .7; font-size: 13px; margin-top: 4px; }
.login-form { width: 100%; max-width: 380px; background: var(--card); border-radius: 14px; padding: 26px; box-shadow: 0 24px 70px rgba(0,0,0,.4); animation: fadeUp .4s ease both; }
.login-note { color: var(--muted); font-size: 11.5px; margin-top: 14px; line-height: 1.55; }
.login-foot { color: rgba(255,255,255,.5); font-size: 11.5px; margin-top: 22px; text-align: center; }
.login-foot a, .login-foot .linkbtn { color: rgba(255,255,255,.8); }
.projgate-cards { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 460px; }
.projcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; cursor: pointer;
  animation: fadeUp .45s ease both; transition: transform .15s, box-shadow .15s; box-shadow: 0 10px 30px rgba(0,0,0,.25); width: 100%; }
.projcard:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(0,0,0,.35); }
.projcard-code { background: var(--gold-soft); color: var(--gold); font-weight: 800; font-size: 12px; letter-spacing: .1em; border-radius: 6px; padding: 3px 10px; }
.projcard-name { font-weight: 700; font-size: 16.5px; color: var(--navy); }
.projcard-meta { font-size: 12.5px; color: var(--muted); }
.projcard-go { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 600; }
.projcard-closed { opacity: .6; }
.projgate-links { display: flex; gap: 18px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.projgate-links .linkbtn { color: rgba(255,255,255,.8); }

/* ---------- save overlay / confirm ---------- */
.saveoverlay { position: fixed; inset: 0; background: rgba(12,30,53,.45); backdrop-filter: blur(2px); z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; animation: popIn .15s ease both; }
.saveoverlay.on { display: flex; }
.saveoverlay-box { background: var(--card); border-radius: 14px; padding: 24px 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; font-weight: 600; color: var(--navy);
  box-shadow: 0 20px 60px rgba(0,0,0,.35); width: 100%; max-width: 380px; text-align: center; animation: popIn .2s ease both; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--gold-bright); border-radius: 50%; animation: spin .8s linear infinite; }
.ov-ico { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; }
.ov-ico svg { width: 34px; height: 34px; stroke: #fff; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ov-ico.ok { background: var(--ok); } .ov-ico.fail { background: var(--fail); }
.ov-title { font-size: 17px; font-weight: 800; color: var(--navy); }
.ov-detail { font-size: 13.5px; color: var(--muted); font-weight: 500; white-space: pre-wrap; line-height: 1.5; }
.ov-detail b { color: var(--ink); font-size: 16px; }
.ov-actions { display: flex; gap: 8px; width: 100%; margin-top: 4px; }
.ov-actions .btn { flex: 1; min-width: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 110; background: var(--navy-deep); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: opacity .2s; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
#toast.on { opacity: 1; }
#toast.bad { background: var(--fail); }
@media (min-width: 900px) { #toast { bottom: 24px; } }

/* ---------- misc ---------- */
.userfields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.useracts { display: flex; flex-wrap: wrap; gap: 12px 18px; padding-top: 10px; border-top: 1px solid var(--line); align-items: center; }
.menu .triprow { text-decoration: none; }
.menu-ic { width: 20px; height: 20px; stroke: var(--navy); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ===================== MOBILE PASS ===================== */
@media (max-width: 899px) {
  .input, select.input, textarea.input { font-size: 16px; padding: 12px 13px; }
  .input-veh { font-size: 22px; padding: 12px; }
  .main { padding-left: 12px; padding-right: 12px; }
  .card { padding: 15px 14px; border-radius: 12px; }
  .btn { padding: 14px 16px; font-size: 15px; }
  .btn-sm { padding: 11px 14px; font-size: 13.5px; }
  .linkbtn { padding: 6px 0; display: inline-block; min-height: 30px; }
  .tab { min-height: 46px; }
  .triprow, .masterrow { padding: 14px 4px; }
  .triprow-veh { font-size: 15px; }
  .triprow-meta { font-size: 12.5px; line-height: 1.5; }
}

/* ===================== DESKTOP PASS (after base rules so it wins) ===================== */
@media (min-width: 900px) {
  .main { max-width: 1160px; margin: 0; padding: 26px 30px 56px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .screen-title { display: none; }
  .backlink { display: inline-block; }
}
a[data-go], .stat[data-go] { cursor: pointer; }
/* v4: scrollable mobile tabs (many tabs, like the Ash app) */
@media (max-width: 899px) {
  .tabs { justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 2px; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; min-width: 74px; max-width: none; font-size: 11.5px; padding: 9px 10px; }
}
.masterrow[data-go] { cursor: pointer; }
@media (min-width: 900px) { .wtabs { flex-wrap: wrap; overflow: visible; } }
.input-bad { border-color: var(--fail) !important; box-shadow: 0 0 0 3px rgba(176,39,30,.12) !important; }

/* ---------- top-bar actions (as in the Ash app) ---------- */
.refreshbtn { background: var(--card); border: 1px solid var(--line); color: var(--navy); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 17px; line-height: 1; display: inline-grid; place-items: center; transition: transform .3s; flex-shrink: 0; }
.refreshbtn:active { transform: rotate(180deg); }
.refreshbtn-top { background: rgba(255,255,255,.12); border: none; color: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pagehead-meta { gap: 10px; }
@media (max-width: 899px) { .topbar-brand > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } }
/* ---------- user access editor ---------- */
.accgroup { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.accgroup-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-weight: 700; color: var(--navy); font-size: 13.5px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.accgroup-head .seg { margin-left: auto; }
.accrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.accrow:last-child { border-bottom: none; }
.accrow-name { font-size: 13.5px; min-width: 0; flex: 1 1 180px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; flex: 0 0 auto; }
.seg button { border: none; background: none; padding: 8px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; border-right: 1px solid var(--line); min-width: 60px; }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--navy); color: #fff; }
.accgroup-head .seg button { padding: 5px 9px; font-size: 11.5px; min-width: 0; }
@media (max-width: 899px) { .accrow .seg { width: 100%; } .accrow .seg button { flex: 1; min-width: 0; padding: 10px 4px; } .accgroup-head .seg { margin-left: 0; width: 100%; } .accgroup-head .seg button { flex: 1; } }

/* ---------- iOS-style bottom bar: 4 tabs + More, and the More sheet ---------- */
button, a, .tab, .projcard, .triprow, .masterrow, .wtab, .seg button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (hover: none) { .projcard:hover { transform: none; box-shadow: none; } .triprow:hover, .masterrow:hover { background: inherit; } }
.tabs { gap: 0; padding: 4px 4px calc(6px + env(safe-area-inset-bottom)); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; flex: 1; max-width: none; min-height: 50px; padding: 6px 2px 4px; font-size: 10.5px; border-radius: 10px; position: relative; letter-spacing: .01em; }
.tabicon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab-active { background: none; color: var(--navy); }
.tab-active .tabicon { stroke-width: 2.3; }
.tab-badge { position: absolute; top: 3px; right: calc(50% - 22px); background: var(--fail); color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 9px; display: inline-grid; place-items: center; padding: 0 4px; }
@media (max-width: 899px) { .tabs { justify-content: space-between; overflow: visible; } .tab { min-width: 0; font-size: 10.5px; } .main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); } }
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; }
.sheet-bg { position: absolute; inset: 0; background: rgba(12,30,53,.45); opacity: 0; transition: opacity .2s; }
.sheet { position: relative; width: 100%; background: var(--canvas); border-radius: 18px 18px 0 0; padding: 8px 14px calc(14px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .25s ease; max-height: 82vh; overflow-y: auto; }
.sheet-wrap.on .sheet-bg { opacity: 1; } .sheet-wrap.on .sheet { transform: none; }
.sheet-grip { width: 38px; height: 4px; border-radius: 2px; background: rgba(12,30,53,.2); margin: 4px auto 12px; }
.sheet-list { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.sheet-item { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: none; border-bottom: 1px solid var(--line); padding: 14px 14px; font-size: 15px; font-weight: 600; color: var(--navy); text-align: left; cursor: pointer; }
.sheet-item:last-child { border-bottom: none; }
.sheet-item.on { background: var(--navy-soft, #EEF3F9); }
.sheet-item .navicon { width: 22px; height: 22px; }
.sheet-item .sidebar-badge { margin-left: auto; }
.sheet-cancel { width: 100%; }

/* ---------- in-app photo viewer ---------- */
.gallery-item { background: none; border: none; padding: 0; text-align: left; cursor: pointer; }
.viewer { position: fixed; inset: 0; z-index: 80; background: #000; display: flex; flex-direction: column; color: #fff; }
.viewer-top { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: rgba(0,0,0,.6); }
.viewer-label { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-count { font-size: 12px; opacity: .7; }
.viewer-close { background: rgba(255,255,255,.15); border: none; color: #fff; width: 36px; height: 36px; border-radius: 18px; font-size: 16px; cursor: pointer; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .05s linear; will-change: transform; -webkit-user-drag: none; }
.viewer-bottom { display: flex; justify-content: center; gap: 10px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); background: rgba(0,0,0,.6); }
.viewer-btn { background: rgba(255,255,255,.15); border: none; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; min-width: 52px; }
body.viewer-open { overflow: hidden; }
/* ---------- statements, daily summary ---------- */
.stmt { display: flex; flex-direction: column; }
.stmt-row { display: grid; grid-template-columns: 74px 1fr auto auto; gap: 8px 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; cursor: default; }
.stmt-row[data-go] { cursor: pointer; }
.stmt-row:last-child { border-bottom: none; }
.stmt-date { color: var(--muted); font-variant-numeric: tabular-nums; }
.stmt-label { min-width: 0; }
.stmt-amt { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stmt-bal { font-weight: 700; color: var(--navy); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 96px; text-align: right; }
.stmt-bill .stmt-label { font-weight: 600; }
@media (max-width: 899px) { .stmt-row { grid-template-columns: 1fr auto; } .stmt-date { grid-column: 1 / -1; font-size: 11.5px; padding-top: 2px; } .stmt-bal { grid-column: 2; min-width: 0; } }
.summary-text { white-space: pre-wrap; font-family: inherit; background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; padding: 14px; font-size: 14px; line-height: 1.6; margin: 12px 0; }
.accrow-tr { width: 100%; margin-top: 6px; }
