/*
 * Navy sidebar, white content surface, one restrained accent.
 *
 * Desktop-first, because the dispatcher works at a desk with many columns
 * visible, but the sidebar collapses to a top bar under 900px so the same
 * screens are usable from a phone in a yard.
 *
 * No CDN, no font import over the network: system fonts render immediately and
 * the Content-Security-Policy stays at default-src 'self'.
 */

:root {
    --navy: #10203c;
    --navy-soft: #1b2f50;
    --navy-line: #27406a;
    --accent: #2f7de1;
    --ink: #16202e;
    --muted: #64748b;
    --line: #e3e8ef;
    --surface: #ffffff;
    --canvas: #f5f7fa;
    --danger: #b3261e;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* --- shell ---------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    flex: 0 0 232px;
    background: var(--navy);
    color: #dce5f2;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
}

.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }

.brand-mark {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    background: var(--accent);
    color: #fff;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .5px;
}

.brand-text { font-weight: 600; color: #fff; letter-spacing: .2px; }

.nav-item {
    display: block;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: 8px;
    color: #b9c7dd;
    text-decoration: none;
    font-size: 14px;
}

.nav-item:hover { background: var(--navy-soft); color: #fff; }
.nav-item.is-active { background: var(--accent); color: #fff; font-weight: 600; }

.sidebar-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--navy-line);
}

.who { font-size: 14px; color: #fff; }
.role { font-size: 11px; letter-spacing: .6px; color: #8ea3c4; text-transform: uppercase; margin-bottom: 10px; }

.link-button {
    background: none; border: 0; padding: 0;
    color: #b9c7dd; font: inherit; font-size: 13px;
    cursor: pointer; text-decoration: underline;
}
.link-button:hover { color: #fff; }

/* --- content -------------------------------------------------------------- */

.content { flex: 1; padding: 26px 30px 40px; min-width: 0; }
.content-head { margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.content-head h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.2px; }
.content-head-actions { margin-left: auto; display: flex; align-items: center; }

/* --- metric cards --------------------------------------------------------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 15px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-label { font-size: 12px; color: var(--muted); letter-spacing: .3px; }
.card-value { font-size: 25px; font-weight: 650; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }

/* --- panels and tables ---------------------------------------------------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 18px;
}

.panel h2 { margin: 0 0 10px; font-size: 15px; font-weight: 650; }
.panel p { margin: 0; color: var(--muted); max-width: 62ch; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
    text-align: left;
    font-size: 11px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0 10px 8px;
    border-bottom: 1px solid var(--line);
}
table.data td { padding: 10px; border-bottom: 1px solid var(--line); }
table.data tr:last-child td { border-bottom: 0; }
/* Numbers line up column-wise, which is the whole point of a figures table. */
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    background: #eef3fb;
    color: #294a78;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .4px;
}

.muted { color: var(--muted); }

/* --- login and error surfaces --------------------------------------------- */

.login-body {
    background: var(--navy);
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 30px 28px;
    width: 100%;
    max-width: 370px;
    box-shadow: 0 18px 44px rgba(6, 16, 34, .35);
}

.brand-login { justify-content: center; margin-bottom: 22px; }
.brand-login .brand-text { color: var(--ink); }

.login-card label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin: 14px 0 5px;
}

.login-card input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    background: #fbfcfe;
}

.login-card input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    background: #fff;
}

