/* JobTrack: self-contained stylesheet (the CSP only allows same-origin styles).
   Mobile first: phones get a top bar + bottom tab bar, wide screens (>= 1024px) a fixed sidebar. */

:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #17201d;
  --ink-2: #4b5450;
  --ink-3: #7f8783;
  --line: #e4e2db;
  --line-2: #d3d0c6;
  --accent: #1f6f5c;
  --accent-hover: #185b4b;
  --accent-ink: #ffffff;
  --accent-soft: #e0efe9;
  --mint: #6fd1b4;
  --shell: #16201d;
  --shell-2: #1f2b27;
  --shell-ink: #c3cdc8;
  --danger: #b4362b;
  --danger-soft: #fbe9e6;
  --warn-soft: #fdf3dc;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 25, .05), 0 4px 14px rgba(20, 30, 25, .05);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --sidebar-w: 248px;
  --appbar-h: 56px;
  --tabbar-h: 64px;
  --gutter: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--sans);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; letter-spacing: -.015em; }
h2 { font-size: 1.08rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .75em; }
small, .muted { color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: .85em; }
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* =====================================================================
   App shell
   ===================================================================== */
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.08rem; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--mint); color: var(--shell); font-weight: 800; font-size: .95rem;
}
.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--mint); color: var(--shell); font-weight: 700; font-size: .9rem;
}
.avatar:hover { text-decoration: none; }

/* ---------- Top bar (phones / tablets) ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  min-height: calc(var(--appbar-h) + var(--safe-top));
  padding: var(--safe-top) var(--gutter) 0;
  background: var(--shell); color: #fff;
}
.appbar-role { font-size: .68rem; font-weight: 700; letter-spacing: .06em; background: rgba(111, 209, 180, .18); color: var(--mint); padding: 2px 8px; border-radius: 99px; }
.appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.appbar-actions form { margin: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: none; border: 0; color: var(--shell-ink); cursor: pointer;
}
.icon-btn:hover, .icon-btn:focus-visible { background: rgba(255, 255, 255, .08); color: #fff; }

/* ---------- Bottom tab bar (phones / tablets) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); font-size: .68rem; font-weight: 600; min-width: 0;
}
.tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar a:hover { text-decoration: none; color: var(--ink); }
.tabbar a.active { color: var(--accent); }
.tabbar a.active .icon { stroke-width: 2.2; }
.tab-cta-circle {
  display: grid; place-items: center; width: 46px; height: 46px; margin-top: -22px; border-radius: 50%;
  background: var(--accent); color: #fff; box-shadow: 0 6px 16px rgba(31, 111, 92, .35);
  border: 3px solid var(--bg);
}
.tab-cta-circle .icon { width: 24px; height: 24px; stroke-width: 2.4; }
.tabbar a.tab-cta { color: var(--ink-2); }
.tabbar a.tab-cta.active { color: var(--accent); }

/* Buttons that duplicate the tab bar's "New" button are hidden while the tab bar is shown */
@media (max-width: 1023px) { body:has(.tabbar) .dup-of-tabbar { display: none; } }

/* ---------- Sidebar (desktop) ---------- */
.sidebar { display: none; }

/* Room for the bottom tab bar when it is shown */
body:has(.tabbar) { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom)); }

