:root {
  color-scheme: dark;
  font-family: "DM Sans", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  background: #1a1410;
  color: #faf5ef;
  --night: #1a1410;
  --night-soft: #2c231a;
  --night-mid: #3d322a;
  --bark: #5c3d2e;
  --bark-light: #8b6a52;
  --amber: #e8a317;
  --amber-glow: #f5c549;
  --amber-deep: #c4880d;
  --accent-rgb: 232, 163, 23;
  --cream: #faf5ef;
  --cream-warm: #f2e8d8;
  --feather: #d4c4ab;
  --text-dim: #a8977e;
  --line: rgba(255, 255, 255, .055);
  --line-strong: rgba(255, 255, 255, .1);
  --serif: "Playfair Display", Georgia, serif;
  --sans: "DM Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 13% -12%, rgba(92, 61, 46, .24), transparent 38rem),
    radial-gradient(ellipse at 96% 20%, rgba(var(--accent-rgb), .035), transparent 36rem),
    var(--night);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 14px;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--amber-glow); outline-offset: 3px; }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  height: 72px;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(5vw, 24px);
  border-bottom: 1px solid var(--line);
  background: rgba(26, 20, 16, .92);
  backdrop-filter: blur(16px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--cream);
  font: 700 21px var(--serif);
  text-decoration: none;
}
.brand-light { color: var(--text-dim); font-weight: 400; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), .58);
  border-radius: 50%;
  background: rgba(var(--accent-rgb), .045);
}
.brand-mark img { width: 60px; height: 60px; max-width: none; object-fit: contain; transform: translateY(-1px); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  margin-left: 4px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), .2);
  border-radius: 50%;
  background: rgba(var(--accent-rgb), .08);
  color: var(--amber-glow);
  font: 500 12px var(--mono);
}

.content { width: min(100% - 64px, 1100px); margin: 0 auto; padding: 46px 0 28px; }
.welcome-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow {
  margin: 0 0 9px;
  color: var(--amber);
  font: 500 10px/1.4 var(--mono);
  letter-spacing: .16em;
}
.welcome-row h1, .login-card h1 {
  margin: 0;
  color: var(--cream);
  font: 700 clamp(27px, 3.2vw, 36px)/1.2 var(--serif);
  letter-spacing: -.025em;
}
.muted { margin: 8px 0 0; color: var(--text-dim); font-size: 13px; line-height: 1.65; }
.button {
  min-height: 38px;
  padding: 9px 16px;
  border: 1px solid rgba(var(--accent-rgb), .56);
  border-radius: 100px;
  background: transparent;
  color: var(--amber-glow);
  font: 400 12px var(--mono);
  letter-spacing: .025em;
  transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}
.button:hover, .button.primary:hover { border-color: var(--amber); background: var(--amber); color: var(--night); }
.button.primary { color: var(--amber); }
.button.ghost { min-height: 34px; border-color: transparent; color: var(--text-dim); }
.button.ghost:hover { border-color: rgba(var(--accent-rgb), .24); background: rgba(var(--accent-rgb), .07); color: var(--amber-glow); }
.button.secondary { border-color: var(--line-strong); color: var(--feather); }
.button.full { width: 100%; margin-top: 8px; padding: 12px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat-card {
  display: flex;
  min-height: 88px;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--night-soft);
}
.stat-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), .16);
  border-radius: 9px;
  background: rgba(var(--accent-rgb), .07);
  color: var(--amber-glow);
  font-size: 17px;
}
.stat-card p { margin: 0 0 4px; color: var(--text-dim); font-size: 12px; }
.stat-card strong { color: var(--cream); font: 700 25px/1.1 var(--serif); }

