:root {
  --navy: #17338a; --navy-dark: #0f2262; --gold: #c8962e;
  --bg: #f5f6fa; --card: #fff; --line: #e3e6ee; --ink: #1c2233; --muted: #6b7388;
  --ok: #059669; --ok-bg: #ecfdf5; --warn: #b45309; --warn-bg: #fffbeb; --err: #b91c1c; --err-bg: #fef2f2;
  --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
[hidden] { display: none !important; }
h2 { margin: 0 0 4px; font-size: 18px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 18px; }
code { background: #eef0f6; padding: 1px 5px; border-radius: 4px; }

.top { background: var(--card); border-bottom: 3px solid var(--gold); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; gap: 24px; min-height: 72px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand img { height: 60px; display: block; }
.tabs { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 10px 16px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button:hover { background: var(--bg); }
.tabs button[aria-selected="true"] { background: var(--navy); color: #fff; }
.status { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.pill { padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--warn-bg); color: var(--warn); }
.pill.live { background: var(--ok-bg); color: var(--ok); }

main { padding-top: 24px; padding-bottom: 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.narrow { max-width: 680px; margin: 0 auto; }
.grid2 { display: grid; grid-template-columns: minmax(340px, 480px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }

label { display: block; margin-top: 14px; font-weight: 600; font-size: 13px; }
label.check { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
input:not([type=checkbox]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font: inherit; font-weight: 400;
  border: 1px solid #cdd2df; border-radius: 8px; background: #fff; color: var(--ink);
}
input[type=file] { display: block; margin-top: 5px; font-weight: 400; width: 100%; }
input:focus, select:focus, textarea:focus, .drop:focus { outline: 2px solid var(--navy); outline-offset: 1px; }
#subject-search { margin-bottom: 6px; }

.btn { border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.primary { background: var(--navy); color: #fff; margin-top: 20px; }
.btn.primary:hover:not(:disabled) { background: var(--navy-dark); }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); padding: 6px 12px; font-size: 13px; }
.btn.ghost:hover { background: var(--bg); }
.btn.good { background: var(--ok); color: #fff; }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.alert { border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid; }
.alert.err { background: var(--err-bg); border-color: #fecaca; color: var(--err); }
.alert.warn { background: var(--warn-bg); border-color: #fde68a; color: var(--warn); }
.alert.ok { background: var(--ok-bg); border-color: #a7f3d0; color: var(--ok); }

.drop { margin-top: 16px; border: 2px dashed #b9c0d4; border-radius: var(--radius); padding: 26px; text-align: center; display: flex; flex-direction: column; gap: 4px; cursor: pointer; background: #fafbfe; }
.drop.over { border-color: var(--navy); background: #eef2ff; }
.files { text-align: left; margin: 12px auto 0; padding-left: 22px; font-size: 13px; max-width: 460px; width: 100%; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.item .t { font-weight: 600; }
.item .s { font-size: 13px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eef0f6; color: var(--muted); }
.badge.ready, .badge.released { background: var(--ok-bg); color: var(--ok); }
.badge.awaiting_review, .badge.graded { background: var(--warn-bg); color: var(--warn); }
.badge.failed { background: var(--err-bg); color: var(--err); }
.badge.processing, .badge.queued { background: #e0e7ff; color: var(--navy); }
.actions { display: flex; gap: 8px; align-items: center; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
td.num { font-variant-numeric: tabular-nums; font-weight: 600; }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(860px, 94vw); max-height: 90vh; box-shadow: 0 20px 60px rgba(15, 34, 98, .3); }
dialog::backdrop { background: rgba(15, 20, 40, .5); }
dialog[open] { display: flex; flex-direction: column; }
.dlg-head { display: flex; justify-content: space-between; gap: 16px; padding: 20px 24px 12px; border-bottom: 1px solid var(--line); }
.dlg-head p { margin: 2px 0 0; }
#review-body { padding: 18px 24px 24px; overflow: auto; }
.q { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.q-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 6px; }
.q .key { background: var(--ok-bg); border-left: 3px solid var(--ok); padding: 6px 10px; margin-top: 8px; font-size: 14px; border-radius: 4px; }
.q .key b { color: var(--ok); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; display: block; }
.q .part { margin: 8px 0 0 14px; padding-left: 10px; border-left: 2px solid var(--line); }
.q p { margin: 4px 0; }
.approve-bar { position: sticky; bottom: -24px; background: #fff; border-top: 1px solid var(--line); margin: 16px -24px -24px; padding: 14px 24px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.spinner { width: 18px; height: 18px; border: 3px solid #d5dbf0; border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
