:root {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --ink: #20242a;
    --muted: #617083;
    --line: #d8dee6;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --warn: #9a5b00;
    --danger: #b42318;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.45;
}

.shell {
    width: min(1480px, calc(100% - 24px));
    margin: 0 auto;
    padding: 22px 0 36px;
}

.topbar,
.toolbar,
article,
section {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 18px;
    margin-bottom: 14px;
}

.eyebrow {
    margin: 0 0 3px;
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(26px, 3vw, 38px); }
h2 { font-size: 18px; }

.nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

a, button {
    border-radius: 6px;
    font-weight: 700;
}

.nav a,
button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}

button {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    cursor: pointer;
}

button:disabled {
    cursor: wait;
    opacity: .65;
}

.toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(150px, 180px) auto 1fr;
    gap: 12px;
    align-items: end;
    padding: 14px;
    margin-bottom: 14px;
}

label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    min-height: 40px;
    padding: 8px 10px;
    font: inherit;
}

select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    min-height: 40px;
    padding: 8px 10px;
    background: #fff;
    font: inherit;
}

.status {
    min-height: 52px;
    padding: 8px 12px;
    border-left: 4px solid var(--accent);
    background: #edf7f5;
}

.status strong,
.status span { display: block; }

.status span {
    color: var(--muted);
    font-size: 14px;
}

.status.failed {
    border-color: var(--danger);
    background: #fff0ee;
}

.notice {
    padding: 14px 18px;
    margin-bottom: 14px;
    border-color: #f2c66d;
    background: #fff8e8;
    color: var(--warn);
}

.grid {
    display: grid;
    grid-template-columns: 1.3fr .9fr;
    gap: 14px;
    background: transparent;
    border: 0;
    margin-bottom: 14px;
}

article,
section:not(.grid) {
    padding: 14px;
    margin-bottom: 14px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.section-head span {
    color: var(--muted);
    font-size: 13px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
}

table {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
    background: #fff;
}

th, td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    position: sticky;
    top: 0;
    background: #eaf1f3;
    z-index: 1;
}

.schedule-title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
}

.schedule-wrap {
    max-height: none;
}

.mobile-schedule-controls,
.mobile-schedule {
    display: none;
}

.schedule-table {
    min-width: 1120px;
    table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
    width: 13%;
    min-height: 54px;
    font-size: 12px;
    line-height: 1.28;
}

.schedule-table thead th:first-child,
.schedule-table tbody th {
    width: 16%;
}

.schedule-table tbody th {
    background: #f7fafb;
    position: sticky;
    left: 0;
    z-index: 2;
}

.shift-line {
    padding: 3px 0;
    white-space: nowrap;
}

.shift-line + .shift-line {
    border-top: 1px solid #edf1f5;
}

.break-line {
    display: block;
    color: var(--muted);
    font-size: 11px;
    white-space: normal;
}

tbody tr:hover { background: #f2f7f8; }

.empty {
    color: var(--muted);
    font-style: italic;
}

.debug pre,
pre {
    overflow: auto;
    max-height: 420px;
    margin: 0;
    padding: 12px;
    border-radius: 6px;
    background: #111827;
    color: #e5e7eb;
}

@media (max-width: 900px) {
    .topbar,
    .toolbar,
    .grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .topbar {
        align-items: stretch;
    }

    .nav a,
    button {
        justify-content: center;
    }
}

@media (max-width: 760px) {
    .shell {
        width: min(100% - 16px, 760px);
        padding-top: 10px;
    }

    .topbar,
    article,
    section:not(.grid) {
        padding: 12px;
    }

    .schedule-wrap {
        display: none;
    }

    .mobile-schedule-controls,
    .mobile-schedule {
        display: block;
    }

    .mobile-schedule-controls {
        margin-bottom: 10px;
    }

    .mobile-schedule {
        display: grid;
        gap: 8px;
    }

    .mobile-shift-card {
        margin: 0;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 6px;
        background: #fff;
    }

    .mobile-shift-card h3 {
        margin: 0 0 6px;
        font-size: 15px;
    }

    .mobile-shift-row {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        align-items: baseline;
        font-size: 14px;
    }

    .mobile-break {
        display: block;
        margin-top: 3px;
        color: var(--muted);
        font-size: 12px;
    }

    .mobile-empty {
        padding: 12px;
        border: 1px dashed var(--line);
        border-radius: 6px;
        color: var(--muted);
        background: #fff;
    }

    .grid {
        display: block;
    }

    table {
        min-width: 680px;
    }
}
