/* MOIMS stylesheet. Restrained, dense layout for shift work: one shell (header, module navigation,
   prototype notice), compact tables, forms with fields that grow with their content (0.14.0). */
:root { --ink:#1c2733; --muted:#5d6876; --line:#d5dbe2; --line2:#e6eaee; --bg:#f3f5f7; --card:#fff;
        --accent:#0a4f8f; --accent-soft:#e7eff8; --head:#0e2133; --ok:#1d6b3a; --warn:#8a5300; --bad:#a9231c; }
* { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; }
body { margin:0; font:14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color:var(--ink); background:var(--bg); }
a { color:var(--accent); }
:focus-visible { outline:2px solid #2f7ed8; outline-offset:2px; }
.skip { position:absolute; left:-999px; top:0; background:#fff; padding:6px 10px; z-index:50; }
.skip:focus { left:8px; }

/* Shell */
.appbar { position:sticky; top:0; z-index:30; background:var(--card); box-shadow:0 1px 0 var(--line); }
.appbar-top { display:flex; flex-wrap:wrap; align-items:center; gap:6px 16px; min-height:44px; padding:4px 20px;
              background:var(--head); color:#dfe7ef; font-size:13px; }
.appbar-top a { color:#fff; text-decoration:none; }
.brand { font-weight:700; font-size:16px; letter-spacing:.04em; }
.rig { padding-left:12px; border-left:1px solid #33506b; }
.opdate b, .rigclock b { color:#fff; font-weight:600; }
.appbar-tools { margin-left:auto; display:flex; align-items:center; gap:10px; }
.quick-log { border:1px solid #4d7a5a; background:#1f5a34; padding:3px 10px; border-radius:3px; }
.quick-log:hover { background:#256b3e; }
.usermenu { position:relative; }
.usermenu > summary { list-style:none; cursor:pointer; padding:3px 8px; border-radius:3px; }
.usermenu > summary::-webkit-details-marker { display:none; }
.usermenu > summary:hover, .usermenu[open] > summary { background:#1d3650; }
.urole { color:#a9bdd0; } .uname { color:#fff; }
.usermenu-panel { position:absolute; right:0; top:32px; min-width:220px; background:#fff; color:var(--ink);
                  border:1px solid var(--line); border-radius:4px; padding:8px 12px; box-shadow:0 6px 18px rgba(0,0,0,.15); }
.usermenu-panel a { display:block; color:var(--accent) !important; padding:4px 0; }
.usermenu-panel p { margin:2px 0 6px; } .usermenu-panel form { margin-top:6px; }
.modnav { display:flex; align-items:stretch; padding:0 12px; border-bottom:1px solid var(--line); background:var(--card); }
.modnav-list { display:flex; flex-wrap:wrap; list-style:none; margin:0; padding:0; flex:1; }
.modnav-list > li > a, .admin-menu > summary { display:block; padding:9px 11px 8px; color:var(--ink); text-decoration:none;
                                            font-size:13.5px; border-bottom:3px solid transparent; cursor:pointer; }
.modnav-list > li > a:hover, .admin-menu > summary:hover { background:#f3f6f9; }
.modnav-list a.active, .admin-menu > summary.active { color:var(--accent); font-weight:600; border-bottom-color:var(--accent); background:var(--accent-soft); }
.modnav-admin { margin-left:auto; position:relative; }
.admin-menu > summary { list-style:none; } .admin-menu > summary::-webkit-details-marker { display:none; }
.admin-menu > summary::after { content:" ▾"; color:var(--muted); }
.admin-menu ul { position:absolute; right:0; top:100%; z-index:40; list-style:none; margin:0; padding:4px 0; min-width:210px;
                 background:#fff; border:1px solid var(--line); border-radius:4px; box-shadow:0 6px 18px rgba(0,0,0,.12); }
.admin-menu ul a { display:block; padding:6px 14px; color:var(--ink); text-decoration:none; }
.admin-menu ul a:hover { background:#f3f6f9; } .admin-menu ul a.active { color:var(--accent); font-weight:600; background:var(--accent-soft); }
.modnav-toggle { display:none; }
.subnav { display:flex; flex-wrap:wrap; gap:2px; padding:0 20px; background:#f8fafb; border-bottom:1px solid var(--line); }
.subnav a { padding:6px 10px; font-size:13px; color:var(--muted); text-decoration:none; border-bottom:2px solid transparent; }
.subnav a.active { color:var(--ink); font-weight:600; border-bottom-color:var(--accent); }
.notice { font-size:11.5px; letter-spacing:.02em; color:#5b4a14; background:#f6f0de; border-bottom:1px solid #eadfbf; padding:3px 20px; }
@media (max-width:1100px) {
  .modnav { flex-direction:column; padding:0; }
  .modnav-toggle { display:block; } .modnav-toggle > summary { padding:8px 16px; cursor:pointer; }
  .modnav-list { display:none; flex-direction:column; }
  .modnav-toggle[open] + .modnav-list { display:flex; }
  .modnav-list > li > a, .admin-menu > summary { border-bottom:0; border-left:3px solid transparent; padding:8px 16px; }
  .modnav-list a.active, .admin-menu > summary.active { border-left-color:var(--accent); }
  .modnav-admin { margin-left:0; } .admin-menu ul { position:static; box-shadow:none; border:0; padding-left:12px; }
  .rig { display:none; }
}
@media (max-width:640px) { .opdate, .rigclock { display:none; } .appbar-top { padding:4px 12px; } main { padding:12px; } .urole { display:none; } }
main { max-width:1480px; margin:0 auto; padding:14px 24px 32px; }
footer { text-align:center; color:var(--muted); font-size:12px; padding:16px; }
.crumbs ol { list-style:none; display:flex; flex-wrap:wrap; gap:4px; margin:0 0 6px; padding:0; font-size:12.5px; color:var(--muted); }
.crumbs li + li::before { content:"›"; margin:0 6px 0 2px; color:#9aa5b1; }
.crumbs a { color:var(--muted); } .crumbs a:hover { color:var(--accent); }
h1 { font-size:20px; margin:4px 0 12px; font-weight:600; } h2 { font-size:16px; margin:22px 0 8px; } h3 { font-size:14px; margin:16px 0 6px; }
.page-head { display:flex; flex-wrap:wrap; align-items:baseline; gap:8px 16px; margin:4px 0 10px; }
.page-head h1 { margin:0; } .page-head .actions { margin:0 0 0 auto; }

/* Tables: dense, wrapping, never truncating */
table { width:100%; border-collapse:collapse; background:var(--card); margin:6px 0 12px; font-size:13.5px; }
th, td { border:1px solid var(--line2); padding:5px 8px; text-align:left; vertical-align:top; overflow-wrap:break-word; }
th { background:#eef1f4; font-weight:600; font-size:12.5px; color:#2f3b48; border-color:var(--line); }
tbody tr:hover td, table tr:hover > td { background-color:#fafcfe; }
td.num, th.num { text-align:right; font-variant-numeric:tabular-nums; }
.table-scroll { overflow-x:auto; max-width:100%; }
.empty { color:var(--muted); font-style:italic; }

/* Forms */
.card { background:var(--card); border:1px solid var(--line); border-radius:4px; padding:14px 16px; margin:10px 0; }
.narrow { max-width:380px; margin:40px auto; }
label { display:flex; flex-direction:column; gap:3px; font-size:12.5px; color:var(--muted); margin:6px 0; }
input, select, textarea { font:inherit; font-size:14px; padding:5px 8px; border:1px solid #c5ced8; border-radius:3px; color:var(--ink); background:#fff; }
input:focus, select:focus, textarea:focus { border-color:#2f7ed8; outline:2px solid rgba(47,126,216,.25); outline-offset:0; }
textarea { width:100%; min-height:4.6em; resize:vertical; line-height:1.45; white-space:pre-wrap; overflow-wrap:break-word;
           field-sizing:content; }
.row { display:flex; flex-wrap:wrap; gap:12px; } .row label { flex:1 1 200px; }
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:4px 10px; }
.grid.wide { grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); } table.form-values td:first-child { width:55%; }
fieldset { border:1px solid var(--line); border-radius:4px; margin:10px 0; padding:6px 12px 10px; }
legend { font-weight:600; font-size:13px; color:var(--ink); padding:0 4px; }
button, .button { font:inherit; font-size:13.5px; display:inline-block; padding:5px 12px; border:1px solid #bcc6d1; border-radius:3px;
                  background:#fff; color:var(--ink); cursor:pointer; text-decoration:none; line-height:1.4; }
button:hover, .button:hover { background:#f2f5f8; }
button.primary, .button.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
button.primary:hover, .button.primary:hover { background:#0c5ea9; }
button.danger { color:var(--bad); border-color:#e1b4b0; }
button.link { background:none; border:0; color:var(--accent); text-decoration:underline; padding:0 4px; }
form.inline { display:inline-flex; gap:6px; align-items:center; }
.actions { display:flex; flex-wrap:wrap; gap:6px; margin:8px 0; align-items:center; }
.filters { display:flex; flex-wrap:wrap; gap:6px 12px; align-items:flex-end; margin-bottom:8px; }
.filters label { margin:0; }
.flash { padding:7px 12px; border-radius:3px; margin:6px 0; border:1px solid; }
.flash.ok { background:#e9f5ed; border-color:#a8d5b6; } .flash.error { background:#fdecea; border-color:#f2b8b5; }
.flash.info { background:#eaf1fa; border-color:#b5cdf0; }

/* Status: one small label per record; provenance only on the record itself */
.status { display:inline-block; font-size:11.5px; line-height:1.5; padding:0 7px; border-radius:3px; background:#eceff3; color:#3b4652; white-space:nowrap; }
.status.draft { background:#eceff3; } .status.submitted { background:#fff2d1; color:var(--warn); }
.status.approved { background:#e0f2e6; color:var(--ok); } .status.void { background:#f6d9d7; color:var(--bad); }
.status.verified { background:#e3eefb; color:var(--accent); } .status.returned { background:#fde7d9; color:#9a4a00; }
.provenance { font-size:12px; color:#5b4a14; background:#f6f0de; border:1px solid #eadfbf; border-radius:3px; padding:0 6px; margin-left:6px; font-weight:400; }
.provenance.generated { color:#1d5d7a; background:#e2f0f7; border-color:#bfdcea; }
.tiles { display:flex; gap:0; flex-wrap:wrap; background:var(--card); border:1px solid var(--line); border-radius:4px; margin:6px 0 12px; }
.tile { flex:1 1 150px; padding:10px 16px; border-right:1px solid var(--line2); color:var(--ink); text-decoration:none; }
.tile:last-child { border-right:0; }
.tile b { display:block; font-size:22px; font-weight:600; } .tile span { color:var(--muted); font-size:12.5px; }
a.tile:hover { background:#f6f9fc; }
.tile-alert b { color:var(--bad); } .tile-alert { box-shadow:inset 0 3px 0 var(--bad); }
.warnings { background:#fff8e6; border:1px solid #efd593; padding:8px 12px; border-radius:3px; margin:8px 0; }
.warnings ul { margin:4px 0 0 18px; padding:0; }
.flags { display:flex; flex-wrap:wrap; gap:8px; } .flag { border:1px solid var(--line); padding:2px 8px; border-radius:3px; background:#fff; }
.flag.on, .alarm { color:var(--bad); font-weight:600; }
.muted { color:var(--muted); } .small { font-size:12px; }
.center { text-align:center; } table.checklist td input[type=text], table.checklist td input:not([type]) { width:100%; }
.prewrap { white-space:pre-wrap; overflow-wrap:break-word; }
.inline-check { flex-direction:row; align-items:center; gap:8px; }
td.exceed { background:#fdecea; color:var(--bad); font-weight:600; }
dl.facts { display:grid; grid-template-columns:max-content 1fr; gap:3px 16px; margin:6px 0; }
dl.facts dt { color:var(--muted); } dl.facts dd { margin:0; }
body.print { background:#fff; padding:16px; } body.print table { font-size:12px; }
@media print { .appbar, .actions, footer, .crumbs, .save-controls { display:none !important; } main { max-width:none; padding:0; } }

/* Shared persistence UI (_persist.html, _persist_status.html, moims.js) */
.persist { position:relative; font-size:13px; }
.persist > summary { list-style:none; cursor:pointer; padding:3px 10px; border-radius:3px; background:#24405c; color:#fff; }
.persist > summary::-webkit-details-marker { display:none; }
.persist-pill[data-level=ok] { background:#1d5b36; } .persist-pill[data-level=warn] { background:#7a4c00; }
.persist-pill[data-level=bad] { background:#8f1f18; } .persist-pill[data-level=busy] { background:#0b5cad; }
.persist-panel { position:absolute; right:0; top:30px; z-index:20; width:min(440px, 92vw); background:#fff; color:var(--ink);
                 border:1px solid var(--line); border-radius:6px; padding:10px 14px; box-shadow:0 6px 20px rgba(0,0,0,.18); }
.persist-panel dl { margin:0; display:grid; grid-template-columns:42% 1fr; gap:4px 10px; }
.persist-panel dt { color:var(--muted); } .persist-panel dd { margin:0; } .persist-panel a { color:var(--accent); }
.form-status { font-size:13px; color:var(--muted); }
.form-status[data-level=warn] { color:var(--warn); } .form-status[data-level=bad] { color:var(--bad); font-weight:600; }
.form-status[data-level=busy] { color:var(--accent); } .form-status[data-level=ok] { color:var(--ok); }
.save-controls { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:12px; }
.draft-banner { background:#e8f0fb; border:1px solid #b5cdf0; border-radius:4px; padding:8px 12px; margin:0 0 10px; }
.draft-banner .actions { margin:6px 0 0; }
.conflict { background:#fdecea; border:1px solid #f2b8b5; border-radius:4px; padding:8px 12px; margin:0 0 10px; }
.conflict .check, label.check { flex-direction:row; align-items:flex-start; gap:8px; color:var(--ink); }
details.op-section { background:var(--card); border:1px solid var(--line); border-radius:6px; margin:10px 0; }
details.op-section > summary { cursor:pointer; padding:10px 14px; display:flex; gap:10px; align-items:baseline; flex-wrap:wrap; }
details.op-section > summary .op-title { font-weight:600; } details.op-section > summary [data-section-status] { margin-left:auto; }
details.op-section > .op-body { padding:0 14px 14px; }
tr.alert-row td:first-child { border-left:4px solid var(--bad); }
/* DP watch check */
.slot-tabs { display:flex; gap:8px; flex-wrap:wrap; margin:10px 0; }
.slot-tab { display:flex; flex-direction:column; gap:2px; min-width:120px; padding:8px 12px; border:1px solid var(--line); border-radius:6px;
            background:var(--card); color:var(--ink); text-decoration:none; }
.slot-tab.current { border-color:var(--accent); box-shadow:inset 0 -3px 0 var(--accent); }
.warn { color:var(--warn); font-weight:600; }
.dpw-groups { display:grid; grid-template-columns:repeat(auto-fill, minmax(290px, 1fr)); gap:10px; }
fieldset.dpw-group { margin:0; padding:6px 10px 10px; background:#fafbfc; }
fieldset.dpw-group legend { font-weight:600; font-size:13px; padding:0 4px; }
.dpw-field { display:flex; flex-wrap:wrap; align-items:center; gap:4px 8px; margin:5px 0; }
.dpw-label { font-size:13px; color:var(--muted); min-width:92px; }
.dpw-field textarea { flex:1 1 100%; font-size:13px; }
.dpw-field input:not([type=radio]):not([type=checkbox]) { width:120px; }
.dpw-text input:not([type=radio]), .dpw-longtext textarea { flex:1 1 100%; width:auto !important; }
.dpw-field.is-notok { background:#fdecea; border-radius:4px; padding:2px 4px; }
.seg { display:inline-flex; flex-wrap:wrap; border:1px solid var(--line); border-radius:4px; overflow:hidden; }
.seg label { margin:0; flex-direction:row; color:var(--ink); font-size:13px; }
.seg input { position:absolute; opacity:0; width:1px; height:1px; }
.seg span { display:inline-block; padding:3px 9px; border-left:1px solid var(--line); cursor:pointer; background:#fff; }
.seg label:first-child span { border-left:0; }
.seg input:focus-visible + span { outline:2px solid var(--accent); outline-offset:-2px; }
.seg input:checked + span { background:var(--accent); color:#fff; }
.seg .seg-ok input:checked + span { background:var(--ok); }
.seg .seg-not_ok input:checked + span, .seg .seg-attn input:checked + span { background:var(--bad); }
.seg .seg-na input:checked + span { background:#6b7684; }
.seg .seg-clear input:checked + span { background:#eceff3; color:var(--muted); }
.seg input:disabled + span { cursor:default; opacity:.8; }
table.dpw-sheet { font-size:11px; table-layout:fixed; margin:6px 0 10px; }
table.dpw-sheet th, table.dpw-sheet td { text-align:center; padding:2px 3px; overflow-wrap:anywhere; }
table.dpw-sheet th { background:#dce6f1; font-weight:600; } table.dpw-sheet th.sub { font-weight:400; }
table.dpw-sheet th.slot-col { width:34px; }
table.dpw-sheet td.notok { background:#f6c9c5; font-weight:600; } table.dpw-sheet td.attn { background:#fce5b4; }
table.dpw-sheet td.na { background:#e7e7e7; }
table.dpw-sheet-head td { font-size:12px; }
@media print { table.dpw-sheet { page-break-inside:avoid; } }
/* Deck-log weather details (0.13.2) */
details.deck-weather { margin:8px 0; }
details.deck-weather > summary { cursor:pointer; color:var(--muted, #555); }
table.compact { width:auto; } table.compact th { text-align:left; padding-right:16px; font-weight:normal; color:var(--muted); background:none; }
/* 0.14.0: sectioned forms (deck log), exports, deck log tables */
.sf-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:2px 12px; }
.sf-grid.sf-wide, .sf-grid .sf-longtext { grid-column:1 / -1; }
.sf-grid.sf-wide { grid-template-columns:1fr; }
.sf .unit { color:#7b8592; font-size:11.5px; }
.sf input[readonly], .sf textarea[readonly] { background:#f6f8fa; color:#33404d; }
.two-col { display:grid; grid-template-columns:repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap:0 12px; }
.two-col > * { min-width:0; }
.two-col > .card { margin:10px 0; }
tr.test-drill td { color:var(--bad); } tr.test-drill td a { color:var(--bad); font-weight:600; }
table.deck-weather-table { font-size:12.5px; } table.deck-weather-table th { text-align:center; padding:4px 5px; }
table.deck-weather-table th.sub { font-weight:400; font-size:11.5px; background:#f4f6f8; }
table.deck-weather-table td { padding:3px 5px; white-space:nowrap; }
tr.empty-row td { color:#9aa5b1; background:#fbfcfd; }
table.compact-num { width:auto; min-width:min(640px, 100%); } table.compact-num th:first-child { text-align:left; }
.export-bar { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin:4px 0 8px; }
.export-bar label { flex-direction:row; align-items:center; gap:6px; margin:0; }
.origin-note { font-size:12px; color:#5b4a14; margin:2px 0 8px; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
textarea[data-autogrow-js] { overflow-y:hidden; resize:none; }
details.void-menu { display:inline-block; } details.void-menu > summary { cursor:pointer; color:var(--bad); font-size:13px; padding:5px 8px; list-style:none; }
details.void-menu[open] > summary { margin-bottom:4px; } details.void-menu input { min-width:260px; }
/* Phones: any wide table scrolls inside itself; the page never scrolls sideways */
@media (max-width:640px) { main table { display:block; max-width:100%; overflow-x:auto; } main .table-scroll > table { display:table; } }

/* 0.15.0: common period filter, registers, paging */
.period { border:1px solid var(--line); background:#f8fafb; padding:8px 12px; margin:8px 0 12px; border-radius:3px; }
.period-kinds { display:flex; gap:2px; margin-bottom:6px; flex-wrap:wrap; }
.period-kinds a { padding:3px 10px; border:1px solid var(--line); border-radius:3px; text-decoration:none; color:var(--muted); background:#fff; font-size:13px; }
.period-kinds a.active { color:var(--ink); font-weight:600; border-color:var(--accent); }
.period-nav { display:flex; flex-wrap:wrap; gap:6px 14px; align-items:center; margin:6px 0 0; }
.period-nav .current { font-weight:600; }
.period .bounds { margin:2px 0 0; }
.pager { display:flex; gap:10px; align-items:center; margin:8px 0; }
.export-links { display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin:6px 0; }
.counts { display:flex; flex-wrap:wrap; gap:4px 14px; font-size:13px; margin:4px 0; }
.chain { font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:12px; word-break:break-all; }
.filters select[multiple] { min-height:5.5em; }
.diff { font-size:12px; }
.diff del { background:#fdecea; text-decoration:line-through; }
.diff ins { background:#e9f5ed; text-decoration:none; }