@media (min-width: 1024px) {
  .appbar, .tabbar { display: none; }
  body:has(.tabbar) { padding-bottom: 0; }
  /* Sign-in / register pages have no sidebar: keep the top bar there */
  body:not(:has(.sidebar)) .appbar { display: flex; }

  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar-w);
    display: flex; flex-direction: column; gap: 6px;
    padding: 22px 14px 16px; background: var(--shell); color: var(--shell-ink);
    overflow-y: auto;
  }
  .sidebar .brand { padding: 0 10px 18px; }
  body:has(.sidebar) main { margin-left: var(--sidebar-w); }

  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-label { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #6f7d77; padding: 6px 12px; }
  .side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
    color: var(--shell-ink); font-weight: 500;
  }
  .side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
  .side-nav a.active { background: var(--shell-2); color: #fff; box-shadow: inset 3px 0 0 var(--mint); }
  .side-nav a.active .icon { color: var(--mint); }
  .side-nav a.side-cta { margin-top: 14px; background: var(--accent); color: #fff; justify-content: center; font-weight: 600; }
  .side-nav a.side-cta:hover { background: var(--accent-hover); }
  .side-nav a.side-cta.active { box-shadow: none; }
  .side-nav a.side-cta .icon { color: #fff; }

  .side-user { margin-top: auto; display: flex; align-items: center; gap: 4px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
  .side-user form { margin: 0; }
  .side-me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: #fff; }
  .side-me:hover, .side-me.active { background: rgba(255, 255, 255, .06); text-decoration: none; }
  .side-me-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
  .side-me-name { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-me-role { font-size: .74rem; color: #8b9893; }
  .side-logout {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
    background: none; border: 0; color: #8b9893; cursor: pointer;
  }
  .side-logout:hover { background: rgba(255, 255, 255, .06); color: #fff; }
}

/* =====================================================================
   Page layout: full width, left aligned (no centred column)
   ===================================================================== */
.page { width: 100%; max-width: 1360px; padding: 18px var(--gutter) 40px; }
.page-narrow { max-width: 860px; }
/* Pages without the sidebar (visitors browsing the interview hall, error pages when signed out):
   a centred, readable column instead of a left-aligned one */
body:not(:has(.sidebar)) .page { max-width: 1040px; margin-left: auto; margin-right: auto; }
@media (min-width: 720px) { :root { --gutter: 28px; } .page { padding-top: 28px; padding-bottom: 56px; } }
@media (min-width: 1280px) { :root { --gutter: 40px; } }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head > div:first-child { min-width: 0; }
.page-head h1 { margin: 0; word-break: break-word; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (min-width: 720px) { h1 { font-size: 1.75rem; } }
@media (max-width: 719px) {
  .page-head { align-items: stretch; }
  .page-head > .actions { width: 100%; }
  .page-head > .actions > .btn, .page-head > .actions > form { flex: 1; }
  .page-head > .actions > form .btn { width: 100%; }
}

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 960px) { .grid-2 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; } }
.stack > * + * { margin-top: 16px; }
@media (min-width: 720px) { .stack > * + * { margin-top: 20px; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
@media (min-width: 720px) { .card { padding: 20px 22px; } }
main > .card + .card, main > .card + details, main > details + .card, main > .tabs + .card, main > .tabs + details { margin-top: 14px; }
.card > h2:first-child { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-flush { padding: 0; overflow: hidden; }
@media (min-width: 720px) { .card-flush { padding: 0; } }
.section-note { color: var(--ink-3); font-size: .85rem; font-weight: 400; }

/* =====================================================================
   Alerts
   ===================================================================== */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid; }
.alert-success { background: var(--accent-soft); border-color: #bfdcd2; color: #174f42; }
.alert-error { background: var(--danger-soft); border-color: #efc4bd; color: #8a2a21; }
.alert-info { background: var(--warn-soft); border-color: #f0dfb2; color: #6b5214; }

/* =====================================================================
   Buttons (44px tall on touch screens)
   ===================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600;
  cursor: pointer; line-height: 1.2; white-space: nowrap; touch-action: manipulation;
}
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: #e8b8b1; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
@media (min-width: 1024px) { .btn { min-height: 40px; padding: 8px 16px; } .btn-sm { min-height: 32px; padding: 4px 10px; } }
.btn-link { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
/* Buttons that look like links: used for POST navigation (filters, tabs, sorting, paging) */
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
form.inline { display: inline; margin: 0; }

/* =====================================================================
   Forms (16px inputs on phones, so iOS does not zoom in on focus)
   ===================================================================== */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px 16px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--ink-3); }
.req::after { content: " *"; color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
input[type=date], input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; min-height: 44px; font: inherit; font-size: 16px; color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff;
  -webkit-appearance: none; appearance: none;
}
select {
  padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237f8783' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
input[type=date], input[type=datetime-local] { min-width: 0; }
input[type=file] { padding: 8px; background: var(--surface-2); }
@media (min-width: 1024px) {
  input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
  input[type=date], input[type=datetime-local], input[type=file], select, textarea { font-size: 15px; min-height: 40px; padding: 8px 11px; }
  input[type=text], input[type=email], input[type=password], input[type=url], input[type=number],
  input[type=date], input[type=datetime-local], select { height: 40px; }
}
textarea { min-height: 110px; resize: vertical; }
textarea.tall { min-height: 260px; font-family: var(--mono); font-size: .88rem; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(31, 111, 92, .18); outline-offset: 0; border-color: var(--accent); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
.field-error { color: var(--danger); font-size: .82rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: .92rem; color: var(--ink-2); }
.check input { margin-top: 3px; flex: none; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
@media (max-width: 719px) { .form-actions > .btn, .form-actions > a.btn { flex: 1 1 140px; } }

/* =====================================================================
   Search & filter panel (a <details>: folded on phones, opened on wide screens by app.js)
   ===================================================================== */
details.filter-panel { padding: 0; }
.filter-summary {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer;
  font-weight: 600; color: var(--ink-2); list-style: none; user-select: none; min-height: 52px;
}
.filter-summary::-webkit-details-marker { display: none; }
.filter-summary .icon { width: 19px; height: 19px; color: var(--accent); }
.filter-summary .icon-chevron { margin-left: auto; color: var(--ink-3); transition: transform .15s; }
details[open] > .filter-summary .icon-chevron { transform: rotate(180deg); }
details.filter-panel.is-active > .filter-summary::after { content: "Active"; order: 2; font-size: .7rem; font-weight: 700; background: var(--accent-soft); color: #174f42; padding: 1px 8px; border-radius: 99px; }
details.filter-panel.is-active > .filter-summary .icon-chevron { margin-left: 0; order: 3; }
details.filter-panel.is-active > .filter-summary span { flex: 1; }
details.filter-panel > form { padding: 0 16px 16px; }
@media (min-width: 720px) { .filter-summary { padding: 14px 22px; } details.filter-panel > form { padding: 0 22px 20px; } }

.filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: end; }
@media (min-width: 560px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 960px) { .filters { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
.filters .field label { font-weight: 500; }
.filter-actions { display: flex; gap: 8px; }
.filter-actions .btn { flex: 1; }
@media (min-width: 960px) { .filter-actions .btn { flex: none; } }

/* =====================================================================
   Tables. On phones, tables marked .rtable turn into one card per row:
   the first cell is the title, other cells show their data-label above the value.
   ===================================================================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
/* Sortable column headers */
th .sort-link { display: inline-flex; align-items: center; gap: 4px; color: inherit; white-space: nowrap; font: inherit; text-transform: inherit; letter-spacing: inherit; font-weight: inherit; }
th .sort-link:hover { color: var(--ink); text-decoration: none; }
th .sort-link.active { color: var(--ink); }
th .sort-arrow { font-size: .95em; opacity: .35; }
th .sort-link:hover .sort-arrow, th .sort-link.active .sort-arrow { opacity: 1; }
tbody tr:last-child td { border-bottom: 0; }
td .primary { font-weight: 600; color: var(--ink); }
td .secondary, td.secondary { color: var(--ink-3); font-size: .85rem; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }

/* Sort bar shown above card-style tables on phones (the table header is hidden there) */
.sortbar { display: none; }

@media (max-width: 719px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr { display: block; width: 100%; }
  .rtable tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px;
    padding: 14px 16px; border-bottom: 1px solid var(--line);
  }
  .rtable tbody tr:last-child { border-bottom: 0; }
  .rtable tbody tr:hover { background: none; }
  .rtable td { display: block; padding: 0; border: 0; min-width: 0; word-break: break-word; }
  .rtable td:first-child, .rtable td:last-child { padding: 0; }
  .rtable td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-size: .68rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3);
  }
  .rtable td.cell-main, .rtable td.cell-wide, .rtable td.cell-actions, .rtable td.empty { grid-column: 1 / -1; }
  .rtable td.cell-main { font-size: 1.02rem; }
  .rtable td.cell-actions .actions { gap: 8px; }
  .rtable td.cell-actions .btn-sm { min-height: 40px; padding: 8px 14px; }
  .rtable td.empty { padding: 32px 0; }

  .sortbar {
    display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line);
    overflow-x: auto; background: var(--surface-2); font-size: .8rem; color: var(--ink-3);
  }
  .sortbar .sortbar-label { font-weight: 600; white-space: nowrap; }
  .sortbar .sort-link {
    display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; padding: 6px 10px; border-radius: 99px;
    border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); font: inherit; font-weight: 600; cursor: pointer;
  }
  .sortbar .sort-link.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
  .sortbar form { margin: 0; }
}

.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .9rem; }
@media (min-width: 720px) { .pager { padding: 12px 22px; } }
.card:not(.card-flush) > .pager { margin: 16px -16px -16px; }
@media (min-width: 720px) { .card:not(.card-flush) > .pager { margin: 18px -22px -20px; } }

/* =====================================================================
   Badges
   ===================================================================== */
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: #eceae4; color: var(--ink-2); line-height: 1.35; }
.s-saved        { background: #eceae4; color: #555c58; }
.s-applied      { background: #e1ecfb; color: #234f8a; }
.s-assessment   { background: #efe6fb; color: #5b3590; }
.s-interviewing { background: #fdf0d6; color: #835a0c; }
.s-offer        { background: #d9f2e6; color: #17603f; }
.s-accepted     { background: #1f6f5c; color: #fff; }
.s-rejected     { background: #f9e1de; color: #8f2c22; }
.s-withdrawn    { background: #e6e6e6; color: #666; }
.s-no-response  { background: #efede8; color: #8a8f8b; }
.o-pending   { background: #eceae4; color: #555c58; }
.o-passed    { background: #d9f2e6; color: #17603f; }
.o-failed    { background: #f9e1de; color: #8f2c22; }
.o-cancelled { background: #e6e6e6; color: #666; }

.qc-technical  { background: #e1ecfb; color: #234f8a; }
.qc-behavioral { background: #efe6fb; color: #5b3590; }
.r-good { background: #d9f2e6; color: #17603f; }
.r-ok   { background: #fdf0d6; color: #835a0c; }
.r-poor { background: #f9e1de; color: #8f2c22; }

/* =====================================================================
   Tabs (scroll sideways on narrow screens) and interview questions
   ===================================================================== */
.tabs {
  display: flex; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; color: var(--ink-2);
  border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs a.active, .tabs button.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.tab-count { font-size: .74rem; color: var(--ink-3); background: #eceae4; border-radius: 99px; padding: 0 7px; margin-left: 6px; }
.tabs .active .tab-count { background: var(--accent-soft); color: #174f42; }
/* Question items: badges top-left, actions top-right; on phones the actions move below the question */
.q-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.q-item > * { grid-column: 1 / -1; }
.q-item > .q-meta { grid-column: 1; grid-row: 1; }
.q-item > .q-actions { grid-column: 2; grid-row: 1; align-self: start; }
.q-item:first-of-type { padding-top: 0; }
.q-item:last-of-type { border-bottom: 0; padding-bottom: 0; }
.q-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: .88rem; min-height: 32px; }
.q-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.q-text { margin-top: 10px; font-weight: 600; font-size: 1rem; white-space: pre-wrap; word-break: break-word; }
.q-answer { margin-top: 8px; }
.q-answer summary { cursor: pointer; color: var(--accent); font-size: .9rem; font-weight: 600; padding: 6px 0; }
.q-answer .notes { margin-top: 6px; background: var(--surface-2); border: 1px solid var(--line); padding: 12px; border-radius: var(--radius-sm); font-size: .92rem; }
.q-noanswer { font-size: .85rem; margin-top: 4px; }
@media (max-width: 559px) {
  .q-item > .q-actions { grid-column: 1 / -1; grid-row: auto; margin-top: 10px; }
}
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; background: #f1efe9; color: var(--ink-2); font-size: .8rem; }
.field .label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
.radio-row { display: flex; gap: 10px 18px; flex-wrap: wrap; }
.radio-col { display: flex; flex-direction: column; gap: 8px; }
.vis-public  { background: #d9f2e6; color: #17603f; }
.vis-private { background: #eceae4; color: #6b716d; }
.hall-meta { font-size: .85rem; color: var(--ink-3); }
.q-cell { white-space: pre-wrap; word-break: break-word; max-width: 560px; }
.radio { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; min-height: 36px; }

/* =====================================================================
   Dashboard / admin overview
   ===================================================================== */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.stat .label { color: var(--ink-3); font-size: .8rem; line-height: 1.35; }
.stat .value { font-size: 1.7rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
@media (min-width: 720px) { .stat { padding: 16px 18px; } .stat .value { font-size: 2.1rem; } }
.stat.accent { background: var(--shell); color: #fff; border-color: var(--shell); grid-column: 1 / -1; position: relative; overflow: hidden; }
.stat.accent::after { content: ""; position: absolute; right: -24px; bottom: -48px; width: 110px; height: 110px; border-radius: 50%; border: 18px solid rgba(111, 209, 180, .10); }
.stat.accent .label { color: #a9b3ae; }
.stat.accent .value { color: var(--mint); }
@media (min-width: 720px) { .stat.accent { grid-column: auto; } }
.status-bars { display: flex; flex-direction: column; gap: 10px; }
.status-bar { display: grid; grid-template-columns: 100px minmax(0, 1fr) 36px; align-items: center; gap: 10px; font-size: .9rem; }
.status-bar .track { height: 8px; border-radius: 99px; background: #efede8; overflow: hidden; }
.status-bar .fill { height: 100%; border-radius: 99px; background: var(--accent); }
.status-bar .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.status-bar a { color: inherit; }
/* <meter> instead of inline style widths, to satisfy the strict CSP */
meter.bar { width: 100%; height: 8px; border: 0; border-radius: 99px; background: #efede8; -webkit-appearance: none; appearance: none; }
meter.bar::-webkit-meter-bar { background: #efede8; border: 0; border-radius: 99px; height: 8px; }
meter.bar::-webkit-meter-optimum-value { background: var(--accent); border-radius: 99px; }
meter.bar::-moz-meter-bar { background: var(--accent); border-radius: 99px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.list li > :first-child { min-width: 0; }
.list li:last-child { border-bottom: 0; }
.list .when { color: var(--ink-3); font-size: .85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 479px) { .list li { flex-direction: column; gap: 2px; } .list .when { white-space: normal; } }

/* =====================================================================
   Application detail page
   ===================================================================== */
.kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 14px; margin: 0; }
.kv dt { color: var(--ink-3); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 8px; }
.kv dt:first-child { margin-top: 0; }
.kv dd { margin: 0; word-break: break-word; }
@media (min-width: 560px) {
  .kv { grid-template-columns: 130px minmax(0, 1fr); gap: 10px 14px; }
  .kv dt { text-transform: none; letter-spacing: 0; font-size: .88rem; font-weight: 400; margin-top: 0; }
}
.jd-text { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; max-height: 480px; overflow: auto; font-size: .9rem; margin: 0; }
.notes { white-space: pre-wrap; word-break: break-word; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 16px 14px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline li:first-child::before { background: var(--accent); }
.timeline .meta { color: var(--ink-3); font-size: .82rem; }
.timeline .tag-backfill { font-size: .72rem; background: var(--warn-soft); color: #6b5214; padding: 0 6px; border-radius: 4px; margin-left: 4px; }

.interview { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.interview + .interview { margin-top: 10px; }
.interview-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.interview-head .round { font-weight: 700; }
.interview .notes { margin-top: 8px; background: var(--surface-2); padding: 10px; border-radius: 8px; font-size: .9rem; }

.doc-group + .doc-group { margin-top: 16px; }
.doc-group h3 { font-size: .9rem; color: var(--ink-2); margin-bottom: 6px; }
.doc-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); flex-wrap: wrap; }
.doc-row > :first-child { min-width: 0; flex: 1 1 180px; }
.doc-row + .doc-row { margin-top: 6px; }
.doc-row.old { background: var(--surface-2); }
.doc-row .ver { font-family: var(--mono); font-size: .8rem; color: var(--ink-3); margin-right: 6px; }
.doc-row .name { word-break: break-all; }
.doc-row .latest { font-size: .72rem; background: var(--accent-soft); color: #174f42; padding: 0 6px; border-radius: 4px; margin-left: 6px; }

details.add-box { margin-top: 14px; border-top: 1px dashed var(--line-2); padding-top: 12px; }
details.add-box summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 36px; display: flex; align-items: center; }
details.add-box[open] summary { margin-bottom: 12px; }

.danger-zone { border-color: #efc4bd; }
.danger-zone h2 { color: var(--danger); }

/* =====================================================================
   Sign in / register: intro on the left, form on the right.
   Phones: the form comes first, the intro follows below it.
   ===================================================================== */
.auth-split {
  display: flex; flex-direction: column;
  min-height: calc(100vh - var(--appbar-h) - var(--safe-top));
}
.auth-panel { order: 1; display: flex; align-items: flex-start; justify-content: center; padding: 24px var(--gutter) 28px; }
.auth-intro { order: 2; background: var(--shell); color: var(--shell-ink); padding: 32px var(--gutter) 40px; position: relative; overflow: hidden; }
.auth-intro::before {
  content: ""; position: absolute; width: 520px; height: 520px; left: -220px; bottom: -260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(111, 209, 180, .14), transparent 65%); pointer-events: none;
}
.auth-intro-inner { position: relative; max-width: 440px; width: 100%; }
.auth-headline { color: #fff; font-size: 1.55rem; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 10px; }
.auth-headline span { color: var(--mint); }
.auth-lede { color: #a9b5b0; margin-bottom: 22px; }
.features { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 12px; }
.features li { display: flex; gap: 12px; align-items: center; color: #e4ebe8; font-weight: 500; }
.feature-icon {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: rgba(111, 209, 180, .12); color: var(--mint);
}
.feature-icon .icon { width: 18px; height: 18px; }
.hall-link { display: inline-flex; align-items: center; gap: 8px; color: var(--mint); font-weight: 600; font-size: .92rem; }
.hall-link .icon { width: 18px; height: 18px; transition: transform .15s; }
.hall-link:hover { text-decoration: none; color: #8ddcc4; }
.hall-link:hover .icon { transform: translateX(3px); }

.auth-card { width: 100%; max-width: 420px; padding: 24px; }
.auth-card h1 { font-size: 1.45rem; }
.auth-card .field + .field { margin-top: 14px; }
.auth-card .btn { width: 100%; margin-top: 20px; }
.auth-foot { text-align: center; margin-top: 16px; color: var(--ink-2); }
@media (max-width: 479px) {
  .auth-card { border: 0; box-shadow: none; background: transparent; padding: 4px 0; }
}

@media (min-width: 900px) {
  .auth-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .auth-intro { order: 0; display: flex; align-items: center; padding: 56px clamp(32px, 5vw, 80px); }
  .auth-panel { order: 0; align-items: center; padding: 48px clamp(24px, 4vw, 64px); }
  .auth-intro { justify-content: flex-end; }
  .auth-panel { justify-content: flex-start; }
  .auth-headline { font-size: clamp(1.9rem, 2.6vw, 2.3rem); }
  .auth-card { padding: 32px; }
}

/* Top bar links for visitors who are not signed in */
.appbar-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border-radius: 10px;
  color: var(--shell-ink); font-weight: 600; font-size: .9rem;
}
.appbar-link .icon { width: 20px; height: 20px; }
.appbar-link:hover, .appbar-link.active { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.btn-on-dark { background: var(--mint); border-color: var(--mint); color: var(--shell); margin-left: 4px; }
.btn-on-dark:hover { background: #8ddcc4; border-color: #8ddcc4; }
@media (max-width: 419px) { .appbar-link span { display: none; } }

.error-page { text-align: center; padding: 64px 20px; }
.error-page .code { font-size: 4rem; font-weight: 800; color: var(--line-2); line-height: 1; }
