/* Rest Hours 1.1 design (owner's mock-up "New design for Rest Hours", ADR-108).
   Loaded after site.css. Everything is scoped to body.officer-ui, so the crew phone pages keep their own look.
   :where() keeps the specificity of the original site.css rules, so page-specific rules there still win. */

.officer-ui {
    --ink: #182b3d;
    --muted: #617083;
    --line: #dce3e9;
    --teal: #314fc0;          /* accent; the old name stays so every existing rule follows the new colour */
    --teal-hover: #253da0;
    --teal-soft: #eef2ff;
    --paper: #f4f6f8;
    --card: #ffffff;
    --success: #226147;
    --success-bg: #e9f3ed;
    --danger: #a73532;
    --danger-bg: #fbedeb;
    --warning: #85612c;
    --warning-bg: #faf2e3;
    --radius: 9px;
    --shadow: 0 6px 24px #182b3d0c;
    font-size: 14px;
    background: var(--paper);
    color: var(--ink);
}
:where(.officer-ui) a:focus-visible, :where(.officer-ui) button:focus-visible,
:where(.officer-ui) input:focus-visible, :where(.officer-ui) select:focus-visible,
:where(.officer-ui) textarea:focus-visible, :where(.officer-ui) summary:focus-visible {
    outline: 3px solid #7188e4; outline-offset: 3px;
}

