:root {
    --bg: #090807;
    --bg-2: #100e0b;
    --panel: #16130e;
    --panel-2: #1d1913;
    --gold: #d4af37;
    --gold-2: #f0d78c;
    --gold-deep: #8d6b1f;
    --ink: #1a1408;
    --text: #f6f1e4;
    --muted: #b4a58a;
    --line: rgba(212, 175, 55, 0.22);
    --danger: #e08b8b;
    --ok: #9dceae;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
    margin: 0;
    font-family: Manrope, "Segoe UI", sans-serif;
    background:
        radial-gradient(900px 420px at 0% 0%, rgba(212, 175, 55, 0.14), transparent 50%),
        var(--bg);
    color: var(--text);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
.app { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
aside {
    background: linear-gradient(180deg, #14110c 0%, #0c0b09 100%);
    border-right: 1px solid var(--line);
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.brand {
    border: 1px solid var(--line);
    background: rgba(212, 175, 55, 0.06);
    border-radius: 18px;
    padding: 16px 16px 14px;
    margin-bottom: 18px;
}
.brand b, .brand-mark {
    display: block;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 32px;
    letter-spacing: 0.14em;
    color: var(--gold-2);
    line-height: 1;
}
.brand span, .login-kicker { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; letter-spacing: 0.04em; }
nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; }
nav a, .side-foot button {
    display: block;
    width: 100%;
    text-align: left;
    text-decoration: none;
    border: 0;
    background: transparent;
    color: #e6d7b4;
    padding: 11px 12px;
    border-radius: 12px;
    font-weight: 650;
    cursor: pointer;
}
nav a:hover, .side-foot button:hover { background: rgba(212, 175, 55, 0.08); }
nav a.active {
    background: linear-gradient(180deg, #f0d78c, #c6a15a);
    color: var(--ink);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.18);
}
.side-foot { margin-top: auto; padding-top: 16px; }
.session-note { color: var(--muted); font-size: 12px; padding: 0 12px 8px; }
main { padding: 28px 32px 48px; min-width: 0; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 18px; }
h1 { margin: 0; font-family: "Cormorant Garamond", Georgia, serif; font-size: 40px; font-weight: 600; color: var(--gold-2); letter-spacing: 0.01em; }
.sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.badge, .flash, .card, .rule-card, .sheet-wrap, .toolbar, .login-card {
    background: linear-gradient(180deg, rgba(255, 236, 190, 0.035), transparent 40%), var(--panel);
    border: 1px solid var(--line);
}
.badge { padding: 10px 14px; border-radius: 14px; color: var(--gold-2); font-weight: 700; white-space: nowrap; }
.flash { border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; color: #efe3c4; }
.flash.error { border-color: rgba(224, 139, 139, 0.5); color: #ffd7d7; }
.cards, .module-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.module-grid { grid-template-columns: repeat(3, 1fr); }
.card { border-radius: 16px; padding: 16px 16px 14px; box-shadow: var(--shadow); }
.card small, .rule-card small { color: var(--gold); letter-spacing: 0.06em; font-size: 11px; font-weight: 700; }
.card strong { display: block; margin-top: 8px; font-size: 28px; color: var(--gold-2); }
.card p { color: var(--muted); margin: 8px 0 0; line-height: 1.45; }
a.card { text-decoration: none; display: block; }
a.card:hover { border-color: rgba(240, 215, 140, 0.7); transform: translateY(-1px); }
.progress { height: 8px; background: #2a2418; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, #8d6b1f, #f0d78c); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px; border-radius: 16px; margin-bottom: 12px; }
.toolbar label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
select, input, textarea {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 11px;
    background: #100e0b;
    color: var(--text);
}
select { min-width: 160px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(212, 175, 55, 0.55); border-color: var(--gold); }
.dept-tabs, .day-tabs { display: flex; gap: 8px; overflow: auto; padding: 4px 0 12px; }
.tab {
    white-space: nowrap;
    text-decoration: none;
    border: 1px solid var(--line);
    background: #120f0c;
    padding: 9px 12px;
    border-radius: 999px;
    font-weight: 700;
    color: var(--gold-2);
    font-size: 13px;
}
.tab.active { background: linear-gradient(180deg, #f0d78c, #c6a15a); color: var(--ink); border-color: transparent; }
.sheet-wrap { border-radius: 16px; overflow: hidden; }
.sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 16px; color: var(--gold-2); }
.save-state { color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.person-name { font-weight: 700; }
.sheet-scroll { overflow: auto; max-height: 64vh; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #221c14;
    color: var(--gold-2);
    text-align: left;
    font-size: 12px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid rgba(212, 175, 55, 0.08);
}
td { border-bottom: 1px solid rgba(212, 175, 55, 0.1); border-right: 1px solid rgba(212, 175, 55, 0.06); padding: 6px; vertical-align: top; }
.compact-table { min-width: 1100px; }
.compact-table th { font-size: 11px; line-height: 1.25; min-width: 92px; white-space: normal; }
.compact-table th.wide, .compact-table td.wide { min-width: 170px; }
.compact-table td { text-align: center; }
.compact-table td.wide { text-align: left; }
td input, td select, td textarea { width: 100%; background: transparent; }
.fixed-input { min-width: 120px; }
.note-input { min-height: 68px; resize: vertical; }
.score-input { width: 78px; text-align: center; }
.tick { width: 18px; height: 18px; accent-color: #d4af37; }
.btn {
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    background: linear-gradient(180deg, #f0d78c, #c6a15a);
    color: var(--ink);
    font-weight: 800;
    cursor: pointer;
}
.btn.light { background: transparent; color: var(--gold-2); border: 1px solid var(--line); }
.btn.block { width: 100%; margin-top: 8px; }
.btn:hover { filter: brightness(1.05); }
.note { color: var(--muted); font-size: 12px; margin: 12px 2px; }
.score-guide { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.score-guide div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: 12px; color: var(--muted); }
.score-guide b { display: block; color: var(--gold-2); font-size: 14px; margin-bottom: 4px; }
.rule-card { border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; }
.rule-card p { margin: 8px 0 0; color: var(--text); line-height: 1.5; }
.score-bad { color: var(--danger); font-weight: 800; }
.score-mid { color: #e0b15a; font-weight: 800; }
.score-ok { color: #e6d7a8; font-weight: 800; }
.score-good { color: var(--ok); font-weight: 800; }
.split { display: grid; gap: 14px; }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(460px, 100%); border-radius: 24px; padding: 34px 30px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 36px; margin: 14px 0 8px; }
.login-lead, .login-foot { color: var(--muted); line-height: 1.5; font-size: 14px; }
.login-card label { display: block; margin: 14px 0 6px; color: var(--gold-2); font-size: 13px; font-weight: 700; }
.login-card input { width: 100%; }
.stack-table td { min-width: 140px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
@media (max-width: 1100px) {
    .cards, .score-guide { grid-template-columns: repeat(2, 1fr); }
    .module-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }
    aside { position: relative; height: auto; }
    main { padding: 18px; }
    h1 { font-size: 32px; }
    .module-grid, .cards, .score-guide { grid-template-columns: 1fr; }
}
