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

:root {
  --bg: #ffffff;
  --surface: #f7f7f7;
  --border: #e0e0e0;
  --border-dark: #111111;
  --text: #111111;
  --muted: #888888;
  --tag-bg: #f0f0f0;
  --urgent: #cc0000;
  --soon: #cc6600;
  --new: #006600;
  --font: -apple-system, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}


/* ── BODY ── */

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  min-height: 100vh;
}


/* ── HEADER ── */

.header {
  border-bottom: 2px solid var(--text);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-logo {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.header-sub {
  font-size: 12px;
  color: var(--muted);
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}


/* ── BUTTONS ── */

.btn {
  padding: 6px 14px;
  border: 1px solid var(--text);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  border-radius: 2px;
}

.btn:hover {
  background: var(--text);
  color: #fff;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-solid {
  background: var(--text);
  color: #fff;
}

.btn-solid:hover {
  background: #444;
}

.btn-ghost {
  border-color: var(--border);
  color: var(--muted);
}

.btn-ghost:hover {
  border-color: var(--text);
  color: var(--text);
  background: transparent;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

.btn-urgent {
  border-color: var(--urgent);
  color: var(--urgent);
}

.btn-urgent:hover {
  background: var(--urgent);
  color: #fff;
}


/* ── SEARCH BAR ── */

.search-bar {
  border-bottom: 1px solid var(--border);
  padding: 12px 32px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: var(--surface);
  flex-wrap: wrap;
}

.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.search-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  padding-top: 6px;
}

.category-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.chip {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  cursor: pointer;
  background: #fff;
  color: var(--muted);
  transition: all 0.1s;
  font-family: var(--font);
}

.chip:hover {
  border-color: var(--text);
  color: var(--text);
}

.chip.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.search-input {
  border: 1px solid var(--border);
  background: #fff;
  padding: 5px 10px;
  font-family: var(--font);
  font-size: 12px;
  color: var(--text);
  outline: none;
  border-radius: 2px;
}

.search-input:focus {
  border-color: var(--text);
}

.search-input::placeholder {
  color: #bbb;
}

.search-input-city {
  width: 120px;
}

.search-input-free {
  width: 180px;
}

select.search-input {
  cursor: pointer;
  width: 120px;
}


/* ── MAIN ── */

.main {
  padding: 0 32px;
}


/* ── SECTIONS ── */

.section {
  border-bottom: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 10px;
  cursor: pointer;
  user-select: none;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.section-count {
  font-size: 11px;
  color: var(--muted);
}

.section-toggle {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}


/* ── TABLE ── */

.table-header {
  display: grid;
  grid-template-columns: 1.8fr 0.9fr 0.7fr 0.9fr 0.8fr 40px auto;
  padding: 5px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.th {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 6px;
}

.th:first-child {
  padding-left: 0;
}


/* ── JOB ROW ── */

.job-row {
  display: grid;
  grid-template-columns: 1.8fr 0.9fr 0.7fr 0.9fr 0.8fr 40px auto;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 0.1s;
}

.job-row:hover {
  background: var(--surface);
  margin: 0 -32px;
  padding: 10px 32px;
}

.job-cell {
  padding: 0 6px;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-cell:first-child {
  padding-left: 0;
}

.job-title-text {
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.job-title-text:hover {
  text-decoration: underline;
}

.job-company-link {
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
  text-decoration: none;
}

.job-company-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 10px;
  letter-spacing: 0.3px;
  background: var(--tag-bg);
  color: var(--muted);
}

.tag-urgent {
  background: #fff0f0;
  color: var(--urgent);
  border: 1px solid #ffcccc;
  font-weight: 600;
}

.tag-soon {
  background: #fff8f0;
  color: var(--soon);
  border: 1px solid #ffd9b3;
}

.tag-followup {
  background: #fff8e0;
  color: #996600;
  border: 1px solid #ffe099;
}

.tag-new {
  background: #f0fff4;
  color: var(--new);
  border: 1px solid #b3f0c8;
}

.job-actions-cell {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0;
}


/* ── PIPELINE BUTTONS ── */

.pipeline-btn {
  padding: 3px 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 10px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.1s;
  white-space: nowrap;
}

.pipeline-btn:hover {
  border-color: var(--text);
  color: var(--text);
}


/* ── UTILITIES ── */

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-row {
  padding: 20px 0;
  color: var(--muted);
  font-size: 12px;
}


/* ── MODAL ── */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: #fff;
  border: 1px solid var(--text);
  border-radius: 2px;
  padding: 28px;
  width: 580px;
  max-width: 95vw;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-sm {
  width: 480px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.2;
}

.modal-company {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.modal-company a {
  color: var(--text);
  text-decoration: none;
}

.modal-company a:hover {
  text-decoration: underline;
}

.modal-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-meta-item {
  font-size: 12px;
  color: var(--muted);
}

.modal-meta-item strong {
  color: var(--text);
  display: block;
  font-size: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.modal-description {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 20px;
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 8px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  border: 1px solid var(--border);
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  outline: none;
  border-radius: 2px;
  background: #fff;
}

.form-input:focus {
  border-color: var(--text);
}

.form-input::placeholder {
  color: #bbb;
}

textarea.form-input {
  min-height: 70px;
  resize: vertical;
}

select.form-input {
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}


/* ── TOASTS ── */

.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 200;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  font-size: 12px;
  border-radius: 2px;
  animation: fadeUp 0.2s ease;
  max-width: 300px;
}

.toast.error {
  background: #c00;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ── MOBILE ── */

@media (max-width: 768px) {
  .header,
  .search-bar,
  .main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .table-header {
    display: none;
  }

  .job-row {
    display: block;
    padding: 14px 0;
    margin: 0 !important;
  }

  .job-row:hover {
    background: transparent;
    padding: 14px 0;
  }

  .job-cell {
    display: block;
    padding: 0;
    white-space: normal;
    overflow: visible;
  }

  .job-cell + .job-cell {
    margin-top: 4px;
  }

  .job-actions-cell {
    margin-top: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}