.primary {
    width: 100%;
    margin-top: 20px;
    padding: 11px 14px;
    background: var(--accent);
    color: #fff;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.primary:hover { background: #2569c2; }
.primary.as-link { display: block; text-align: center; text-decoration: none; }

.alert {
    margin: 0 0 4px;
    padding: 10px 12px;
    background: #fdecea;
    border: 1px solid #f5c6c2;
    color: var(--danger);
    border-radius: 8px;
    font-size: 13px;
}

.error-card { text-align: center; }
.error-status { font-size: 44px; font-weight: 700; color: var(--accent); margin: 0; letter-spacing: -1px; }
.error-card h1 { font-size: 19px; margin: 6px 0 10px; }

/* --- mobile --------------------------------------------------------------- */

@media (max-width: 900px) {
    .shell { flex-direction: column; }

    .sidebar {
        width: 100%;
        flex: none;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
    }

    .brand { margin-bottom: 0; }
    .sidebar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
    .nav-item { margin: 0; padding: 7px 11px; }

    .sidebar-foot {
        margin: 0;
        padding: 0;
        border: 0;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .role { display: none; }
    .content { padding: 18px 16px 30px; }
    .cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

    /* Wide figure tables scroll rather than forcing the page sideways. */
    .panel { overflow-x: auto; }
}

/* --- registry surfaces ----------------------------------------------------- */

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

.button {
    display: inline-block;
    padding: 8px 13px;
    background: var(--accent);
    color: #fff;
    border: 1px solid var(--accent);
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.button:hover { background: #2569c2; }

.button.ghost {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line);
    font-weight: 500;
}

.button.ghost:hover { background: #eef2f7; }

.primary.inline { width: auto; margin-top: 0; }

/* Row actions sit side by side; the deactivate control is a form because it
   changes state and therefore needs a CSRF token, and a link cannot carry one. */
.row-actions { white-space: nowrap; text-align: right; }
.row-actions form { display: inline; margin-left: 10px; }
.row-actions a { color: var(--accent); text-decoration: none; }
.row-actions a:hover { text-decoration: underline; }

.link-button.dark { color: var(--muted); }
.link-button.dark:hover { color: var(--danger); }

/* A deactivated row stays visible and legible, just clearly retired. */
tr.inactive td { opacity: .55; }

/* --- forms ----------------------------------------------------------------- */

.form-panel { max-width: 620px; }

.field { margin-bottom: 14px; }

.field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 5px;
}

.field input[type="text"],
.field input[type="email"],
.field select,
.field textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    background: #fbfcfe;
}

.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    background: #fff;
}

.field.has-error input, .field.has-error select, .field.has-error textarea {
    border-color: #e09a95;
    background: #fdf7f7;
}

.field-error { margin: 5px 0 0; font-size: 12px; color: var(--danger); }
.field-hint { margin: 5px 0 0; font-size: 12px; color: var(--muted); }

.field label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); font-weight: 400; }
.field label.check input { width: auto; }

.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; }


/* Compact operational forms: more fields above the fold without reducing legibility. */
.form-panel { padding: 14px 16px; }
.form-panel .field { margin-bottom: 9px; }
.form-panel .field label { margin-bottom: 3px; }
.form-panel .field input[type="text"],
.form-panel .field input[type="email"],
.form-panel .field input[type="date"],
.form-panel .field select,
.form-panel .field textarea { padding: 7px 9px; }
.form-panel .form-actions { margin-top: 12px; }

.compact-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 14px;
    align-items: start;
}
.compact-form-grid > .field-wide,
.compact-form-grid > .form-actions { grid-column: 1 / -1; }
.compact-form-grid > .form-actions { margin-top: 4px; }

@media (max-width: 720px) {
    .compact-form-grid { grid-template-columns: 1fr; }
    .compact-form-grid > .field-wide,
    .compact-form-grid > .form-actions { grid-column: auto; }
}

/* --- loads ------------------------------------------------------------------ */

.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filter { display: flex; flex-direction: column; gap: 4px; }
.filter label { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .3px; }
.filter input, .filter select {
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    background: #fbfcfe;
}

.form-panel.wide { max-width: 900px; }
.form-panel h2 {
    margin: 22px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--muted);
}
.form-panel h2:first-of-type { margin-top: 0; }
.form-panel h3 { margin: 18px 0 4px; font-size: 14px; }
.form-panel .small { font-size: 13px; margin-bottom: 12px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 14px; }

.field input[type="date"] {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    background: #fbfcfe;
}