/* ---------- Header ---------- */
.officer-ui .site-header { background: #fff; border-bottom: 1px solid var(--line); }
.officer-ui .header-inner {
    max-width: 1560px; min-height: 82px; padding: 12px 32px; gap: 32px;
    display: flex; align-items: center; justify-content: flex-start;
}
.officer-ui .brand { gap: 11px; font-size: 18px; font-weight: 600; letter-spacing: -.5px; min-width: 210px; color: var(--ink); }
.officer-ui .brand:hover { text-decoration: none; }
.officer-ui .brand small { font-size: 10px; font-weight: 400; letter-spacing: .045em; margin-top: 1px; }
.officer-ui .brand-mark { width: 42px; height: 42px; }
.officer-ui .brand-company { max-height: 44px; max-width: 180px; }
.officer-ui nav.main-nav { display: flex; gap: 8px; margin: 0 auto; }
.officer-ui nav.main-nav a {
    padding: 10px 20px; border-radius: 6px; color: var(--muted); font-weight: 500; font-size: 13px;
}
.officer-ui nav.main-nav a:hover { background: var(--paper); color: var(--ink); text-decoration: none; }
.officer-ui nav.main-nav a[aria-current="page"] { background: var(--teal-soft); color: var(--teal); font-weight: 500; }

/* Account menu under the name: Guide and Sign out live here (ADR-108). */
.account-menu { position: relative; min-width: 210px; display: flex; justify-content: flex-end; }
.account-menu > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 9px;
    padding: 5px 8px; border-radius: 8px; font-size: 12px; color: var(--ink);
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary::after { content: none; }
@media (max-width: 600px) { .officer-ui .account-menu[open] { flex-basis: auto; } }
.account-menu > summary:hover, .account-menu[open] > summary { background: var(--paper); }
.account-menu .account-name { display: flex; flex-direction: column; line-height: 1.3; text-align: left; }
.account-menu .account-name small { font-size: 10px; color: var(--muted); margin-top: 1px; }
.account-menu .account-caret { font-size: 10px; color: var(--muted); }
.avatar {
    width: 31px; height: 31px; border-radius: 50%; background: #edf0f5; color: #5b6d81;
    display: grid; place-items: center; font-size: 10px; font-weight: 600; flex-shrink: 0;
}
.account-panel {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; padding: 5px;
    background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 120;
}
.account-panel a { display: block; padding: 9px 11px; border-radius: 5px; font-size: 12px; color: var(--ink); white-space: nowrap; }
.account-panel a:hover { background: var(--teal-soft); color: var(--teal); text-decoration: none; }
.account-panel .account-sep { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }

/* ---------- Page frame ---------- */
.officer-ui .content { max-width: 1560px; padding: 28px 32px 36px; min-height: calc(100vh - 195px); }
.officer-ui .content.content-wide, .officer-ui .content:has(.workrest-workspace-grid) { max-width: 1560px; padding: 20px 32px 28px; }
.officer-ui .site-footer {
    max-width: 1560px; margin: 0 auto; padding: 20px 32px 24px; font-size: 10px; color: var(--muted);
    border-top: 1px solid var(--line);
}
.officer-ui .site-footer .footer-vessel strong { font-weight: 500; color: #43566a; }
body.officer-ui:has(.workrest-workspace-grid) .site-footer { padding: 10px 32px; }

.officer-ui h1 { font-weight: 600; letter-spacing: -1px; }
.officer-ui .page-header { margin-bottom: 24px; align-items: center; }
.officer-ui .page-header h1 { font-size: 29px; font-weight: 600; letter-spacing: -1px; line-height: 1.2; }
.officer-ui .page-header p { font-size: 13px; margin-top: 6px; max-width: 780px; }
.page-eyebrow { font-size: 10px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; margin-bottom: 9px; }
.officer-ui .page-header-actions { gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
:where(.officer-ui) .btn {
    min-height: 36px; padding: 7px 12px; border-radius: 6px; font-size: 12px; font-weight: 500; line-height: 1.4;
}
:where(.officer-ui) .btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
:where(.officer-ui) .btn-primary:hover { background: var(--teal-hover); border-color: var(--teal-hover); }
:where(.officer-ui) .btn-secondary { background: #fff; border-color: var(--line); color: var(--ink); }
:where(.officer-ui) .btn-secondary:hover { background: #f8f9fb; border-color: #c5d0da; }
:where(.officer-ui) .btn-danger { background: #fff; color: var(--danger); border-color: #e9cfcd; }
:where(.officer-ui) .btn-danger:hover { background: var(--danger-bg); }
:where(.officer-ui) .btn-sm { min-height: 29px; padding: 4px 9px; font-size: 11px; }
:where(.officer-ui) .btn-lg { min-height: 42px; padding: 9px 18px; font-size: 13px; }
:where(.officer-ui) .btn:active:not(:disabled) { transform: translateY(1px); }
:where(.officer-ui) .button { min-height: 36px; padding: 7px 12px; font-size: 12px; font-weight: 500; background: var(--teal); }

/* ---------- Forms ---------- */
:where(.officer-ui) .form-control, :where(.officer-ui) .form-select {
    min-height: 38px; padding: 8px 11px; font-size: 13px; border: 1px solid var(--line); border-radius: 6px;
}
:where(.officer-ui) .form-control:hover { border-color: #b9c6d3; }
:where(.officer-ui) .form-control:focus { border-color: var(--teal); box-shadow: 0 0 0 3px #314fc01f; }
:where(.officer-ui) .form-group label, :where(.officer-ui) .form-label { font-size: 12px; color: #53667b; font-weight: 500; }
:where(.officer-ui) .form-hint { font-size: 11px; }
:where(.officer-ui) input[type=checkbox], :where(.officer-ui) input[type=radio] { accent-color: var(--teal); }

/* ---------- Cards and tables ---------- */
:where(.officer-ui) .card, :where(.officer-ui) .table-card, :where(.officer-ui) .form-card,
:where(.officer-ui) .details-card, :where(.officer-ui) .filter-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none;
}
:where(.officer-ui) .filter-card { background: #fff; }
:where(.officer-ui) table { font-size: 12px; }
:where(.officer-ui) th {
    font-size: 10px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted);
    background: #fafbfc; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
:where(.officer-ui) td { padding: 12px 14px; border-bottom: 1px solid #edf0f3; }
:where(.officer-ui) tbody tr:hover { background: #fafbfe; }

/* ---------- Badges, notices ---------- */
:where(.officer-ui) .badge { padding: 3px 7px; border-radius: 4px; font-size: 10px; font-weight: 500; background: #edf1f5; color: #53667b; }
:where(.officer-ui) .badge-active, :where(.officer-ui) .badge-onboard { background: var(--success-bg); color: var(--success); border: 0; }
:where(.officer-ui) .badge-inactive, :where(.officer-ui) .badge-ashore { background: #edf1f5; color: #58647c; border: 0; }
:where(.officer-ui) .badge-planned { background: var(--warning-bg); color: var(--warning); }
:where(.officer-ui) .alert { border-radius: 6px; font-size: 12px; }
:where(.officer-ui) .alert-danger { background: var(--danger-bg); color: var(--danger); border-color: #e9cfcd; }
:where(.officer-ui) .alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #eedcb9; }
.status-banner { margin-bottom: 16px; padding: 10px 16px; background: var(--success-bg, #ecfdf5); color: var(--success, #065f46); border: 1px solid #cfe3d6; border-radius: 6px; font-weight: 500; font-size: 13px; }

/* Settings back link and organisation tabs: a quiet breadcrumb, not a second menu. */
:where(.officer-ui) .sub-nav { background: transparent; padding: 0; gap: 8px; align-items: center; font-size: 11px; margin-bottom: 18px; }
:where(.officer-ui) .sub-nav a { padding: 5px 10px; font-size: 12px; font-weight: 500; border-radius: 5px; }
:where(.officer-ui) .sub-nav a:first-child { padding-left: 0; }
:where(.officer-ui) .sub-nav a[aria-current="page"] { background: var(--teal-soft); color: var(--teal); box-shadow: none; }

/* ---------- Dialogs ---------- */
:where(.officer-ui) dialog { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 80px #182b3d33; }
:where(.officer-ui) dialog::backdrop { background: #182b3d66; }

/* ---------- Narrow screens ---------- */
@media (max-width: 1100px) {
    .officer-ui .header-inner { gap: 16px; padding-left: 24px; padding-right: 24px; }
    .officer-ui .brand, .account-menu { min-width: 175px; }
    .officer-ui nav.main-nav a { padding-left: 16px; padding-right: 16px; }
    .officer-ui .content { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 850px) {
    .account-menu { min-width: 0; }
    .account-menu .account-name, .account-menu .account-caret { display: none; }
    .officer-ui .brand { min-width: 0; }
}
@media (max-width: 600px) {
    .officer-ui .header-inner { padding: 12px 16px; gap: 12px; min-height: 72px; flex-wrap: wrap; }
    .officer-ui .brand { font-size: 17px; gap: 8px; }
    .officer-ui .brand-mark { width: 35px; height: 35px; }
    .account-menu { margin-left: auto; order: 2; }
    .officer-ui nav.main-nav { order: 3; width: 100%; margin: 2px 0 -4px; justify-content: space-between; gap: 6px; }
    .officer-ui nav.main-nav a { flex: 1; text-align: center; padding: 8px 14px; font-size: 12px; }
    .officer-ui .content { padding: 22px 16px 28px; }
    .officer-ui .page-header h1 { font-size: 26px; }
}
@media print { .account-menu { display: none; } }

/* ========== Hours overview (mock-up "Hours", Compact / Days) ========== */
.officer-ui .hov { background: transparent; border: 0; border-radius: 0; padding: 0; }
.officer-ui .hov .month-message { margin-bottom: 14px; }
.officer-ui .hov-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.officer-ui .hov-title { font-size: 29px; font-weight: 600; letter-spacing: -1px; line-height: 1.2; margin: 0; }
.officer-ui .hov-subtitle { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.officer-ui .hov-month { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.officer-ui .hov-month strong { min-width: 120px; text-align: center; font-size: 13px; font-weight: 600; }
.officer-ui .hov-month .hov-step { width: 36px; min-width: 36px; padding: 6px; font-size: 18px; font-weight: 400; }
.officer-ui .hov-month .btn { padding-top: 6px; padding-bottom: 6px; }
.officer-ui .month-closed-box { font-size: 12px; color: var(--muted); padding: 6px 10px; background: #edf0f8; border-radius: 6px; }

.officer-ui .hov-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.hov-search-wrap { flex: 1; min-width: 180px; position: relative; display: block; }
.hov-search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-52%); color: #8994a1; font-size: 15px; pointer-events: none; }
.officer-ui .hov-search { width: 100%; min-height: 38px; padding: 8px 11px 8px 32px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff; }
.officer-ui .hov-search:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px #314fc01f; }
.officer-ui .hov-dept-filter { min-height: 38px; min-width: 160px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; background: #fff; }
.officer-ui .hov-views { display: inline-flex; gap: 3px; padding: 3px; background: #e8edf2; border: 0; border-radius: 7px; overflow: visible; flex-shrink: 0; }
.officer-ui .hov-view { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; padding: 6px 13px; min-height: 30px; border-radius: 5px; }
.officer-ui .hov-view + .hov-view { border-left: 0; }
.officer-ui .hov-view.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #182b3d0d; }

.officer-ui .hov-line2 { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 16px; margin: 0 0 18px; }
.officer-ui .hov-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.officer-ui .hov-filter { border: 0; background: none; border-radius: 5px; padding: 7px 10px; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.officer-ui .hov-filter:hover { background: #e9edf2; }
.officer-ui .hov-filter.is-active { background: #e8eefc; color: var(--teal); }
.officer-ui .hov-filter b { font-size: 11px; font-weight: 500; opacity: .85; }
.officer-ui .hov-line2-note { margin-left: auto; font-size: 11px; color: var(--muted); }

/* Compact: two cards per row, three on wide screens; each card shows the month as one thin strip. */
.officer-ui .hcv-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.officer-ui .hcv-item { min-width: 0; }
.officer-ui .hcv-card {
    display: block; background: #fff; border: 1px solid var(--line);
    padding: 20px 22px 22px; border-radius: 12px; min-width: 0; transition: border-color 140ms, box-shadow 140ms; color: var(--ink);
}
.officer-ui .hcv-card:hover { border-color: #b9c7df; box-shadow: 0 2px 9px #182b3d08; text-decoration: none; }
.hcv-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.officer-ui .hcv-no { font-size: 13px; font-variant-numeric: tabular-nums; color: #8090a1; min-width: 26px; font-weight: 400; }
.officer-ui .hcv-who { display: flex; flex-direction: column; min-width: 0; }
.hcv-name { font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.hcv-name:hover { color: var(--teal); }
.officer-ui .hcv-who small { font-size: 13px; color: #617083; margin-top: 3px; }
.officer-ui .hcv-who small span { color: #8a97a6; }
.hcv-status { margin-left: auto; text-align: right; flex-shrink: 0; line-height: 1.3; }
.officer-ui .hcv-count { display: block; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.officer-ui .hcv-count span { font-size: 15px; color: var(--muted); font-weight: 400; }
.hcv-state { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.is-bad .hcv-state { color: var(--danger); }
.is-ok .hcv-state { color: var(--success); }
.is-part .hcv-state { color: var(--muted); }
.hcv-strip { display: grid; grid-template-columns: repeat(var(--days, 31), minmax(0, 1fr)); gap: 4px; margin: 26px 0 0; }
.hcv-day { display: block; min-width: 0; height: 11px; border-radius: 2px; background: #dfe3ea; }
.hcv-day[data-status=ok] { background: #9dbfa9; }
.hcv-day[data-status=issue] { background: #c96963; }
.hcv-day[data-status=offboard], .hcv-day[data-status=future] { background: #d6e1da; }
a.hcv-day:hover { outline: 2px solid var(--teal); outline-offset: 1px; filter: brightness(.95); position: relative; z-index: 1; }
a.hcv-day:focus-visible { outline-offset: 1px; position: relative; z-index: 2; }

/* Days: the whole month, one small square per day with the hours worked. */
.officer-ui .hov-scroll { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); max-height: calc(100vh - 300px); }
.officer-ui .hov-table { font-size: 12px; }
.officer-ui .hov-table thead th { background: #fafbfc; font-size: 10px; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; padding: 9px 3px; }
.officer-ui .hov-table thead .hov-name-h { padding-left: 14px; font-size: 10px; }
.officer-ui .hov-name-h, .officer-ui .hov-name { min-width: 175px; padding: 6px 12px 6px 14px; border-right: 1px solid #edf0f3; }
.officer-ui .hov-name a { font-weight: 500; font-size: 12px; }
.officer-ui .hov-rank { font-size: 10px; }
.officer-ui .hov-no { font-size: 10px; color: #8090a1; float: left; min-width: 18px; margin-top: 2px; }
.officer-ui .hov-day-h { min-width: 28px; }
.officer-ui .hov-day-h .n { font-size: 10px; font-weight: 500; color: var(--ink); }
.officer-ui .hov-day-h .w { font-size: 9px; }
.officer-ui .hov-day-h.is-today { background: var(--teal-soft); color: var(--teal); }
.officer-ui .hov-day-h.is-today .n { color: var(--teal); }
.officer-ui .hov-day-h.is-today .w { color: var(--teal); }
.officer-ui .hov-dept th { background: #f7f9fb; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .08em; padding: 6px 14px; }
.officer-ui .hov-row > * { border-bottom: 1px solid #edf0f3; }
.officer-ui .hov-row:hover .hov-name, .officer-ui .hov-row:hover { background: #fafbfe; }
.officer-ui .hov-cell { padding: 3px 2px; height: 34px; }
.officer-ui .hov-cell a { height: 28px; min-width: 24px; border: 0; border-radius: 3px; font-size: 10px; font-weight: 500; }
.officer-ui .hov-cell.is-ok a { background: #b5d1be; color: #244231; }
.officer-ui .hov-cell.is-bad a { background: #c96963; color: #fff; }
.officer-ui .hov-cell.is-empty a { background: #dce2e8; color: #5f7083; }
.officer-ui .hov-cell .hov-out, .officer-ui .hov-cell.is-future::after {
    border: 0; border-radius: 3px; height: 28px; min-width: 24px;
    background: repeating-linear-gradient(135deg, #f0f3f6, #f0f3f6 3px, #dce2e8 3px, #dce2e8 4px);
}
.officer-ui .hov-cell.is-future::after { content: ""; display: block; opacity: .6; }
.officer-ui .hov-cell a:hover { outline: 2px solid var(--teal); outline-offset: 1px; }
.officer-ui .hov-filled-h, .officer-ui .hov-filled { padding: 6px 12px; text-align: right; font-variant-numeric: tabular-nums; font-size: 11px; color: var(--muted); white-space: nowrap; }

.officer-ui .hov-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; font-size: 11px; color: var(--muted); margin: 16px 0 0; }
.officer-ui .hov-legend i { width: 9px; height: 9px; border-radius: 2px; border: 0; }
.officer-ui .hov-legend i.is-ok { background: #b5d1be; border: 0; }
.officer-ui .hov-legend i.is-bad { background: #c96963; border: 0; }
.officer-ui .hov-legend i.is-empty { background: #dce2e8; border: 0; }
.officer-ui .hov-legend i.is-out { background: repeating-linear-gradient(135deg, #f0f3f6, #f0f3f6 2px, #c9d2db 2px, #c9d2db 3px); border: 0; }
.officer-ui .hov-empty { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 48px 24px; }
.officer-ui .hov-nomatch { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 32px 24px; text-align: center; }

@media (min-width: 1380px) {
    .officer-ui .hcv-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
    .hcv-strip { gap: 2px; }
    .officer-ui .hov-line2-note { margin-left: 0; }
}
@media (max-width: 700px) {
    .officer-ui .hcv-list { grid-template-columns: 1fr; }
}

/* ========== Seafarer month editor (mock-up "editor"): same page and behaviour, new look ========== */
.officer-ui .workrest-workspace-grid { gap: 18px; grid-template-columns: 236px minmax(0, 1fr); }
.officer-ui .workrest-sidebar-card,
.officer-ui .workrest-particulars-card,
.officer-ui .workrest-month-card,
.officer-ui .workrest-day-card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.officer-ui .workrest-main-column { gap: 14px; }

/* Crew list */
.officer-ui .workrest-back-overview { font-size: 12px; font-weight: 500; }
.officer-ui .workrest-search-input { border: 1px solid var(--line); border-radius: 6px; font-size: 12px; min-height: 34px; }
.officer-ui .workrest-sidebar-header { font-size: 10px; letter-spacing: .1em; color: var(--muted); }
.officer-ui .workrest-crew-item { min-height: 44px; border-left: 3px solid transparent; border-bottom: 1px solid #f0f3f6; border-radius: 0; }
.officer-ui .workrest-crew-item:hover { background: #f6f8fc; }
.officer-ui .workrest-crew-item.active { background: var(--teal-soft); border-left: 3px solid var(--teal); }
.officer-ui .workrest-crew-item.active:hover { background: #e4eaff; }
.officer-ui .workrest-crew-item .crew-name { font-size: 12px; font-weight: 600; color: var(--ink); }
.officer-ui .workrest-crew-item.active .crew-name { color: var(--teal); font-weight: 600; }
.officer-ui .workrest-crew-item .crew-rank { font-size: 10.5px; color: var(--muted); }
.officer-ui .workrest-crew-item.active .crew-rank { color: #4a5f9e; }

/* Header of the person */
.officer-ui .workrest-particulars-card { padding: 16px 18px; }
.officer-ui .particulars-seafarer-name { font-size: 20px; font-weight: 600; letter-spacing: -.5px; }
.officer-ui .particulars-rank-badge { font-size: 10px; font-weight: 500; background: #edf1f5; color: #53667b; border: 0; padding: 3px 7px; }
.officer-ui .particulars-meta-row { font-size: 12px; }
.officer-ui .particulars-meta-row strong { font-weight: 500; }
.officer-ui .wk-label { font-size: 12px; }
.officer-ui .wk-segmented-control { border: 0; background: #e8edf2; padding: 3px; border-radius: 7px; gap: 3px; }
.officer-ui .wk-btn { border: 0; border-radius: 5px; font-size: 11px; font-weight: 500; }

/* Month card and table */
.officer-ui .workrest-month-card, .officer-ui .workrest-day-card { padding: 14px 18px; }
.officer-ui .workrest-card-title { font-size: 15px; font-weight: 600; }
.officer-ui .workrest-card-subtitle { font-size: 11px; }
.officer-ui .workrest-table-container { border: 0; border-radius: 0; }
.officer-ui .workrest-month-table { font-size: 11px; }
.officer-ui .workrest-month-table thead th {
    background: #fff; font-size: 9px; font-weight: 500; text-transform: none; letter-spacing: 0;
    color: var(--muted); border-bottom: 1px solid var(--line);
}
.officer-ui .workrest-hours-header { font-size: 9px; font-weight: 500; }
.officer-ui .workrest-hours-header span { border-right: 0; }
.officer-ui .workrest-day-row { border-bottom: 0; }
.officer-ui .workrest-day-row td { padding: 2px 6px; }
.officer-ui .workrest-day-row:hover { background: #f6f8fc; }
.officer-ui .workrest-day-row.selected-row { background: var(--teal-soft) !important; }
.officer-ui .td-w-date { font-weight: 600; }
.officer-ui .td-w-work { color: var(--ink); font-weight: 500; }
.officer-ui .workrest-day-row.selected-row .td-w-date, .officer-ui .workrest-day-row.selected-row .td-w-day { color: var(--teal); }
.officer-ui .workrest-day-row:focus-visible { outline: 2px solid #7188e4; }

/* Timelines: separate half-hour blocks with thin white gaps, a wider gap every 6 hours (as in the mock-up). */
.officer-ui .workrest-row-timeline { height: 16px; border: 0; border-radius: 2px; background: #fff; }
.officer-ui .w-slot, .officer-ui .day-interactive-slot { border-right: 1px solid #fff; }
.officer-ui .w-slot:nth-child(2n), .officer-ui .day-interactive-slot:nth-child(2n) { border-right: 1px solid #fff; }
.officer-ui .w-slot:nth-child(12n), .officer-ui .day-interactive-slot:nth-child(12n) { border-right: 3px solid #fff; }
.officer-ui .w-slot:last-child, .officer-ui .day-interactive-slot:last-child { border-right: 0; }
.officer-ui .w-slot.slot-rest, .officer-ui .day-interactive-slot.slot-rest { background-color: #e7ecf1; }
.officer-ui .w-slot.slot-work, .officer-ui .day-interactive-slot.slot-work { background-color: var(--teal); }
.officer-ui .w-slot.slot-unknown, .officer-ui .day-interactive-slot.slot-unknown { background-color: #d5dce4; }
.officer-ui .w-slot.slot-outside, .officer-ui .day-interactive-slot.slot-outside {
    background: repeating-linear-gradient(135deg, #f1f3f6, #f1f3f6 2px, #dce2e8 2px, #dce2e8 3px);
}
.officer-ui .day-interactive-slot.slot-work:hover { background-color: #8295dc; }
.officer-ui .day-interactive-slot.slot-rest:hover { background-color: #c9d4f3; }
.officer-ui .day-interactive-slot.slot-unknown:hover { background-color: #c3ccd6; }
.officer-ui .day-total-val-work { color: var(--teal); }
.officer-ui .swatch-box-work { background-color: var(--teal); border-color: var(--teal); }

/* ========== Settings: one quiet list, state on the right (owner 2026-11-01: no cards) ========== */
.set-page { max-width: 920px; }
.officer-ui .set-heading { text-align: left; margin-bottom: 24px; }
.officer-ui .set-heading h1 { font-size: 29px; font-weight: 600; letter-spacing: -1px; text-transform: none; margin: 0; }
.officer-ui .set-heading p { font-size: 13px; margin-top: 6px; }
.set-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 0 8px; }
.set-group { padding: 0; }
.set-group + .set-group { border-top: 1px solid var(--line); margin-top: 4px; }
.officer-ui .set-group-title {
    margin: 0; padding: 18px 22px 6px; text-align: left; text-transform: none;
    font-size: 12px; font-weight: 600; letter-spacing: 0; color: var(--ink);
}
.set-group-title span { color: #8090a1; font-weight: 400; font-variant-numeric: tabular-nums; margin-right: 10px; }
.officer-ui .settings-link.set-row {
    display: flex; flex-direction: row; align-items: center; gap: 16px;
    padding: 13px 22px; margin: 0; border: 0; border-radius: 0; background: transparent;
    border-bottom: 1px solid #f0f3f6; color: var(--ink); text-decoration: none; width: 100%; text-align: left;
}
.set-group .set-row:last-child, .set-group .settings-stop:last-child .set-row { border-bottom: 0; }
.officer-ui .settings-link.set-row:hover { background: #f8f9fc; }
.officer-ui .settings-link.set-row:hover strong { color: var(--teal); }
.officer-ui .settings-link.set-row:focus-visible { outline: 3px solid #7188e4; outline-offset: -3px; }
.set-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.officer-ui .set-row .set-text strong { font-size: 13px; font-weight: 600; color: inherit; }
.officer-ui .set-row .set-text small { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.officer-ui .set-row .set-value { flex-shrink: 0; font-size: 12px; color: var(--muted); text-align: right; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.officer-ui .set-row .set-go { flex-shrink: 0; width: 14px; text-align: center; font-size: 16px; color: #a3aebb; }
.officer-ui .set-row-danger strong { color: var(--danger); }
/* On / off state shown as a switch on the right; the switch itself is changed on its own page. */
.set-state { display: inline-block; width: 34px; height: 20px; border-radius: 999px; background: #d5dce4; position: relative; vertical-align: middle; }
.set-state i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #182b3d33; transition: left 140ms; }
.set-state.is-on { background: var(--teal); }
.set-state.is-on i { left: 16px; }
@media (max-width: 600px) {
    .officer-ui .settings-link.set-row { padding: 12px 16px; gap: 10px; }
    .officer-ui .set-group-title { padding-left: 16px; }
    .officer-ui .set-row .set-value { max-width: 34%; }
}

/* ---------- Month on top, Day Editor under it as one 24-hour strip ---------- */
.officer-ui .wr-stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.officer-ui .wr-stack .workrest-day-card .workrest-card-header { align-items: center; flex-wrap: wrap; gap: 10px; }
.officer-ui .wr-stack #selectedDayTitleText { color: var(--ink) !important; font-weight: 600; }
.officer-ui .wr-stack .workrest-day-actions { flex-wrap: wrap; gap: 6px; }
.officer-ui .wr-stack .workrest-day-actions .day-nav-btn { width: 32px; min-width: 32px; padding: 4px; }
.officer-ui .wr-stack .day-timeline-box { background: #fff; border: 0; padding: 0; gap: 18px; }
.officer-ui .wr-stack .day-hour-markers { font-size: 10px; font-weight: 500; color: var(--muted); }
.officer-ui .wr-stack .day-hour-markers span { border-right: 0; }
.officer-ui .wr-stack .day-slots-48 { height: 34px; border: 0; border-radius: 4px; background: #fff; }
.officer-ui .wr-stack .day-interactive-slot.slot-unknown { background: #d5dce4; }
.officer-ui .wr-stack .day-totals-summary-box { border-left: 1px solid var(--line); padding-left: 18px; min-width: 120px; }
.officer-ui .wr-stack .day-total-lbl { font-size: 10px; font-weight: 500; letter-spacing: .06em; }
.officer-ui .wr-stack .day-total-val { font-size: 17px; font-weight: 600; }
.officer-ui .wr-stack .day-total-val-rest { color: var(--success); }
.officer-ui .wr-stack .workrest-bottom-row { border-top: 1px solid #edf0f3; padding-top: 10px; }
.officer-ui .wr-stack .day-comment-input { border: 1px solid var(--line); border-radius: 6px; min-height: 32px; }

/* Crew list in the editor: running number before the name */
.officer-ui .crew-item-no { flex: 0 0 20px; font-size: 10px; color: #8090a1; font-variant-numeric: tabular-nums; text-align: right; margin-right: 2px; align-self: flex-start; padding-top: 2px; }
.officer-ui .workrest-crew-item { justify-content: flex-start; }
.officer-ui .workrest-crew-item .roster-attention-dot { margin-left: auto; }


/* ========== Crew list (mock-up "crew") ========== */
.officer-ui .crew-filter { padding: 14px 16px; }
.officer-ui .crew-filter label { font-size: 10px; font-weight: 500; letter-spacing: .06em; color: var(--muted); }
/* "Hours" in each row: a quiet link-button, the blue fill stays for the main actions above the list. */
.officer-ui td .btn-primary.btn-sm[href*="/WorkRest"] { background: #fff; color: var(--teal); border-color: var(--line); }
.officer-ui td .btn-primary.btn-sm[href*="/WorkRest"]:hover { background: var(--teal-soft); border-color: #bbc8ee; }
.officer-ui td .btn-primary.btn-sm[href*="/WorkRest"]::after { content: " ↗"; font-size: 10px; }
.officer-ui .crew-no, .officer-ui td.crew-no { color: #8090a1; font-variant-numeric: tabular-nums; }

/* Crew header and one filter row, as in the mock-up */
.officer-ui .crew-page-header { align-items: center; margin-bottom: 22px; }
.officer-ui .crew-page-header p a { margin-left: 4px; }
.officer-ui .crew-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 18px;
    background: transparent; border: 0; padding: 0; box-shadow: none;
}
.crew-tabs { display: inline-flex; gap: 3px; padding: 3px; background: #e8edf2; border-radius: 7px; flex-shrink: 0; }
.crew-tabs a { padding: 7px 14px; border-radius: 5px; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.crew-tabs a:hover { color: var(--ink); text-decoration: none; }
.crew-tabs a[aria-current="page"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #182b3d0d; }
.crew-tabs .tab-count { font-size: 11px; color: #8994a1; margin-left: 5px; font-variant-numeric: tabular-nums; }
.crew-search { flex: 1; min-width: 200px; position: relative; display: block; margin: 0; }
.crew-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-52%); color: #8994a1; font-size: 15px; pointer-events: none; }
.officer-ui .crew-search input {
    width: 100%; min-height: 40px; padding: 8px 12px 8px 34px; font-size: 13px;
    border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink);
}
.officer-ui .crew-search input:focus, .officer-ui .crew-select:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px #314fc01f; }
.officer-ui .crew-select { min-height: 40px; min-width: 170px; padding: 8px 12px; font-size: 13px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.visually-hidden-submit { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.crew-bar-more { flex-basis: 100%; display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-top: -4px; }
.officer-ui .crew-bar-more .filter-more { border: 0; padding: 0; margin: 0; background: transparent; }
.officer-ui .crew-bar-more .filter-more-summary { font-size: 12px; color: var(--muted); padding: 0; }
.officer-ui .crew-bar-more .filter-more[open] { flex-basis: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.officer-ui .crew-bar-more .btn-reset { font-size: 12px; }
/* Table: left-aligned columns like the mock-up */
.officer-ui .crew-table th, .officer-ui .crew-table td { text-align: left; }
.officer-ui .crew-table th.actions-cell, .officer-ui .crew-table td.actions-cell { text-align: right; }
.officer-ui .crew-table .sort-header { color: var(--muted); font-weight: 500; font-size: 10px; }
.officer-ui .crew-table .crew-name-link { color: var(--ink); font-weight: 600; font-size: 13px; }
.officer-ui .crew-table .rank-title { font-weight: 400; color: var(--ink); }
@media (max-width: 700px) {
    .crew-tabs { flex-wrap: wrap; }
    .officer-ui .crew-select { flex: 1; }
}
.crew-since { font-size: 10px; color: var(--muted); margin-top: 4px; line-height: 1.4; }
.officer-ui .crew-table .action-menu > summary { min-width: 30px; padding: 3px 8px; font-size: 14px; letter-spacing: 1px; color: var(--muted); border-color: transparent; background: transparent; }
.officer-ui .crew-table .action-menu > summary:hover, .officer-ui .crew-table .action-menu[open] > summary { background: #edf1f5; color: var(--ink); }
.officer-ui .crew-table td .btn-primary.btn-sm[href*="/WorkRest"] { border-color: transparent; background: transparent; font-weight: 600; color: var(--ink); }
.officer-ui .crew-table td .btn-primary.btn-sm[href*="/WorkRest"]:hover { background: var(--teal-soft); color: var(--teal); }

/* ========== Settings shell: sections on the left, the chosen section on the right (owner 2026-11-01) ========== */
.set-shell { max-width: none; }
.set-shell-heading { margin-bottom: 26px; }
.set-shell-title { display: block; font-size: 29px; font-weight: 600; letter-spacing: -1px; line-height: 1.2; color: var(--ink); }
.set-shell-heading p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.set-shell-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }

.set-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.set-nav a { display: block; padding: 11px 14px; border-radius: 7px; font-size: 13px; color: var(--muted); text-decoration: none; transition: background-color 120ms, color 120ms; }
.set-nav a:hover { background: #e9edf3; color: var(--ink); text-decoration: none; }
.set-nav a[aria-current="page"] { background: #e8eefc; color: var(--teal); font-weight: 500; }

/* The right side: one white sheet. Whatever the section page draws inside sits on it without boxes of its own. */
.set-content {
    min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px;
    padding: 30px 34px 34px; box-shadow: 0 1px 2px #182b3d08;
}
.set-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: -8px 0 26px; flex-wrap: wrap; }
.set-tabs a { padding: 10px 0 12px; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.set-tabs a:hover { color: var(--ink); text-decoration: none; }
.set-tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--teal); }

/* Headings: page title, then section titles; inline sizes from the older pages give way. */
.set-content h1, .set-content .page-header h1, .set-content .records-header h1 { font-size: 22px !important; font-weight: 600 !important; letter-spacing: -.5px !important; margin: 0 0 6px !important; color: var(--ink) !important; text-transform: none !important; }
.set-content h2 { font-size: 16px !important; font-weight: 600 !important; letter-spacing: -.2px !important; color: var(--ink) !important; margin: 26px 0 10px !important; }
.set-content > :first-child h2:first-child, .set-content > .card:first-child > div:first-child > h2,
.set-content > .set-tabs + * h2:first-child { font-size: 22px !important; letter-spacing: -.5px !important; margin-top: 0 !important; }
.set-content h3 { font-size: 13px !important; font-weight: 600 !important; color: var(--ink) !important; margin: 22px 0 8px !important; }
.set-content p, .set-content .lead { font-size: 13px; line-height: 1.6; color: var(--muted); }
.set-content > :first-child p:first-of-type, .set-content .page-header p, .set-content .lead { margin-bottom: 4px; }
.set-content .page-header { margin-bottom: 18px; align-items: flex-start; }
.set-content .page-header-actions { margin-left: auto; }

/* Boxes from the older pages become plain sections, separated by a thin line. */
.set-content :is(.card, .table-card, .form-card, .filter-card, .details-card, .status-panel, .reliability-container) {
    border: 0 !important; box-shadow: none !important; border-radius: 0 !important; background: transparent !important;
    padding: 0 !important; max-width: none !important; margin: 0 !important;
}
.set-content :is(.card, .form-card, .status-panel) + :is(.card, .form-card, .status-panel, .table-card) { border-top: 1px solid var(--line) !important; margin-top: 28px !important; padding-top: 26px !important; }
.set-content .table-card, .set-content .table-wrap { border: 1px solid var(--line) !important; border-radius: 9px !important; overflow-x: auto; margin-top: 8px !important; }
.set-content .filter-card { margin-bottom: 16px !important; }

/* Form fields */
.set-content label { color: var(--ink); }
.set-content .form-group { margin-bottom: 16px; }
.set-content .form-group > label, .set-content form label[style*="font-weight: 600"] { font-size: 12px !important; font-weight: 500 !important; color: #53667b !important; }
.set-content .form-control, .set-content select, .set-content input[type=text], .set-content input[type=number], .set-content input[type=date], .set-content textarea {
    border: 1px solid var(--line) !important; border-radius: 7px !important; min-height: 40px; font-size: 13px !important; background: #fff;
}
.set-content .form-control:focus, .set-content select:focus, .set-content input:focus { border-color: var(--teal) !important; box-shadow: 0 0 0 3px #314fc01f !important; outline: none; }
.set-content .form-hint, .set-content small, .set-content .muted { color: var(--muted) !important; }
.set-content .form-actions, .set-content form > div:last-child:has(> .btn-primary) { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 18px; display: flex; gap: 8px; justify-content: flex-end; }

/* Choice cards (print template etc.): blue when chosen. */
.set-content .template-options label { border: 1px solid var(--line) !important; background: #fff !important; border-radius: 9px !important; padding: 14px 16px !important; transition: border-color 120ms, background-color 120ms; }
.set-content .template-options label:hover { border-color: #b9c7df !important; }
.set-content .template-options label:has(input:checked) { border-color: #8da0e4 !important; background: #f3f6ff !important; }
.set-content input[type=radio] { accent-color: var(--teal); width: 16px; height: 16px; }

/* On / off settings: the text on the left, a switch on the right. */
.set-content .portal-switch, .set-content .form-check,
.set-content label:has(> input[type=checkbox][name="SettingsInput.AutoBackupEnabled"]) {
    display: flex !important; flex-direction: row-reverse; justify-content: space-between; align-items: center !important;
    gap: 16px !important; padding: 14px 0; margin: 0 0 8px !important; border-bottom: 1px solid #edf0f3; cursor: pointer; font-weight: 500 !important;
}
.set-content .portal-switch > input[type=checkbox], .set-content .form-check > input[type=checkbox],
.set-content input[type=checkbox][name="SettingsInput.AutoBackupEnabled"] {
    appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 40px !important; height: 23px !important; margin: 0 !important;
    border-radius: 999px; background: #d5dce4; position: relative; cursor: pointer; transition: background-color 140ms;
}
.set-content .portal-switch > input[type=checkbox]::after, .set-content .form-check > input[type=checkbox]::after,
.set-content input[type=checkbox][name="SettingsInput.AutoBackupEnabled"]::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 2px #182b3d40; transition: left 140ms;
}
.set-content .portal-switch > input:checked, .set-content .form-check > input:checked,
.set-content input[type=checkbox][name="SettingsInput.AutoBackupEnabled"]:checked { background: var(--teal); }
.set-content .portal-switch > input:checked::after, .set-content .form-check > input:checked::after,
.set-content input[type=checkbox][name="SettingsInput.AutoBackupEnabled"]:checked::after { left: 19px; }
.set-content .portal-switch > input:disabled, .set-content .form-check > input:disabled { opacity: .5; cursor: not-allowed; }
.set-content .du-right:has(input:checked) { background: #f3f6ff; border-color: #8da0e4; }
.set-content .du-right-icon { background: #edf1f5; }

/* Tables inside the sheet */
.set-content table { font-size: 12px; }
.set-content th { background: #fafbfc; }

/* "System & help" page and other short lists of links */
.set-panel { margin: 0; }
.set-panel-head { margin-bottom: 18px; }
.set-panel-head p { margin: 0; }
.set-rows { border-top: 1px solid var(--line); }
.officer-ui .set-rows .settings-link.set-row { padding: 15px 4px; }
.officer-ui .set-rows .settings-link.set-row:hover { background: #f8f9fc; }

/* Status page inside the sheet */
.set-content .status-panel dl.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 16px 0; border-top: 1px solid var(--line); }
.set-content .status-panel dl.details > div { padding: 12px 0; border-bottom: 1px solid #edf0f3; }
.set-content .status-panel dt { font-size: 11px; color: var(--muted); }
.set-content .status-panel dd { margin: 2px 0 0; font-size: 13px; color: var(--ink); }

@media (max-width: 900px) {
    .set-shell-grid { grid-template-columns: 1fr; gap: 14px; }
    .set-nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
    .set-nav a { white-space: nowrap; padding: 8px 12px; }
    .set-content { padding: 22px 18px 24px; }
}

.set-content .btn { white-space: nowrap; }

/* Vessel details as a sheet (one vessel) */
.vessel-sheet { border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; margin-top: 6px; }
.vessel-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid #edf0f3; }
.vessel-sheet-kicker { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.vessel-sheet-name { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.4px; color: var(--ink); }
.vessel-sheet-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 24px; margin: 20px 0 0; }
.vessel-sheet-grid dt { font-size: 11px; color: var(--muted); }
.vessel-sheet-grid dd { margin: 4px 0 0; font-size: 14px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.vessel-sheet-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px solid #edf0f3; }
.vessel-sheet-quiet { display: inline-flex; gap: 14px; align-items: center; font-size: 12px; }
.vessel-sheet-note { margin: 18px 0 0; }
@media (max-width: 900px) { .vessel-sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Filter rows inside the sheet: fields side by side, labels small */
.set-content .filter-bar { background: #f8f9fb !important; border: 1px solid #edf0f3 !important; border-radius: 9px !important; padding: 14px 16px !important; }
.set-content .filter-row, .set-content .filter-main-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.set-content .filter-row .filter-group, .set-content .filter-main-row .filter-group { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.set-content .filter-row .filter-search, .set-content .filter-main-row .filter-search { flex: 2 1 260px; }
.set-content .filter-group label { font-size: 10px !important; font-weight: 500 !important; letter-spacing: .06em; text-transform: uppercase; color: var(--muted) !important; }
.set-content .filter-actions { display: flex; gap: 8px; align-items: flex-end; }
.set-content .filter-more-summary { font-size: 12px; color: var(--muted); }

/* Hours: status tabs in the same row and the same look as the Crew tabs */
.officer-ui .hov-tools { gap: 12px; margin-bottom: 8px; }
.officer-ui .hov-filters.crew-tabs { display: inline-flex; flex-wrap: nowrap; gap: 3px; padding: 3px; background: #e8edf2; border-radius: 7px; }
.officer-ui .crew-tabs .hov-filter { border: 0; background: transparent; padding: 7px 14px; border-radius: 5px; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; gap: 0; }
.officer-ui .crew-tabs .hov-filter:hover { background: transparent; color: var(--ink); }
.officer-ui .crew-tabs .hov-filter.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #182b3d0d; }
.officer-ui .hov-search-wrap.crew-search { flex: 1; min-width: 180px; }
.officer-ui .crew-search .hov-search { min-height: 40px; padding-left: 34px; }
.officer-ui .hov-dept-filter.crew-select { min-height: 40px; }
.officer-ui .hov-views { min-height: 40px; align-items: stretch; }
.officer-ui p.hov-line2-note { margin: 0 0 14px; text-align: right; font-size: 11px; color: var(--muted); }
@media (max-width: 1100px) { .officer-ui .hov-filters.crew-tabs { flex-wrap: wrap; } }
.officer-ui .wk-btn.active-yes { background: var(--teal); color: #fff; }
.officer-ui .wk-btn.active-no { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #182b3d14; }

/* Seafarer header, compact (owner 2026-11-01): name and a small position tag on the left, department / vessel /
   watchkeeper on the right of the same line, the month and the actions under it. Same height as the crew-list top. */
.officer-ui .workrest-particulars-card { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 18px; }
.officer-ui .particulars-info { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap; }
.officer-ui .particulars-title-row { gap: 8px; flex-wrap: nowrap; min-width: 0; }
.officer-ui .particulars-seafarer-name { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.officer-ui .particulars-rank-badge { font-size: 10px; padding: 2px 6px; white-space: nowrap; }
.officer-ui .particulars-meta-row { margin-left: auto; font-size: 12px; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.officer-ui .particulars-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.officer-ui .particulars-actions .btn, .officer-ui .particulars-actions .save-status-box { min-height: 34px; }

/* Month table you can paint in */
.officer-ui .workrest-month-table.is-paintable .w-slot:not(.slot-outside) { cursor: crosshair; }
.officer-ui .workrest-month-table.is-paintable .workrest-row-timeline:hover { box-shadow: 0 0 0 1px #8da0e4; }
.officer-ui .workrest-month-table.is-paintable .w-slot.slot-rest:hover { background: #c9d4f3; }
.officer-ui .workrest-month-table.is-paintable .w-slot.slot-unknown:hover { background: #c3ccd6; }
.officer-ui .workrest-month-table.is-paintable .w-slot.slot-work:hover { background: #4560c9; }
.officer-ui .workrest-month-table.is-painting, .officer-ui .workrest-month-table.is-painting .w-slot { cursor: crosshair !important; user-select: none; }
.officer-ui .workrest-month-table.is-paintable .workrest-row-timeline { height: 18px; }

/* Watchkeeper: the chosen answer is blue, Yes or No (owner 2026-11-01) */
.officer-ui .wk-btn.active-yes, .officer-ui .wk-btn.active-no { background: var(--teal); color: #fff; box-shadow: none; font-weight: 600; }
.officer-ui .wk-segmented-control.wk-readonly .wk-btn.active-yes, .officer-ui .wk-segmented-control.wk-readonly .wk-btn.active-no { background: #8da0e4; color: #fff; }

/* Header actions: month, Preview / Print, Close month on the left; Save and its status at the far right */
.officer-ui .particulars-actions .save-button-cluster { order: 10; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.officer-ui .wr-strict-note { color: #85612c; }
.officer-ui .wr-strict-note a { color: inherit; text-decoration: underline; }

/* System & help: a choice inside a row */
.officer-ui .set-rows .set-row-form { display: flex; align-items: center; gap: 16px; padding: 15px 4px; border-bottom: 1px solid #f0f3f6; }
.officer-ui .set-row-form .set-text strong { font-size: 13px; font-weight: 600; color: var(--ink); }
.officer-ui .set-row-form .set-text small { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.officer-ui .set-select { flex-shrink: 0; min-height: 36px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; background: #fff; color: var(--ink); }
.officer-ui .filter-more-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
/* Month table keeps usable half-hour squares in a narrow window: it scrolls sideways inside its box. */
.officer-ui .workrest-month-table { min-width: 860px; }
.officer-ui .day-comment-container { flex-wrap: wrap; min-width: 0; max-width: 100%; }
.officer-ui .day-comment-container input { min-width: 0; max-width: 100%; }
/* Legend squares in the same colours as the table */
.officer-ui .swatch-box-rest { background-color: #e7ecf1; border-color: #e7ecf1; }
.officer-ui .swatch-box-unknown { background-color: #d5dce4; border-color: #d5dce4; }
.officer-ui .hov-filters.crew-tabs { max-width: 100%; }
@media (max-width: 700px) {
    .officer-ui .particulars-meta-row { margin-left: 0; justify-content: flex-start; }
    .officer-ui .particulars-title-row { flex-wrap: wrap; }
}
@media (max-width: 1024px) { .officer-ui .workrest-workspace-grid { grid-template-columns: minmax(0, 1fr); } }
.officer-ui .particulars-info, .officer-ui .particulars-title-row, .officer-ui .workrest-particulars-card { min-width: 0; }
.officer-ui .particulars-info > * { min-width: 0; }


/* ===== Phone layout: crew pages and header ===== */
/* ========== Phones (<= 640px): header + crew management pages (proposal crew.md) ==========
   Scope fence: page-level rules use ".content > X" so the Settings sheet (.set-shell/.set-content) is not touched. */
@media (max-width: 640px) {

    /* ---- 1. Header: one slim brand row, then the three places as a segmented control ---- */
    .demo-banner { font-size: 11.5px; line-height: 1.35; padding: 5px 12px; }
    .officer-ui .header-inner { flex-wrap: wrap; min-height: 0; padding: 8px 16px; gap: 8px 12px; }
    .officer-ui .brand { min-width: 0; gap: 8px; font-size: 16px; }
    .officer-ui .brand small { display: none; }
    .officer-ui .brand-mark { width: 32px; height: 32px; }
    .officer-ui .brand-company { max-height: 32px; max-width: 120px; }
    .officer-ui .account-menu { min-width: 0; margin-left: auto; order: 2; }
    .officer-ui .account-menu > summary { padding: 4px; }
    .officer-ui .avatar { width: 34px; height: 34px; font-size: 11px; }
    .officer-ui .account-panel { min-width: 200px; }
    .officer-ui .account-panel a { padding: 12px 14px; font-size: 15px; }
    .officer-ui nav.main-nav { order: 3; width: 100%; margin: 0; gap: 3px; padding: 3px; background: #e8edf2; border-radius: 8px; }
    .officer-ui nav.main-nav a { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 6px; font-size: 14px; border-radius: 6px; }
    .officer-ui nav.main-nav a[aria-current="page"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px #182b3d14; }

    /* ---- 2. Page frame, title, header buttons ---- */
    .officer-ui .content { padding: 16px 16px 28px; }
    .officer-ui .page-eyebrow { margin-bottom: 6px; }
    .officer-ui .content > .page-header { gap: 12px; margin-bottom: 16px; }
    .officer-ui .content > .page-header > div:first-child { flex: 1 1 100%; min-width: 0; }
    .officer-ui .content > .page-header h1 { font-size: 24px; letter-spacing: -.5px; }
    .officer-ui .content > .page-header p { font-size: 14px; line-height: 1.5; }
    .officer-ui .content > .page-header .page-header-actions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
    .officer-ui .content > .page-header .page-header-actions > .btn { width: 100%; min-height: 44px; font-size: 14px; line-height: 1.25; white-space: normal; text-align: center; }
    .officer-ui .content > .page-header .page-header-actions > .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .officer-ui .content > .page-header .page-header-actions > .btn:only-child { grid-column: auto; }
    /* Crew list: "+ Add crew member" first and full width, then Crew access | Import crew list */
    .officer-ui .crew-page-header .page-header-actions > .btn-primary { order: -1; grid-column: 1 / -1; }

    /* ---- 3. Inputs: 16px text stops iOS zooming the page on focus ---- */
    .officer-ui input:not([type=checkbox]):not([type=radio]):not([type=file]), .officer-ui select, .officer-ui textarea { font-size: 16px; }
    .officer-ui .content > :is(.form-card, form) .form-control { min-height: 44px; }

    /* ---- 4. Crew list filter bar ---- */
    .officer-ui .crew-bar { gap: 10px; margin-bottom: 14px; }
    .officer-ui .crew-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
    .officer-ui .crew-tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 44px; padding: 5px 2px; font-size: 12.5px; line-height: 1.2; text-align: center; }
    .officer-ui .crew-tabs .tab-count { margin-left: 0; font-size: 11px; }
    .officer-ui .crew-search { flex: 1 1 100%; min-width: 0; }
    .officer-ui .crew-search input { min-height: 44px; }
    .officer-ui .crew-select { flex: 1 1 140px; min-width: 0; min-height: 44px; }
    .officer-ui .crew-bar-more { margin-top: 0; }
    .officer-ui .crew-bar-more .filter-more-summary { min-height: 36px; font-size: 14px; }
    .officer-ui .crew-bar-more .filter-more[open] { padding: 12px; }
    .officer-ui .crew-bar-more .filter-main-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
    .officer-ui .crew-bar-more .filter-select { min-width: 0; }
    .officer-ui .filter-more-content { gap: 14px; }
    .officer-ui .filter-date-section { flex: 1 1 100%; }
    .officer-ui .filter-date-inputs .filter-group { flex: 1 1 0; min-width: 0; }
    .officer-ui .filter-date-inputs .form-control { width: 100%; }
    .officer-ui .filter-more-actions .btn { width: 100%; min-height: 44px; }

    /* ---- 5. Sort chips instead of column headings (crew list + stacked tables) ---- */
    .officer-ui :is(.crew-table, .stack-table) thead { display: block; margin-bottom: 10px; }
    .officer-ui :is(.crew-table, .stack-table) thead tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
    .officer-ui :is(.crew-table, .stack-table) thead tr:has(.sort-header)::before { content: "Sort"; margin-right: 2px; font-size: 12px; color: var(--muted); }
    .officer-ui :is(.crew-table, .stack-table) thead th { display: block; padding: 0; background: none; border: 0; }
    .officer-ui :is(.crew-table, .stack-table) thead th:not(:has(.sort-header, .import-all)) { display: none; }
    .officer-ui .stack-table thead:not(:has(.sort-header, .import-all)) { display: none; }
    .officer-ui :is(.crew-table, .stack-table) .sort-header { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; }
    .officer-ui :is(.crew-table, .stack-table) .sort-header.active { background: var(--teal-soft); border-color: #c9d3f5; color: var(--teal); }

    /* ---- 6. Crew list: every person is a card ----
       [No.] Name ●
             Master · Deck
             [On board] Since 3 May  Leaves … (last day)
             [ Hours ↗ ...................... ] [ ··· ]            */
    .officer-ui .table-card:has(> .table-wrap > :is(.crew-table, .stack-table)) { background: transparent; border: 0; box-shadow: none; }
    .officer-ui .table-wrap:has(> :is(.crew-table, .stack-table)) { overflow: visible; }
    .officer-ui .crew-table, .officer-ui .crew-table tbody { display: block; }
    .officer-ui .crew-table tbody tr { display: flex; flex-wrap: wrap; align-items: flex-start; position: relative; margin: 0 0 8px; padding: 14px 14px 12px 44px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
    .officer-ui .crew-table tbody tr:hover { background: #fff; }
    .officer-ui .crew-table tbody tr:has(> td.crew-no:empty) { padding-left: 14px; }
    .officer-ui .crew-table tbody td { display: block; padding: 0; border: 0; text-align: left; font-size: 14px; }
    .officer-ui .crew-table td.crew-no { position: absolute; left: 14px; top: 16px; width: auto; padding: 0; font-size: 13px; text-align: left; }
    .officer-ui .crew-table td.crew-no:empty { display: none; }
    .officer-ui .crew-table td.crew-col-name { order: 1; flex: 1 1 100%; min-width: 0; }
    .officer-ui .crew-table .crew-name-row { display: flex; align-items: center; gap: 8px; }
    .officer-ui .crew-table .crew-name-link { font-size: 16px; line-height: 1.3; }
    .officer-ui .crew-table .crew-sub { font-size: 13px; }
    .officer-ui .crew-table td.crew-col-status { order: 7; flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 8px; }
    .officer-ui .crew-table td.crew-col-status :is(.crew-since, .form-hint) { margin: 0 !important; font-size: 12.5px !important; }
    .officer-ui .crew-table td.crew-col-pos { order: 4; margin-top: 3px; }
    .officer-ui .crew-table td.crew-col-dept { order: 5; margin-top: 3px; color: var(--muted); }
    .officer-ui .crew-table td.crew-col-vessel { order: 6; margin-top: 3px; color: var(--muted); }
    .officer-ui .crew-table td:is(.crew-col-dept, .crew-col-vessel)::before { content: "·"; margin: 0 6px; color: #a3aebb; }
    .officer-ui .crew-table td.actions-cell { order: 8; flex-basis: 100%; margin-top: 12px; padding-top: 10px; border-top: 1px solid #edf0f3; text-align: left; }
    .officer-ui .crew-table .action-group { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; width: 100%; }
    .officer-ui .crew-table .action-group > .btn { flex: 1 1 auto; min-height: 40px; font-size: 14px; }
    .officer-ui .crew-table td .btn-primary.btn-sm[href*="/WorkRest"] { border-color: var(--line); color: var(--teal); }
    .officer-ui .crew-table .action-menu { margin-left: auto; }
    .officer-ui .crew-table .action-menu > summary { min-width: 48px; min-height: 40px; font-size: 18px; border: 1px solid var(--line); }
    /* Row menus: bigger tap rows, long items wrap instead of running off the screen */
    .officer-ui .action-menu-dropdown { max-width: calc(100vw - 20px); }
    .officer-ui .action-menu-dropdown :is(a, button, .dropdown-item) { padding: 12px 16px; font-size: 15px; white-space: normal; }

    /* ---- 7. Stacked tables: assignment register, assignment + position history, import review ----
       td.stack-title = bold first line; td.stack-sub (+ .stack-sub-after) = grey second line "A · B";
       td[data-label] = "Label ........ value" row; td.stack-field = label above a form field. */
    .officer-ui .stack-table, .officer-ui .stack-table tbody { display: block; }
    .officer-ui .stack-table tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; position: relative; margin: 0 0 8px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
    .officer-ui .stack-table tbody tr:hover { background: #fff; }
    .officer-ui .details-card .stack-table tbody tr { background: #fafbfc; }
    .officer-ui .stack-table tbody tr::after { content: ""; order: 4; flex-basis: 100%; height: 0; }   /* line break after the grey line */
    .officer-ui .stack-table tbody td { order: 10; flex: 1 1 100%; display: flex; justify-content: space-between; gap: 12px; min-width: 0; padding: 3px 0; border: 0; background: transparent; font-size: 14px; text-align: right; overflow-wrap: anywhere; }
    .officer-ui .stack-table td[data-label]::before { content: attr(data-label); flex: none; font-size: 13px; color: var(--muted); text-align: left; }
    .officer-ui .stack-table td.stack-title { order: 1; display: block; flex-basis: 100%; padding: 0 0 2px; font-size: 16px; font-weight: 600; text-align: left; }
    .officer-ui .stack-table td.stack-title strong { font-size: 16px !important; }
    .officer-ui .stack-table td.stack-sub { order: 2; display: block; flex: 0 1 auto; padding: 0 0 6px; color: var(--muted); text-align: left; }
    .officer-ui .stack-table td.stack-sub strong { font-weight: 400; }
    .officer-ui .stack-table td.stack-sub-after { order: 3; }
    .officer-ui .stack-table td.stack-sub-after::before { content: "·"; margin: 0 6px; color: #a3aebb; }
    .officer-ui .stack-table td.stack-field { display: block; text-align: left; padding-top: 6px; }
    .officer-ui .stack-table td.stack-field[data-label]::before { display: block; margin-bottom: 4px; }
    .officer-ui .stack-table td.actions-cell { order: 20; justify-content: flex-start; margin-top: 8px; padding-top: 10px; border-top: 1px solid #edf0f3; text-align: left; }
    .officer-ui .stack-table td.actions-cell > a { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 14px; font-weight: 500; text-decoration: none; }
    /* Tick box of the import rows sits left of the name */
    .officer-ui .stack-table tbody tr:has(> td.stack-check) { padding-left: 46px; }
    .officer-ui .stack-table td.stack-check { position: absolute; left: 14px; top: 13px; width: auto; padding: 0; flex: none; }
    .officer-ui .stack-table :is(td.stack-check, th) input[type=checkbox] { width: 20px; height: 20px; }
    .officer-ui .stack-table thead th:has(.import-all) { display: flex; align-items: center; gap: 8px; width: auto !important; }
    .officer-ui .stack-table thead th:has(.import-all)::after { content: "Tick / untick all"; font-size: 13px; font-weight: 400; color: var(--muted); }
    .officer-ui .stack-table tr.row-muted { background: #fbfcfd; }

    /* ---- 8. Crew profile (Details) ---- */
    .officer-ui .content > .details-card { padding: 16px; margin-bottom: 12px; border-radius: 12px; }
    .officer-ui .content > .details-card h2 { font-size: 17px; margin-bottom: 12px; }
    .officer-ui .content > :is(.details-card, .form-card) .details-list { grid-template-columns: 1fr !important; row-gap: 0 !important; }
    .officer-ui .content > :is(.details-card, .form-card) .details-list dt { font-size: 12.5px; }
    .officer-ui .content > :is(.details-card, .form-card) .details-list dd { margin: 1px 0 10px; font-size: 15px; overflow-wrap: anywhere; }
    .officer-ui .content > :is(.details-card, .form-card) .details-list dd:last-child { margin-bottom: 0; }
    .officer-ui .content > :is(.details-card, .form-card) .details-list dd .form-hint { display: block !important; margin: 2px 0 0 !important; }
    /* Button rows under "Current assignment" / "Planned assignment": wrap, bigger; "More…" opens full width under the row */
    .officer-ui .content > .details-card > div:has(> .btn) { position: relative; flex-wrap: wrap; gap: 8px !important; }
    .officer-ui .content > .details-card > div:has(> .btn) > .btn { flex: 1 1 auto; min-height: 40px; font-size: 14px; white-space: normal; }
    .officer-ui .content > .details-card .action-menu { position: static; }
    .officer-ui .content > .details-card .action-menu > summary { min-height: 40px; font-size: 14px; }
    .officer-ui .content > .details-card .action-menu-dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 0; width: auto; min-width: 0; max-width: none; }

    /* ---- 9. Forms: Add crew member, Assignment edit (all modes), Import upload, quick sign-off ---- */
    .officer-ui .content > .form-card, .officer-ui dialog.form-card { max-width: none; padding: 18px 16px; border-radius: 12px; }
    .officer-ui .content > .form-card .details-card { padding: 14px !important; margin-bottom: 16px !important; border-radius: 10px; }
    .officer-ui .form-row { grid-template-columns: 1fr; gap: 0; }
    .officer-ui .content > .form-card .form-group label { font-size: 13px; }
    .officer-ui .content > :is(.form-card, form) .form-hint { font-size: 12.5px; line-height: 1.45; }
    .officer-ui :is(.content > .form-card, .content > form, dialog) .form-actions { flex-wrap: wrap; gap: 8px; }
    .officer-ui :is(.content > .form-card, .content > form, dialog) .form-actions > .btn { flex: 1 1 140px; min-height: 44px; font-size: 15px; }
    .officer-ui .content > .form-card .form-actions > a:not(.btn) { flex-basis: 100%; margin-left: 0 !important; padding: 6px 0; font-size: 14px !important; text-align: center; }
    .officer-ui dialog { width: calc(100vw - 24px); box-sizing: border-box; }

    /* ---- 10. Import crew list ---- */
    .officer-ui .import-drop { padding: 28px 12px; }
    .officer-ui .import-summary { gap: 6px 18px; }
    .officer-ui .import-columns { padding: 12px; }
    .officer-ui .import-columns-controls label { flex: 1 1 100%; }
    .officer-ui .import-columns-controls .btn { width: 100%; min-height: 44px; }
    .officer-ui .import-bulk span { flex-basis: 100%; }
    .officer-ui .import-bulk .form-control { flex: 1 1 150px; width: auto; height: auto; min-height: 44px; }
    .officer-ui .import-bulk .btn { min-height: 44px; }
    .officer-ui .import-table :is(select, input.form-control, .import-day) { width: 100%; min-width: 0; max-width: 100%; height: auto; min-height: 44px; }
    .officer-ui .import-new { flex-direction: column; }

    /* ---- 11. Assignment register filters ---- */
    .officer-ui .content > .filter-card .filter-main-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .officer-ui .content > .filter-card :is(.filter-search, .filter-actions) { grid-column: 1 / -1; }
    .officer-ui .content > .filter-card .filter-select { min-width: 0; }
    .officer-ui .content > .filter-card .filter-group .form-control { height: auto; min-height: 44px; }
    .officer-ui .content > .filter-card .filter-actions { margin-left: 0; }
    .officer-ui .content > .filter-card .filter-actions .btn { flex: 1 1 0; height: auto; min-height: 44px; }
}


/* ===== Phone layout: hours pages ===== */
/* ========== Phones: Hours pages (overview + one person's month), review 2026-11-05 ========== */

/* Desktop: the crew list is always open, the phone-only "Change person" button stays hidden. */
.workrest-roster-toggle { display: none; }

/* Root cause of the one-letter-per-line names (all widths): .hcv-status was flex-shrink:0, so the long red
   "! Rule not met on 2 days · incomplete" kept its full width and .hcv-who (min-width:0, no flex-grow) was squeezed
   to almost nothing; .hcv-name has overflow-wrap:anywhere, so it broke after every letter. Now the name keeps at
   least 7em and the status text wraps instead. Nothing changes when the card is wide enough. */
.officer-ui .hcv-who { flex: 1 1 auto; min-width: 7em; }
.officer-ui .hcv-status { flex-shrink: 1; min-width: 0; }

@media (max-width: 640px) {
    /* ---- Page frame: 16 px gutter (content-wide and :has(.workrest-workspace-grid) set 32 px and beat the 600 px rule) ---- */
    .officer-ui .content.content-wide,
    .officer-ui .content:has(.workrest-workspace-grid) { padding: 16px 16px 28px; }
    body.officer-ui:has(.hov) .site-footer,
    body.officer-ui:has(.workrest-workspace-grid) .site-footer { padding: 12px 16px; }

    /* ================= Hours overview (_HoursOverview) ================= */
    .officer-ui .hov-bar { gap: 12px; margin-bottom: 16px; }
    .officer-ui .hov-title { font-size: 26px; }
    /* Month: ‹ November 2026 › across the width, like the crew Month page; "This month" / "Close month for all…" under it */
    .officer-ui .hov-month { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 8px; width: 100%; }
    .officer-ui .hov-month .hov-step { width: 44px; min-width: 44px; min-height: 44px; justify-content: center; }
    .officer-ui .hov-month strong { min-width: 0; font-size: 15px; }
    .officer-ui .hov-month > a.btn:not(.hov-step),
    .officer-ui .hov-month > .hov-close { grid-column: 1 / -1; margin-left: 0; min-height: 44px; justify-content: center; }

    /* Status tabs: a 2 x 2 block instead of a ragged wrap; search on its own row; department + view on one row */
    .officer-ui .hov-tools { gap: 8px; margin-bottom: 10px; }
    .officer-ui .hov-filters.crew-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 100%; }
    .officer-ui .crew-tabs .hov-filter { justify-content: center; min-height: 40px; padding: 6px 8px; }
    .officer-ui .hov-search-wrap.crew-search { flex: 1 1 100%; min-width: 0; }
    .officer-ui .crew-search .hov-search { min-height: 44px; font-size: 16px; }          /* 16 px: iOS does not zoom in */
    .officer-ui .hov-dept-filter.crew-select { flex: 1 1 0; min-width: 0; min-height: 44px; font-size: 16px; }
    .officer-ui .hov-views { min-height: 44px; }
    .officer-ui p.hov-line2-note { text-align: left; margin: 2px 0 10px; }

    /* Compact cards: number | name + position | count; the status line under the name, full width */
    .officer-ui .hcv-list { gap: 8px; }
    .officer-ui .hcv-card { padding: 14px 14px 16px; }
    .officer-ui .hcv-head { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 6px; align-items: start; position: relative; }
    .officer-ui .hcv-no { grid-column: 1; grid-row: 1 / span 2; min-width: 0; padding-top: 2px; }
    .officer-ui .hcv-who { grid-column: 2; grid-row: 1; min-width: 0; }
    .officer-ui .hcv-status { display: contents; }
    .officer-ui .hcv-count { grid-column: 3; grid-row: 1; text-align: right; white-space: nowrap; }
    .officer-ui .hcv-state { grid-column: 2 / -1; grid-row: 2; margin-top: 0; text-align: left; }
    .officer-ui .hcv-name { overflow-wrap: normal; }
    /* The whole top of the card opens the month (the name link is stretched over it); the day squares stay separate links */
    .officer-ui .hcv-name::after { content: ""; position: absolute; inset: -14px -14px -6px; }
    .officer-ui .hcv-strip { margin-top: 14px; gap: 2px; }
    .officer-ui .hcv-day { height: 16px; }

    /* Days view: a narrower sticky name column leaves room for the days */
    .officer-ui .hov-name-h, .officer-ui .hov-name { min-width: 116px; max-width: 128px; padding: 6px 8px 6px 10px; }
    .officer-ui .hov-scroll { max-height: 70vh; }

    /* ================= One person's month (WorkRest/Index) ================= */
    .officer-ui .workrest-workspace-grid { gap: 12px; }
    .officer-ui .workrest-main-column { gap: 12px; }

    /* Crew list collapses to one bar: "← All crew · overview" + "Change person 27 ▾"; opens on tap */
    .officer-ui .workrest-sidebar-card { flex-direction: row; flex-wrap: wrap; align-items: center; }
    .officer-ui .workrest-sidebar-card > * { flex: 1 1 100%; }
    .officer-ui .workrest-sidebar-card > .workrest-back-overview { flex: 1 1 0; min-width: 0; padding: 12px 10px 12px 14px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .officer-ui .workrest-sidebar-card > .alert { margin: 0 10px 10px !important; }
    .officer-ui .workrest-roster-toggle {
        display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; margin: 6px 8px 6px auto;
        min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px;
        background: #fff; color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
    }
    .officer-ui .workrest-roster-toggle:first-child { flex: 1 1 100%; justify-content: space-between; margin-left: 8px; }
    .workrest-roster-toggle-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
    .workrest-roster-toggle-caret { font-size: 10px; color: var(--muted); transition: transform 140ms; }
    .officer-ui .workrest-sidebar-card.is-open .workrest-roster-toggle-caret { transform: rotate(180deg); }
    .officer-ui .workrest-sidebar-card:not(.is-open) > .workrest-search-box,
    .officer-ui .workrest-sidebar-card:not(.is-open) > .workrest-sidebar-header,
    .officer-ui .workrest-sidebar-card:not(.is-open) > .workrest-crew-list { display: none; }
    .officer-ui .workrest-sidebar-card > .workrest-search-box { border-top: 1px solid var(--line); }
    .officer-ui .workrest-sidebar-card .workrest-crew-list { max-height: 60vh; min-height: 0; }
    .officer-ui .workrest-search-input { min-height: 44px; font-size: 16px; }
    .officer-ui .workrest-crew-item { min-height: 48px; }

    /* Person header: name, then department / vessel, watchkeeper on its own row, then the month and the buttons */
    .officer-ui .workrest-particulars-card { padding: 14px; gap: 12px; }
    .officer-ui .particulars-seafarer-name { font-size: 19px; white-space: normal; }
    .officer-ui .particulars-meta-row { gap: 6px 12px; }
    .officer-ui .particulars-meta-sep { display: none; }                     /* decorative "•" only */
    .officer-ui .watchkeeper-toggle-wrap { flex: 1 1 100%; justify-content: space-between; }
    .officer-ui .wk-btn { min-height: 34px; padding: 4px 16px; }
    .officer-ui .particulars-actions { gap: 8px; }
    .officer-ui .workrest-month-switcher { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; flex: 1 1 100%; }
    .officer-ui .btn-month-step { min-height: 44px; font-size: 20px; }
    .officer-ui .month-display-text { text-align: center; font-size: 15px; }
    .officer-ui .particulars-actions > #btnPreviewPrint,
    .officer-ui .particulars-actions > #btnCloseMonth { flex: 1 1 140px; min-height: 44px; justify-content: center; }
    .officer-ui .particulars-actions > .month-closed-box,
    .officer-ui .particulars-actions > .badge { flex: 1 1 100%; justify-content: center; text-align: center; white-space: normal; }

    /* Save + status: always under the thumb, like the crew "My hours" bottom bar */
    .officer-ui .particulars-actions .save-button-cluster {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0;
        display: flex; align-items: center; gap: 8px;
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
        background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px #182b3d14;
    }
    .officer-ui .save-button-cluster .btn-workrest-save { flex: 1 1 auto; min-height: 48px; font-size: 15px; }
    .officer-ui .save-button-cluster .save-status-box { flex: 0 0 auto; min-height: 48px; }
    body.officer-ui:has(.save-button-cluster) { padding-bottom: 76px; }
    .officer-ui .workrest-toast { left: 16px; right: 16px; bottom: 88px; justify-content: center; }

    /* Month Overview: no 860 px sideways scroll. Each day is one grid line: date | day | 24 h bar | work | rest */
    .officer-ui .wr-stack { gap: 12px; }
    .officer-ui .workrest-month-card,
    .officer-ui .workrest-day-card { padding: 12px 10px; }
    .officer-ui .workrest-card-header { flex-direction: column; align-items: flex-start; gap: 2px; }
    .officer-ui .workrest-table-container { max-height: 52vh !important; overflow-x: hidden; overflow-y: auto; }   /* !important: beats the inline height set by fit() */
    .officer-ui .workrest-month-table { min-width: 0; display: block; }
    .officer-ui .workrest-month-table thead { display: block; position: sticky; top: 0; z-index: 5; background: #fff; }
    .officer-ui .workrest-month-table tbody { display: block; }
    .officer-ui .workrest-month-table tr { display: grid; grid-template-columns: 40px 34px minmax(0, 1fr) 28px 30px; column-gap: 4px; align-items: center; }
    .officer-ui .workrest-month-table thead th { position: static; display: block; width: auto; padding: 6px 0; font-size: 9px; }
    .officer-ui .workrest-month-table td { display: block; width: auto; padding: 4px 0; }
    .officer-ui .td-w-date, .officer-ui .td-w-day { font-size: 11px; white-space: nowrap; }
    .officer-ui .day-dow-text { width: auto; }
    .officer-ui .workrest-remark-icon { font-size: 9px; margin-left: 2px; }
    .officer-ui .td-w-work, .officer-ui .td-w-rest { font-size: 11px; text-align: right; }
    .officer-ui .workrest-row-timeline,
    .officer-ui .workrest-month-table.is-paintable .workrest-row-timeline { height: 14px; }
    /* ~3.5 px per half-hour: no half-hour gaps (they would eat the colour), only the 6-hour gaps */
    .officer-ui .w-slot, .officer-ui .w-slot:nth-child(2n) { border-right: 0; }
    .officer-ui .w-slot:nth-child(12n) { border-right: 2px solid #fff; }
    .officer-ui .w-slot:last-child { border-right: 0; }
    /* Hour scale: 00 06 12 18 only */
    .officer-ui .workrest-hours-header span { visibility: hidden; text-align: left; white-space: nowrap; }
    .officer-ui .workrest-hours-header span:nth-child(6n+1) { visibility: visible; }

    /* Day Editor: buttons in two tidy rows; the day as 8 rows x 3 hours of finger-size half-hours (crew "Grid") */
    .officer-ui .wr-stack .workrest-day-card .workrest-card-header { flex-direction: column; align-items: stretch; gap: 8px; }
    .officer-ui .wr-stack .workrest-day-actions { display: flex; flex-wrap: wrap; gap: 6px; }
    .officer-ui .wr-stack .workrest-day-actions .day-nav-btn { flex: 0 0 44px; width: 44px; min-width: 44px; min-height: 40px; }
    .officer-ui .wr-stack .workrest-day-actions #btnCopyPrev { flex: 1 1 auto; min-height: 40px; justify-content: center; }
    .officer-ui .wr-stack .workrest-day-actions #btnExactInterval { flex: 1 1 100%; min-height: 40px; justify-content: center; }
    .officer-ui .wr-stack .day-timeline-box { flex-direction: column; align-items: stretch; gap: 10px; }
    .officer-ui .wr-stack .day-hour-markers { display: none; }                /* replaced by the row labels below */
    .officer-ui .wr-stack .day-slots-48 {
        grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 2px; row-gap: 6px;
        height: auto; overflow: visible; padding-left: 46px; background: transparent; border-radius: 0;
        touch-action: manipulation;                                           /* the page still scrolls over the grid */
    }
    .officer-ui .wr-stack .day-interactive-slot { position: relative; min-height: 40px; border: 0; border-radius: 6px; }
    .officer-ui .wr-stack .day-interactive-slot:nth-child(2n+1):not(:nth-child(6n+1)) { margin-left: 5px; }
    .officer-ui .wr-stack .day-interactive-slot:nth-child(6n+1)::before {
        position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%);
        font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none;
    }
    .officer-ui .wr-stack .day-interactive-slot:nth-child(1)::before { content: "00:00"; }
    .officer-ui .wr-stack .day-interactive-slot:nth-child(7)::before { content: "03:00"; }
    .officer-ui .wr-stack .day-interactive-slot:nth-child(13)::before { content: "06:00"; }
    .officer-ui .wr-stack .day-interactive-slot:nth-child(19)::before { content: "09:00"; }
    .officer-ui .wr-stack .day-interactive-slot:nth-child(25)::before { content: "12:00"; }
    .officer-ui .wr-stack .day-interactive-slot:nth-child(31)::before { content: "15:00"; }
    .officer-ui .wr-stack .day-interactive-slot:nth-child(37)::before { content: "18:00"; }
    .officer-ui .wr-stack .day-interactive-slot:nth-child(43)::before { content: "21:00"; }
    .officer-ui .wr-stack .day-totals-summary-box {
        flex-direction: row; justify-content: space-around; gap: 16px; min-width: 0;
        border-left: 0; border-top: 1px solid #edf0f3; padding: 10px 0 0;
    }
    .officer-ui .wr-stack .day-total-line { gap: 8px; justify-content: flex-start; }
    .officer-ui .wr-stack .workrest-bottom-row { flex-direction: column; align-items: stretch; gap: 10px; }
    .officer-ui .day-comment-container { flex-wrap: nowrap; width: 100%; }
    .officer-ui .wr-stack .day-comment-input { flex: 1 1 auto; width: auto; min-width: 0; min-height: 44px; font-size: 16px; }
    .officer-ui .workrest-legend-line { margin-left: 0; gap: 6px 12px; font-size: 11px; }
}


/* ===== Phone layout: settings area ===== */
/* ========== Settings on a phone (<= 640 px) - review 2026-11-05 ==========
   Desktop and tablet keep the left section list. On a phone: one "Settings section" button opens the list of
   sections (<details>, no JS); the sub-tabs become a segmented control like the crew Day / Month switch; wide
   tables become one card per row (td.set-card-title / td[data-label] / td.set-card-block / td.set-card-actions). */
.set-jump { display: none; }

@media (max-width: 640px) {
    /* Shell heading: compact, so the section starts on the first screen */
    .set-shell .page-eyebrow { margin-bottom: 4px; }
    .set-shell-heading { margin-bottom: 14px; }
    .set-shell-title { font-size: 24px; letter-spacing: -.6px; }
    .set-shell-heading p { display: none; }
    .set-shell-grid { gap: 12px; }

    /* Section switcher instead of the cut-off strip */
    .set-nav { display: none; }
    .set-jump { display: block; }
    .set-jump > summary {
        list-style: none; display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 8px 10px 8px 14px;
        background: #fff; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--ink);
    }
    .set-jump > summary::-webkit-details-marker { display: none; }
    .set-jump-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
    .set-jump-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
    .set-jump-current { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .set-jump-caret {
        flex: none; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
        background: var(--teal-soft); color: var(--teal); font-size: 11px; transition: transform 140ms;
    }
    .set-jump[open] > summary { border-color: #8da0e4; box-shadow: 0 0 0 3px #314fc01a; }
    .set-jump[open] .set-jump-caret { transform: rotate(180deg); }
    .set-jump-list { margin-top: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
    .set-jump-list a {
        display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 16px;
        font-size: 14px; color: var(--ink); text-decoration: none; border-top: 1px solid #edf0f3;
    }
    .set-jump-list a:first-child { border-top: 0; }
    .set-jump-list a::after { content: "\203A"; color: #a3aebb; font-size: 18px; line-height: 1; }
    .set-jump-list a:active { background: #f8f9fc; }
    .set-jump-list a.is-current { background: #f3f6ff; color: var(--teal); font-weight: 600; }
    .set-jump-list a.is-current::after { content: "\2713"; color: var(--teal); font-size: 14px; }

    /* The white sheet: less padding */
    .set-content { padding: 18px 14px 20px; }

    /* Sub-tabs: segmented control, every tab visible (two per row) */
    .set-tabs {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 3px;
        margin: -4px 0 20px; background: #e8edf2; border: 0; border-radius: 9px;
    }
    .set-tabs a {
        display: flex; align-items: center; justify-content: center; text-align: center; min-height: 40px; padding: 6px 8px;
        margin: 0; border: 0; border-radius: 7px; font-size: 12.5px; font-weight: 500; line-height: 1.25; color: var(--muted); white-space: normal;
    }
    .set-tabs a[aria-current="page"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px #182b3d14; }
    .set-tabs a:last-child:nth-child(odd) { grid-column: 1 / -1; }

    /* Page header: text first, then the action buttons full width */
    .set-content .page-header, .set-content .records-header { flex-direction: column; align-items: stretch !important; gap: 12px; margin-bottom: 16px !important; }
    .set-content .page-header-actions, .set-content .records-header > div:last-child { margin-left: 0; width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
    .set-content .page-header-actions > .btn, .set-content .page-header-actions > form,
    .set-content .page-header-actions > form > .btn, .set-content .records-header > div:last-child > .btn {
        flex: 1 1 100%; width: 100%; min-height: 44px; font-size: 13px;
    }
    .set-content .page-header-actions > .badge { white-space: normal; text-align: left; line-height: 1.4; }

    /* Fields: 16 px so iPhone does not zoom in; filters stack, the selects share a row */
    .set-content .form-control, .set-content select, .set-content textarea,
    .set-content input[type=text], .set-content input[type=number], .set-content input[type=date],
    .set-content input[type=search], .set-content input[type=password] { font-size: 16px !important; min-height: 44px; }
    .set-content .filter-bar { padding: 12px !important; }
    .set-content .filter-row, .set-content .filter-main-row { gap: 10px; }
    .set-content .filter-row .filter-group, .set-content .filter-main-row .filter-group { flex: 1 1 calc(50% - 5px); }
    .set-content .filter-row .filter-search, .set-content .filter-main-row .filter-search { flex: 1 1 100%; }
    .set-content .filter-actions { width: 100%; }
    .set-content .filter-actions .btn { flex: 1; min-height: 42px; }

    /* Save / Cancel rows: full-width buttons, the main one on top */
    .set-content .form-actions, .set-content form > div:last-child:not(.catalog-submit-bar):has(> .btn-primary), .set-content .du-actions { flex-direction: column-reverse; align-items: stretch; }
    .set-content .form-actions .btn, .set-content form > div:last-child:not(.catalog-submit-bar):has(> .btn-primary) > .btn, .set-content .du-actions .btn { width: 100%; min-height: 44px; }

    /* Dialogs (Add user, Reset password) fit the screen */
    .set-content dialog { width: calc(100% - 24px) !important; max-width: 460px; max-height: calc(100dvh - 24px); padding: 20px 16px !important; }

    /* ---- Wide tables -> one card per row ---- */
    .set-content .table-card:has(td.set-card-title), .set-content div:has(> table td.set-card-title) {
        border: 0 !important; border-radius: 0 !important; overflow: visible !important; background: transparent !important; box-shadow: none !important;
    }
    .set-content table:has(td.set-card-title), .set-content table:has(td.set-card-title) > tbody { display: block; width: 100%; }
    .set-content table:has(td.set-card-title) > thead { display: none; }
    .set-content table:has(td.set-card-title) > tbody > tr {
        display: flex; flex-direction: column; gap: 7px; padding: 14px 14px 12px; margin: 0 0 10px;
        background: #fff; border: 1px solid var(--line) !important; border-radius: 12px;
    }
    .set-content table:has(td.set-card-title) > tbody > tr:hover { background: #fff; }
    .set-content table:has(td.set-card-title) td {
        display: block; position: relative; padding: 0 !important; border: 0 !important; width: auto !important; max-width: none !important;
        font-size: 13px !important; line-height: 1.45; text-align: left !important; white-space: normal; overflow-wrap: anywhere; color: var(--ink);
    }
    .set-content table:has(td.set-card-title) td[data-label] { padding-left: 108px !important; min-height: 19px; }
    .set-content table:has(td.set-card-title) td[data-label]::before {
        content: attr(data-label); position: absolute; left: 0; top: 1px; width: 98px; font-size: 11.5px; color: var(--muted); line-height: 1.45;
    }
    .set-content table:has(td.set-card-title) td.set-card-title { order: -1; font-size: 15px !important; font-weight: 600; padding-bottom: 2px !important; }
    .set-content table:has(td.set-card-title) td.set-card-title :is(.crew-sub, .form-hint) { font-weight: 400; font-size: 12px !important; color: var(--muted); }
    .set-content table:has(td.set-card-title) td.set-card-block { padding-left: 0 !important; }
    .set-content table:has(td.set-card-title) td.set-card-block::before { position: static; display: block; width: auto; margin-bottom: 3px; }
    .set-content table:has(td.set-card-title) td.set-card-actions {
        order: 99; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; padding-top: 11px !important; border-top: 1px solid #edf0f3 !important;
    }
    .set-content td.set-card-actions > div { display: flex !important; flex-wrap: wrap; gap: 8px !important; width: 100%; }
    .set-content td.set-card-actions form { display: contents !important; }
    .set-content td.set-card-actions :is(.btn, button, a, summary) {
        display: inline-flex; align-items: center; justify-content: center; min-height: 38px; margin: 0 !important;
        padding: 7px 12px !important; font-size: 13px !important; border-radius: 7px !important;
    }
    .set-content td.set-card-actions :is(.btn-link, a:not(.btn)) { border: 1px solid var(--line); background: #fff; text-decoration: none; font-weight: 500; }
    .set-content td.set-card-actions .du-pass[open] { flex-basis: 100%; }
    .set-content td.set-card-actions .du-pass[open] form { display: flex !important; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
    .set-content td.set-card-actions .du-pass .form-control { max-width: none; flex: 1 1 100%; }

    /* Catalogue picker: tick box on the left of each card */
    .set-content .table-catalog:has(td.set-card-title) > tbody > tr { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 10px; row-gap: 7px; }
    .set-content .table-catalog:has(td.set-card-title) td { grid-column: 2; }
    .set-content .table-catalog:has(td.set-card-title) td.cat-check { grid-column: 1; grid-row: 1; padding-top: 1px !important; }
    .set-content .table-catalog:has(td.set-card-title) td.set-card-title { grid-row: 1; }
    .set-content .table-catalog:has(td.set-card-title) td[data-label] { padding-left: 64px !important; }
    .set-content .table-catalog:has(td.set-card-title) td[data-label]::before { width: 56px; top: 50%; transform: translateY(-50%); }
    .set-content .table-catalog td.set-card-title label { font-size: 15px !important; font-weight: 600 !important; color: var(--ink) !important; }
    .set-content .table-catalog input[type=checkbox] { width: 22px; height: 22px; }
    .set-content .table-catalog .code-input { max-width: 170px; }
    .set-content .catalog-toolbar { padding: 10px 12px; }
    .set-content .catalog-search-wrap { flex: 1 1 100%; min-width: 0; }
    .set-content .catalog-submit-bar {
        position: sticky; bottom: 0; z-index: 5; background: #fff; margin: 12px -14px -20px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; box-shadow: 0 -4px 16px #182b3d14;
    }
    .set-content .catalog-submit-bar .btn { flex: 1 1 0; min-height: 44px; }
    .set-content .catalog-submit-bar .manual-hint { margin-left: 0 !important; flex-basis: 100%; text-align: center; font-size: 13px !important; }

    /* Crew access & QR code: one column (the columns were at least 340 px - wider than the sheet) */
    .portal-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .portal-qr svg { width: 200px; height: 200px; }
    .portal-addr { word-break: break-all; }

    /* Department users form */
    .du-form { padding: 0; }
    .du-set { padding: 10px 12px; }
    .du-group-list { padding-left: 4px; gap: 6px 16px; }
    .du-check { min-height: 32px; }

    /* Vessel details sheet */
    .vessel-sheet { padding: 16px 14px; border-radius: 12px; }
    .vessel-sheet-name { font-size: 19px; }
    .vessel-sheet-grid { gap: 14px 16px; margin-top: 16px; }
    .vessel-sheet-actions { flex-direction: column; align-items: stretch; }
    .vessel-sheet-actions > .btn { width: 100%; min-height: 44px; }
    .vessel-sheet-quiet { justify-content: center; gap: 22px; }

    /* System & help: the select goes under its text */
    .officer-ui .set-rows .set-row-form { flex-wrap: wrap; gap: 10px; }
    .officer-ui .set-row-form .set-select { flex: 1 1 100%; min-height: 44px; font-size: 16px; }
    .officer-ui .set-rows .settings-link.set-row { padding: 14px 2px; }

    /* System status: one column */
    .set-content .status-panel dl.details { grid-template-columns: minmax(0, 1fr); }

    /* Guide (main layout, not the shell): contents as one swipeable row, not a sticky block of five rows */
    .guide-head h1 { font-size: 22px; }
    .guide-toc {
        flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 14px; padding: 8px 16px;
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent 100%);
                mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 28px), transparent 100%);
    }
    .guide-toc::-webkit-scrollbar { display: none; }
    .guide-toc a { flex: none; white-space: nowrap; padding: 7px 12px; }
    .guide-card { padding: 16px 14px; border-radius: 12px; scroll-margin-top: 64px; }
    .guide-card h2 { font-size: 17px; flex-wrap: wrap; gap: 6px 10px; }
    .guide-tips p { flex-basis: 100%; }
}

/* ===== Phone layout: final touches after the check at 375 px ===== */
@media (max-width: 640px) {
    .main-nav:not(:has(a)) { display: none !important; }                       /* sign-in page: no empty grey bar */
    .officer-ui .hov-filters.crew-tabs { grid-template-columns: 1fr 1fr; grid-auto-flow: row; }            /* overview filters: 2 x 2 */
    .officer-ui .workrest-month-table tr { grid-template-columns: 38px 30px minmax(0, 1fr) 30px 34px; padding-right: 6px; }
}
