/* ==========================================================================
   The Blackboard – admin area
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
    --bg: #f4f2ee;
    --card: #fff;
    --line: #e4e0d8;
    --text: #23211e;
    --muted: #7a746b;
    --green: #24382f;
    --green-2: #2f4c3f;
    --blue: #2f6fd9;
    --red: #c8432f;
    --radius: 10px;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 14px; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0 0 14px; }
code { background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 4px; font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; }
.num { text-align: right; }

/* ---- Top bar ------------------------------------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 24px;
    min-height: 58px;
    background: var(--green);
    color: #eee;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0 10%, #d9412f 30%, #7a1e12); }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; }
.mainnav a, .userbox a { color: rgba(255,255,255,.78); padding: 8px 12px; border-radius: 7px; }
.mainnav a:hover, .userbox a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.mainnav a.active { background: rgba(255,255,255,.14); color: #fff; }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.linklike { background: none; border: 0; color: rgba(255,255,255,.78); font: inherit; cursor: pointer; padding: 8px 10px; border-radius: 7px; }
.linklike:hover { background: rgba(255,255,255,.08); color: #fff; }

.role { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.role-admin { background: #ffd75e; color: #4a3a00; }
.role-helper { background: #cfe3ff; color: #12366e; }

.container { max-width: 1240px; margin: 0 auto; padding: 28px 24px 60px; }

/* ---- Cards & layout ------------------------------------------------------ */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.card.empty { text-align: center; padding: 40px; color: var(--muted); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 2px; }
.page-head p { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; align-items: start; }
.edit-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }
.narrow { max-width: 560px; }
.sticky { position: sticky; top: 76px; }
@media (max-width: 900px) {
    .edit-grid, .detail-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .sticky { position: static; }
}

/* ---- Buttons ------------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit; font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, border-color .12s;
}
.btn:hover { background: #f7f5f1; border-color: #cfc9be; text-decoration: none; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-2); border-color: var(--green-2); }
.btn-danger { color: var(--red); border-color: #f0c9c1; }
.btn-danger:hover { background: #fdf0ed; border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.05); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-block { width: 100%; padding: 12px; }
.btn[disabled], .btn.disabled { opacity: .4; pointer-events: none; }
.btn-row { display: flex; gap: 6px; }
.btn-col { display: grid; gap: 8px; }
form.inline { display: inline-flex; gap: 2px; }

/* ---- Alerts ---------------------------------------------------------------- */
.alert { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert-ok { background: #e3f4e8; color: #1d5c33; border: 1px solid #bfe3ca; }
.alert-error { background: #fdecea; color: #8e2a1a; border: 1px solid #f3c6bd; }

/* ---- Forms ------------------------------------------------------------------ */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 5px; font-weight: 600; font-size: .9rem; }
.form label small, .field-title small { font-weight: 400; color: var(--muted); }
.field-title { font-weight: 600; font-size: .9rem; display: block; margin-bottom: 4px; }
.field-group { display: grid; gap: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=datetime-local], input:not([type]), select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #d3cdc2;
    border-radius: 7px;
    background: #fff;
    font: inherit;
    font-weight: 400;
    color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,111,217,.15); }