/* A definition list as a two-column detail sheet. */
dl.detail { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
dl.detail dt { color: var(--muted); font-size: 13px; }
dl.detail dd { margin: 0; }

/* Something an operator must act on, not merely a value that happens to be no. */
.warn { color: var(--danger); font-weight: 600; }

.toolbar form { display: inline; }

@media (max-width: 900px) {
    dl.detail { grid-template-columns: 1fr; gap: 2px 0; }
    dl.detail dd { margin-bottom: 10px; }
}

/* --- dashboard -------------------------------------------------------------- */

.period-bar { position: relative; }
.period-label { margin: 0 0 0 auto; font-size: 13px; color: var(--muted); align-self: center; }

.card-foot { font-size: 11px; color: var(--muted); }

/* Attention Required is the panel an operator should look at first, so it is
   the one thing on the page allowed to use colour to demand it. */
.attention { border-left: 4px solid var(--danger); }
.attention.is-clear { border-left-color: #2e9e6b; }
.attention h2 { display: flex; align-items: center; gap: 8px; }
.attention .count {
    background: var(--danger);
    color: #fff;
    border-radius: 99px;
    padding: 1px 8px;
    font-size: 12px;
}

.attention-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.attention-group h3 { margin: 0 0 8px; font-size: 13px; color: var(--ink); }
.attention-group ul { margin: 0; padding-left: 18px; font-size: 13px; }
.attention-group li { margin-bottom: 5px; }
.attention-group a { color: var(--accent); text-decoration: none; }
.attention-group a:hover { text-decoration: underline; }

.two-column { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.two-column .panel { margin-bottom: 0; }

@media (max-width: 900px) {
    .period-label { margin: 6px 0 0; width: 100%; }
    .two-column { grid-template-columns: 1fr; gap: 0; }
    .two-column .panel { margin-bottom: 18px; }
}

/* --- payroll ---------------------------------------------------------------- */

/* The formula column is the auditable part, so it is readable rather than
   squeezed to fit the numbers around it. */
table.payroll td.formula { font-size: 13px; color: var(--muted); white-space: nowrap; }
table.payroll tr.totals-row td { border-top: 2px solid var(--line); border-bottom: 0; }

@media (max-width: 900px) {
    table.payroll td.formula { white-space: normal; }
}

/* --- reports ---------------------------------------------------------------- */

.patterns { border-left: 4px solid #d99b2b; }
.patterns h3 { font-size: 13px; margin: 0 0 8px; }
ul.plain { list-style: none; margin: 0; padding: 0; font-size: 13px; }
ul.plain li { margin-bottom: 6px; }
ul.plain a { color: var(--accent); text-decoration: none; }
ul.plain a:hover { text-decoration: underline; }

/* Wide statistics tables scroll inside their panel rather than stretching the
   page, which keeps the sidebar and the filters reachable on a narrow screen. */
.panel > table.data { min-width: 100%; }

/* --- language switcher ------------------------------------------------------ */

/* Three buttons rather than a select: a select needs script to submit itself,
   and the CSP has no 'unsafe-inline'. The codes are shown, with the language's
   own name in the title, because RU/RO/EN is recognisable in every locale. */
.lang-switcher { display: flex; gap: 6px; margin: 0; }

.lang-button {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 5px 9px;
    color: var(--muted);
    font: inherit;
    font-size: 11px;
    letter-spacing: .5px;
    cursor: pointer;
}

.lang-button:hover { color: var(--ink); border-color: #9fb0c5; background: #f8fafc; }
.lang-button.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* On the login page the switcher sits on the dark backdrop under the card,
   where login-body's grid places it as a second centred row. */
.login-body .lang-switcher { margin: 14px 0 0; justify-content: center; }

@media (max-width: 900px) {
    /* The sidebar becomes a horizontal bar, so the switcher sits inline with
       the account details rather than stacked above them. */
    .lang-switcher { margin-bottom: 0; }
}


/* --- high-visibility theme -------------------------------------------------- */
/* Owner requirement: substantially larger type, high contrast, no grey UI. */
:root {
    --ink: #081425;
    --muted: #173a63;
    --line: #b8d0ee;
    --canvas: #ffffff;
}

body { background: #ffffff; color: var(--ink); font-size: 22px; line-height: 1.4; }
.sidebar { width: 280px; flex-basis: 280px; }
.brand-mark { width: 42px; height: 42px; font-size: 17px; }
.brand-text { font-size: 22px; }
.nav-item { font-size: 19px; padding: 12px 14px; }
.who { font-size: 20px; }
.role { font-size: 15px; color: #dce5f2; }
.link-button { font-size: 17px; }

.content-head h1 { font-size: 32px; }
.card-label { font-size: 18px; color: var(--muted); }
.card-value { font-size: 38px; }
.card-foot { font-size: 16px; color: var(--muted); }
.panel h2 { font-size: 22px; }
.panel p { font-size: 18px; color: var(--muted); }

table.data { font-size: 18px; }
table.data th { font-size: 15px; color: var(--muted); }
table.data td { font-size: 18px; }
.pill { font-size: 15px; }
.muted { color: var(--muted); }

.button, .primary { font-size: 18px; }
.field label { font-size: 17px; color: var(--muted); }
.field input[type="text"],
.field input[type="email"],
.field input[type="date"],
.field select,
.field textarea { font-size: 19px; background: #ffffff; }
.field-error, .field-hint { font-size: 16px; }
.filter label { font-size: 15px; color: var(--muted); }
.filter input, .filter select { font-size: 18px; background: #ffffff; }
.lang-button { font-size: 16px; padding: 7px 11px; }

.card, .panel, .login-card { background: #ffffff; }
.button.ghost { background: #ffffff; }
.button.ghost:hover { background: #edf5ff; }

@media (max-width: 900px) {
    body { font-size: 19px; }
    .sidebar { width: 100%; flex-basis: auto; }
    .nav-item { font-size: 17px; }
    .content-head h1 { font-size: 27px; }
}


/* Strong visual boundaries: every interactive/data surface is clearly outlined. */
.card,
.panel,
.login-card,
.field input,
.field select,
.field textarea,
.filter input,
.filter select,
.button.ghost {
    border: 2px solid #6f9fd6;
}

.card,
.panel,
.login-card {
    box-shadow: 0 2px 8px rgba(16, 32, 60, .10);
}

table.data th { border-bottom: 2px solid #6f9fd6; }
table.data td { border-bottom: 1px solid #9bbce0; }

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 3px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

.pill { background: #dcebff; color: #143d70; }
.alert { border: 2px solid #d75248; }
.attention { border-left-width: 6px; }


/* 2x typography scale requested by owner. */
body { font-size: 30px; }
.brand-mark { width: 48px; height: 48px; font-size: 26px; }
.brand-text { font-size: 28px; }
.nav-item { font-size: 28px; padding: 14px 16px; }
.who { font-size: 28px; }
.role { font-size: 22px; }
.link-button { font-size: 26px; }

.content-head h1 { font-size: 44px; }
.card-label { font-size: 24px; }
.card-value { font-size: 50px; }
.card-foot { font-size: 22px; }
.panel h2 { font-size: 30px; }
.panel p { font-size: 28px; }

table.data { font-size: 28px; }
table.data th { font-size: 22px; }
table.data td { font-size: 28px; }

.button, .primary { font-size: 28px; padding: 12px 18px; }
.field label { font-size: 24px; }
.field input[type="text"],
.field input[type="email"],
.field input[type="date"],
.field select,
.field textarea { font-size: 28px; padding: 11px 13px; }
.field-error, .field-hint { font-size: 22px; }
.filter label { font-size: 22px; }
.filter input, .filter select { font-size: 26px; }
.lang-button { font-size: 22px; padding: 8px 12px; }
