:root {
  --brand: #393985; --brand-dark: #2a2a66; --brand-tint: #eeeef8;
  --ink: #1f2330; --muted: #646a7c; --line: #e2e4ec; --bg: #f5f6fa;
  --warn: #9a5b00; --warn-tint: #fff4e0; --err: #b42318; --err-tint: #fdecea; --ok: #1f7a4d; --ok-tint: #e7f5ee;
  font-family: Roboto, system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); font-size: 14.5px; line-height: 1.45; }
a { color: var(--brand); }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1rem; margin: 0 0 10px; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; background: #fff; border-bottom: 1px solid var(--line); padding: 0 20px; height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--brand); text-decoration: none; font-size: 1.05rem; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.top nav a.active { background: var(--brand-tint); color: var(--brand); }
.me { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.me img { width: 28px; height: 28px; border-radius: 50%; }
@media (max-width: 640px) { .me span { display: none; } .top { gap: 8px; padding: 0 10px; } .logo span { display: none; } }

main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.loading { color: var(--muted); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: #c7cad8; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--err); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; padding: 2px 4px; }

input, select, textarea { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgb(57 57 133 / .35); border-color: var(--brand); }
textarea { width: 100%; min-height: 70px; resize: vertical; }

/* login */
.login { max-width: 380px; margin: 12vh auto; background: #fff; border-radius: 14px; padding: 36px; text-align: center; box-shadow: 0 8px 30px rgb(20 20 60 / .08); }
.login img { width: 64px; }
.login h1 { margin: 12px 0 6px; }
.login p { color: var(--muted); margin: 0 0 24px; }
.gbtn { display: inline-flex; align-items: center; gap: 10px; border: 1px solid #dadce0; border-radius: 6px; padding: 10px 18px; text-decoration: none; color: #3c4043; font-weight: 500; background: #fff; }
.gbtn:hover { background: #f8f9fa; }

/* list */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs button { font: inherit; border: 0; background: none; padding: 7px 12px; border-radius: 999px; cursor: pointer; color: var(--muted); white-space: nowrap; font-weight: 500; }
.tabs button.active { background: var(--brand); color: #fff; }
.tabs .n { opacity: .75; margin-left: 4px; font-size: .85em; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters input[type=search] { flex: 1; min-width: 200px; }
.filters label { display: flex; align-items: center; gap: 6px; color: var(--muted); }

.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgb(20 20 60 / .05); }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #f8f8fd; }
.table tbody tr:last-child td { border-bottom: 0; }
.name { font-weight: 600; }
.sub { color: var(--muted); font-size: .82rem; }
.empty { text-align: center; color: var(--muted); padding: 48px 12px; background: #fff; border-radius: 12px; }
@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table td { border: 0; padding: 3px 14px; }
  .table td.hide-sm { display: none; }
}

.stage { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--brand-tint); color: var(--brand); white-space: nowrap; }
.stage.new { background: #e5f0ff; color: #1a56b0; }
.stage.hired { background: var(--ok-tint); color: var(--ok); }
.stage.rejected, .stage.withdrawn { background: #eef0f3; color: #6b7280; }
.flag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .75rem; font-weight: 600; background: var(--warn-tint); color: var(--warn); margin: 2px 4px 0 0; }
.flag.info { background: #eef0f3; color: #555c6b; }
.stars { color: #f0a500; letter-spacing: 1px; white-space: nowrap; }
.stars.edit button { background: none; border: 0; font-size: 1.25rem; cursor: pointer; color: #d4d6de; padding: 0 1px; }
.stars.edit button.on { color: #f0a500; }

/* detail */
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; font-weight: 500; }
.detail-head { background: #fff; border-radius: 12px; padding: 18px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; box-shadow: 0 1px 2px rgb(20 20 60 / .05); }
.detail-head .who { flex: 1; min-width: 220px; }
.detail-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.detail-head select { font-weight: 600; }
.grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }
.panel { background: #fff; border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgb(20 20 60 / .05); }
.panel.flags { border-left: 4px solid #f0a500; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }
.ssn { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; }
.answers { margin: 0; padding: 0; list-style: none; }
.answers li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.answers li:last-child { border: 0; }
.answers .a { font-weight: 600; }
.answers .a.flagged { color: var(--warn); }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.doc { border: 1px solid var(--line); border-radius: 10px; padding: 14px 10px; text-align: center; cursor: pointer; background: #fafbfd; font: inherit; }
.doc:hover { border-color: var(--brand); }
.doc .ico { font-size: 1.8rem; }
.doc b { display: block; font-size: .85rem; }
.note { border-bottom: 1px solid var(--line); padding: 10px 0; }
.note:last-child { border: 0; }
.note .meta { color: var(--muted); font-size: .8rem; display: flex; justify-content: space-between; }
.note .body { white-space: pre-wrap; margin-top: 3px; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.timeline li { padding: 5px 0 5px 16px; position: relative; color: #3b4050; }
.timeline li::before { content: ''; position: absolute; left: 0; top: 12px; width: 7px; height: 7px; border-radius: 50%; background: #c3c6d6; }
.timeline .when { color: var(--muted); }

/* positions */
.pos-list { display: grid; gap: 12px; }
.pos-card { background: #fff; border-radius: 12px; padding: 16px 18px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; box-shadow: 0 1px 2px rgb(20 20 60 / .05); }
.pos-card .info { flex: 1; min-width: 220px; }
.pill-off { background: #eef0f3; color: #6b7280; border-radius: 999px; padding: 1px 8px; font-size: .75rem; font-weight: 600; }
code.snippet { display: block; background: #1f2330; color: #e7e9f5; padding: 10px 12px; border-radius: 8px; font-size: .8rem; word-break: break-all; margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: .9rem; }
.field small { color: var(--muted); font-weight: 400; }
.qedit { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fafbfd; }
.qedit .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.qedit .row > input[type=text] { flex: 1; min-width: 200px; }
.qedit textarea { min-height: 80px; }
.flag-opts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0; }
.flag-opts label { font-weight: 400; display: flex; gap: 4px; align-items: center; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1f2330; color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; }
#toast.show { opacity: 1; }
#toast.err { background: var(--err); }

dialog#lightbox { width: min(1000px, 95vw); height: min(800px, 90vh); border: 0; border-radius: 12px; padding: 0; overflow: hidden; }
dialog#lightbox::backdrop { background: rgb(10 10 30 / .7); }
.lb-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
#lb-body { height: calc(100% - 52px); display: grid; place-items: center; background: #f0f1f5; overflow: auto; }
#lb-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
#lb-body iframe { width: 100%; height: 100%; border: 0; }