textarea { resize: vertical; }
.form label.checkbox, label.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
label.checkbox input { width: 17px; height: 17px; margin: 0; flex: none; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { margin: 0; padding: 9px 12px; background: #f6f4ef; border-radius: 7px; font-size: .83rem; color: var(--muted); }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.input-with-btn { display: flex; gap: 6px; }

.poster-preview { display: flex; align-items: center; gap: 14px; }
.poster-preview img { width: 140px; height: 105px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; display: block !important; width: 42px; height: 42px; border-radius: 6px; background: var(--paper); border: 2px solid rgba(0,0,0,.08); cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.swatch:has(input:checked) { outline: 3px solid var(--blue); outline-offset: 2px; }
.paper-cream  { --paper: #fbf6e9; }
.paper-yellow { --paper: #fff1a8; }
.paper-pink   { --paper: #ffd6dc; }
.paper-blue   { --paper: #d5e9ff; }
.paper-green  { --paper: #d7f2cf; }
.paper-orange { --paper: #ffdcb8; }

/* ---- Auth ---------------------------------------------------------------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #24382f, #15221c); }
.auth-card { width: min(420px, 100%); background: #fff; border-radius: 14px; padding: 32px; box-shadow: 0 30px 70px rgba(0,0,0,.4); }
.auth-card h1 { margin-bottom: 2px; }
.auth-card .btn { width: 100%; padding: 12px; }

/* ---- Dashboard ---------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 18px 0 24px; }
.stat { display: grid; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); }
a.stat:hover { border-color: #cfc9be; text-decoration: none; }
.stat-num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-hl { background: var(--green); border-color: var(--green); color: #fff; }
.stat-hl .stat-label { color: rgba(255,255,255,.7); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.feed li:last-child { border-bottom: 0; }

/* ---- Tables ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #faf9f6; }
.table td { padding: 11px 12px; border-bottom: 1px solid #efece6; vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.card .table th { background: transparent; padding-left: 0; }
.card .table td { padding-left: 0; }
.table-subs tbody tr { cursor: pointer; }
.table-subs tbody tr:hover { background: #fbfaf7; }
.table-subs tr.is-new td:nth-child(3) .strong::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-right: 7px; vertical-align: middle; }
.col-check { width: 36px; }
.col-check input { width: 17px; height: 17px; }
.excerpt { color: #5c564e; font-size: .86rem; margin-top: 2px; }
.note-hint { font-size: .8rem; color: #8a6d00; margin-top: 3px; }
.actions { text-align: right; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--green); }
.tabs a span { font-size: .75rem; background: #ebe7df; border-radius: 20px; padding: 0 7px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters select { width: auto; min-width: 140px; }
.filters input[type=search] { flex: 1; min-width: 200px; width: auto; }

.bulkbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); flex-wrap: wrap; }
.bulkbar select { width: auto; padding: 5px 9px; }

.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 18px; }

/* ---- Badges & stars ----------------------------------------------------------- */
.badge { display: inline-block; font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 20px; white-space: nowrap; vertical-align: middle; }
.badge-new, .dot-new { background: #dbe8ff; color: #1f4fa3; }
.badge-review, .dot-review { background: #fff0c2; color: #7a5a00; }
.badge-shortlist, .dot-shortlist { background: #ecdcff; color: #5b2a9c; }
.badge-accepted, .dot-accepted { background: #d6f2df; color: #1d6a3a; }
.badge-rejected, .dot-rejected { background: #fadcd6; color: #9c2f1d; }
.badge-muted { background: #ebe7df; color: var(--muted); }
.dot-new { background: #2f6fd9; } .dot-review { background: #e6b422; } .dot-shortlist { background: #8a4fd6; }
.dot-accepted { background: #2e9d55; } .dot-rejected { background: #c8432f; }

.stars { color: #f0b400; letter-spacing: 1px; white-space: nowrap; }
.stars-off { color: #e2ddd3; }

/* ---- Notice list (admin) -------------------------------------------------------- */
.notice-admin-list { display: grid; gap: 12px; }
.na-item { display: grid; grid-template-columns: 84px 1fr auto; gap: 18px; align-items: center; padding: 14px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.na-item.is-hidden { opacity: .65; background: #faf9f6; }
.na-thumb { width: 84px; height: 64px; border-radius: 6px; background: var(--paper); display: grid; place-items: center; overflow: hidden; font-size: 1.6rem; font-weight: 800; color: rgba(0,0,0,.35); box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.na-thumb img { width: 100%; height: 100%; object-fit: cover; }
.na-main h3 { margin: 0 0 3px; font-size: 1.05rem; }
.na-main p { margin: 2px 0; }
.na-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) { .na-item { grid-template-columns: 64px 1fr; } .na-thumb { width: 64px; height: 50px; } .na-actions { grid-column: 1 / -1; justify-content: flex-start; } }

/* ---- Submission detail ------------------------------------------------------------ */
.dl { display: grid; grid-template-columns: 110px 1fr; gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: .85rem; font-weight: 600; }
.dl dd { margin: 0; }
.media-list { display: grid; gap: 16px; }
.media { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #faf9f6; }
.media img { display: block; max-width: 100%; max-height: 560px; margin: 0 auto; background: #eee; }
.media video { display: block; width: 100%; max-height: 560px; background: #000; }
.audio-box { display: flex; align-items: center; gap: 12px; padding: 18px; font-size: 1.6rem; }
.audio-box audio { flex: 1; }
.file-box { display: block; padding: 30px; text-align: center; font-weight: 600; font-size: 1.05rem; }
.media figcaption { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #fff; border-top: 1px solid var(--line); }
.media .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .9rem; }

.status-picker { display: grid; gap: 6px; }
.status-picker .sp { display: block; cursor: pointer; }
.status-picker input { position: absolute; opacity: 0; }
.status-picker span { display: block; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 8px; font-weight: 600; }
.status-picker .sp:hover span { border-color: #cfc9be; }
.sp-new input:checked + span       { background: #dbe8ff; border-color: #2f6fd9; color: #1f4fa3; }
.sp-review input:checked + span    { background: #fff0c2; border-color: #e6b422; color: #7a5a00; }
.sp-shortlist input:checked + span { background: #ecdcff; border-color: #8a4fd6; color: #5b2a9c; }
.sp-accepted input:checked + span  { background: #d6f2df; border-color: #2e9d55; color: #1d6a3a; }
.sp-rejected input:checked + span  { background: #fadcd6; border-color: #c8432f; color: #9c2f1d; }
.status-picker input:focus-visible + span { box-shadow: 0 0 0 3px rgba(47,111,217,.25); }

.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 2px; }
.star-input input { position: absolute; opacity: 0; }
.form .star-input label { display: inline; font-size: 1.7rem; line-height: 1; color: #ddd6c9; cursor: pointer; font-weight: 400; }
.star-input label:hover, .star-input label:hover ~ label,
.star-input input:checked ~ label { color: #f0b400; }
.form .star-input .star-clear { font-size: .95rem; color: var(--muted); margin-left: 10px; order: -1; }
.star-input input#r0:checked ~ label { color: #ddd6c9; }
.star-input .star-clear:hover ~ label { color: #ddd6c9 !important; }

.danger-zone { text-align: right; }

/* ---- Small menu ------------------------------------------------------------------- */
.menu { position: relative; display: inline-block; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: 100%; z-index: 10; width: 240px; display: grid; gap: 10px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.12); text-align: left; }
