/*
 * Poster Control — admin portal.
 *
 * Light throughout, but deliberately unlike the extension so the two are never
 * confused: a left sidebar instead of top tabs, serif headings instead of all
 * sans, a warm paper canvas instead of cool grey, and teal/amber accents
 * instead of LinkedIn blue.
 *
 * Each target page owns an accent that is applied to the whole shell, so which
 * pipeline you are operating on is unmistakable at a glance.
 */

:root {
  color-scheme: light;

  --ink: #1a1d23;
  --ink-2: #414852;
  --muted: #737b87;
  --line: #e6e2da;
  --line-2: #f0ece4;
  --surface: #ffffff;
  --canvas: #faf8f4;
  --tint: #f4f1ea;

  --accent: #4f46e5;
  --accent-soft: #eff0fe;
  --accent-line: #d3d5fb;

  --ok: #0b6b45;
  --ok-soft: #e8f5ee;
  --warn: #8a5a00;
  --warn-soft: #fdf4e3;
  --bad: #a8261e;
  --bad-soft: #fbedec;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(26,29,35,.04), 0 3px 12px rgba(26,29,35,.05);
}

/* Per-page accent, set on the shell so sidebar and content always agree. */
[data-page="pakistan-placement"] {
  --accent: #0f766e;
  --accent-soft: #e7f4f2;
  --accent-line: #bcded9;
}
[data-page="next-recruitment"] {
  --accent: #a4560a;
  --accent-soft: #fdf1e4;
  --accent-line: #f0d8ba;
}

* { box-sizing: border-box; }

/*
 * The hidden attribute works by setting display:none in the UA stylesheet, so
 * any author rule that sets display beats it — .login { display: grid } kept
 * the sign-in screen on top of the app after a successful login. Anything
 * toggled with hidden needs this to win.
 */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 14px/1.55 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

h1, h2, h3 { font-family: ui-serif, Georgia, "Times New Roman", serif; font-weight: 600; }
h1 { font-size: 23px; margin: 0; letter-spacing: -.012em; }
h2 { font-size: 17px; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ---------- login ---------- */
.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: var(--tint); }
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 34px; width: 100%; max-width: 400px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow);
}
.login-mark, .sidebar-mark {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 11px; background: var(--accent); color: #fff;
  font-family: ui-serif, Georgia, serif; font-weight: 600; letter-spacing: .5px;
}
.error { color: var(--bad); margin: 0; font-size: 13px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--tint); border-right: 1px solid var(--line);
  padding: 20px 16px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-brand { display: flex; gap: 11px; align-items: center; margin-bottom: 16px; }
.sidebar-brand strong { display: block; font-size: 14px; }
.sidebar-brand .muted { font-size: 12px; }

.sidebar-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 16px 0 7px;
}

