:root {
  --bg: #f5f6f8; --surface: #fff; --ink: #1c2230; --muted: #5d6677; --line: #dfe3ea;
  --accent: #b3121b; --accent-ink: #fff; --focus: #2457d6;
  --ok: #157347; --ok-bg: #e7f5ee; --warn: #8a5a00; --warn-bg: #fff4dc; --err: #b42318; --err-bg: #fdecea;
  --s-assigned: #5b6b86; --s-in_progress: #2457d6; --s-extension_requested: #a35a00; --s-pending_review: #7a3fb8;
  --s-rejected: #b42318; --s-approved: #157347; --s-published: #0b6e83;
  --fb: #1877f2; --ig: #c13584; --yt: #e62117;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c; --surface: #1b2029; --ink: #e7eaf0; --muted: #9aa3b4; --line: #2c3340;
    --accent: #e0444c; --focus: #7aa2ff;
    --ok: #4cc38a; --ok-bg: #12301f; --warn: #f0b44c; --warn-bg: #33270e; --err: #ff7b72; --err-bg: #3a1513;
    --s-assigned: #9aa8c2; --s-in_progress: #7aa2ff; --s-extension_requested: #f0b44c; --s-pending_review: #c49bf0;
    --s-rejected: #ff7b72; --s-approved: #4cc38a; --s-published: #4fc6dc;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Tamil", "Nirmala UI", Latha, sans-serif; }
.ta { font-family: "Noto Sans Tamil", "Nirmala UI", Latha, system-ui, sans-serif; }
a { color: var(--focus); }
h1 { font-size: 1.5rem; margin: .2rem 0 .6rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
h2 { font-size: 1.08rem; margin: 0 0 .7rem; }
h3 { font-size: 1rem; margin: .8rem 0 .4rem; }
small, .small { font-size: .85em; }
.muted { color: var(--muted); }
code { font-size: .9em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand small { color: var(--muted); font-weight: 500; }
.logo { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-size: .8em; }
.nav { display: flex; gap: .2rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
/* Phones: wrap the menu instead of hiding items off-screen. */
@media (max-width: 860px) { .nav { flex-wrap: wrap; overflow: visible; } .nav a { padding: .35rem .55rem; } }
.nav a { padding: .45rem .7rem; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500; }
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a.on { background: var(--accent); color: var(--accent-ink); }
.me { display: flex; gap: .6rem; align-items: center; white-space: nowrap; }
.me a { color: var(--ink); text-decoration: none; font-weight: 500; }
.me form { margin: 0; }
.modebar { background: var(--warn-bg); color: var(--warn); text-align: center; font-size: .85rem; padding: .25rem 1rem; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 1rem; }
.crumbs { margin: 0 0 .3rem; }
.crumbs a { text-decoration: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card.attention { border-color: var(--accent); border-width: 2px; }
.card.narrow { max-width: 520px; }
.login { max-width: 380px; margin: 10vh auto; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.review-split { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
@media (max-width: 860px) { .split, .review-split { grid-template-columns: 1fr; } .top { flex-wrap: wrap; } .nav { order: 3; flex-basis: 100%; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 40px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.btn.wide { width: 100%; }
.btn.sm { padding: .25rem .6rem; min-height: 32px; font-size: .9em; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.busy { opacity: .7; pointer-events: none; }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.btns { display: flex; gap: .6rem; flex-wrap: wrap; }

label { display: block; font-weight: 600; font-size: .92rem; }
label small, legend small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; min-height: 40px; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; margin-top: .25rem; }
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: .92rem; margin-bottom: .3rem; padding: 0; }
.stack { display: grid; gap: .8rem; }
.stack + .stack, .upload + .upload, .upload + .stack, .stack + form { margin-top: .9rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; align-items: end; }
.grid-form .span2 { grid-column: 1 / -1; }
.inline-form { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin: 0; }
.inline-form input:not([type=checkbox]) { width: auto; margin: 0; min-width: 0; flex: 1 1 120px; }
.inline { margin: .6rem 0; }
.checks { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 500; font-size: .92rem; cursor: pointer; color: var(--ink); text-decoration: none; }
.chip:has(input:checked), .chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.chip.sm { padding: .15rem .5rem; font-size: .82rem; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.filters-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: .8rem; }
.filters-form input:not([type=checkbox]), .filters-form select { width: auto; margin: 0; }
.filters-form label { display: flex; gap: .3rem; align-items: center; }
.search { display: flex; gap: .5rem; }
.search input { margin: 0; }

.flash { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash.error { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.pw { font-size: 1.1em; user-select: all; background: var(--surface); padding: .1rem .4rem; border-radius: 4px; }
.empty { color: var(--muted); padding: 1rem 0; }
.ok { color: var(--ok); font-weight: 600; }
.err { color: var(--err); }

.st { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; color: var(--s); background: color-mix(in srgb, var(--s) 13%, transparent); white-space: nowrap; }
.st-assigned { --s: var(--s-assigned); } .st-in_progress { --s: var(--s-in_progress); } .st-extension_requested { --s: var(--s-extension_requested); }
.st-pending_review { --s: var(--s-pending_review); } .st-rejected { --s: var(--s-rejected); } .st-approved { --s: var(--s-approved); } .st-published { --s: var(--s-published); }
.tag { display: inline-block; margin-left: .3rem; padding: 0 .4rem; border-radius: 4px; font-size: .75rem; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.tag.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.due { white-space: nowrap; }
.due.late { color: var(--err); font-weight: 600; }
.pf { display: inline-block; font-size: .75rem; font-weight: 700; padding: 0 .4rem; border-radius: 4px; margin: 0 .15rem .1rem 0; color: #fff; }
.pf-facebook.pf { background: var(--fb); } .pf-instagram.pf { background: var(--ig); } .pf-youtube.pf { background: var(--yt); }
.job { font-weight: 700; font-size: .85em; text-transform: capitalize; }
.job-success { color: var(--ok); } .job-failed { color: var(--err); } .job-queued, .job-uploading { color: var(--warn); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin: .8rem 0 1rem; }
.stat { display: flex; flex-direction: column; padding: .7rem .8rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--s, var(--line)); color: var(--ink); text-decoration: none; }
.stat b { font-size: 1.6rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.late { --s: var(--err); }
.todo { display: grid; gap: .5rem; margin-bottom: 1rem; }
.todo-item { padding: .7rem .9rem; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); text-decoration: none; font-weight: 500; }

.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.card .tablewrap { border: 0; }
table.list { width: 100%; border-collapse: collapse; font-size: .92rem; }
.list th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: .55rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.list tr:last-child td { border-bottom: 0; }
.list .title { min-width: 220px; }
.list .title a { color: var(--ink); text-decoration: none; font-weight: 500; }
.list .title a:hover { text-decoration: underline; }
.list .num a { font-weight: 600; }
.list tr.is-late td:first-child { box-shadow: inset 3px 0 var(--err); }
.list tr.inactive { opacity: .55; }
.nowrap { white-space: nowrap; }
.audit .remarks { max-width: 380px; white-space: pre-wrap; word-break: break-word; }
.user-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0; }
.user-row .who { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; flex: 1 1 320px; }
.user-row .who input { width: auto; flex: 1 1 140px; margin: 0; min-height: 32px; padding: .2rem .45rem; }

.news { list-style: none; margin: .5rem 0 0; padding: 0; max-height: 70vh; overflow-y: auto; border-top: 1px solid var(--line); }
.news li a { display: block; padding: .55rem .4rem; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.news li a:hover { background: var(--bg); }
.news li.on a { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); box-shadow: inset 3px 0 var(--accent); }
.news small { display: block; color: var(--muted); }
.picked h3 { margin-top: 0; }
.imgs { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0; }
.imgs img { height: 90px; border-radius: 6px; object-fit: cover; }
.body { white-space: pre-wrap; max-height: 360px; overflow-y: auto; font-size: .95rem; background: var(--bg); padding: .6rem .7rem; border-radius: 8px; }
.brief { margin-top: .8rem; padding: .6rem .7rem; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 0 8px 8px 0; }
blockquote { margin: .4rem 0; padding: .4rem .7rem; border-left: 3px solid var(--line); color: var(--muted); white-space: pre-wrap; }

.meta { display: grid; grid-template-columns: max-content 1fr; gap: .35rem .9rem; margin: 0; }
.meta dt { color: var(--muted); font-size: .88rem; }
.meta dd { margin: 0; }
video.reel { display: block; width: 100%; max-width: 340px; aspect-ratio: 9 / 16; background: #000; border-radius: 8px; margin: 0 auto .4rem; }
video.reel.small { max-width: 200px; }
img.thumb { display: block; max-width: 220px; max-height: 300px; border-radius: 8px; border: 1px solid var(--line); }
.upload { display: grid; gap: .45rem; padding: .7rem; border: 1px dashed var(--line); border-radius: 8px; margin-top: .8rem; }
.upload input[type=file] { padding: .35rem; }
progress { width: 100%; height: 8px; }
.vcheck:empty { display: none; }
.vcheck.warn { color: var(--warn); } .vcheck.ok { color: var(--ok); }
.versions { margin: 0; padding-left: 1.1rem; font-size: .9rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .45rem 0 .45rem .8rem; border-left: 3px solid var(--line); margin-left: .2rem; }
.timeline li.reject { border-color: var(--err); } .timeline li.approve { border-color: var(--ok); } .timeline li.ext { border-color: var(--s-extension_requested); }
.timeline time { color: var(--muted); font-size: .82rem; display: block; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.qcard { display: flex; gap: .7rem; padding: .7rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.qcard:hover { border-color: var(--accent); }
.qcard.locked { opacity: .6; }
.qcard img, .qcard .noimg { width: 72px; height: 128px; object-fit: cover; border-radius: 6px; flex: none; background: var(--bg); }
.qcard .noimg { display: grid; place-items: center; font-size: .7rem; color: var(--muted); text-align: center; }
.qbody { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.qbody small { color: var(--muted); }
details summary { cursor: pointer; color: var(--focus); margin: .4rem 0; }
