*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    background: #f8f9fa;
}

.site-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .5rem 1.5rem;
    background: #1e293b;
    color: #f1f5f9;
}
.site-title { color: #f1f5f9; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.header-user { margin-left: auto; font-size: .85rem; opacity: .8; }
.logout-form button {
    background: transparent; border: 1px solid #475569; color: #cbd5e1;
    padding: .25rem .75rem; border-radius: 4px; cursor: pointer; font-size: .8rem;
}
.logout-form button:hover { background: #334155; }

.main-content { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

.page-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-header h1 { margin: 0; font-size: 1.5rem; flex: 1; }

.btn {
    display: inline-block; padding: .4rem .9rem; border-radius: 5px; border: none;
    cursor: pointer; text-decoration: none; font-size: .85rem; font-weight: 500;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #e2e8f0; color: #1e293b; }
.btn-secondary:hover { background: #cbd5e1; }

.table-wrap { overflow-x: auto; }
.table {
    width: 100%; border-collapse: collapse; background: #fff;
    border: 1px solid #e2e8f0; border-radius: 6px; overflow: hidden;
}
.table th {
    text-align: left; padding: .5rem .75rem; background: #f1f5f9;
    font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
    color: #64748b; border-bottom: 1px solid #e2e8f0;
}
.table td { padding: .4rem .5rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:nth-child(even) td { background: #fafafa; }
.table tbody tr:hover td { background: #f0f9ff; }

.td-prio { white-space: nowrap; }
.td-prio form { display: flex; gap: 2px; }
.prio-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border: 1px solid #d1d5db; border-radius: 4px;
    background: #e5e7eb; cursor: pointer; font-size: .85rem; padding: 0;
}
.prio-btn:hover { opacity: .75; }
.prio-btn.prio-1.active { background: #22c55e; border-color: #16a34a; }
.prio-btn.prio-2.active { background: #eab308; border-color: #ca8a04; }
.prio-btn.prio-3.active { background: #f97316; border-color: #ea580c; }
.prio-btn.prio-4.active { background: #ef4444; border-color: #dc2626; }
.prio-btn.prio-1:not(.active):hover { background: #bbf7d0; }
.prio-btn.prio-2:not(.active):hover { background: #fef08a; }
.prio-btn.prio-3:not(.active):hover { background: #fed7aa; }
.prio-btn.prio-4:not(.active):hover { background: #fecaca; }

.counters { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.counter {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .3rem .7rem; border-radius: 99px; font-size: .8rem; font-weight: 600;
    background: #e5e7eb; color: #374151;
}
.counter-1 { background: #dcfce7; color: #15803d; }
.counter-2 { background: #fef9c3; color: #854d0e; }
.counter-3 { background: #ffedd5; color: #9a3412; }
.counter-4 { background: #fee2e2; color: #991b1b; }
.counter-null { background: #f1f5f9; color: #64748b; }

.td-field { min-width: 120px; }
.inline-input {
    width: 100%; border: 1px solid transparent; padding: .25rem .4rem;
    font-size: .85rem; border-radius: 3px; background: transparent;
    font-family: inherit;
}
.inline-input:focus { border-color: #2563eb; outline: none; background: #fff; }
.inline-input:hover:not(:focus) { border-color: #e2e8f0; }

.btn-delete {
    background: transparent; border: none; color: #9ca3af; cursor: pointer;
    padding: .2rem .4rem; font-size: 1rem; border-radius: 3px;
}
.btn-delete:hover { color: #ef4444; background: #fee2e2; }

.add-candidate-bar {
    display: flex; align-items: center; gap: .5rem; margin-bottom: .75rem; flex-wrap: wrap;
}
.input-add {
    padding: .35rem .6rem; border: 1px solid #d1d5db; border-radius: 4px;
    font-size: .85rem; width: 150px;
}
.candidate-total { margin-left: auto; color: #64748b; font-size: .85rem; }

@keyframes flash {
    0% { background-color: #fef08a; }
    100% { background-color: transparent; }
}
.flash td { animation: flash 600ms ease-out; }

.badge { font-size: .75rem; padding: .15rem .4rem; border-radius: 3px; margin-left: .4rem; }
.badge-archived { background: #fee2e2; color: #991b1b; }

.form-card {
    background: #fff; padding: 1.5rem; border-radius: 8px;
    border: 1px solid #e2e8f0; max-width: 600px;
}
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 500; margin-bottom: .3rem; font-size: .9rem; }
.field input[type=text], .field textarea, .field select {
    width: 100%; padding: .4rem .6rem; border: 1px solid #d1d5db; border-radius: 4px;
    font-family: inherit; font-size: .9rem;
}
.field input[type=text]:focus, .field textarea:focus { outline: none; border-color: #2563eb; }
.field-errors { color: #dc2626; font-size: .85rem; margin-top: .25rem; list-style: none; padding: 0; }
.form-actions { margin-top: 1.5rem; }

.archive-filter { margin-bottom: 1rem; }
.empty-state { color: #64748b; font-style: italic; }
.recruitment-desc { color: #475569; margin-bottom: 1rem; }

.messages { list-style: none; padding: .5rem; background: #dbeafe; border-radius: 4px; margin-bottom: 1rem; }
.message { padding: .25rem 0; }

@media (max-width: 900px) {
    .table-wrap { overflow-x: scroll; }
    .main-content { padding: 1rem; }
}

/* ── Recruitment tabs ─────────────────────────────────────────────────────── */
.recruitment-tabs {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: .75rem 0 0; margin-bottom: .5rem; border-bottom: 2px solid #e2e8f0;
}
.tabs-back { color: #64748b; text-decoration: none; font-size: .85rem; white-space: nowrap; }
.tabs-back:hover { color: #1e293b; }
.tabs-title { font-weight: 600; font-size: 1.05rem; flex: 1; color: #1e293b; }
.tabs-nav { display: flex; gap: 0; margin-left: auto; }
.tab {
    padding: .45rem 1rem; text-decoration: none; font-size: .85rem; font-weight: 500;
    color: #64748b; border: 1px solid #e2e8f0; border-bottom: none;
    background: #f8f9fa; margin-right: -1px;
}
.tab:first-child { border-radius: 6px 0 0 0; }
.tab:last-child { border-radius: 0 6px 0 0; }
.tab:hover { background: #f1f5f9; color: #1e293b; }
.tab-active { background: #fff; color: #2563eb; font-weight: 600; border-top: 2px solid #2563eb; }

.page-subheader {
    display: flex; align-items: center; gap: 1rem; margin: .75rem 0 1rem; flex-wrap: wrap;
}
.page-subheader h2 { margin: 0; font-size: 1.25rem; flex: 1; }
.candidate-subheader h2 { font-size: 1.4rem; }

/* ── Candidate cards grid ─────────────────────────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 1rem;
}
.candidate-card {
    display: flex; flex-direction: column; gap: .4rem;
    padding: 1rem 1.1rem; background: #fff;
    border: 1px solid #e2e8f0; border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    text-decoration: none; color: inherit;
    transition: box-shadow 150ms, transform 150ms; cursor: pointer;
}
.candidate-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); transform: translateY(-2px); }
.candidate-card-name { font-size: 1.1rem; font-weight: 700; color: #1e293b; }
.candidate-card-tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.tag-badge {
    background: #e0f2fe; color: #0369a1; font-size: .75rem;
    padding: .1rem .4rem; border-radius: 3px;
}
.candidate-card-strengths {
    font-size: .85rem; color: #475569;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.candidate-card-indicators {
    display: flex; gap: .6rem; margin-top: auto; padding-top: .4rem;
    font-size: .8rem; color: #64748b;
}

/* ── Candidate detail ─────────────────────────────────────────────────────── */
.detail-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem;
}
.detail-col {
    background: #fff; padding: 1.25rem; border: 1px solid #e2e8f0; border-radius: 8px;
}
.detail-col h3 { margin: 0 0 .75rem; font-size: 1rem; color: #1e293b; }
.detail-separator { height: 1px; background: #e2e8f0; margin: 1rem 0; }
.detail-notes { background: #fff; padding: 1.25rem; border: 1px solid #e2e8f0; border-radius: 8px; }
.detail-notes h3 { margin: 0 0 .75rem; font-size: 1rem; }

.info-list { display: grid; gap: .4rem; margin: 0; }
.info-list dt { font-size: .75rem; text-transform: uppercase; color: #94a3b8; letter-spacing: .04em; }
.info-list dd { margin: 0 0 .5rem; font-size: .9rem; color: #334155; }

.prio-badge {
    font-size: .8rem; font-weight: 600; padding: .25rem .6rem; border-radius: 99px;
}
.prio-badge.prio-1 { background: #dcfce7; color: #15803d; }
.prio-badge.prio-2 { background: #fef9c3; color: #854d0e; }
.prio-badge.prio-3 { background: #ffedd5; color: #9a3412; }
.prio-badge.prio-4 { background: #fee2e2; color: #991b1b; }

/* ── Upload & docs ────────────────────────────────────────────────────────── */
.upload-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .75rem; }
.upload-form input[type=file] { font-size: .8rem; }
.upload-form select { padding: .3rem .5rem; border: 1px solid #d1d5db; border-radius: 4px; font-size: .8rem; }
.input-label, .input-url {
    padding: .35rem .5rem; border: 1px solid #d1d5db; border-radius: 4px; font-size: .85rem;
}
.input-url { min-width: 200px; }
.upload-error { color: #dc2626; font-size: .85rem; margin-top: .25rem; }

.doc-list, .link-list { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-direction: column; gap: .4rem; }
.doc-item, .link-item { display: flex; align-items: center; gap: .5rem; padding: .3rem .4rem; background: #f8f9fa; border-radius: 4px; }
.doc-link, .ext-link { font-size: .85rem; color: #2563eb; text-decoration: none; flex: 1; }
.doc-link:hover, .ext-link:hover { text-decoration: underline; }
.doc-kind { font-size: .75rem; color: #94a3b8; }

.link-form { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .75rem; }

/* ── Long notes ───────────────────────────────────────────────────────────── */
.long-notes-area {
    width: 100%; padding: .6rem .8rem; border: 1px solid #d1d5db; border-radius: 6px;
    font-family: inherit; font-size: .9rem; resize: vertical; min-height: 200px;
}
.long-notes-area:focus { outline: none; border-color: #2563eb; }
.save-indicator { display: block; margin-top: .3rem; font-size: .8rem; font-style: italic; color: #94a3b8; }
.save-indicator.saved { color: #16a34a; }
.save-indicator.unsaved { color: #d97706; }

/* ── Stub ────────────────────────────────────────────────────────────────── */
.stub-content { padding: 2rem 0; }
.stub-message { color: #64748b; font-size: 1rem; line-height: 1.8; }

.empty-selection { text-align: center; padding: 3rem; color: #64748b; }

@media (max-width: 900px) {
    .detail-grid { grid-template-columns: 1fr; }
    .recruitment-tabs { gap: .5rem; }
    .tabs-title { font-size: .9rem; }
}


/* ── Interview list & cards ─────────────────────────────────────── */

.status-filter {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-btn {
  padding: .25rem .65rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: .85rem;
}

.filter-active {
  background: var(--primary, #2563eb);
  color: #fff;
  border-color: var(--primary, #2563eb);
}

.interview-day-header {
  font-size: 1.05rem;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  padding: .5rem 0 .25rem;
  margin: 1.2rem 0 .5rem;
  color: var(--text-muted, #555);
}

.interview-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: .75rem;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.interview-card--past {
  opacity: .72;
}

.interview-card-header {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: baseline;
  margin-bottom: .4rem;
  font-size: .9rem;
  color: var(--text-muted, #555);
}

.interview-past-label {
  background: #e5e7eb;
  color: #6b7280;
  border-radius: 4px;
  padding: .1rem .45rem;
  font-size: .78rem;
}

.interview-card-body {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  margin-bottom: .6rem;
}

.interview-candidate-name {
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--text);
}

.interview-candidate-name:hover { text-decoration: underline; }

.interview-badges { display: flex; gap: .4rem; flex-wrap: wrap; }

.interview-status-badge,
.interview-outcome-badge {
  border-radius: 4px;
  padding: .15rem .5rem;
  font-size: .8rem;
  font-weight: 500;
}

.interview-status-scheduled { background: #dbeafe; color: #1d4ed8; }
.interview-status-done      { background: #dcfce7; color: #15803d; }
.interview-status-cancelled { background: #f3f4f6; color: #6b7280; }
.interview-status-no_show   { background: #fed7aa; color: #c2410c; }

.interview-outcome-1 { background: #dcfce7; color: #15803d; }
.interview-outcome-2 { background: #fef9c3; color: #92400e; }
.interview-outcome-3 { background: #fee2e2; color: #b91c1c; }

.interview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: flex-start;
  margin-top: .5rem;
}

.interview-toggle {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.interview-toggle summary {
  padding: .3rem .7rem;
  cursor: pointer;
  font-size: .85rem;
  user-select: none;
  background: #f9fafb;
}

.interview-toggle[open] summary {
  border-bottom: 1px solid var(--border);
}

.interview-toggle > *:not(summary) {
  padding: .75rem;
}

.interview-edit-form .field-row {
  margin-bottom: .5rem;
}

.interview-edit-form label {
  display: block;
  font-size: .85rem;
  margin-bottom: .2rem;
}

/* Modal dialog */

dialog {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}

dialog::backdrop {
  background: rgba(0,0,0,.4);
}

dialog h3 {
  margin-top: 0;
  margin-bottom: 1rem;
}

/* Candidate detail — interviews section */

.candidate-interview-item {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
}

.candidate-interview-item:last-of-type { border-bottom: none; }

.interview-datetime-compact {
  font-size: .9rem;
  color: var(--text-muted, #555);
  min-width: 9rem;
}

/* btn-danger */
.btn-danger {
  background: #dc2626;
  color: #fff;
  border: none;
}

.btn-danger:hover { background: #b91c1c; }

.btn-success {
  background: #16a34a;
  color: #fff;
  border: none;
}

.btn-success:hover { background: #15803d; }

.info-msg {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: .5rem .8rem;
  font-size: .9rem;
}
