:root {
  --bg: #07080a;
  --card: #0e1013;
  --inner: #1d2027;
  --inner2: #16181d;
  --line: #2a2d35;
  --text: #e8eaee;
  --muted: #9aa0ab;
  --green: #3ecf8e;
  --green-bg: #1a4a35;
  --red: #ef5b5b;
  --red-bg: #4a2025;
  --amber: #e0b04a;
  --amber-bg: #4a3a1f;
  --blue: #7aa7ff;
  --blue-bg: #243247;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; }
h1 { font-size: 1.7rem; letter-spacing: .02em; }
h2 { font-size: 1.15rem; letter-spacing: .03em; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.upper { text-transform: uppercase; letter-spacing: .04em; }
.hidden { display: none; }

/* header */
.top { border-bottom: 1px solid var(--line); background: #000; position: sticky; top: 0; z-index: 5; }
.topin { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.brand { color: var(--text); font-weight: 700; letter-spacing: .06em; }
.brand span { color: var(--green); font-weight: 600; margin-left: 4px; }
.brand:hover { text-decoration: none; }
.top nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.top nav a { color: var(--muted); }
.top nav a:hover { color: var(--text); text-decoration: none; }
.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
.linkbtn:hover { color: var(--text); }
main { padding-top: 22px; padding-bottom: 50px; min-height: 70vh; }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; padding: 16px 0 28px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.inner { background: var(--inner); border-radius: 12px; padding: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 860px) { .grid2, .grid3, .split { grid-template-columns: 1fr; } }

/* portal */
.dept-card { display: block; background: var(--inner2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); }
a.dept-card:hover { text-decoration: none; border-color: var(--green); }
.dept-card.closed { opacity: .6; }
.dept-media { height: 190px; background: linear-gradient(135deg, #12202c, #0b0d12 60%, #1c2a22); display: flex; align-items: center; justify-content: center; font-size: 2.4rem; letter-spacing: .08em; color: #ffffff33; font-weight: 800; }
.dept-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dept-body { padding: 14px; }

/* badges + pills */
.badge, .pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .75rem; font-weight: 700; }
.badge-green, .pill-green { background: #0f3a28; color: var(--green); }
.badge-red, .pill-red { background: #3d1519; color: var(--red); }
.badge-amber, .pill-amber { background: #3d2e12; color: var(--amber); }
.badge-blue, .pill-blue { background: #1a2740; color: var(--blue); }
.pill-grey { background: #23262d; color: var(--muted); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--inner); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-size: 1.9rem; line-height: 1.1; }
.stat.pending b { color: var(--amber); }
.stat.accepted b { color: var(--green); }
.stat.rejected b { color: var(--red); }

/* tabs + toolbar */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; color: var(--muted); font-size: .88rem; }
.tab:hover { color: var(--text); text-decoration: none; border-color: #444955; }
.tab.on { background: #fff; color: #000; border-color: #fff; font-weight: 600; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }

/* queue */
.qrow { display: block; padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--text); }
.qrow:last-child { border-bottom: 0; }
.qrow:hover { text-decoration: none; background: #ffffff08; }
.qtop { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.qtop .tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* forms */
label { display: block; font-weight: 600; margin-bottom: 4px; }
.field { margin-bottom: 16px; }
.help { color: var(--muted); font-size: .82rem; margin: -2px 0 6px; font-weight: 400; }
input[type=text], input[type=search], input[type=number], select, textarea {
  width: 100%; background: var(--inner2); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: transparent; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 5px; }
.req { color: var(--red); }

.btn { display: inline-block; border: 1px solid var(--line); background: var(--inner); color: var(--text); border-radius: 10px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { text-decoration: none; filter: brightness(1.2); }
.btn-primary { background: var(--green-bg); border-color: #2a7a57; color: #fff; }
.btn-danger { background: var(--red-bg); border-color: #7a2e35; }
.btn-small { padding: 4px 10px; font-size: .82rem; border-radius: 8px; }
.decisions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 14px; }
.dbtn { border: 0; border-radius: 10px; padding: 18px 10px; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; text-align: center; }
.dbtn span { display: block; font-size: 1.1rem; margin-bottom: 4px; }
.dbtn:hover { filter: brightness(1.25); }
.d-accept { background: var(--green-bg); } .d-accept span { color: var(--green); }
.d-reject { background: var(--red-bg); } .d-reject span { color: var(--red); }
.d-interview { background: var(--amber-bg); } .d-interview span { color: var(--amber); }
.d-info { background: var(--blue-bg); } .d-info span { color: var(--blue); }

/* flash */
.flash { border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; border: 1px solid; }
.flash-ok { background: #0f2a1f; border-color: #2a7a57; color: #bdf2d8; }
.flash-err { background: #2d1216; border-color: #7a2e35; color: #ffc9ce; }
.flash-warn { background: #2d2410; border-color: #7a6020; color: #ffe2a0; }
ul.errors { margin: 6px 0 0; padding-left: 20px; }

/* profile + history */
.profile { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--inner); display: flex; align-items: center; justify-content: center; font-weight: 700; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.history .num { color: var(--muted); width: 18px; flex: none; }
.history details { margin-top: 6px; }
.history summary { cursor: pointer; color: var(--muted); font-size: .82rem; }
.note { background: var(--inner); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.note .meta { color: var(--muted); font-size: .78rem; margin-top: 4px; }
.answer { margin-bottom: 14px; }
.answer .q { color: var(--muted); font-size: .85rem; margin-bottom: 2px; }
.answer .a { white-space: pre-wrap; word-break: break-word; background: var(--inner2); border-radius: 10px; padding: 10px 12px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.pre { white-space: pre-wrap; word-break: break-word; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }

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

/* question editor */
.qrow-edit { background: var(--inner); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.qrow-edit .row { display: grid; grid-template-columns: 1fr 140px; gap: 10px; margin-bottom: 8px; }
.qrow-edit .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.qrow-edit .acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qrow-edit .acts label { margin: 0; display: flex; gap: 6px; align-items: center; font-weight: 500; }
@media (max-width: 600px) { .qrow-edit .row, .qrow-edit .row2 { grid-template-columns: 1fr; } }
