:root {
    --bg: #f8f7f2;
    --card: #ffffff;
    --text: #222222;
    --muted: #666666;
    --line: #e4dfcf;
    --red: #b71c1c;
    --red-soft: #fff1f0;
    --yellow: #f6d94d;
    --yellow-soft: #fff9d7;
    --accent: #8c1111;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: Arial, Helvetica, sans-serif;
    background:
        linear-gradient(180deg, rgba(246,217,77,0.10), rgba(246,217,77,0.04) 180px, transparent 180px),
        var(--bg);
    color: var(--text);
    line-height: 1.4;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: rgba(255,255,255,0.96);
    border-bottom: 3px solid var(--yellow);
    position: sticky;
    top: 0;
    backdrop-filter: blur(6px);
    z-index: 5;
}

.topbar-brand,
.hero-inline,
.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-logo,
.detail-logo {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--yellow);
}

.brand-logo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 16px;
    border: 3px solid var(--yellow);
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}

.button-link,
button {
    display: inline-block;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(180deg, #c62525, var(--red));
    color: #fff;
    padding: 10px 16px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(183, 28, 28, 0.18);
}

.button-link:hover,
button:hover {
    text-decoration: none;
    filter: brightness(0.96);
}

.container {
    max-width: 1220px;
    margin: 22px auto;
    padding: 0 14px 30px;
}

.container-full {
    max-width: 1600px;
    margin: 22px auto;
    padding: 0 14px 30px;
}

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

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 18px;
}

.accent-card {
    background: linear-gradient(135deg, rgba(246,217,77,0.16), rgba(255,255,255,0.98));
    border-top: 4px solid var(--red);
}

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

.auth-shell {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 20px;
}

.auth-card form label,
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-weight: 600;
    margin-bottom: 12px;
}

input, textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #d1cab5;
    border-radius: 9px;
    background: #fffef8;
    font: inherit;
}

input:focus, textarea:focus {
    outline: 2px solid rgba(246,217,77,0.35);
    border-color: var(--red);
    background: #fff;
}

.small { font-size: 0.9rem; }
.muted { color: var(--muted); }
.eyebrow {
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 700;
    margin: 0 0 6px;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 14px;
}
.alert-error {
    background: var(--red-soft);
    color: var(--red);
    border: 1px solid #f1c2bd;
}
.alert-success {
    background: #e8f5e9;
    color: #1b5e20;
    border: 1px solid #a5d6a7;
}
.alert-warn {
    background: #fff8e1;
    color: #e65100;
    border: 1px solid #ffe082;
}

.report-form {
    padding: 16px;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--accent);
    border-left: 5px solid var(--yellow);
    padding-left: 10px;
}

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

.compact-grid-top {
    grid-template-columns: 120px 180px 180px 180px;
}

.compact-grid.one-col {
    grid-template-columns: 1fr;
}

.small-field { max-width: 120px; }
.date-field { max-width: 180px; }
.temp-field { max-width: 180px; }
.narrow-field { max-width: 140px; }

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    align-items: center;
    padding: 4px 0 10px;
}

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

.checkbox-row input[type="checkbox"] {
    width: auto;
}

.inline-time input {
    width: auto;
}

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    border-bottom: 1px solid var(--line);
    padding: 9px 8px;
    text-align: left;
    vertical-align: middle;
}

.table th {
    background: #fff8db;
    color: #6b1a1a;
    white-space: nowrap;
}

tr.dashboard:hover {
    background-color: #ddd;
}

.staff-table input {
    min-width: 92px;
    padding: 7px 8px;
}

.staff-table td:first-child {
    white-space: nowrap;
    font-weight: 700;
}

.compact-table td,
.compact-table th {
    padding: 8px 7px;
}

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

.full-span { grid-column: 1 / -1; }
.actions { margin-top: 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.button-link-secondary {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    background: #f0ece0;
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--line);
}
.button-link-secondary:hover { background: var(--line); text-decoration: none; }

.button-danger {
    background: var(--red);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}
.button-danger:hover { background: #8b0000; }

/* Audit log */
.audit-entry {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
    background: #fafaf7;
}
.audit-entry:last-child { margin-bottom: 0; }
.audit-header { font-size: 0.9rem; margin-bottom: 6px; }
.audit-reason { font-size: 0.88rem; color: var(--muted); margin-bottom: 8px; }
.audit-ua { cursor: help; border-bottom: 1px dashed var(--muted); }
.audit-diff { margin-top: 8px; }
.audit-old { color: var(--red); text-decoration: line-through; white-space: pre-wrap; }
.audit-new { color: #1a6b1a; white-space: pre-wrap; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

dialog { border: 1px solid var(--line); border-radius: 8px; padding: 24px; box-shadow: 0 4px 20px rgba(0,0,0,.15); max-width: 360px; width: 90%; }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog p { margin: 0 0 20px; font-size: 1rem; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 920px) {
    .auth-shell,
    .detail-grid,
    .compact-grid,
    .compact-grid-top {
        grid-template-columns: 1fr;
    }

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