:root {
  --bg: #0d1117;
  --bg-secondary: #161b22;
  --border: #30363d;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --green: #238636;
  --green-hover: #2ea043;
  --green-bright: #3fb950;
  --red: #f85149;
  --red-bright: #ff7b72;
  --yellow: #d29922;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

header h1 { font-size: 24px; margin-bottom: 4px; }
header .subtitle { color: var(--text-muted); margin-bottom: 20px; }

a { color: var(--accent); }

button {
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button:disabled { color: var(--text-muted); cursor: not-allowed; border-color: var(--border); }
button.primary { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; }
button.success { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
button.success:disabled { background: var(--bg-secondary); border-color: var(--border); color: var(--text-muted); }
button.active { background: var(--accent); border-color: var(--accent); color: #0d1117; font-weight: 600; }

input, select {
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

.hidden { display: none !important; }

/* Toast */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #0d4429; border: 1px solid var(--green-hover); color: var(--green-bright); }
.toast.error { background: #490b0b; border: 1px solid var(--red); color: var(--red-bright); }
.toast.loading { background: #1f2d3d; border: 1px solid var(--accent); color: var(--accent); }

/* Stats */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 10px 16px;
  min-width: 100px;
}
.stat-card .stat-value { font-size: 22px; font-weight: 700; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); }
.stat-card.stat-total { border-left-color: var(--text); }
.stat-card.stat-to-apply { border-left-color: var(--text-muted); }
.stat-card.stat-application-submitted { border-left-color: var(--accent); }
.stat-card.stat-interview { border-left-color: var(--yellow); }
.stat-card.stat-offer,
.stat-card.stat-accepted { border-left-color: var(--green-bright); }
.stat-card.stat-rejected,
.stat-card.stat-withdrawn { border-left-color: var(--red); }

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.view-toggle, .filters, .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type="search"] { min-width: 200px; }

/* Table */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; min-width: 1100px; }
thead th {
  text-align: left;
  padding: 10px 8px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: var(--accent); }
thead th.sorted::after { content: ' ' attr(data-dir); color: var(--accent); }
tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
tbody tr:hover { background: rgba(110, 118, 129, 0.07); }
.col-number { font-weight: 600; color: var(--text-muted); white-space: nowrap; }

.cell-input { width: 100%; min-width: 90px; padding: 5px 6px; font-size: 12px; }
.notes-input { min-width: 140px; }
.date-cell { display: flex; gap: 4px; align-items: center; }
.date-input { width: 90px; }
.btn-today { padding: 4px 6px; font-size: 12px; line-height: 1; }

.links { display: flex; flex-direction: column; gap: 2px; min-width: 110px; }
.links a { font-size: 12px; white-space: nowrap; }
.extra-links { display: flex; flex-direction: column; gap: 2px; }

/* Kanban */
.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-col {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 240px;
  max-width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.kanban-col h3 {
  font-size: 13px;
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kanban-col h3 .count {
  background: var(--bg);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 11px;
  color: var(--text-muted);
}
.kanban-cards {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
  flex: 1;
}
.kanban-cards.dragover { background: rgba(88, 166, 255, 0.08); }
.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: grab;
  font-size: 13px;
}
.kanban-card.dragging { opacity: 0.4; }
.kanban-card .card-title { font-weight: 600; }
.kanban-card .card-sub { color: var(--text-muted); font-size: 12px; margin: 2px 0; }
.kanban-card .card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.kanban-card .card-applied { font-size: 11px; color: var(--green-bright); margin-top: 4px; }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  border: 1px solid var(--border);
}
.badge.priority-high { color: var(--red-bright); border-color: var(--red); }
.badge.priority-medium { color: var(--yellow); border-color: var(--yellow); }
.badge.priority-low { color: var(--text-muted); }

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(1, 4, 9, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  padding: 16px;
}
.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  max-width: 540px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
}
.modal-content h2 { margin-top: 0; }
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
}

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--text-muted);
  padding: 8px 14px;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.form-grid input, .form-grid select { width: 100%; }

.status {
  padding: 12px;
  margin-top: 12px;
  border-radius: 6px;
  display: none;
  font-size: 13px;
}
.status.success { background: #0d4429; border: 1px solid var(--green-hover); color: var(--green-bright); display: block; }
.status.error { background: #490b0b; border: 1px solid var(--red); color: var(--red-bright); display: block; }
.status.loading { background: #1f2d3d; border: 1px solid var(--accent); color: var(--accent); display: block; }

.help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
  padding: 12px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.help h3 { font-size: 13px; margin-top: 0; color: var(--text); }
.help a { color: var(--accent); }

.field-row { margin-bottom: 12px; }
.field-row label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.field-row input { width: 100%; }

@media (max-width: 700px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .filters input[type="search"] { min-width: 0; flex: 1; }
}
