:root {
    --ink: #1a1512;
    --ink-soft: #3a312b;
    --paper: #f6f1ea;
    --card: #fffdfb;
    --line: #e6dcd2;
    --terracotta: #b0621a;
    --terracotta-dark: #8d4c12;
    --blue: #0064a2;
    --ok: #1f7a4d;
    --ok-bg: #e7f6ee;
    --wait: #9a5b12;
    --wait-bg: #fff1df;
    --hot: #9d3412;
    --hot-bg: #ffece4;
    --muted: #6d625a;
    --danger: #9f2d2d;
    --shadow: 0 18px 40px rgba(26, 21, 18, 0.06);
    --sidebar: 17.5rem;
    --font: "Outfit", "Segoe UI", sans-serif;
    --serif: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--paper);
}
a { color: var(--terracotta-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar);
    flex: 0 0 var(--sidebar);
    background: var(--ink);
    color: #f6f1ea;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 1.15rem 1.1rem 0.9rem;
    text-decoration: none;
    color: inherit;
}
.brand img { width: 2.6rem; height: 2.6rem; object-fit: contain; }
.brand small { display: block; letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.66rem; opacity: 0.62; }
.brand strong { font-family: var(--serif); font-size: 1.25rem; font-weight: 560; }
.nav { overflow: auto; padding: 0.4rem 0.75rem 1rem; flex: 1; }
.nav-label {
    margin: 1rem 0.55rem 0.35rem;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(246, 241, 234, 0.46);
}
.nav a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: rgba(246, 241, 234, 0.84);
    text-decoration: none;
    border-radius: 0.75rem;
    padding: 0.62rem 0.7rem;
    margin-bottom: 0.15rem;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: white; }
.nav a.is-on { background: rgba(176, 98, 26, 0.22); color: #fff7ef; }
.nav i { width: 1.1rem; text-align: center; color: #e0b089; }
.nav .count {
    margin-left: auto;
    background: var(--terracotta);
    color: white;
    border-radius: 999px;
    min-width: 1.3rem;
    height: 1.3rem;
    display: inline-grid;
    place-items: center;
    font-size: 0.72rem;
    padding: 0 0.35rem;
}
.sidebar-foot { padding: 0.9rem; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-foot a { color: inherit; text-decoration: none; display: flex; gap: 0.55rem; align-items: center; opacity: 0.8; }

.main { flex: 1; min-width: 0; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.4rem;
    background: rgba(255, 253, 251, 0.9);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}
.menu-btn, .logout {
    border: 1px solid var(--line);
    background: white;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
}
.menu-btn { display: none; }
.who { display: flex; align-items: center; gap: 0.7rem; }
.avatar {
    width: 2.1rem; height: 2.1rem; border-radius: 50%;
    display: grid; place-items: center;
    background: #f3d7c4; color: var(--terracotta-dark); font-weight: 650;
}
.content { padding: 1.4rem; max-width: 1180px; }

.page-head, .split, .filters, .inline, .actions, .stat, .who, .topbar, .brand {
    display: flex;
}
.page-head { justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; }
.page-head h1, .login h1, .card h2 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.02em; margin: 0; }
.page-head p, .help, .empty, .muted { color: var(--muted); }
.page-head p { margin: 0.3rem 0 0; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    border-radius: 999px; border: 1px solid transparent; text-decoration: none;
    padding: 0.62rem 1rem; cursor: pointer; background: white; color: var(--ink);
}
.btn-primary { background: var(--terracotta); color: white; }
.btn-primary:hover { background: var(--terracotta-dark); }
.btn-ghost { border-color: var(--line); background: white; color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: #f0d0d0; }
.btn-small { padding: 0.38rem 0.7rem; font-size: 0.86rem; }
.actions { gap: 0.4rem; flex-wrap: wrap; }

.notice { border-radius: 0.9rem; padding: 0.8rem 1rem; margin-bottom: 1rem; }
.notice-ok { background: var(--ok-bg); color: var(--ok); }
.notice-err { background: #fdecec; color: var(--danger); }
.notice ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem; margin-bottom: 1rem; }
.stat {
    position: relative;
    overflow: hidden;
    background: var(--card); border: 1px solid var(--line); border-radius: 1rem;
    padding: 0.95rem 1rem 0.95rem 1.15rem; flex-direction: column; gap: 0.15rem;
    text-decoration: none; color: inherit; box-shadow: var(--shadow);
}
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, var(--terracotta)); }
.stat i { color: var(--accent, var(--terracotta)); font-size: 0.95rem; }
.stat b { font-family: var(--serif); font-size: 1.7rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 0.92rem; }
.dash-charts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.9rem; margin-bottom: 0.9rem; }
.chart-wide { grid-column: 1 / -1; }
.chart-box { position: relative; height: 250px; padding: 0.6rem 0.8rem 0.9rem; }
.chart-box-wide { height: 280px; }
.content:has(.dash) { max-width: 1280px; }
.grid-2 { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 0.9rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow); }
.card-head, .card-body { padding: 0.95rem 1.05rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 1.15rem; }
.list-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.05rem; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row p { margin: 0.2rem 0 0; color: var(--muted); }

