/* ── Design tokens ───────────────────────────────────────────────── */
:root {
  --ink:        #0f0f0f;
  --ink-mid:    #444;
  --ink-light:  #888;
  --paper:      #f8f9fb;
  --cream:      #eef1f5;
  --rule:       #d8dce3;
  --accent:     #1a365d;
  --accent-lt:  #e8eef6;
  --accent-mid: #2b6cb0;
  --gold:       #c89b3c;
  --red:        #c0392b;
  --red-lt:     #fdecea;
  --green:      #27ae60;
  --green-lt:   #e8f8ef;
  --radius:     8px;
  --radius-sm:  4px;
  --shadow:     0 1px 4px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.12);
  --mono:       'DM Mono', monospace;
  --serif:      'DM Serif Display', Georgia, serif;
  --sans:       'DM Sans', system-ui, sans-serif;
  --nav-width:  240px;
  --header-h:   56px;
}

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Shell layout ────────────────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--nav-width) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────── */
.tm-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}
.tm-logo {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--accent);
  text-decoration: none;
}
.tm-logo span { color: var(--gold); }
.tm-logo-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent-mid);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-left: 10px;
}
.tm-header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.tm-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--ink-mid);
  font-size: 20px;
}

/* ── Left nav ────────────────────────────────────────────────────── */
.tm-nav {
  border-right: 1px solid var(--rule);
  background: var(--cream);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
}
.tm-nav-greeting {
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  margin-bottom: 8px;
  color: var(--ink);
}
.tm-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-mid);
  text-decoration: none;
  font-size: 14px;
  transition: all .12s;
}
.tm-nav-link:hover { background: var(--accent-lt); color: var(--accent); }
.tm-nav-link.active { background: var(--accent-lt); color: var(--accent); font-weight: 500; }
.tm-nav-link .icon { font-size: 16px; width: 20px; text-align: center; }
.tm-nav-divider { height: 1px; background: var(--rule); margin: 12px 0; }
.tm-nav-status {
  font-size: 12px;
  color: var(--ink-light);
  padding: 8px 12px;
  line-height: 1.6;
}

/* ── Main content ────────────────────────────────────────────────── */
.tm-main { padding: 32px 40px; max-width: 100%; }
.tm-page-title { font-family: var(--serif); font-size: 24px; color: var(--accent); margin-bottom: 4px; }
.tm-page-subtitle { font-size: 13px; color: var(--ink-light); margin-bottom: 24px; }

/* ── Cards ───────────────────────────────────────────────────────── */
.tm-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.tm-card-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
  color: var(--ink);
}

/* ── Stat cards ──────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.stat-value {
  font-family: var(--serif);
  font-size: 32px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 12px;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-family: var(--mono);
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .12s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-mid); }
.btn-outline { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent-lt); }
.btn-ghost { background: transparent; color: var(--ink-mid); }
.btn-ghost:hover { background: var(--cream); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Form elements ───────────────────────────────────────────────── */
.tm-field { margin-bottom: 16px; }
.tm-label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-mid); margin-bottom: 5px; }
.tm-input, .tm-textarea, .tm-select {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.tm-input:focus, .tm-textarea:focus, .tm-select:focus { border-color: var(--accent-mid); }
.tm-textarea { resize: vertical; min-height: 120px; }

/* ── Toast ───────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 999;
  transform: translateY(120%);
  transition: transform .25s ease;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}
.toast.show { transform: translateY(0); }
.toast.ok { background: var(--green); color: #fff; }
.toast.err { background: var(--red); color: #fff; }

/* ── Table ───────────────────────────────────────────────────────── */
.tm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tm-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-light);
  border-bottom: 2px solid var(--rule);
}
.tm-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.tm-table tr:hover { background: var(--accent-lt); }
.tm-table tr { cursor: pointer; transition: background .1s; }

/* ── Badge ───────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--mono);
}
.badge-green { background: var(--green-lt); color: var(--green); }
.badge-gray  { background: var(--cream); color: var(--ink-light); }
.badge-blue  { background: var(--accent-lt); color: var(--accent-mid); }

/* ── Spinner ─────────────────────────────────────────────────────── */
.tm-spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--rule);
  border-top-color: var(--accent-mid);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────────────── */
.tm-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-light);
}
.tm-empty-icon { font-size: 40px; margin-bottom: 12px; }
.tm-empty-title { font-size: 16px; font-weight: 500; color: var(--ink-mid); margin-bottom: 6px; }
.tm-empty-body  { font-size: 14px; margin-bottom: 20px; }

/* ── Modal ───────────────────────────────────────────────────────── */
.tm-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.tm-modal-overlay.open { display: flex; }
.tm-modal {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 28px;
  width: min(700px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.tm-modal-title { font-size: 17px; font-weight: 500; margin-bottom: 10px; }
.tm-modal-body  { font-size: 14px; color: var(--ink-mid); margin-bottom: 22px; line-height: 1.6; }
.tm-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Tabs ────────────────────────────────────────────────────────── */
.tm-tabs {
  display: flex;
  border-bottom: 2px solid var(--rule);
  margin-bottom: 20px;
  gap: 0;
}
.tm-tab {
  padding: 10px 18px;
  font-size: 14px;
  color: var(--ink-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}
.tm-tab:hover { color: var(--ink); }
.tm-tab.active { color: var(--accent); border-bottom-color: var(--accent-mid); font-weight: 500; }

/* ── Progress bar ────────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-fill {
  height: 100%;
  background: var(--accent-mid);
  border-radius: 3px;
  transition: width .3s ease;
}

/* ── Drop zone ───────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--rule);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #fff;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-mid);
  background: var(--accent-lt);
}
.drop-zone-icon { font-size: 36px; margin-bottom: 8px; }
.drop-zone-text { font-size: 14px; color: var(--ink-mid); }
.drop-zone-hint { font-size: 12px; color: var(--ink-light); margin-top: 4px; }

/* ── Profile rendering (shared between candidates + match) ───────── */
.profile-summary-block {
  background: var(--accent-lt);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
}
.profile-summary-label {
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent-mid);
  margin-bottom: 8px;
}
.profile-section-title {
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-light);
  margin: 16px 0 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
}
.profile-table {
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
}
.profile-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.profile-row:last-child { border-bottom: none; }
.profile-row-label {
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-light);
  background: var(--cream);
}
.profile-row-value {
  padding: 8px 12px;
  color: var(--ink-mid);
  line-height: 1.5;
}

/* Section blocks (used in modals) */
.section-block {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.6;
}
.section-block-label {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--accent-mid);
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) 1fr;
  }
  .tm-hamburger { display: block; }
  .tm-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: var(--nav-width);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-md);
  }
  .tm-nav.open { transform: translateX(0); }
  .tm-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(0,0,0,.3);
    z-index: 99;
  }
  .tm-nav-backdrop.open { display: block; }
  .tm-main { padding: 20px 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sortable:hover {
  background: var(--surface-hover, rgba(0,0,0,0.04));
}
.sort-icon {
  margin-left: 4px;
  opacity: 0.35;
  font-size: 11px;
}
.sort-icon.active {
  opacity: 1;
  color: var(--accent, #7c3aed);
}