:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #e2e5ea;
  --ink: #14181f;
  --ink-soft: #5b6470;
  --free: #16874f;
  --free-soft: #d9f0e2;
  --tentative: #a5710d;
  --tentative-soft: #fbeccd;
  --busy: #b3321f;
  --busy-soft: #fadcd6;
  --oof: #6b3fb5;
  --oof-soft: #e8ddfa;
  --warn-bg: #fbeccd;
  --warn-ink: #7a5205;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141a;
    --panel: #171c24;
    --line: #262d38;
    --ink: #e8ecf2;
    --ink-soft: #98a2b0;
    --free: #4cc98a;
    --free-soft: #1c3a2c;
    --tentative: #e0b356;
    --tentative-soft: #3a2f16;
    --busy: #f08573;
    --busy-soft: #40211b;
    --oof: #b79af0;
    --oof-soft: #2c2340;
    --warn-bg: #3a2f16;
    --warn-ink: #e0b356;
  }
}

* { box-sizing: border-box; }

/* An author `display` rule outranks the UA stylesheet's [hidden] { display: none }, which
   silently un-hides any flex or grid container we mark hidden - the identity fields and
   the recruiter tabs both did exactly that. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 24px 16px 40px;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: 860px; margin: 0 auto; }

.head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 15px; }
.sub { margin: 2px 0 0; color: var(--ink-soft); font-size: 13px; }
.muted { color: var(--ink-soft); font-size: 13px; }
.meta { display: flex; align-items: center; gap: 10px; }

.badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }

/* current status ------------------------------------------------------- */

.now {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--ink-soft);
  border-radius: var(--radius);
  margin-bottom: 22px;
}
.now.is-free { border-left-color: var(--free); }
.now.is-tentative { border-left-color: var(--tentative); }
.now.is-busy { border-left-color: var(--busy); }
.now.is-oof { border-left-color: var(--oof); }
.now.is-off_hours { border-left-color: var(--ink-soft); }

.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ink-soft); flex: none; }
.is-free .dot { background: var(--free); }
.is-tentative .dot { background: var(--tentative); }
.is-busy .dot { background: var(--busy); }
.is-oof .dot { background: var(--oof); }

.now-text { display: flex; flex-direction: column; gap: 2px; }
.now-text strong { font-size: 20px; letter-spacing: -0.01em; }

/* agenda --------------------------------------------------------------- */

.agenda {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 8px;
}
.agenda-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.agenda-tools { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.hint { margin: 2px 0 0; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--ink-soft); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.sw-free { background: var(--free-soft); border: 1px solid var(--free); }
.sw-busy { background: var(--busy-soft); border: 1px solid var(--busy); }

.ruler {
  position: relative;
  height: 16px;
  margin-left: 92px;
  color: var(--ink-soft);
  font-size: 11px;
}
.ruler span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ruler span:first-child { transform: none; }
.ruler span:last-child { transform: translateX(-100%); }

.days { list-style: none; margin: 0; padding: 0; }

.day {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid var(--line);
}
.day:first-child { border-top: 0; }
.day-label {
  width: 82px;
  flex: none;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.day.today .day-label { color: var(--ink); font-weight: 700; }
.day.weekend .day-label { opacity: 0.72; }

.track {
  position: relative;
  flex: 1;
  height: 30px;
  border-radius: 6px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}

/* Only the genuinely bookable stretches are tinted. */
.open-window { position: absolute; top: 0; bottom: 0; background: var(--free-soft); }

.block {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 3px;
  border-radius: 4px;
}
/* One appearance for every commitment. Tentative and out-of-office are not the
   applicant's business, so they are not drawn differently. */
.block-busy { background: var(--busy-soft); box-shadow: inset 0 0 0 1px var(--busy); }

.nowline {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--ink);
  opacity: 0.75;
}

.foot { margin-top: 16px; text-align: center; }

/* shared controls ------------------------------------------------------ */

.btn {
  font: inherit;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--ink);
  color: var(--panel);
  cursor: pointer;
}
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-small { padding: 4px 10px; font-size: 13px; }

.select, input[type="text"], input[type="email"], textarea {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  width: 100%;
}
textarea { resize: vertical; }
input:focus-visible, textarea:focus-visible, .select:focus-visible, .btn:focus-visible,
.slot:focus-visible, .tab:focus-visible, .thread-button:focus-visible {
  outline: 2px solid var(--free);
  outline-offset: 1px;
}

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; }
.field > span { color: var(--ink-soft); font-weight: 600; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 0; }
.field-inline > span { white-space: nowrap; }
.field-inline .select { width: auto; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.check input { width: auto; }

.notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 14px;
}
.notice-ok { border-color: var(--free); background: var(--free-soft); }
.notice-warn { border-color: var(--busy); background: var(--busy-soft); }

