/* ============================================================
   PeoplePulse — Admin / Management backend
   ============================================================ */

/* ------------------------------------------------------------
   Design tokens.

   admin.css is loaded AFTER styles.css, so these :root declarations
   override the public site's values on admin pages only. CSS merges
   :root blocks rather than replacing them, so every token NOT listed
   here (--ok, --yellow-soft, --font, --maxw…) still comes from
   styles.css. Only the tokens the admin language actually changes are
   restated, so there is one place to look when they drift.

   The direction: a dense, quiet, legible tool. Definition comes from
   1px borders, not from float. Red and yellow are demoted to accents.
   ------------------------------------------------------------ */
/* Admin sidebar only. Every other token comes from tokens.css - do not redeclare them here. */
:root {
  --side-w: 248px;
  --side-bg: #07112b;
  --side-fg: #b6c3da;
  --side-accent: #6f8cff;
}

/* --bg is now pure white, which is also the panel colour. The page
   itself takes the faint tint so white panels keep their figure/ground
   separation without needing a shadow to float. */
body.admin { background: var(--bg-soft); }

.app { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.side {
  background: var(--side-bg); color: var(--side-fg); padding: 20px 12px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px;
}
.side .brand { padding: 6px 10px 16px; }
.side .brand .wordmark { font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; }
.side .brand .wordmark .p1 { color: #fff; }
.side .brand .wordmark .p2 { color: var(--side-accent); }
.side .brand .tagline { color: #8fa0bf; font-size: .6rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin-top: 3px; }
.side .grp { font-size: .64rem; text-transform: uppercase; letter-spacing: .13em; color: #6a7d9e; padding: 16px 10px 6px; font-weight: 700; }
.side a {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius);
  color: var(--side-fg); font-weight: 600; font-size: .89rem; transition: background .12s, color .12s;
  border-left: 2px solid transparent;
}
.side a:hover { background: rgba(255,255,255,.05); color: #fff; }
/* Active reads from a light rail + white text, not a heavy blue slab. */
.side a.active { background: rgba(111,140,255,.12); color: #fff; border-left-color: var(--side-accent); }
.side a .badge { margin-left: auto; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 2px; }
.side a svg { flex: none; }
.side-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid rgba(255,255,255,.09); display: flex; align-items: center; gap: 10px; }
.side-foot .av { width: 32px; height: 32px; border-radius: var(--radius); background: rgba(255,255,255,.1); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .78rem; }
.side-foot b { color: #fff; font-size: .86rem; display: block; line-height: 1.25; font-weight: 700; }
.side-foot small { color: #8fa0bf; font-size: .76rem; }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line); padding: 0 26px; height: 60px;
  display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 1.12rem; margin: 0; letter-spacing: -.02em; font-weight: 700; }
.topbar .sub { color: var(--slate); font-size: .81rem; font-weight: 500; }
.topbar .spacer { flex: 1; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 11px; width: 260px; color: var(--slate); }
.search-box input { border: 0; background: transparent; outline: none; font-family: var(--font); font-size: .88rem; width: 100%; color: var(--ink); }
/* The inner input drops its own outline, so the wrapper carries the ring. */
.search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 48, 144, .12); }
.icon-btn { width: 34px; height: 34px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--slate); position: relative; }
.icon-btn:hover { border-color: var(--blue); color: var(--blue); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; border: 2px solid #fff; }

.content { padding: 22px 26px 40px; }

/* ---------- Buttons ----------
   styles.css makes .btn-primary a red fill with a coloured glow. In the
   admin that is exactly backwards: primary is the calm brand blue, red
   is reserved for destruction. Overriding here rather than rewriting
   every view keeps the markup untouched — admin.css only loads on admin
   pages, so these bare selectors are already scoped to the backend. */
.btn {
  font-weight: 600; font-size: .89rem; padding: 8px 15px;
  border-radius: var(--radius); border: 1px solid transparent;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:active { transform: none; }
.btn-primary, .btn-blue { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: none; }
.btn-primary:hover, .btn-blue:hover { background: var(--blue-700); border-color: var(--blue-700); box-shadow: none; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-soft); border-color: #c3cee0; color: var(--ink); }
/* Destructive: outlined, not a slab of red. */
.btn-danger { background: #fff; color: #b3161c; border-color: #e9b9bb; }
.btn-danger:hover { background: #fdecec; border-color: #d8888c; color: #8f1116; }
.btn-lg { padding: 11px 22px; font-size: .96rem; }
.btn-sm { padding: 6px 12px; font-size: .83rem; border-radius: var(--radius); }

/* ---------- Focus ----------
   Nothing in styles.css gives .btn, .ico-link, .chip or the sign-out
   button a focus ring. One rule for the light content area, one for the
   dark sidebar (where --blue would be invisible). */
.main a:focus-visible,
.main button:focus-visible,
.main select:focus-visible,
.main [tabindex]:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px; border-radius: var(--radius);
}
.side a:focus-visible,
.side button:focus-visible {
  outline: 2px solid var(--side-accent); outline-offset: 2px;
}

/* ---------- Filter bar ---------- */
.filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: var(--radius);
  background: #fff; border: 1px solid var(--line); font-weight: 600; font-size: .85rem; color: var(--slate); cursor: pointer;
}
.chip:hover { border-color: #c3cee0; color: var(--ink); }
.chip.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.chip.active .count { background: rgba(255,255,255,.22); color: #fff; }
.chip .count { background: var(--bg-soft); color: var(--slate); font-size: .75rem; padding: 1px 6px; border-radius: 3px; font-variant-numeric: tabular-nums; }

/* ---------- Stat cards (dashboard-ish header) ---------- */
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.mini { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; }
.mini .top { display: flex; align-items: center; justify-content: space-between; }
.mini .ic { width: 32px; height: 32px; border-radius: var(--radius); display: grid; place-items: center; }
.mini b { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; display: block; margin-top: 4px; font-variant-numeric: tabular-nums; }
.mini span { color: var(--slate); font-weight: 600; font-size: .83rem; }
.mini .delta { font-size: .78rem; font-weight: 600; color: var(--slate); }
.delta.up { color: var(--ok); } .delta.down { color: var(--red); }

/* ---------- Kanban ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 3px 4px 10px; font-weight: 700; font-size: .85rem; letter-spacing: -.01em; }
.col-head .pill { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.col-head .n { margin-left: auto; background: #fff; color: var(--slate); font-size: .76rem; padding: 0 7px; border-radius: 3px; border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.kard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 8px; box-shadow: none; cursor: grab; transition: border-color .12s, box-shadow .12s; }
.kard:hover { border-color: #c3cee0; box-shadow: var(--shadow-sm); transform: none; }
.kard .k-top { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.kard .av { width: 32px; height: 32px; border-radius: var(--radius); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .76rem; flex: none; }
.kard .k-name b { font-size: .89rem; display: block; line-height: 1.25; }
.kard .k-name small { color: var(--slate); font-size: .77rem; }
.kard .k-role { font-size: .83rem; color: var(--ink); font-weight: 600; margin-bottom: 8px; }
.kard .k-meta { display: flex; flex-wrap: wrap; gap: 5px; }
.kard .k-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
/* Placeholder rating — deliberately neutral so it does not read as a
   real, meaningful score. */
.kard .rating { color: #c3cbd8; font-size: .8rem; letter-spacing: 1px; }
.kard .when { color: var(--slate); font-size: .75rem; font-weight: 600; }
.mintag { font-size: .71rem; font-weight: 600; padding: 2px 7px; border-radius: 3px; background: var(--blue-50); color: var(--blue); }
.mintag.r { background: #fdecec; color: #b3161c; }
.mintag.g { background: #e9f4ee; color: #13623c; }
/* Applied without an account — neutral, not an alarm. */
.mintag.guest { background: #eef1f6; color: #46566f; }
.mintag.y { background: #fdf3d8; color: #7a5c00; }

/* ---------- Drag & drop states ---------- */
.col-drop { min-height: 120px; }
.kard.dragging { opacity: .45; }
.col.over { background: var(--blue-50); box-shadow: inset 0 0 0 1px var(--blue); }

/* ---------- Dashboard cards / chart / lists ---------- */
.grid-2c { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.card-a { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: none; }
.card-a h3 { font-size: 1rem; margin: 0 0 16px; letter-spacing: -.02em; display: flex; justify-content: space-between; align-items: center; }
.chart { display: flex; align-items: flex-end; gap: 12px; height: 160px; padding-top: 10px; }
.chart .bar { flex: 1; background: var(--bg-soft); border-radius: 2px 2px 0 0; position: relative; display: flex; flex-direction: column; justify-content: flex-end; }
/* One series, one colour. Alternating red bars turned a chart into the
   loudest thing on the page. */
.chart .bar i { display: block; background: var(--blue); border-radius: 2px 2px 0 0; }
.chart + div .lbl, .lbl { text-align: center; font-size: .74rem; color: var(--muted); font-weight: 600; padding-top: 6px; }
.trow { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: 0; }
.trow .av { width: 32px; height: 32px; border-radius: var(--radius); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .75rem; flex: none; }
.trow .m { flex: 1; min-width: 0; }
.trow .m b { display: block; font-size: .88rem; }
.trow .m small { color: var(--slate); font-size: .79rem; }
.iv { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.iv:last-child { border-bottom: 0; }

/* ---------- Status tags (dashboard counters) ----------
   Squared off and darkened to clear AA on their own fills. */
.tag { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 3px; background: var(--blue-50); color: var(--blue); font-variant-numeric: tabular-nums; }
.tag.red { background: #fdecec; color: #b3161c; }
.tag.green { background: #e9f4ee; color: #13623c; }
.tag.yellow { background: #fdf3d8; color: #7a5c00; }

/* ---------- Admin content header + data tables ---------- */
.ch { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.ch h2 { margin: 0; font-size: 1.12rem; letter-spacing: -.02em; }
.ch p { margin: 3px 0 0; color: var(--slate); font-size: .86rem; }
.dtable { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: none; }
.dtable th { text-align: left; font-size: .69rem; text-transform: uppercase; letter-spacing: .07em; color: var(--slate); font-weight: 700; padding: 9px 14px; border-bottom: 1px solid var(--line); background: var(--bg-soft); white-space: nowrap; }
.dtable td { padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: .88rem; vertical-align: middle; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable tbody tr:hover td { background: var(--bg-soft); }
/* --muted is ~3:1 on white — decorative only. Real table text uses
   --slate (~5.8:1) so secondary rows still clear AA. */
.dtable .muted { color: var(--slate); font-size: .81rem; }
.dtable b { font-weight: 700; }
/* Figures line up and read down the column. */
.dtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.pill-s { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 3px; white-space: nowrap; }
.pill-s.green { background: #e9f4ee; color: #13623c; }
.pill-s.gray { background: #eef1f6; color: #46566f; }
.pill-s.blue { background: var(--blue-50); color: var(--blue); }
.pill-s.amber { background: #fdf3d8; color: #7a5c00; }
.form-error { padding: 9px 13px; border-radius: var(--radius); border: 1px solid #e9b9bb; border-left: 3px solid var(--red); color: #8f1116; background: #fdf4f4; font-size: .86rem; font-weight: 600; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.ico-link { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; color: var(--slate); cursor: pointer; }
.ico-link:hover { border-color: var(--blue); color: var(--blue); }
.ico-link.danger:hover { border-color: #d8888c; color: #b3161c; background: #fdecec; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--slate); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }

/* Referenced by AdminJobs/Form.cshtml for its row of checkboxes. It had
   no rule anywhere, so the inline `gap` on it did nothing. */
.form-row { display: flex; flex-wrap: wrap; align-items: center; }

/* ---------- Panels & form controls ----------
   styles.css sizes its controls for the public site (12px radius, 13px
   padding) and wraps them in :where(), which has zero specificity — so
   these plain selectors re-tune them for a dense admin without a
   specificity fight. Without this the fields stay visibly rounder than
   the 4px buttons sitting next to them. */
body.admin .panel { border-radius: var(--radius); box-shadow: none; margin-bottom: 16px; }
body.admin .panel-head { padding: 13px 18px; }
body.admin .panel-head h2 { font-size: 1rem; letter-spacing: -.02em; }
body.admin .panel-body { padding: 18px; }

body.admin .field { margin-bottom: 14px; }
body.admin .field > label { font-size: .84rem; margin-bottom: 6px; }
body.admin .field .hint { font-size: .79rem; color: var(--slate); }
body.admin .form-grid { gap: 0 16px; }

body.admin .field input, body.admin .field select, body.admin .field textarea,
body.admin input[type="text"], body.admin input[type="email"], body.admin input[type="password"],
body.admin input[type="tel"], body.admin input[type="number"], body.admin input[type="url"],
body.admin input[type="date"], body.admin select, body.admin textarea {
  border-radius: var(--radius);
  border: 1px solid var(--field-border);
  padding: 8px 11px;
  font-size: .89rem;
}
body.admin .field select, body.admin select { padding-right: 34px; background-position: right 11px center; }
body.admin .field textarea, body.admin textarea { min-height: 96px; padding: 9px 11px; }
body.admin .field input:focus, body.admin .field select:focus, body.admin .field textarea:focus,
body.admin input:focus, body.admin select:focus, body.admin textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 48, 144, .12);
}
body.admin label.check { font-size: .86rem; color: var(--ink); }

@media (max-width: 980px) { .grid-2c { grid-template-columns: 1fr; } }
@media (max-width: 1100px) {
  .app { grid-template-columns: 64px 1fr; }
  .side .brand .wordmark, .side .brand .tagline, .side a span, .side .grp, .side-foot b, .side-foot small { display: none; }
  .side a { justify-content: center; border-left: 0; border-right: 2px solid transparent; }
  .side a.active { border-right-color: var(--side-accent); }
  .mini-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .search-box { display: none; }
}

/* Sign-out is a POST form so it cannot be triggered by a stray GET; style its button
   exactly like the sidebar links it sits among. */
.signout-form { margin: 0; }
.signout-form button {
    display: flex; align-items: center; gap: 11px; width: 100%;
    background: none; border: 0; padding: 8px 10px; margin: 0; cursor: pointer;
    font: inherit; font-size: .89rem; font-weight: 600; color: var(--side-fg);
    text-align: left; border-radius: var(--radius); border-left: 2px solid transparent;
    transition: background .12s, color .12s;
}
.signout-form button:hover { background: rgba(255,255,255,.05); color: #fff; }

/* ------------------------------------------------------------
   Admin sign-in. The page sets Layout = null and carries its own dark
   theme; these give it the same tokens as the rest of the console.
   ------------------------------------------------------------ */
body.admin-login { background: var(--side-bg); display: grid; place-items: center; min-height: 100vh; margin: 0; font-family: var(--font); }
.login-wrap { width: 100%; max-width: 380px; padding: 32px; }
.login-head { text-align: center; margin-bottom: 22px; }
.login-head .wordmark { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.login-head .wordmark .p1 { color: #fff; }
.login-head .wordmark .p2 { color: var(--side-accent); }
.login-head .login-tag { color: #8fa0bf; font-size: .64rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; margin-top: 4px; }
.login-card { background: #0e1b38; border: 1px solid #22335a; border-radius: var(--radius-lg); padding: 24px; }
.login-card label { display: block; color: #c7d4ea; font-size: .82rem; font-weight: 600; margin-bottom: 6px; }
.login-card input[type=email], .login-card input[type=password] {
    width: 100%; box-sizing: border-box; background: #07112b; border: 1px solid #22335a; border-radius: var(--radius);
    padding: 10px 12px; color: #fff; font-family: var(--font); font-size: .92rem; margin-bottom: 15px;
    transition: border-color .12s, box-shadow .12s;
}
.login-card input:focus { outline: none; border-color: var(--side-accent); box-shadow: 0 0 0 3px rgba(111,140,255,.18); }
.login-card .remember { display: flex; align-items: center; gap: 8px; color: #b6c3da; font-size: .85rem; margin-bottom: 16px; font-weight: 500; }
.login-card .remember input { margin: 0; accent-color: var(--side-accent); }
.login-btn {
    width: 100%; background: var(--blue); color: #fff; border: 1px solid #1b3f9e; border-radius: var(--radius); padding: 11px;
    font-family: var(--font); font-size: .93rem; font-weight: 700; cursor: pointer; transition: background .12s;
}
.login-btn:hover { background: #0a3ea8; }
.login-btn:focus-visible { outline: 2px solid var(--side-accent); outline-offset: 2px; }
.login-card input:focus-visible, .login-card .remember input:focus-visible { outline: none; }
.login-err {
    background: #2a1116; border: 1px solid #5b2230; border-left: 3px solid #e2565d; color: #ffc2c2;
    border-radius: var(--radius); padding: 10px 12px; font-size: .86rem; margin-bottom: 15px;
}
.login-err ul { margin: 0; padding-left: 18px; }
.login-foot { text-align: center; color: #8fa0bf; font-size: .8rem; margin-top: 16px; }