.page-nav { display: flex; flex-direction: column; gap: 7px; }
.page-btn {
  width: 100%; text-align: left; cursor: pointer; font: inherit;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-left: 4px solid var(--dot);
  border-radius: 10px; padding: 12px 13px;
  display: flex; align-items: center; gap: 10px;
}
.page-btn:hover { border-color: var(--dot); }
.page-btn.active {
  background: #fff; box-shadow: var(--shadow);
  border-color: var(--dot); border-left-width: 4px;
}
.page-btn .name { flex: 1; font-weight: 600; }
.page-btn.active .name { color: var(--dot); }
.page-btn .n {
  background: var(--tint); border-radius: 20px; padding: 1px 9px;
  font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted);
}
.page-btn.active .n { background: var(--dot); color: #fff; }

.view-nav { display: flex; flex-direction: column; gap: 2px; }
.view-btn {
  width: 100%; text-align: left; cursor: pointer; font: inherit;
  background: none; border: 0; border-radius: 8px; padding: 9px 12px;
  color: var(--ink-2); display: flex; align-items: center; gap: 8px;
}
.view-btn:hover { background: #ece8e0; }
.view-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.view-btn .count {
  margin-left: auto; background: rgba(0,0,0,.06); border-radius: 20px;
  padding: 0 8px; font-size: 12px; font-variant-numeric: tabular-nums;
}
.view-btn.active .count { background: var(--accent); color: #fff; }
.sidebar-foot { margin-top: auto; padding-top: 16px; }
.btn-block { width: 100%; }

/* ---------- main ---------- */
.main { padding: 26px 32px 60px; max-width: 1180px; }

.page-header {
  display: flex; align-items: flex-start; gap: 20px;
  padding-bottom: 16px; margin-bottom: 22px;
  border-bottom: 3px solid var(--accent);
}
.page-header h1 { color: var(--accent); }
.header-actions { margin-left: auto; display: flex; gap: 8px; }

.view { display: none; }
.view.active { display: block; }

/* ---------- pipeline strip ---------- */
.flow {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 11px 14px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 12.5px; color: var(--muted);
}
.flow-step { padding: 3px 10px; border-radius: 20px; background: var(--canvas); }
.flow-step.done { color: var(--ok); background: var(--ok-soft); }
.flow-step.current {
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-line); font-weight: 600;
}
.flow-arrow { color: var(--line); }

/* ---------- buttons & fields ---------- */
.btn {
  font: inherit; cursor: pointer; padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn:hover { background: var(--tint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(.93); background: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { filter: brightness(.93); background: var(--bad); }

.input, .textarea {
  font: inherit; width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface); color: var(--ink);
}
.textarea { resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus { outline: 2px solid var(--accent-line); border-color: var(--accent); }
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.row { display: flex; align-items: center; gap: 10px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}

/* ---------- jobs ---------- */
.job-list { display: flex; flex-direction: column; gap: 10px; }

.job {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 26px 1fr auto; gap: 14px; align-items: start;
}
.job-main { min-width: 0; }
.job-title { font-weight: 600; margin-bottom: 3px; }
.job-text {
  color: var(--ink-2); font-size: 13px; white-space: pre-wrap;
  max-height: 66px; overflow: hidden; margin: 0;
}
.job-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--muted); }
.job-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }

.switch { display: inline-flex; align-items: center; cursor: pointer; }
.switch input { display: none; }
.switch .track {
  width: 38px; height: 22px; border-radius: 11px; background: #d4cec3;
  position: relative; transition: background .15s; display: block;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.switch-row strong { display: block; }
.switch-row .muted { font-size: 13px; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag-on { background: var(--ok-soft); color: var(--ok); }
.tag-off { background: var(--canvas); color: var(--muted); }
.tag-published { background: var(--ok-soft); color: var(--ok); }
.tag-failed { background: var(--bad-soft); color: var(--bad); }
.tag-queued { background: var(--warn-soft); color: var(--warn); }
.tag-sample { background: var(--accent-soft); color: var(--accent); }

.stat-row { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 20px; min-width: 118px;
}
.stat b { display: block; font-size: 24px; font-family: ui-serif, Georgia, serif; }
.stat span { font-size: 12px; color: var(--muted); }

.result {
  background: var(--canvas); border: 1px solid var(--line); border-radius: 9px;
  padding: 12px; font-size: 12.5px; overflow-x: auto; white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.lp { padding: 12px 0; border-bottom: 1px solid var(--line); }
.lp:last-child { border-bottom: 0; }
.lp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.lp-head strong { flex: 1; }
.lp a { font-size: 12px; color: var(--accent); word-break: break-all; }

/* ---------- preview drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(26,29,35,.35); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 94vw);
  background: var(--surface); z-index: 50; display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(26,29,35,.14);
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.drawer-body { padding: 22px; overflow-y: auto; }
.compare { display: grid; gap: 14px; }
.compare h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; font-family: inherit; }
.compare pre {
  margin: 0; padding: 14px; border-radius: 10px; white-space: pre-wrap;
  word-break: break-word; font: inherit; border: 1px solid var(--line); background: var(--canvas);
}
.compare .after { background: var(--accent-soft); border-color: var(--accent-line); }
.compare .comment { background: var(--ok-soft); border-color: #c3e3d2; }

.rule { border: 0; border-top: 1px solid var(--line); margin: 22px 0 18px; }
.sub { font-size: 15px; margin: 0 0 6px; }
.gap-top { margin-top: 16px; }
.hint { display: block; font-size: 12px; margin-top: 5px; }
.add-key { margin-bottom: 16px; }
.add-key .input { flex: 1; }

/* One row per credential — key or channel. */
.cred {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.cred:last-child { border-bottom: 0; }
.cred-name { font-weight: 600; min-width: 150px; }
.cred-detail { color: var(--muted); font-size: 13px; }
.cred .spacer { flex: 1; }
.cred .input, .cred select { max-width: 320px; }
.cred-bad { color: var(--bad); }

/* The scraped post, shown in the drawer as-is. */
.job-full {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font: inherit; line-height: 1.6;
}

.empty { text-align: center; padding: 54px 20px; color: var(--muted); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px;
  border-radius: 9px; box-shadow: var(--shadow); z-index: 60;
}
.toast.error { background: var(--bad); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
}
