@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #f5f2ec;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-2: #ffffff;
    --text: #2f2a2a;
    --muted: #6f6761;
    --line: rgba(96, 73, 67, 0.12);
    --shadow: 0 20px 50px rgba(80, 60, 56, 0.10);
    --teal: #4ebcb0;
    --teal-soft: rgba(143, 218, 210, 0.18);
    --terracotta: #e4876c;
    --terracotta-soft: rgba(228, 135, 108, 0.16);
    --success: #2a8f74;
    --danger: #b95353;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(143, 218, 210, 0.32), transparent 22%),
        radial-gradient(circle at top right, rgba(228, 135, 108, 0.16), transparent 18%),
        linear-gradient(180deg, #f7f4ef 0%, #f3efe8 100%);
}

a { color: inherit; }

.admin-shell {
    width: min(1480px, calc(100% - 40px));
    margin: 22px auto 40px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.brand img {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.brand strong {
    display: block;
    font-size: 1rem;
}

.brand span,
.muted {
    color: var(--muted);
}

.topnav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topnav a,
.ghost-button,
.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.topnav a,
.ghost-button {
    background: rgba(255,255,255,0.7);
    border: 1px solid var(--line);
}

.primary-button {
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--teal), #66d0c5);
    color: white;
    cursor: pointer;
}

.ghost-button:hover,
.primary-button:hover,
.topnav a:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(80, 60, 56, 0.08);
}

.topbar__user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-main {
    margin-top: 20px;
    display: grid;
    gap: 18px;
}

.hero-panel,
.panel-card,
.stat-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.hero-panel--compact {
    padding-block: 22px;
}

.hero-actions,
.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.eyebrow {
    margin: 0 0 8px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--teal);
}

h1, h2, h3, h4 {
    margin: 0;
}

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

.stat-card {
    padding: 20px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 10px;
}

.stat-card strong {
    font-size: 2rem;
    line-height: 1;
}

.panel-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 18px;
}

.panel-grid--history {
    grid-template-columns: 1.2fr 0.8fr;
}

.panel-card {
    padding: 22px;
}

.panel-card__head,
.month-block__head,
.day-editor__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.mini-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--teal-soft);
    color: var(--text);
    font-weight: 700;
    border: 1px solid rgba(78, 188, 176, 0.2);
}

.quick-links,
.week-list,
.revision-list,
.legend-list--admin {
    display: grid;
    gap: 12px;
}

.quick-links a {
    display: block;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.82);
    border: 1px solid var(--line);
    text-decoration: none;
    font-weight: 600;
}

.week-item,
.revision-item,
.snapshot-day {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 20px;
    background: rgba(255,255,255,0.82);
    border: 1px solid var(--line);
}

.week-item--active {
    border-color: rgba(78, 188, 176, 0.4);
    box-shadow: inset 0 0 0 1px rgba(78, 188, 176, 0.16);
}

.week-item__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.month-block {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 22px;
}

.history-group + .history-group {
    margin-top: 20px;
}

.alert {
    padding: 14px 16px;
    border-radius: 18px;
    font-weight: 600;
}

.alert--success {
    background: rgba(42, 143, 116, 0.12);
    color: var(--success);
    border: 1px solid rgba(42, 143, 116, 0.18);
}

.alert--error {
    background: rgba(185, 83, 83, 0.12);
    color: var(--danger);
    border: 1px solid rgba(185, 83, 83, 0.18);
}

.editor-form {
    display: grid;
    gap: 18px;
}

.form-section,
.day-editor {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 22px;
}

.form-grid {
    display: grid;
    gap: 14px;
}

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

label {
    display: grid;
    gap: 8px;
    font-weight: 600;
}

input,
textarea {
    width: 100%;
    border: 1px solid rgba(96, 73, 67, 0.14);
    background: rgba(255,255,255,0.88);
    border-radius: 16px;
    padding: 12px 14px;
    font: inherit;
    color: var(--text);
    resize: vertical;
}

textarea {
    min-height: 110px;
}

.form-stack {
    display: grid;
    gap: 14px;
}

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

.entry-table {
    display: grid;
    gap: 10px;
}

.entry-row {
    display: grid;
    grid-template-columns: 110px 110px 1.2fr 1.2fr 180px 1.2fr 88px 44px;
    gap: 10px;
    padding: 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(96, 73, 67, 0.10);
    align-items: end;
}

.entry-row label {
    font-size: 0.84rem;
    font-weight: 600;
}

.entry-row__wide {
    min-width: 0;
}

.entry-row input {
    padding: 10px 12px;
    border-radius: 14px;
}

.remove-row-button {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 14px;
    background: rgba(185, 83, 83, 0.12);
    color: var(--danger);
    font-size: 1.5rem;
    cursor: pointer;
}

.login-card {
    width: min(520px, calc(100% - 24px));
    margin: 60px auto;
    padding: 30px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 30px;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-logo {
    width: 110px;
    height: 110px;
    object-fit: contain;
    margin-bottom: 8px;
}

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

.snapshot-day {
    align-items: flex-start;
    flex-direction: column;
}

.snapshot-day__head {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 10px;
}

.snapshot-list {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
}

.snapshot-list li {
    line-height: 1.5;
}

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

    .panel-grid,
    .panel-grid--history,
    .form-grid--two {
        grid-template-columns: 1fr;
    }

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

    .remove-row-button {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .admin-shell {
        width: min(100% - 20px, 1480px);
        margin: 14px auto 28px;
    }

    .topbar,
    .hero-panel,
    .panel-card,
    .form-section,
    .day-editor,
    .stat-card {
        border-radius: 22px;
    }

    .topbar,
    .hero-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .topnav,
    .topbar__user,
    .hero-actions,
    .actions-row,
    .form-actions {
        width: 100%;
    }

    .topnav a,
    .ghost-button,
    .primary-button {
        flex: 1 1 180px;
    }

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

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

.revision-item--stacked {
    align-items: flex-start;
}

.hint-card {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(143, 218, 210, 0.14);
    border: 1px solid rgba(78, 188, 176, 0.16);
}

.hint-card p {
    margin: 8px 0 0;
    line-height: 1.65;
    color: var(--muted);
}

.hint-card code {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.78);
    border: 1px solid var(--line);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.regulation-grid {
    align-items: start;
}

.users-grid {
    grid-template-columns: 0.85fr 1.15fr;
}

.user-list {
    display: grid;
    gap: 16px;
}

.user-card {
    padding: 18px;
    border-radius: 22px;
    background: rgba(255,255,255,0.84);
    border: 1px solid var(--line);
    display: grid;
    gap: 16px;
}

.user-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.user-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.chip-ok {
    background: rgba(42,143,116,0.12);
    border-color: rgba(42,143,116,0.18);
}

.chip-off {
    background: rgba(185,83,83,0.12);
    border-color: rgba(185,83,83,0.18);
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    min-height: 0;
}

.hint-line {
    color: var(--muted);
    font-size: 0.94rem;
}

.form-stack--inline {
    padding-top: 14px;
    border-top: 1px dashed var(--line);
}

.regulation-preview-box {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255,255,255,0.82);
    border: 1px solid var(--line);
}

@media (max-width: 1100px) {
    .users-grid {
        grid-template-columns: 1fr;
    }
}