/* recruiter tabs ------------------------------------------------------- */

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab {
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
}
.tab.active { color: var(--panel); background: var(--ink); border-color: var(--ink); }

/* booking -------------------------------------------------------------- */

.confirm {
  margin-top: 18px;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--free);
  border-left: 5px solid var(--free);
  border-radius: var(--radius);
}
.confirm-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.confirm-head strong { font-size: 16px; }

/* A slot is a start time inside an open window: full-height, granularity-wide, sitting
   on top of the day's track. Buttons rather than a click surface so the calendar is
   keyboard reachable and each time is announced. */
.slot {
  position: absolute;
  top: 0;
  bottom: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid color-mix(in srgb, var(--free) 45%, transparent);
  background: transparent;
  cursor: pointer;
}
.slot:hover { background: color-mix(in srgb, var(--free) 30%, transparent); }
.slot.picked { background: transparent; border-left-color: transparent; }

.selection {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background: var(--free);
  color: var(--panel);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  overflow: hidden;
  white-space: nowrap;
}

.identity { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.booking-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

/* recruiter console ---------------------------------------------------- */

.shell-wide { max-width: 1120px; }

.gate {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.gate h2 { margin-bottom: 6px; }

.console { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }

.threads, .pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.threads-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.thread-list { list-style: none; margin: 0; padding: 0; max-height: 68vh; overflow-y: auto; }
.thread { border-top: 1px solid var(--line); }
.thread:first-child { border-top: 0; }
.thread-button {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  padding: 10px 4px;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.thread.active .thread-button { background: var(--free-soft); border-radius: 7px; }
.thread-top { display: flex; justify-content: space-between; gap: 8px; }
.thread-who { font-size: 14px; }
.thread-when, .thread-foot { color: var(--ink-soft); font-size: 12px; }
.thread-subject {
  color: var(--ink-soft);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-foot { display: flex; gap: 8px; align-items: center; }
.tag {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.shared { font-style: italic; }
.empty, .placeholder { padding: 8px 4px; }

.pane-actions { display: flex; gap: 8px; align-items: center; }
#thread-view.closed .messages, #thread-view.closed .interviews { opacity: 0.7; }
#thread-view.closed .composer { border-top-color: var(--tentative); }

.pane-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}
.messages {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 52vh;
  overflow-y: auto;
}
.message {
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.message.out { border-left: 3px solid var(--free); }
.message.in { border-left: 3px solid var(--oof); }
.message-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  font-size: 12px;
  color: var(--ink-soft);
}
.message-author { font-weight: 700; color: var(--ink); }
.message-subject { font-size: 13px; margin: 3px 0; color: var(--ink-soft); }
.message.suspect { border-left-color: var(--tentative); }
.chip {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.chip-warn { background: var(--tentative-soft); border-color: var(--tentative); color: var(--ink); }
.message-body {
  margin: 6px 0 0;
  font: inherit;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* interview requests + working hours ----------------------------------- */

.interviews { border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 14px; }
.interviews-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.interviews-head h3 { margin: 0; font-size: 14px; }
.interview-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.interview {
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-left: 3px solid var(--free);
}
.interview.cancelled { border-left-color: var(--ink-soft); opacity: 0.72; }
.interview.cancelled .interview-head strong { text-decoration: line-through; }
.interview-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}
.interview-meta { color: var(--ink-soft); font-size: 12px; margin-top: 2px; }
.interview-notes {
  margin: 6px 0 0;
  font: inherit;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink-soft);
}
.interview .btn { margin-top: 8px; }

.hours { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 13px; }
.hours summary { cursor: pointer; font-weight: 700; }
.hours-row { display: flex; gap: 12px; margin: 10px 0; }
.hours-row .field-inline input { width: auto; }
.days-picker {
  border: 0;
  padding: 0;
  margin: 0 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.days-picker legend { padding: 0; margin-bottom: 4px; }

.composer { border-top: 1px solid var(--line); padding-top: 14px; }
.composer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.composer-actions { display: flex; gap: 8px; align-items: center; }
.composer-actions .select { width: auto; }

@media (max-width: 860px) {
  .console { grid-template-columns: 1fr; }
  .thread-list { max-height: 34vh; }
  .identity { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .ruler { margin-left: 64px; }
  .day-label { width: 58px; font-size: 12px; }
  .now-text strong { font-size: 18px; }
}

/* demo-only credential box ---------------------------------------------
   Loud on purpose: it appears only when demo_auto_provision_applicants is on, and what it
   contains - a live password in a web page - should look as wrong as it is. */
.demo-warning {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 2px dashed var(--busy);
  background: var(--busy-soft);
  font-size: 14px;
}

.demo-warning > strong {
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
}

.demo-warning p { margin: 0 0 10px; }

.demo-creds {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0 0 10px;
}

.demo-creds dt { font-size: 12px; opacity: 0.75; }

.demo-creds dd {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  user-select: all;
}