.filters { gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.8rem; align-items: center; }
.filters input, .filters select, .field input, .field select, .field textarea {
    width: 100%; border: 1px solid var(--line); background: white; border-radius: 0.75rem; padding: 0.68rem 0.75rem;
}
.filters input, .filters select { width: auto; min-width: 10rem; }
.field textarea { min-height: 8rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus {
    outline: 2px solid rgba(176, 98, 26, 0.28); border-color: var(--terracotta);
}
.form-grid { display: grid; gap: 0.85rem; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.field label { display: block; font-size: 0.82rem; margin-bottom: 0.32rem; font-weight: 600; }
.help { margin: 0.3rem 0 0; font-size: 0.84rem; }
.check { display: flex; gap: 0.5rem; align-items: center; }
.check input { width: auto; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 1rem; background: var(--card); }
table { width: 100%; border-collapse: collapse; min-width: 42rem; }
th, td { text-align: left; padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); background: #fbf7f3; }
tr:last-child td { border-bottom: 0; }
.thumb { width: 3.2rem; height: 2.3rem; object-fit: cover; border-radius: 0.4rem; background: #efe7df; }
.badge { display: inline-flex; border-radius: 999px; padding: 0.15rem 0.55rem; font-size: 0.78rem; background: #f3eee8; color: var(--ink-soft); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-wait { background: var(--wait-bg); color: var(--wait); }
.badge-hot { background: var(--hot-bg); color: var(--hot); }
.badge-no { background: #fdecec; color: var(--danger); }
.badge-muted { background: #f3eee8; color: var(--muted); }
.empty { text-align: center; padding: 2rem 1rem !important; }
.pager { display: flex; gap: 0.8rem; align-items: center; justify-content: flex-end; margin-top: 0.8rem; }
.pager a, .pager span { text-decoration: none; }
.pager .is-off { opacity: 0.4; }
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.tabs a { text-decoration: none; border: 1px solid var(--line); background: white; border-radius: 999px; padding: 0.4rem 0.75rem; color: var(--ink); }
.tabs a.is-on { background: var(--ink); color: white; border-color: var(--ink); }
.inline { gap: 0.45rem; align-items: center; }
.inline input, .inline select { min-width: 0; }
.video-row { display: grid; gap: 0.6rem; grid-template-columns: 1.2fr 0.7fr 1.2fr auto; align-items: end; padding: 0.8rem; border: 1px dashed var(--line); border-radius: 0.9rem; margin-bottom: 0.6rem; }
.stack { display: grid; gap: 0.9rem; }
.bulk { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.8rem; }
.bulk select { min-width: 12rem; border: 1px solid var(--line); background: white; border-radius: 0.75rem; padding: 0.62rem 0.75rem; }
.pick { width: 1rem; height: 1rem; }
.cal-nav { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; margin-bottom: 0.7rem; }
.cal-wrap { overflow: auto; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.35rem; min-width: 46rem; }
.cal-head { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 0.15rem 0.2rem; }
.cal-day { min-height: 6.4rem; background: white; border: 1px solid var(--line); border-radius: 0.7rem; padding: 0.35rem; display: flex; flex-direction: column; gap: 0.25rem; }
.cal-day.is-out { opacity: 0.45; }
.cal-day.is-today { border-color: var(--terracotta); }
.cal-day > span { font-size: 0.78rem; color: var(--muted); }
.cal-day a { font-size: 0.72rem; line-height: 1.25; text-decoration: none; background: #f6efe7; border-radius: 0.35rem; padding: 0.15rem 0.3rem; color: inherit; }
.cal-day a.is-approved { background: var(--ok-bg); }
.cal-day a.is-pending { background: var(--wait-bg); }
.cal-day a.is-rejected, .cal-day a.is-cancelled { background: #fdecec; }
.card-sheet { width: min(100%, 34rem); margin: 0 auto; }
.sheet-table td { height: 2.4rem; }
@media print {
    .sidebar, .topbar, .bulk, .filters, .pager, .no-print, .menu-btn { display: none !important; }
    .shell, .main, .content { display: block; max-width: none; padding: 0; }
    .card, .table-wrap { box-shadow: none; }
}
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background:
    radial-gradient(60rem 30rem at 10% -10%, rgba(176, 98, 26, 0.18), transparent 50%),
    var(--paper); }
.login { width: min(100%, 28rem); background: var(--card); border: 1px solid var(--line); border-radius: 1.3rem; padding: 1.5rem; box-shadow: var(--shadow); }
.login .brand { padding: 0 0 1rem; color: var(--ink); }
.overlay { display: none; }

.upload-progress {
    margin-top: 0.35rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    background: #fbf7f3;
}
.upload-progress-top {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: baseline;
    margin-bottom: 0.55rem;
}
.upload-progress-top strong { font-size: 0.92rem; }
.upload-progress-top span {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--terracotta);
}
.upload-progress-track {
    height: 0.7rem;
    border-radius: 999px;
    background: #ebe2d8;
    overflow: hidden;
}
.upload-progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--terracotta), #0064a2);
    transition: width 0.15s ease-out;
}
.upload-progress .help { margin-top: 0.55rem; }

@media (max-width: 980px) {
    .stats, .grid-2, .cols-2, .video-row, .dash-charts { grid-template-columns: 1fr; }
    .chart-wide { grid-column: auto; }
    .sidebar { position: fixed; z-index: 20; transform: translateX(-105%); transition: transform 0.2s ease; }
    .sidebar.is-open { transform: none; }
    .menu-btn { display: inline-flex; }
    .overlay.is-open { display: block; position: fixed; inset: 0; background: rgba(26, 21, 18, 0.45); z-index: 15; }
    .content { padding: 1rem; }
    table { min-width: 36rem; }
}
