:root {
    --bg: #dfe5eb;
    --panel: #edf1f4;
    --panel-elevated: #f3f5f7;
    --panel-soft: #e2e8ee;
    --control-bg: #f1f4f6;
    --row-hover: #e5eaf0;
    --weekend-bg: #d6e1ec;
    --ink: #172033;
    --muted: #59677a;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --border: #bdc8d3;
    --shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
    --info-soft: #dce8f3;
    --success-soft: #dcece2;
    --warning-soft: #f0e5ca;
    --danger-soft: #f1dde1;
    --danger-soft-strong: #ead0d5;
    --purple-soft: #e8e1f1;
    --today-soft: #ccdeed;
    --nav-bg: #172033;
    --nav-bg-soft: #1f2a3d;
    --nav-ink: #f8fafc;
    --nav-muted: #cbd5e1;
    --nav-border: rgba(255, 255, 255, .12);
    --nav-hover: rgba(37, 99, 235, .24);
}

.ftl-page { max-width: 1800px; }
.ftl-time-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ftl-table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    table-layout: auto;
    font-size: .78rem;
}
.ftl-table th,
.ftl-table td {
    min-width: 0;
    vertical-align: top;
    padding: .42rem .32rem;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
}
.ftl-table .badge {
    max-width: 100%;
    white-space: normal;
    border-radius: 8px;
    padding: .18rem .35rem;
    font-size: .72rem;
}
.ftl-table .btn-small {
    padding: .35rem .5rem;
    font-size: .72rem;
}
.ftl-nonzero-value {
    color: #0f766e;
    font-weight: 800;
}
.ftl-table .ftl-date-notes-cell { width: 21%; }
.ftl-table .ftl-date-notes-stack {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .35rem;
}
.ftl-table .ftl-date-notes-stack > strong,
.ftl-table .ftl-date-notes-stack > .small,
.ftl-table .ftl-date-notes-stack > .badge {
    display: block;
    width: 100%;
    margin: 0;
}
.ftl-table .ftl-date-notes-stack > .badge { text-align: center; }
.ftl-table .ftl-date-notes-stack .table-actions {
    width: 100%;
    min-width: 0;
}
.ftl-table .ftl-date-notes-stack .table-actions .btn {
    min-width: 0;
    white-space: normal;
}
.ftl-exceeded td { background: var(--danger-soft); color: #6f1515; }
.ftl-exceeded:hover td { background: var(--danger-soft-strong); }
.ftl-external-organization {
    display: grid;
    grid-template-columns: minmax(220px, auto) minmax(220px, 1fr);
    gap: .75rem;
    align-items: end;
    margin-top: .8rem;
}
.ftl-external-organization .check-pill { align-self: center; }
.ftl-external-organization .form-row { margin: 0; }
.ftl-external-badge { color: #6d28d9; border-color: #b9a9dc; background: var(--purple-soft); }
.ftl-extension-settings {
    display: grid;
    grid-template-columns: minmax(190px, auto) minmax(260px, 1fr) minmax(190px, auto);
    gap: .75rem;
    align-items: end;
    margin-top: .8rem;
}
.ftl-extension-settings .check-pill { align-self: center; }
.ftl-extension-settings .form-row { margin: 0; }
.ftl-continuity-meta { display: block; margin-top: .2rem; color: var(--muted); font-size: .68rem; line-height: 1.25; }
.ftl-exceeded .ftl-continuity-meta { color: #7f1d1d; }
.pic-record-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    padding: .35rem;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    background: var(--info-soft);
}
.pic-record-status.is-warning {
    border-color: #f2ba63;
    background: var(--warning-soft);
    color: #7c3f00;
}
.pic-record-status .badge { flex: 1 1 120px; }
.pic-record-status .btn { flex: 0 1 auto; }
.ftl-following-context {
    margin: .75rem 0 1rem;
    padding: .75rem .85rem;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    background: var(--info-soft);
    color: #1e3a5f;
}
.ftl-following-context { display: grid; gap: .3rem; }
.ftl-workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 1rem;
    align-items: start;
}
.ftl-workspace-grid.is-read-only {
    width: 100%;
    max-width: none;
    grid-template-columns: minmax(0, 1fr) minmax(0, 4fr);
}
.ftl-workspace-grid.is-read-only > .ftl-readonly-filter-card,
.ftl-workspace-grid.is-read-only > .ftl-readonly-records-card {
    width: 100%;
    max-width: none;
    margin: 0;
}
.ftl-readonly-filter-card {
    padding: 1rem;
}
.ftl-readonly-filter-card h2 {
    margin: 0 0 1rem;
}
.ftl-readonly-filter-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .85rem;
    align-items: stretch;
    margin: 0;
}
.ftl-readonly-filter-form > div,
.ftl-readonly-filter-form .form-control,
.ftl-readonly-filter-form > .btn {
    width: 100%;
    min-width: 0;
}
.ftl-readonly-filter-form > .badge {
    width: 100%;
    text-align: center;
}
.ftl-workspace-grid > .form-panel,
.ftl-workspace-grid > .table-card {
    min-width: 0;
    margin: 0;
}
.ftl-workspace-grid > .table-card { padding: 1rem; }
.ftl-workspace-grid > .table-card > .toolbar { margin: 0 0 1rem; }
.ftl-form-line {
    display: grid;
    gap: 0 1rem;
    align-items: end;
    justify-content: start;
}
.ftl-form-line > .form-row { width: auto; }
.ftl-date-time-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: .35rem; }
.ftl-block-segments {
    margin: .85rem 0;
    padding: .8rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--control-bg);
}
.ftl-block-segments-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.ftl-block-segments-heading .form-help { min-height: 0; max-width: 58rem; }
.ftl-block-segment {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: .65rem;
    align-items: end;
    padding: .7rem 0;
    border-top: 1px solid var(--border);
}
.ftl-block-segment-number { align-self: center; font-weight: 800; color: var(--muted); }
.ftl-block-segment label { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(6rem, .65fr); gap: .35rem; align-items: center; font-weight: 700; }
.ftl-block-segment label > span { grid-column: 1 / -1; }
.ftl-block-segment label .form-control:first-of-type { grid-column: 1; }
.ftl-block-segment label .form-control:last-of-type { grid-column: 2; }
.ftl-block-segment-summary { margin-top: .35rem; color: var(--muted); font-size: .8rem; font-weight: 700; }
.ftl-workspace-grid > .form-panel { font-size: .93rem; }
.ftl-workspace-grid > .form-panel .form-control { font-size: .9rem; }
.ftl-form-line-user,
.ftl-form-line-2,
.ftl-form-line-3,
.ftl-form-line-4,
.ftl-form-line-5,
.ftl-form-line-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ftl-form-line-1 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-help {
    display: block;
    min-height: 2.7em;
    margin: .2rem 0 .35rem;
    color: var(--muted);
    font-size: .72rem;
    line-height: 1.3;
}
@media (max-width: 1200px) {
    .ftl-workspace-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .ftl-workspace-grid.is-read-only { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
    .ftl-form-line-1,
    .ftl-form-line-2,
    .ftl-form-line-3,
    .ftl-form-line-4,
    .ftl-form-line-5,
    .ftl-form-line-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ftl-block-segment { grid-template-columns: 4.5rem minmax(0, 1fr); }
    .ftl-block-segment > label,
    .ftl-block-segment > button { grid-column: 2; }
}
@media (max-width: 640px) {
    .ftl-form-line-1,
    .ftl-form-line-2,
    .ftl-form-line-3,
    .ftl-form-line-4,
    .ftl-form-line-5,
    .ftl-form-line-6 { grid-template-columns: minmax(0, 1fr); }
    .ftl-form-line > .form-row { width: 100%; }
    .ftl-external-organization { grid-template-columns: minmax(0, 1fr); }
    .ftl-extension-settings { grid-template-columns: minmax(0, 1fr); }
    .ftl-block-segments-heading { flex-direction: column; }
    .ftl-block-segment { grid-template-columns: minmax(0, 1fr); }
    .ftl-block-segment > * { grid-column: 1; }
}
.inline-form { display: inline-block; margin-left: 5px; }


* { box-sizing: border-box; }
html { font-size: 14.5px; }
body {
    margin: 0;
    font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
    font-size: .95rem;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.btn,
.nav-link,
.nav-dropdown-toggle,
.form-control {
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
}

.btn:hover {
    box-shadow: 0 4px 12px rgba(16, 24, 40, .12);
}

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 24px 24px;
}

@media (max-height: 760px), (max-width: 640px) {
    .login-wrapper {
        padding-top: 40px;
    }
}

.card {
    width: min(100%, 460px);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1.55rem;
}

.logo { max-width: 300px; display: block; margin: 0 auto 1rem; }
.login-product-logo { width: 15%; height: auto; display: block; margin: 0 auto .75rem; }
h1, h2, h3 { margin: 0 0 .45rem; line-height: 1.2; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
p { color: var(--muted); line-height: 1.48; }

.cookie-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    display: none;
    justify-content: center;
    color: var(--nav-ink);
    background: var(--nav-bg);
    box-shadow: 0 2px 10px rgba(16, 24, 40, .2);
    z-index: 9999;
}

.cookie-content {
    width: 100%;
    max-width: 1100px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.cookie-content p {
    margin: 0;
    color: var(--nav-ink);
    font-size: 14px;
    line-height: 1.4;
}

.cookie-actions {
    display: flex;
    gap: 10px;
}

.cookie-btn {
    padding: 8px 14px;
    border: 0;
    border-radius: 4px;
    color: #ffffff;
    background: var(--success);
    cursor: pointer;
    font-size: 13px;
    transition: filter .2s ease;
}

.cookie-btn:hover { filter: brightness(.95); }

@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .cookie-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

.form-row { margin: .8rem 0; }
label { display: block; font-weight: 700; margin-bottom: .4rem; }
.form-control {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .68rem .85rem;
    font-size: .94rem;
    background: var(--control-bg);
    color: var(--ink);
}
.form-control:focus { outline: 3px solid rgba(37, 99, 235, .16); border-color: var(--accent); }

.btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: .64rem 1rem;
    font-weight: 700;
    cursor: pointer;
    color: #ffffff;
    background: var(--accent);
}
.btn:hover { filter: brightness(.98); text-decoration: none; }
.btn-success { background: var(--success); }
.btn-block { width: 100%; }

.alert {
    border: 1px solid var(--danger);
    background: var(--danger-soft);
    color: #991b1b;
    border-radius: 8px;
    padding: .85rem 1rem;
    margin: 1rem 0;
}
.alert.info { border-color: #83acd5; background: var(--info-soft); color: #1e3f73; }

.login-links { margin-top: 1rem; text-align: center; }
.login-link-button {
    appearance: none;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent-dark);
    font: inherit;
    cursor: pointer;
}
.login-link-button:hover { text-decoration: underline; }
.login-link-button:focus-visible { outline: 3px solid rgba(37, 99, 235, .16); outline-offset: 3px; }
.navbar {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: .6rem 1.4rem;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: 0 8px 24px rgba(16, 24, 40, .18);
    
}
.navbar-brand { display: inline-flex; align-items: center; gap: .8rem; color: var(--nav-ink); font-weight: 900; }
.navbar-brand img { height: 36px; width: auto; }
.navbar-links { display: flex; gap: 1rem; margin-left: auto; }
.navbar-user { color: var(--nav-muted); font-weight: 700; }
.navbar-clock {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .12rem;
    border: 1px solid var(--nav-border);
    border-radius: 10px;
    padding: .36rem .72rem;
    background: var(--nav-bg-soft);
    color: var(--nav-ink);
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.08;
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.navbar-clock span {
    display: block;
}
.navbar-product-logo {
    width: auto;
    height: 32px;
    flex: 0 0 auto;
}

.navbar a { color: var(--nav-ink); }
.navbar a:hover { text-decoration: none; }
.navbar-brand:hover { color: var(--nav-ink); text-decoration: none; }

.page { max-width: 1080px; margin: 1.5rem auto; padding: 0 1.2rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 1.65rem; margin-bottom: .25rem; }
.small { font-size: .82rem; color: var(--muted); }

.toolbar { display: flex; gap: .75rem; align-items: end; justify-content: space-between; margin: 1.25rem 0; flex-wrap: wrap; }
.toolbar form { display: flex; gap: .6rem; align-items: end; flex-wrap: wrap; }
.table-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.table-responsive { width: 100%; overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; background: var(--panel); }
.data-table th, .data-table td { padding: .64rem .78rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.data-table th { background: var(--panel-soft); font-size: .82rem; color: var(--muted); }
.data-table tr:last-child td { border-bottom: 0; }
.pagination { display: flex; gap: .75rem; align-items: center; justify-content: center; margin: 0 0 1rem; flex-wrap: wrap; }
.pagination-pages { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.pagination-page { min-width: 2.1rem; text-align: center; }
.pagination-page.is-active { opacity: .72; cursor: default; pointer-events: none; font-weight: 700; }
.pagination-ellipsis { color: var(--muted); padding: 0 .25rem; }
.badge { display: inline-block; border: 1px solid var(--border); border-radius: 999px; padding: .2rem .55rem; background: var(--control-bg); color: var(--muted); font-size: .85rem; }
@media (max-width: 720px) { .navbar { align-items: flex-start; flex-direction: column; } .navbar-links { margin-left: 0; } }

/* Colored action buttons for navbar and application use */
.btn-blue { background: #2563eb; color: #ffffff; }
.btn-green { background: #16a34a; color: #ffffff; }
.btn-purple { background: #4f46e5; color: #ffffff; }
.btn-orange { background: #d97706; color: #ffffff; }
.btn-red, .btn-danger { background: var(--danger); color: #ffffff; }
.btn-slate { background: #475569; color: #ffffff; }
.btn-yellow { background: #ca8a04; color: #ffffff; }
.btn-small { padding: .38rem .66rem; font-size: .8rem; }
.btn-nav { padding: .46rem .78rem; font-size: .84rem; }
.button-row { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; }

/* Responsive dropdown navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "brand menu account";
    align-items: center;
    gap: 1rem;
}
.navbar-brand {
    grid-area: brand;
    min-width: 0;
}
.navbar-brand img { max-width: 100%; object-fit: contain; }
.navbar-center {
    grid-area: menu;
    display: flex;
    flex-wrap: wrap;
    min-width: 0;
    justify-content: center;
    align-items: center;
    gap: .5rem;
}
.navbar-right {
    grid-area: account;
    display: flex;
    flex-wrap: wrap;
    min-width: 0;
    justify-content: flex-end;
    align-items: center;
    gap: .75rem;
}
.navbar-user {
    min-width: 0;
    max-width: 100%;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.navbar-right > .btn,
.navbar-clock,
.navbar-product-logo { flex-shrink: 0; }
.nav-link,
.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border: 0;
    border-radius: 999px;
    padding: .65rem 1rem;
    font: inherit;
    font-weight: 700;
    white-space: nowrap;
    color: var(--nav-ink);
    background: transparent;
    cursor: pointer;
}
.nav-link:hover,
.nav-dropdown-toggle:hover,
.nav-dropdown:hover .nav-dropdown-toggle,
.nav-dropdown:focus-within .nav-dropdown-toggle,
.nav-dropdown.is-open .nav-dropdown-toggle {
    background: var(--nav-hover);
    color: var(--nav-ink);
    text-decoration: none;
}
.nav-dropdown {
    position: relative;
}
.nav-dropdown::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: .35rem;
}
.nav-dropdown-menu {
    position: absolute;
    left: 50%;
    top: calc(100% + .25rem);
    min-width: 175px;
    transform: translateX(-50%) translateY(-.25rem);
    display: grid;
    gap: .25rem;
    padding: .45rem;
    border: 1px solid var(--nav-border);
    border-radius: 8px;
    background: var(--nav-bg-soft);
    box-shadow: 0 12px 28px rgba(16, 24, 40, .22);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
.nav-dropdown-menu a {
    display: block;
    border-radius: 8px;
    padding: .58rem .72rem;
    color: var(--nav-ink);
    font-weight: 750;
}
.nav-dropdown-menu a:hover {
    background: var(--nav-hover);
    color: var(--nav-ink);
    text-decoration: none;
}

.page-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.form-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 1rem;
    margin: 1rem 0;
}
.pic-discretion-page { max-width: 1500px; }
.pic-reports-card { padding: 1rem; }
.pic-reports-card > .toolbar { margin: 0 0 1rem; }
.pic-discretion-form-card,
.pic-report-detail { max-width: 980px; }
.pic-caa-warning {
    margin: .75rem 0;
    padding: .75rem .85rem;
    border: 1px solid #ef9f3f;
    border-radius: 9px;
    background: var(--warning-soft);
    color: #713f12;
    line-height: 1.45;
}
.pic-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .65rem;
    margin: .8rem 0 1rem;
}
.pic-metric-grid > div {
    display: grid;
    gap: .2rem;
    padding: .7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-elevated);
}
.pic-metric-grid span { color: var(--muted); font-size: .78rem; }
.pic-narrative {
    margin: .8rem 0;
    padding: .8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-elevated);
}
.pic-narrative h3 { margin: .65rem 0 .25rem; }
.pic-narrative h3:first-child { margin-top: 0; }
.pic-narrative p { white-space: normal; overflow-wrap: anywhere; }
.pic-operator-review {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 1rem;
}
.role-box {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .8rem;
    margin: .8rem 0 0;
}
.role-box legend { font-weight: 700; color: var(--muted); padding: 0 .35rem; }
.role-box.is-disabled { opacity: .62; }
.check-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin: .25rem .4rem .25rem 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .36rem .58rem;
    background: var(--control-bg);
    font-weight: 700;
}
.danger-panel { border-color: rgba(190, 80, 102, .48); background: var(--danger-soft); }
.mt-1 { margin-top: 1rem; }

@media (max-width: 1280px) {
    .navbar {
        grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
        grid-template-areas: "brand account" "menu menu";
    }
}

@media (max-width: 720px) {
    .navbar {
        grid-template-columns: 1fr;
        grid-template-areas: "brand" "menu" "account";
        justify-items: stretch;
    }
    .navbar-brand,
    .navbar-center,
    .navbar-right {
        justify-content: center;
    }
    .navbar-center,
    .navbar-right {
        flex-wrap: wrap;
    }
    .navbar-clock {
        white-space: normal;
        text-align: center;
        justify-content: center;
    }
    .navbar-product-logo {
        height: 30px;
    }
    .nav-dropdown-menu {
        left: auto;
        right: 0;
        transform: translateY(-.25rem);
    }
    .nav-dropdown:hover .nav-dropdown-menu,
    .nav-dropdown:focus-within .nav-dropdown-menu,
    .nav-dropdown.is-open .nav-dropdown-menu {
        transform: translateY(0);
    }
    .page-title-row { flex-direction: column; }
}

/* Reusable linked files section */
.files-section-grid {
    display: grid;
    grid-template-columns: minmax(220px, 25%) 1fr;
    gap: 1rem;
    align-items: start;
}
.file-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: .9rem;
}
.file-upload-input {
    min-height: 7.5rem;
}
.file-meta {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
@media (max-width: 840px) {
    .files-section-grid { grid-template-columns: 1fr; }
}

/* Groups administration */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .45rem;
}
.group-user-pill {
    align-items: flex-start;
    border-radius: 8px;
    width: 100%;
}
.group-user-pill small {
    color: var(--muted);
}
.table-actions {
    margin-top: 0;
}
.table-actions form {
    margin: 0;
}

/* Full-width application layout/cards */
.page {
    width: 100%;
    max-width: none;
    margin: 1.35rem 0;
    padding: 0 1rem;
}

.card,
.stat,
.table-card,
.form-panel,
.file-card {
    width: 100%;
    max-width: none;
}

.grid {
    grid-template-columns: 1fr;
}

.files-section-grid,
.comments-section-grid {
    grid-template-columns: minmax(220px, 25%) minmax(0, 1fr);
}

@media (max-width: 840px) {
    .files-section-grid,
    .comments-section-grid {
        grid-template-columns: 1fr;
    }
}

.login-wrapper .card {
    width: min(100%, 460px);
    max-width: 460px;
}

/* Compact vertical action buttons inside data tables */
.data-table td .button-row,
.data-table td .table-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .35rem;
    margin-top: 0;
    min-width: 5.25rem;
}
.data-table td .table-actions form {
    margin: 0;
}
.data-table td .btn-small,
.data-table td .table-actions .btn {
    display: inline-flex;
    justify-content: center;
    width: 100%;
    padding: .28rem .48rem;
    font-size: .74rem;
    line-height: 1.15;
    white-space: nowrap;
}

.cell-center {
    text-align: center !important;
    vertical-align: middle !important;
}

.dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-split-grid {
    display: grid;
    grid-template-columns: minmax(220px, 25%) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    margin: 1.25rem 0;
}

.admin-split-grid .form-panel,
.admin-split-grid .table-card {
    margin: 0;
}

.admin-users-split-grid {
    grid-template-columns: minmax(220px, 30%) minmax(0, 1fr);
}

.admin-table-toolbar {
    padding: 1rem;
    margin: 0;
    border-bottom: 1px solid var(--border);
}

.admin-form-card .form-grid {
    grid-template-columns: 1fr;
}

@media (max-width: 840px) {
    .dashboard-grid,
    .admin-split-grid {
        grid-template-columns: 1fr;
    }
}

/* Linked files/comments tables */
.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .75rem;
}
.card-title-row h3 {
    margin: 0;
}
.linked-files-table td,
.linked-comments-table td {
    vertical-align: middle;
}
.linked-files-table th,
.linked-comments-table th {
    vertical-align: middle;
}

@media (max-width: 520px) {
    .card-title-row { align-items: flex-start; flex-direction: column; }
}

/* Professional neutral theme refinements */
.form-control::placeholder { color: rgba(79, 113, 132, .66); }
select.form-control option { background: var(--control-bg); color: var(--ink); }
.data-table tbody tr:hover { background: var(--row-hover); }

.data-table tbody tr.clickable-row { cursor: pointer; }
.data-table tbody tr.clickable-row:focus { outline: 3px solid rgba(37, 99, 235, .18); outline-offset: -3px; }
.nav-dropdown-menu a:focus,
.nav-link:focus,
.nav-dropdown-toggle:focus,
.btn:focus { outline: 3px solid rgba(37, 99, 235, .18); outline-offset: 2px; }

/* Dashboard cards */
#dashboard-ftl-card,
.dashboard-roster-card {
    width: calc(100% - 2rem);
    margin-right: auto;
    margin-left: auto;
}

#dashboard-ftl-card > .small,
.dashboard-roster-empty {
    margin: 0;
    padding: 1rem;
}

.dashboard-roster-card { margin-bottom: 1rem; }
#dashboard-roster-title,
#dashboard-ftl-title {
    margin: 0 0 .15rem;
    font-family: inherit;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}
.dashboard-roster-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: .55rem;
    padding: 1rem;
}
.dashboard-roster-day {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    min-height: 92px;
    padding: .55rem;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel-elevated);
    text-align: center;
}
.dashboard-roster-day header { display: flex; align-items: center; justify-content: space-between; gap: .35rem; margin-bottom: .45rem; }
.dashboard-roster-day header span { color: var(--muted); font-size: .64rem; font-weight: 700; text-transform: uppercase; }
.dashboard-roster-day header time { color: var(--ink); font-size: .72rem; font-weight: 800; }
.dashboard-roster-day > strong { display: block; color: var(--ink); font-size: 1rem; line-height: 1.1; }
.dashboard-roster-label { display: -webkit-box; margin-top: .25rem; overflow: hidden; color: var(--muted); font-size: .65rem; line-height: 1.2; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.dashboard-roster-day.is-weekend { background: var(--panel-soft); }
.dashboard-roster-day.is-unassigned { border-style: dashed; }
.dashboard-roster-day.is-rest { border-color: #70c994; background: var(--success-soft); }
.dashboard-roster-day.is-rest > strong, .dashboard-roster-day.is-rest .dashboard-roster-label { color: #047857; }
.dashboard-roster-day.is-auto-rest { box-shadow: inset 0 -3px #34d399; }
.dashboard-roster-day.is-conflict { border-color: #d86a80; background: var(--danger-soft); box-shadow: inset 0 0 0 1px #c51d45; }
.dashboard-roster-day.is-conflict > strong, .dashboard-roster-day.is-conflict .dashboard-roster-label { color: #9f1239; }
.dashboard-roster-day.is-today { outline: 2px solid #60a5fa; outline-offset: 1px; }
.dashboard-roster-conflict { position: absolute; top: 3px; right: 3px; border-radius: 4px; padding: 2px 3px; color: #fff; background: #be123c; font-size: .5rem; font-weight: 900; line-height: 1; }

.admin-dashboard-section {
    margin-top: 1.5rem;
}

.admin-dashboard-title-row {
    margin-top: .5rem;
    margin-bottom: .75rem;
}

.admin-dashboard-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.admin-dashboard-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
}

.admin-dashboard-card .table-responsive {
    flex: 1 1 auto;
}

.admin-dashboard-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--panel-soft);
}

.admin-dashboard-card-header h3 {
    margin-bottom: .15rem;
}

.admin-dashboard-card-actions {
    justify-content: flex-end;
    margin-top: 0;
}

.dashboard-card-pagination {
    justify-content: center;
    gap: .5rem;
    margin: 0;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--panel-soft);
}

.dashboard-card-pagination .btn-small {
    width: auto;
}

.compact-dashboard-table th,
.compact-dashboard-table td {
    padding: .55rem .62rem;
}

.compact-dashboard-table td .btn-small {
    width: auto;
}

.ftl-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    margin-top: 1rem;
    padding: 0 1rem 1rem;
}
.dashboard-ftl-records { padding: 1rem; }
.dashboard-ftl-record-table { min-width: 760px; }
.dashboard-ftl-record-table th,
.dashboard-ftl-record-table td { padding: .6rem .7rem; vertical-align: middle; }
.dashboard-ftl-record-table tbody th { background: var(--panel-elevated); color: var(--ink); white-space: nowrap; }
.dashboard-ftl-record-table td:nth-child(3),
.dashboard-ftl-record-table td:nth-child(4),
.dashboard-ftl-record-table td:nth-child(5) { white-space: nowrap; }
.dashboard-ftl-record-table .ftl-external-badge { margin-left: .35rem; color: #6d28d9; border-color: #b9a9dc; background: var(--purple-soft); font-size: .66rem; }
.dashboard-ftl-record-table tr.is-exceeded > th,
.dashboard-ftl-record-table tr.is-exceeded > td { background: var(--danger-soft); color: #8d1837; }
.ftl-dashboard-grid.is-admin { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ftl-dashboard-user-card {
    min-width: 0;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel-elevated);
    box-shadow: 0 3px 12px rgba(15, 40, 70, .06);
}
.ftl-dashboard-user-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}
.ftl-dashboard-user-header h2 { margin: 0 0 .15rem; font-size: 1.05rem; }
.ftl-dashboard-user-header .badge { max-width: 48%; white-space: normal; text-align: right; }
.ftl-dashboard-user-actions {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-end;
    gap: .45rem;
}
.ftl-dashboard-user-actions .badge { max-width: 100%; }
.ftl-dashboard-user-actions .button-row { justify-content: flex-end; margin-top: 0; }
.ftl-dashboard-user-actions .btn-small { width: auto; }
.ftl-dashboard-user-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    padding-top: .8rem;
}
.ftl-dashboard-user-stats > div { min-width: 0; }
.ftl-dashboard-user-stats .small { display: block; margin-bottom: .25rem; }
.ftl-dashboard-user-stats strong { display: block; overflow-wrap: anywhere; }
.ftl-dashboard-recent { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.ftl-dashboard-recent h3 { margin: 0 0 .6rem; font-size: .9rem; }
.ftl-dashboard-recent > .small { margin: 0; }
.ftl-dashboard-recent-table { table-layout: fixed; font-size: .72rem; }
.ftl-dashboard-recent-table th,
.ftl-dashboard-recent-table td { padding: .42rem .38rem; vertical-align: middle; overflow-wrap: anywhere; }
.ftl-dashboard-recent-table th:nth-child(1) { width: 20%; }
.ftl-dashboard-recent-table th:nth-child(2) { width: 18%; }
.ftl-dashboard-recent-table th:nth-child(3) { width: 34%; }
.ftl-dashboard-recent-table th:nth-child(4) { width: 28%; }
.ftl-dashboard-recent-table td:nth-child(3) span { display: block; white-space: nowrap; }
.ftl-dashboard-recent-table .badge { max-width: 100%; white-space: normal; font-size: .68rem; }
.ftl-dashboard-recent-table .ftl-external-badge { margin-top: .2rem; color: #6d28d9; border-color: #b9a9dc; background: var(--purple-soft); }
.ftl-dashboard-recent-table tr.is-exceeded > th,
.ftl-dashboard-recent-table tr.is-exceeded > td { background: var(--danger-soft); color: #8d1837; }
.ftl-dashboard-user-card.ftl-dashboard-exceeded {
    border-color: #dc6b6b;
    background: var(--danger-soft-strong);
    color: #6f1515;
    box-shadow: 0 3px 14px rgba(150, 25, 25, .14);
}
.ftl-dashboard-user-card.ftl-dashboard-exceeded .ftl-dashboard-user-header { border-bottom-color: #e8aaaa; }

@media (max-width: 900px) {
    .ftl-dashboard-grid.is-admin { grid-template-columns: minmax(0, 1fr); }
    .dashboard-roster-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    #dashboard-ftl-card, .dashboard-roster-card { width: 100%; }
    #dashboard-ftl-card .ftl-dashboard-grid { padding-right: .75rem; padding-left: .75rem; }
    .dashboard-ftl-records { padding: .75rem; }
    .dashboard-roster-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: .75rem; }
    .ftl-dashboard-user-stats { grid-template-columns: minmax(0, 1fr); }
    .ftl-dashboard-user-header { flex-direction: column; }
    .ftl-dashboard-user-header .badge { max-width: 100%; text-align: left; }
    .ftl-dashboard-user-actions { align-items: flex-start; }
    .ftl-dashboard-user-actions .button-row { justify-content: flex-start; }
}

@media (max-width: 390px) {
    .dashboard-roster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
    .admin-dashboard-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .admin-dashboard-card-header {
        flex-direction: column;
    }

    .admin-dashboard-card-actions {
        justify-content: flex-start;
    }
}

/* Two-factor authentication settings */
.two-factor-page {
    max-width: 1180px;
    margin: 1.5rem auto 2rem;
    padding: 0 1.25rem;
}

.two-factor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
    gap: 1rem;
    align-items: stretch;
    margin: 1rem 0;
}

.two-factor-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
}

.two-factor-card form {
    margin-top: auto;
}

.two-factor-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .5rem;
}

.two-factor-setup-card {
    padding: 1.25rem;
}

.two-factor-setup-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

.qr-box {
    display: grid;
    place-items: center;
    min-height: 220px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--control-bg);
    padding: 1rem;
}

.qr-box img {
    max-width: 100%;
    width: 220px;
    height: auto;
}

.manual-key {
    display: block;
    width: 100%;
    overflow-wrap: anywhere;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--control-bg);
    color: var(--ink);
    padding: .85rem;
    font-size: 1rem;
    letter-spacing: .08em;
}

.btn:disabled {
    cursor: not-allowed;
    filter: grayscale(.35);
    opacity: .72;
}

@media (max-width: 820px) {
    .two-factor-grid,
    .two-factor-setup-grid {
        grid-template-columns: 1fr;
    }
}

.two-factor-recovery-form {
    margin-top: 1rem;
}

.recovery-note {
    margin-top: .75rem;
    font-size: .9rem;
    line-height: 1.4;
}

/* Crew rostering */
.roster-page {
    width: 100%;
    max-width: none;
    margin: 1.25rem auto 3rem;
}

.roster-heading {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    align-items: end;
    margin-bottom: 1rem;
}

.roster-heading h1 { margin: .15rem 0; }
.roster-heading p { max-width: 820px; margin: .25rem 0; }
.roster-kicker { color: #2457a6; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; }
.roster-stat-strip { display: flex; gap: .6rem; flex-wrap: wrap; }
.roster-stat-strip span { background: var(--panel-elevated); border: 1px solid var(--border); border-radius: 10px; padding: .65rem .85rem; white-space: nowrap; }
.roster-stat-strip .is-warning { color: #7b390d; background: var(--warning-soft); border-color: #d99a55; }
.roster-stat-strip .is-change { color: #7b3d0d; background: var(--warning-soft); border-color: #d2a43d; }
.roster-stat-strip .is-variance { color: #075985; background: #e0f2fe; border-color: #7dd3fc; }
.roster-stat-strip .is-danger { color: #8d1837; background: var(--danger-soft); border-color: #d86a80; }

.roster-month-card { padding: 0; overflow: hidden; }
.roster-month-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.roster-month-navigation { display: flex; align-items: center; gap: .5rem; }
.roster-month-navigation .btn { min-width: 38px; padding-inline: .65rem; font-size: 1.25rem; }
.roster-month-input { min-width: 170px; font-weight: 700; }
.roster-crew-search-form { display: flex; align-items: end; gap: .4rem; flex: 1 1 260px; max-width: 430px; }
.roster-crew-search-field { flex: 1 1 auto; width: auto; min-width: 180px; }
.roster-crew-search-form .btn { white-space: nowrap; }
.roster-filter-form { display: flex; align-items: end; justify-content: flex-end; gap: .55rem; flex: 1 1 auto; flex-wrap: wrap; }
.roster-filter-field { width: min(230px, 100%); }
.roster-filter-field label { display: block; margin-bottom: .24rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
.roster-pdf-month-filter { width: min(150px, 100%); }
.roster-filter-actions { display: flex; gap: .4rem; align-items: center; }
.roster-publication-actions { display: flex; align-items: flex-end; justify-content: flex-end; gap: .5rem; flex: 0 0 auto; flex-wrap: wrap; }
.roster-publish-form { display: flex; flex: 0 0 auto; align-self: flex-end; }
.roster-publish-form .btn { white-space: nowrap; }
.roster-publication-actions > .btn { white-space: nowrap; }
.roster-rule-banner { padding: .72rem 1rem; background: var(--info-soft); border-bottom: 1px solid #9ebbd5; color: #1e3a5f; font-size: .86rem; }

.roster-matrix-wrap { width: 100%; min-height: 0; overflow: visible; }
.roster-matrix { width: 100%; min-width: 0; max-width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; background: var(--panel-elevated); }
.roster-matrix th, .roster-matrix td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.roster-matrix thead th { position: sticky; top: 0; z-index: 4; background: var(--panel-soft); }
.roster-matrix tbody tr:hover > .roster-crew-column,
.roster-matrix tbody tr:hover > .roster-summary-column,
.roster-matrix tbody tr:hover > .roster-cell:not(.is-weekend):not(.is-today):not(.is-auto-rest):not(.is-rule-satisfied):not(.is-conflict):not(.is-changed):not(.is-variance):not(.is-noncompliant):not(.is-published-locked) {
    background: var(--row-hover);
}

.roster-crew-column { position: sticky; left: 0; z-index: 3; width: clamp(120px, 12vw, 190px); min-width: 0; max-width: 190px; padding: .55rem clamp(.3rem, .55vw, .75rem); text-align: left; background: var(--panel-elevated); box-shadow: 2px 0 0 var(--border); }
.roster-matrix thead .roster-crew-column { z-index: 6; background: var(--panel-soft); }
.roster-crew-column strong, .roster-crew-column span, .roster-crew-filter-link { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-crew-filter-link { color: var(--ink); font-weight: 700; }
.roster-crew-filter-link:hover, .roster-crew-filter-link:focus { color: var(--accent-dark); text-decoration: underline; }
.roster-crew-column span { color: var(--muted); font-size: .76rem; font-weight: 400; }
.roster-crew-column .roster-qualification-status { display: inline-block; max-width: 100%; margin-top: .3rem; padding: .12rem .42rem; border: 1px solid var(--border); border-radius: 999px; background: var(--control-bg); font-size: .68rem; font-weight: 700; }
.roster-crew-column .roster-qualification-status.is-valid { color: #166534; border-color: #86b596; background: var(--success-soft); }
.roster-crew-column .roster-qualification-status.is-expiring { color: #854d0e; border-color: #c6a65c; background: var(--warning-soft); }
.roster-crew-column .roster-qualification-status.is-invalid,
.roster-crew-column .roster-qualification-status.is-unlinked,
.roster-crew-column .roster-qualification-status.is-stale,
.roster-crew-column .roster-qualification-status.is-unknown,
.roster-crew-column .roster-qualification-status.is-unavailable { color: #991b1b; border-color: #d48b98; background: var(--danger-soft); }
.roster-crew-column .roster-operation-profile { display: block; max-width: 100%; margin-top: .3rem; padding: .2rem .42rem; overflow-wrap: anywhere; border: 1px solid var(--border); border-radius: .55rem; background: var(--control-bg); font-size: .68rem; font-weight: 700; line-height: 1.2; white-space: normal; }
.roster-crew-column .roster-operation-profile.is-configured { color: #1e3a5f; border-color: #9ebbd5; background: var(--info-soft); }
.roster-crew-column .roster-operation-profile.is-unconfigured { color: #991b1b; border-color: #d48b98; background: var(--danger-soft); }

.roster-day-heading { width: auto; min-width: 0; height: 54px; padding: .3rem .08rem; overflow: hidden; text-align: center; }
.roster-day-heading span, .roster-day-heading strong { display: block; }
.roster-day-heading span { color: var(--muted); font-size: clamp(.48rem, .55vw, .68rem); text-transform: uppercase; }
.roster-day-heading strong { font-size: clamp(.62rem, .78vw, .96rem); }
.roster-day-heading.is-weekend, .roster-cell.is-weekend { background: var(--weekend-bg); }
.roster-day-heading.is-today { background: var(--today-soft); color: #1d4ed8; }

.roster-cell { position: relative; width: auto; min-width: 0; height: 64px; padding: 2px 1px; overflow: hidden; text-align: center; background: var(--panel-elevated); }
.roster-cell.is-today { box-shadow: inset 2px 0 #60a5fa, inset -2px 0 #60a5fa; }
.roster-cell.is-auto-rest { background: var(--success-soft); }
.roster-cell.is-rule-satisfied { background: var(--success-soft); }
.roster-cell.is-conflict { background: var(--danger-soft); box-shadow: inset 0 0 0 2px #d86a80; }
.roster-cell.is-variance { background: #e0f2fe; box-shadow: inset 0 -3px #0284c7; }
.roster-cell.is-changed { background: var(--warning-soft); box-shadow: inset 0 -3px #d58b0b; }
.roster-cell.is-noncompliant { background: var(--danger-soft-strong); box-shadow: inset 0 0 0 2px #c51d45; }
.roster-cell.is-published-locked { cursor: not-allowed; }
.roster-cell-form { margin: 0; }
.roster-code-select { width: 100%; min-width: 0; height: 32px; border: 1px solid transparent; border-radius: 6px; padding: 0; background: transparent; color: var(--ink); font-size: clamp(.5rem, .57vw, .72rem); font-weight: 700; text-align: center; text-align-last: center; cursor: pointer; appearance: none; }
.roster-code-select:hover, .roster-code-select:focus { border-color: #82acd4; outline: none; background: var(--control-bg); }
.roster-planned-time { display: block; width: 100%; margin-top: -1px; border: 0; padding: 0; color: #334155; background: transparent; font: inherit; font-size: .72rem; font-weight: 400; line-height: 1.12; white-space: normal; overflow-wrap: normal; cursor: pointer; }
.roster-planned-time:hover, .roster-planned-time:focus { color: var(--accent-dark); text-decoration: underline; outline: none; }
.roster-recovery-form { margin-top: 2px; }
.roster-recovery-button { width: 100%; border: 0; border-radius: 4px; padding: 2px 1px; background: #be123c; color: #fff; font-size: .5rem; font-weight: 800; line-height: 1.1; cursor: pointer; }
.roster-recovery-button:hover, .roster-recovery-button:focus { background: #9f1239; outline: 2px solid #fda4af; outline-offset: 1px; }
.roster-cell.is-conflict .roster-code-select { color: #be123c; }
.roster-cell.is-amended { box-shadow: inset 0 0 0 2px #0f766e; }
.roster-amendment-mark { display: block; margin-top: 2px; color: #0f766e; font-size: .5rem; font-weight: 800; line-height: 1.05; }
.roster-amendment-plan { display: block; margin-top: 1px; color: #475569; font-size: .5rem; font-weight: 400; line-height: 1.05; }
.roster-auto-code { display: grid; place-content: center; min-height: 32px; line-height: 1; color: #047857; }
.roster-auto-code strong { font-size: .7rem; }
.roster-auto-code span { margin-top: 3px; font-size: .56rem; letter-spacing: .05em; }
.roster-readonly-code { display: grid; place-content: center; min-height: 32px; color: var(--ink); font-size: .72rem; font-weight: 700; line-height: 1; }
.roster-readonly-code { display: grid; place-content: center; min-height: 32px; color: var(--ink); line-height: 1; }
.roster-readonly-code strong { font-size: .72rem; }
.roster-readonly-code small { display: block; margin-top: 3px; color: #334155; font-size: .72rem; font-weight: 400; line-height: 1.12; }
.roster-readonly-code.is-published span,
.roster-published-label { display: block; margin-top: 3px; color: #1d4ed8; font-size: .62rem; font-weight: 900; letter-spacing: .04em; line-height: 1; }
.roster-readonly-code.is-unassigned { color: #94a3b8; }
.roster-actual-code { min-height: 15px; margin-top: 2px; border-radius: 4px; padding: 2px 1px; overflow: hidden; color: #047857; background: #c7e5d6; font-size: .54rem; font-weight: 800; line-height: 1.05; white-space: nowrap; text-overflow: ellipsis; }
.roster-actual-code.is-link { display: block; text-decoration: none; cursor: pointer; }
.roster-actual-code.is-link:hover,
.roster-actual-code.is-link:focus-visible { text-decoration: underline; outline: 1px solid currentColor; outline-offset: 1px; }
.roster-actual-code.is-variance { color: #075985; background: #bae6fd; }
.roster-actual-code.is-changed { color: #7b3d0d; background: #e8d293; }
.roster-cell.is-noncompliant .roster-actual-code { color: #8d1837; background: #e6c2ca; }
.roster-nc-mark { position: absolute; top: 1px; right: 1px; border-radius: 3px; padding: 1px 2px; color: #fff; background: #be123c; font-size: .48rem; font-weight: 900; line-height: 1; }
.roster-external-mark { position: absolute; top: 1px; left: 1px; border-radius: 3px; padding: 1px 2px; color: #fff; background: #6d28d9; font-size: .46rem; font-weight: 900; line-height: 1; }

.roster-summary-column { position: sticky; right: 0; z-index: 3; width: clamp(64px, 7vw, 100px); min-width: 0; padding: .4rem clamp(.2rem, .45vw, .55rem); overflow: hidden; background: var(--panel-elevated); box-shadow: -2px 0 0 var(--border); font-size: clamp(.54rem, .6vw, .7rem); text-align: left; }
.roster-matrix thead .roster-summary-column { z-index: 6; background: var(--panel-soft); }
.roster-summary-column span, .roster-summary-column strong { display: block; white-space: nowrap; }
.roster-summary-column strong { color: #be123c; }

.roster-pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 54px; padding: .65rem 1rem; border-top: 1px solid var(--border); background: var(--panel-soft); }
.roster-page-summary { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.roster-pagination { justify-content: flex-end; margin: 0; }

.roster-legend { display: flex; flex-wrap: wrap; gap: .45rem .8rem; margin-top: .8rem; padding: .85rem 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); font-size: .76rem; }
.roster-legend span { white-space: nowrap; color: var(--muted); }
.roster-legend strong { color: var(--ink); }
.roster-legend .legend-auto strong { color: #047857; }
.roster-legend .legend-actual strong { color: #047857; }
.roster-legend .legend-external strong { color: #6d28d9; }
.roster-legend .legend-published strong { color: #1d4ed8; }
.roster-legend .legend-amendment strong { color: #0f766e; }
.roster-legend .legend-change strong { color: #b45309; }
.roster-legend .legend-variance strong { color: #0369a1; }
.roster-legend .legend-conflict strong { color: #be123c; }
.roster-duty-dialog { width: min(680px, calc(100vw - 2rem)); border: 1px solid var(--border); border-radius: 12px; padding: 0; color: var(--ink); background: var(--panel-elevated); box-shadow: 0 24px 70px rgb(15 23 42 / .35); }
.roster-resend-dialog { width: min(720px, calc(100vw - 2rem)); border: 1px solid var(--border); border-radius: 12px; padding: 0; color: var(--ink); background: var(--panel-elevated); box-shadow: 0 24px 70px rgb(15 23 42 / .35); }
.roster-duty-dialog::backdrop { background: rgb(15 23 42 / .62); backdrop-filter: blur(2px); }
.roster-resend-dialog::backdrop { background: rgb(15 23 42 / .62); backdrop-filter: blur(2px); }
.roster-duty-dialog form { padding: 1rem 1.1rem 1.15rem; }
.roster-resend-dialog form { padding: 1rem 1.1rem 1.15rem; }
.roster-duty-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.roster-duty-dialog-heading h2 { margin: .15rem 0; }
.roster-duty-dialog-heading p { margin: .15rem 0; }
.roster-duty-dialog [hidden] { display: none !important; }
.roster-resolution-options { display: grid; gap: .45rem; margin: 0 0 .85rem; border: 1px solid var(--border); border-radius: 10px; padding: .65rem; }
.roster-resolution-options legend { padding: 0 .25rem; color: var(--muted); font-size: .78rem; font-weight: 700; }
.roster-resolution-options label { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .65rem; border-radius: 8px; padding: .65rem; cursor: pointer; }
.roster-resolution-options label:hover, .roster-resolution-options label:has(input:focus-visible) { background: var(--row-hover); }
.roster-resolution-options label:has(input:checked) { background: var(--info-soft); box-shadow: inset 0 0 0 1px #82acd4; }
.roster-resolution-options strong, .roster-resolution-options small { display: block; }
.roster-resolution-options small, .roster-amendment-note { color: var(--muted); }
.roster-rest-conflict-dialog > form > .form-row { margin-bottom: .85rem; }
.roster-resend-crew-list { display: grid; max-height: min(52vh, 460px); margin: 0 0 1rem; border: 1px solid var(--border); border-radius: 10px; padding: .35rem; overflow-y: auto; background: var(--control-bg); }
.roster-resend-crew-option { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .75rem; border-radius: 8px; padding: .7rem .75rem; cursor: pointer; }
.roster-resend-crew-option:hover, .roster-resend-crew-option:has(input:focus-visible) { background: var(--row-hover); }
.roster-resend-crew-option:has(input:checked) { background: var(--info-soft); box-shadow: inset 0 0 0 1px #82acd4; }
.roster-resend-crew-option span, .roster-resend-crew-option strong, .roster-resend-crew-option small { display: block; min-width: 0; }
.roster-resend-crew-option strong, .roster-resend-crew-option small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-resend-crew-option small, .roster-resend-crew-option time { color: var(--muted); font-size: .76rem; }
.user-opening-balance-groups { display: grid; gap: .65rem; }
.user-opening-balance-group { border: 1px solid var(--border); border-radius: 9px; padding: .65rem; background: var(--panel-soft); }
.user-opening-balance-group h3 { margin: 0 0 .55rem; font-size: .9rem; }
.user-opening-balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: .55rem; }
.user-opening-balance-grid .form-row { margin: 0; }
.user-opening-balance-notes { margin-top: .65rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
    .roster-heading { align-items: flex-start; flex-direction: column; gap: .75rem; }
    .roster-month-toolbar { align-items: stretch; flex-direction: column; }
    .roster-filter-form { align-items: stretch; flex-direction: column; }
    .roster-filter-field { width: 100%; }
    .roster-filter-actions .btn { flex: 1; text-align: center; }
    .roster-publish-form { align-self: stretch; }
    .roster-publish-form .btn { width: 100%; }
    .roster-publication-actions { align-items: stretch; flex-direction: column; width: 100%; }
    .roster-crew-search-form { max-width: none; }
    .roster-crew-column { width: 90px; min-width: 0; max-width: 90px; }
    .roster-summary-column { width: 54px; }
    .roster-day-heading span { display: none; }
    .roster-pagination-bar { align-items: stretch; flex-direction: column; }
    .roster-pagination { justify-content: center; }
    .roster-page-summary { text-align: center; }
    .user-opening-balance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.2rem;
    background: var(--panel-soft);
    color: var(--muted);
    font-size: .82rem;
    text-align: center;
}
.site-footer__content { max-width: 1080px; margin: 0 auto; line-height: 1.5; }
.site-footer a { font-weight: 700; }
.site-footer a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.login-wrapper { min-height: calc(100vh - 60px); }
