:root {
    --bg: #f6f7f3;
    --surface: #ffffff;
    --surface-muted: #eef2ed;
    --ink: #18201d;
    --muted: #637069;
    --line: #dce2dd;
    --accent: #146b5f;
    --accent-strong: #0d4d45;
    --warn: #9d4e12;
    --danger: #a73535;
    --shadow: 0 18px 50px rgba(24, 32, 29, 0.08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    min-height: 40px;
    padding: 0 16px;
}

button:hover {
    background: var(--accent-strong);
}

a {
    color: var(--accent);
    font-weight: 800;
}

.account-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    color: #d7e7e0;
    font-size: 14px;
}

.account-actions a {
    color: #d7e7e0;
}

.account-actions form {
    margin: 0;
}

.secondary-button {
    min-height: 34px;
    padding: 0 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.42);
}

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
}

.auth-card {
    width: min(100%, 440px);
    padding: 30px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.auth-card .eyebrow {
    color: var(--accent);
}

.auth-card button {
    width: 100%;
}

.auth-link {
    margin: 18px 0 0;
    text-align: center;
}

.muted-copy {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.form-error,
.form-success {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
}

.form-error {
    color: var(--danger);
    background: #fff0f0;
}

.form-success {
    color: var(--accent-strong);
    background: #eaf7f1;
}

.app-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.summary-panel {
    display: grid;
    grid-template-columns: minmax(220px, 0.7fr) 1.6fr;
    gap: 24px;
    align-items: end;
    padding: 28px;
    background: #13251f;
    color: #fff;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.summary-panel .summary-grid {
    grid-column: 1 / -1;
}

.admin-hero {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.eyebrow {
    color: #a8cabe;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 8px;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: 36px;
    line-height: 1.1;
    margin-bottom: 0;
}

h2 {
    font-size: 20px;
    line-height: 1.2;
    margin-bottom: 0;
}

h3 {
    font-size: 16px;
    margin-bottom: 0;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.summary-grid article {
    min-height: 96px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
}

.summary-grid span,
.panel-heading span,
.schedule-card small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.summary-grid span {
    color: #b8cfc7;
}

.summary-grid strong {
    display: block;
    margin-top: 10px;
    overflow-wrap: anywhere;
    font-size: 24px;
    line-height: 1.15;
}

.workspace-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.panel {
    margin-top: 18px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.workspace-grid .panel {
    margin-top: 0;
}

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

.panel-heading.compact {
    margin: 0;
    padding: 14px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 14px;
}

input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    padding: 10px 12px;
    background: #fff;
}

input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(20, 107, 95, 0.14);
}

.field-row,
.scenario-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.scenario-form {
    grid-template-columns: 1.1fr 1.1fr 0.8fr;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: 0;
}

.number {
    text-align: right;
    white-space: nowrap;
}

.actions {
    text-align: right;
    width: 112px;
}

.actions button {
    min-height: 34px;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--danger);
    padding: 0 10px;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin: 8px 0 18px;
}

.schedule-card {
    display: grid;
    gap: 8px;
    min-height: 132px;
    padding: 16px;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
	border-radius: 10px;
    text-align: left;
}

.schedule-card:hover,
.schedule-card.selected {
    background: #eef7f4;
    border-color: var(--accent);
    color: var(--ink);
}

.schedule-card strong {
    overflow-wrap: anywhere;
    font-size: 20px;
}

.schedule-card em {
    color: var(--warn);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.schedule-detail {
    margin-top: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.schedule-summary {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin: 0;
}

.schedule-summary > div {
    padding: 18px 14px;
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
}

.schedule-summary > div:last-child {
    border-right: 0;
}

.schedule-summary dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.schedule-summary dd {
    margin: 8px 0 0;
    font-size: 18px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.schedule-warning {
    grid-column: 1 / -1;
    margin: 0;
    padding: 14px;
    border-top: 1px solid var(--line);
    color: var(--warn);
    font-size: 13px;
    font-weight: 700;
}

.empty {
    color: var(--muted);
    padding: 22px;
    text-align: center;
}

.toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 10;
    max-width: min(360px, calc(100% - 40px));
    transform: translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
    border-radius: 8px;
    background: var(--accent-strong);
    color: #fff;
    padding: 14px 16px;
    box-shadow: var(--shadow);
    font-weight: 700;
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: var(--danger);
}

@media (max-width: 860px) {
    .summary-panel,
    .workspace-grid,
    .field-row,
    .scenario-form {
        grid-template-columns: 1fr;
    }

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

    .account-actions {
        justify-content: flex-start;
    }

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

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

    .schedule-summary > div:nth-child(2n) {
        border-right: 0;
    }
}

@media (max-width: 540px) {
    .app-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 10px;
    }

    .summary-panel,
    .panel {
        padding: 16px;
    }

    h1 {
        font-size: 30px;
    }

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

    .panel-heading {
        align-items: stretch;
        flex-direction: column;
    }
}