.board { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--night-soft); }
.board-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 21px 22px 17px; }
.board-heading h2 { margin: 0; color: var(--cream); font: 700 20px/1.25 var(--serif); }
.board-heading .muted { margin-top: 4px; font-size: 12px; }
.filters { display: flex; align-items: center; gap: 9px; }
.search {
  display: flex;
  width: 220px;
  height: 37px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  color: var(--text-dim);
}
.search span { color: var(--amber); font-size: 18px; }
.search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--cream); font-size: 12px; }
.search input::placeholder { color: #887864; }
.filters select, .login-card input, dialog input, dialog select, dialog textarea {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--night);
  color: var(--cream);
}
.filters select, dialog select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.filters select { height: 37px; padding-left: 12px; color: var(--feather); font-size: 12px; }
option { background: var(--night-soft); color: var(--cream); }
.table-wrap { overflow: auto; }
table { width: 100%; min-width: 790px; border-collapse: collapse; }
thead { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(26, 20, 16, .42); }
th { padding: 12px 15px; color: var(--text-dim); font: 500 9px/1.4 var(--mono); letter-spacing: .11em; text-align: left; text-transform: uppercase; }
th:first-child, td:first-child { padding-left: 22px; }
td { padding: 13px 15px; border-bottom: 1px solid var(--line); color: var(--feather); font-size: 12px; }
tbody tr { transition: background-color .14s ease; }
tbody tr:hover { background: rgba(var(--accent-rgb), .035); }
tbody tr:last-child td { border-bottom: 0; }
.company-cell { display: flex; min-width: 225px; align-items: center; gap: 11px; }
.company-badge {
  display: grid;
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--night-mid);
  color: var(--amber-glow);
  font: 500 13px var(--serif);
}
.role-title { color: var(--cream); font: 700 13px/1.45 var(--serif); }
.company-name { margin-top: 3px; color: var(--text-dim); font-size: 11px; }
.role-link { display: block; color: inherit; text-decoration: none; }
.role-link:hover .role-title { color: var(--amber-glow); }
.fit { display: inline-block; margin-left: 6px; color: var(--amber); font: 400 9px var(--mono); }
.status-select {
  min-width: 112px;
  padding: 7px 26px 7px 11px;
  appearance: none;
  border: 1px solid transparent;
  border-radius: 100px;
  outline: 0;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  font-size: 10px;
}
.status-select:focus-visible { outline: 2px solid var(--amber-glow); outline-offset: 2px; }
.status-assessing, .status-shortlisted { background-color: rgba(var(--accent-rgb), .12); color: var(--amber-glow); }
.status-draft, .status-prepared { background-color: rgba(139, 106, 82, .18); color: var(--cream-warm); }
.status-submitted, .status-interview, .status-offer { background-color: rgba(var(--accent-rgb), .08); color: var(--amber); }
.status-rejected, .status-withdrawn, .status-inactive, .status-blocked, .status-not_applied { background-color: rgba(255, 255, 255, .055); color: var(--text-dim); }
.compensation { color: var(--cream-warm); font-weight: 500; white-space: nowrap; }
.edit-button { padding: 4px 8px; border: 0; border-radius: 100px; background: transparent; color: var(--text-dim); font-size: 17px; }
.edit-button:hover { background: rgba(var(--accent-rgb), .08); color: var(--amber-glow); }
.notice { margin: 0 22px 14px; padding: 10px 13px; border: 1px solid rgba(var(--accent-rgb), .18); border-radius: 8px; background: rgba(var(--accent-rgb), .07); color: var(--amber-glow); font-size: 12px; }
.empty-state { padding: 54px 20px; text-align: center; }
.empty-icon { color: var(--amber); font-size: 25px; }
.empty-state h3 { margin: 11px 0 0; color: var(--cream); font: 700 18px var(--serif); }
.empty-state .button { margin-top: 17px; }
footer { padding: 20px 0; color: #8d7e6c; font: 400 10px var(--mono); text-align: center; }
footer span { padding: 0 6px; color: var(--amber-deep); }

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(92, 61, 46, .28), transparent 25rem),
    var(--night);
}
.login-card { width: min(100%, 420px); padding: 34px; border: 1px solid var(--line-strong); border-radius: 13px; background: rgba(44, 35, 26, .92); }
.login-card > .brand-mark { width: 52px; height: 52px; flex-basis: 52px; margin-bottom: 25px; }
.login-card > .brand-mark img { width: 74px; height: 74px; }
.login-card .muted { max-width: 33ch; }
.login-card form { margin-top: 25px; }
.login-card label, dialog label { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; color: var(--feather); font-size: 11px; font-weight: 500; }
.login-card input, dialog input, dialog select, dialog textarea { width: 100%; padding: 10px 11px; outline: 0; font-size: 12px; }
.login-card input:focus, dialog input:focus, dialog select:focus, dialog textarea:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .1); }
.form-error { min-height: 15px; margin: 8px 0 0; color: #f0a69a; font-size: 11px; }
.login-foot { margin: 19px 0 0; padding-top: 15px; border-top: 1px solid var(--line); color: var(--text-dim); font: 400 10px var(--mono); text-align: center; }

dialog { width: min(780px, calc(100% - 28px)); max-height: 90vh; padding: 0; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--night-soft); color: var(--cream); }
dialog::backdrop { background: rgba(14, 10, 8, .78); backdrop-filter: blur(4px); }
dialog form { padding: 24px; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 19px; }
.dialog-header h2 { margin: 0; color: var(--cream); font: 700 22px var(--serif); }
.icon-button { width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text-dim); font-size: 20px; line-height: 1; }
.icon-button:hover { border-color: rgba(var(--accent-rgb), .4); color: var(--amber-glow); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid label { margin-bottom: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid textarea { resize: vertical; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .topbar { height: 64px; padding: 0 16px; }
  .content { width: calc(100% - 32px); padding: 34px 0 20px; }
  .welcome-row { align-items: flex-start; gap: 18px; }
  .welcome-row .button { flex: 0 0 auto; white-space: nowrap; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat-card { min-height: 75px; gap: 10px; padding: 12px; }
  .stat-card strong { font-size: 22px; }
  .stat-icon { width: 32px; height: 32px; flex-basis: 32px; }
  .board-heading { align-items: flex-start; flex-direction: column; padding: 18px 16px 15px; }
  .filters { width: 100%; }
  .search { width: auto; flex: 1; }
  .filters select { max-width: 145px; }
  .top-actions { gap: 2px; }
  .top-actions .button { padding: 8px 10px; font-size: 10px; }
  .avatar { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }

  /* Replace the wide desktop table with vertically scrollable role cards. */
  .table-wrap { overflow: visible; }
  table { width: 100%; min-width: 0; border-collapse: separate; border-spacing: 0; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; padding: 12px; }
  tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--night);
    transition: border-color .14s ease, background-color .14s ease;
  }
  tbody tr:hover { border-color: var(--line-strong); background: var(--night-soft); }
  tbody tr:last-child td { border-bottom: 0; }
  td, th:first-child, td:first-child { min-width: 0; padding: 0; border: 0; }
  tbody td:first-child { grid-column: 1; grid-row: 1; }
  tbody td:nth-child(2) { grid-column: 2; grid-row: 1; justify-self: end; }
  tbody td:nth-child(3) { grid-column: 1; grid-row: 2; }
  tbody td:nth-child(4) { grid-column: 1; grid-row: 3; }
  tbody td:nth-child(5) { grid-column: 2; grid-row: 3; justify-self: end; text-align: right; }
  tbody td:nth-child(6) { grid-column: 2; grid-row: 2; justify-self: end; }
  .company-cell { min-width: 0; gap: 9px; }
  .company-badge { width: 32px; height: 32px; flex-basis: 32px; }
  .role-title { overflow-wrap: anywhere; }
  .status-select { min-width: 0; max-width: 126px; padding-left: 9px; font-size: 10px; }
  tbody td:nth-child(3)::before,
  tbody td:nth-child(4)::before,
  tbody td:nth-child(5)::before {
    display: block;
    margin-bottom: 3px;
    color: var(--text-dim);
    font: 500 9px/1.3 var(--mono);
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  tbody td:nth-child(3)::before { content: "Location"; }
  tbody td:nth-child(4)::before { content: "Compensation"; }
  tbody td:nth-child(5)::before { content: "Applied"; }
}
@media (max-width: 420px) {
  .welcome-row { flex-direction: column; }
  .welcome-row .button { align-self: flex-start; }
  .stats { gap: 7px; }
  .stat-card p { font-size: 11px; }
  .login-card { padding: 27px 23px; }
  .theme-toggle .theme-label { display: none; }
  tbody { gap: 8px; padding: 10px; }
  tbody tr { gap: 9px 8px; padding: 10px; }
  .status-select { max-width: 116px; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

:root[data-theme="light"] {
  color-scheme: light;
  background: #f4f7f4;
  color: #1b2b23;
  --night: #f4f7f4;
  --night-soft: #ffffff;
  --night-mid: #e9f0eb;
  --bark: #557c69;
  --bark-light: #8ca997;
  --amber: #3f765d;
  --amber-glow: #286247;
  --amber-deep: #527862;
  --accent-rgb: 63, 118, 93;
  --cream: #1b2b23;
  --cream-warm: #354a3e;
  --feather: #465b4e;
  --text-dim: #708176;
  --line: rgba(38, 79, 57, .1);
  --line-strong: rgba(38, 79, 57, .2);
}
:root[data-theme="light"] body {
  background:
    radial-gradient(ellipse at 13% -12%, rgba(73, 126, 95, .13), transparent 38rem),
    radial-gradient(ellipse at 96% 20%, rgba(87, 148, 111, .07), transparent 36rem),
    var(--night);
}
:root[data-theme="light"] .topbar { background: rgba(255, 255, 255, .91); }
:root[data-theme="light"] .login-shell {
  background:
    radial-gradient(ellipse at 50% 35%, rgba(73, 126, 95, .14), transparent 25rem),
    var(--night);
}
:root[data-theme="light"] .login-card { background: rgba(255, 255, 255, .94); }
:root[data-theme="light"] thead { background: rgba(233, 240, 235, .65); }
:root[data-theme="light"] .search input::placeholder { color: #87958c; }
:root[data-theme="light"] .status-assessing, :root[data-theme="light"] .status-shortlisted { background-color: #e2f0e6; color: #246244; }
:root[data-theme="light"] .status-draft, :root[data-theme="light"] .status-prepared { background-color: #edf1ed; color: #56665c; }
:root[data-theme="light"] .status-submitted, :root[data-theme="light"] .status-interview, :root[data-theme="light"] .status-offer { background-color: #e8f2eb; color: #286247; }
:root[data-theme="light"] .status-rejected, :root[data-theme="light"] .status-withdrawn, :root[data-theme="light"] .status-inactive, :root[data-theme="light"] .status-blocked, :root[data-theme="light"] .status-not_applied { background-color: #edf0ed; color: #68786e; }
:root[data-theme="light"] .notice { background: #eff7f0; color: #286247; }
:root[data-theme="light"] footer { color: #718078; }
:root[data-theme="light"] .brand-mark { border-color: rgba(63, 118, 93, .34); background: rgba(63, 118, 93, .07); }
:root[data-theme="light"] .stat-icon { border-color: rgba(63, 118, 93, .18); background: rgba(63, 118, 93, .07); }
