:root {
    --bg: #f6f2ea;
    --card: #fffaf3;
    --ink: #1f1a16;
    --accent: #b94b2f;
    --accent-dark: #8f3520;
    --muted: #7a6f66;
    --border: #e4d9cd;
    --ok: #1e7f5a;
    --warn: #b64d1b;
    --error: #8b1d2b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Fira Sans", "Trebuchet MS", sans-serif;
    background: radial-gradient(circle at top, #fff1dc, #f3e6d5 60%, #efe0cd);
    color: var(--ink);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

.topbar {
    background: #fff3df;
    border-bottom: 1px solid var(--border);
}

.topbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-family: "Playfair Display", "Georgia", serif;
    font-size: 22px;
    letter-spacing: 0.5px;
}

.nav a {
    margin-left: 16px;
    text-decoration: none;
    color: var(--accent-dark);
    font-weight: 600;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 12px 32px rgba(83, 62, 36, 0.08);
    margin-bottom: 20px;
}

.card h2 {
    margin-top: 0;
    font-family: "Playfair Display", "Georgia", serif;
}

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    background: #f8efe4;
    border: 1px solid var(--border);
}

.flash.success {
    border-color: rgba(30, 127, 90, 0.4);
    color: var(--ok);
}

.flash.error {
    border-color: rgba(139, 29, 43, 0.4);
    color: var(--error);
}

form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: white;
}

button,
.button-link {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

button.secondary,
.button-link.secondary {
    background: var(--muted);
}

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

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

.table th,
.table td {
    border-bottom: 1px solid var(--border);
    padding: 10px 8px;
    vertical-align: top;
}

.table th {
    text-align: left;
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

.student-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.incident-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-top: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    align-items: flex-start;
    white-space: nowrap;
    max-width: 100%;
    min-width: 0;
}

.incident-item {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 4px 6px;
    background: #fffdf8;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    flex: 0 0 auto;
    width: auto;
}

.compact-table {
    table-layout: fixed;
}

.compact-table th:first-child,
.compact-table td:first-child {
    width: 36px;
}

.compact-table th:nth-child(2),
.compact-table td:nth-child(2) {
    width: 70px;
}

form .incident-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 0;
}

.incident-code {
    font-size: 12px;
    letter-spacing: 0.02em;
}

.incident-comment {
    margin-top: 4px;
    width: 140px;
    padding: 6px 8px;
    font-size: 12px;
    display: block;
}

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

.footer {
    text-align: center;
    color: var(--muted);
    padding-bottom: 30px;
}

@media (max-width: 720px) {
    .table {
        display: block;
        overflow-x: auto;
    }
    .compact-table {
        display: table;
        overflow: visible;
        width: 100%;
    }
    .incident-comment {
        width: 110px;
    }
}
