:root {
  --bg: #f3f1ec;
  --panel: #ffffff;
  --ink: #1c2430;
  --muted: #667085;
  --line: #e6e2d9;
  --brand: #3d4f7c;
  --brand-soft: #e8ecf6;
  --accent: #0f7a5a;
  --accent-soft: #e5f5ef;
  --warn: #9a6700;
  --warn-soft: #fff4d6;
}

body {
  background:
    radial-gradient(circle at top left, rgba(61, 79, 124, 0.08), transparent 32%),
    linear-gradient(180deg, #f7f5f1 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

.navbar {
  background: #182033 !important;
  box-shadow: 0 8px 24px rgba(24, 32, 51, 0.18);
}
.navbar .navbar-nav {
  align-items: center;
}
.navbar .nav-link {
  display: inline-flex;
  align-items: center;
  padding-top: .45rem;
  padding-bottom: .45rem;
  line-height: 1.25;
}
.nav-logout-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
}
.nav-logout {
  line-height: 1.25;
  padding: .28rem .65rem;
  position: relative;
  top: 1px;
}

.page-title {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.page-title.compact {
  font-size: 1.35rem;
  margin: 0;
}

.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}

.search-bar {
  min-width: min(100%, 420px);
}
.search-bar.compact {
  min-width: min(100%, 280px);
}

.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-brand:hover {
  background: #2f3d63;
  border-color: #2f3d63;
  color: #fff;
}

.job-feed {
  display: grid;
  gap: 1rem;
}
.job-feed.compact {
  gap: .45rem;
}

/* Wide jobs board: fill the viewport with 3–4 cards */
.jobs-shell {
  max-width: 1680px;
  margin-inline: auto;
  padding-inline: clamp(.85rem, 2vw, 1.75rem);
}
.job-feed.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .75rem;
  align-items: stretch;
}
@media (min-width: 700px) {
  .job-feed.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1100px) {
  .job-feed.grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.job-tile {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  height: 100%;
  overflow: hidden;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.job-tile:hover {
  border-color: #cfc8b8;
  box-shadow: 0 8px 22px rgba(28, 36, 48, 0.08);
  transform: translateY(-1px);
}
.job-tile-link {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: .8rem .9rem 0;
  color: inherit;
  text-decoration: none;
  min-height: 0;
}
.job-tile-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin-bottom: .35rem;
}
.query-badge {
  display: inline-flex;
  align-items: center;
  max-width: 70%;
  padding: .22rem .55rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #b8e0d0;
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.query-badge-empty {
  background: #f0eee8;
  color: var(--muted);
  border-color: var(--line);
  font-weight: 600;
}
.job-tile-source {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--brand);
  opacity: .85;
  margin-bottom: .2rem;
}
.job-tile-title {
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 .35rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.job-tile-snippet {
  flex: 1 1 auto;
  margin: 0 0 .55rem;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.job-tile-foot {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: nowrap;
  padding: .55rem .9rem .75rem;
  margin-top: auto;
}
.job-tile-foot .job-budget {
  flex: 0 1 auto;
  width: max-content;
  max-width: calc(100% - 7.5rem);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.job-tile-foot .job-competition {
  flex: 0 0 auto;
  margin-left: auto;
  white-space: nowrap;
}
.job-tile-del {
  flex: 0 0 auto;
  margin: 0;
}
.job-del-btn {
  appearance: none;
  border: 1px solid #f1c4c4;
  background: #fff5f5;
  color: #b42318;
  font-size: .72rem;
  font-weight: 650;
  line-height: 1;
  padding: .28rem .5rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.job-del-btn:hover {
  background: #fee2e2;
  border-color: #e8a0a0;
}

.job-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.job-row:hover {
  border-color: #cfc8b8;
  box-shadow: 0 6px 18px rgba(28, 36, 48, 0.06);
}
.job-row-link {
  display: block;
  padding: .7rem .9rem .65rem;
  color: inherit;
  text-decoration: none;
}
.job-row-origin {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .28rem;
  font-size: .78rem;
}
.job-origin-group {
  color: var(--muted);
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.origin-source {
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
  color: var(--brand);
  font-size: .7rem;
}
.origin-sep { opacity: .45; margin: 0 .15rem; }
.origin-query {
  font-weight: 600;
  color: var(--ink);
}
.job-row-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.3;
}
.job-row-snippet {
  margin: .35rem 0 .45rem;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.job-row-signals {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.job-competition {
  font-size: .78rem;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
}
.job-competition.is-hot {
  color: #9a3b2f;
}
.comp-sep { opacity: .4; margin: 0 .2rem; }
.job-row-busy {
  border-color: #ebd4cf;
  background: #fffbfa;
}
.job-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
  align-items: center;
  font-size: .76rem;
  color: var(--muted);
}
.query-filter {
  min-width: 9.5rem;
  max-width: 12rem;
}

.job-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(28, 36, 48, 0.04);
  transition: transform .15s ease, box-shadow .15s ease;
}
.job-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(28, 36, 48, 0.08);
}
.job-card-link {
  display: block;
  padding: 1.15rem 1.25rem 1.05rem;
  color: inherit;
  text-decoration: none;
}
.job-card-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: .55rem;
}
.job-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.job-budget {
  flex: 0 0 auto;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #f0dfaa;
  border-radius: 999px;
  padding: .35rem .75rem;
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
}
.job-budget.compact {
  padding: .18rem .5rem;
  font-size: .72rem;
}
.job-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 .55rem;
  line-height: 1.35;
}
.job-snippet {
  color: var(--muted);
  margin: 0 0 .85rem;
  line-height: 1.55;
  font-size: .95rem;
}
.job-skills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .9rem;
}
.skill-chip {
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: .22rem .65rem;
  font-size: .78rem;
  font-weight: 600;
}
.skill-chip.compact {
  padding: .1rem .45rem;
  font-size: .7rem;
}
.skill-more {
  background: #f0eee8;
  color: var(--muted);
}
.job-card-foot {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: .84rem;
  border-top: 1px solid var(--line);
  padding-top: .75rem;
}
.foot-date { opacity: .85; }

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .2rem .55rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  background: #f0eee8;
  color: var(--muted);
}
.pill-source {
  background: var(--brand-soft);
  color: var(--brand);
}
.pill-query {
  background: var(--accent-soft);
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
}
.meta-pub {
  color: var(--brand);
  font-weight: 700;
  font-size: .78rem;
}

.detail-hero {
  display: grid;
  grid-template-columns: 1.6fr .7fr;
  gap: 1.25rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.4rem;
  box-shadow: 0 12px 32px rgba(28, 36, 48, 0.05);
}
.detail-title {
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  margin: 0 0 .5rem;
  line-height: 1.25;
}
.detail-sub {
  color: var(--muted);
  font-size: .95rem;
}
.budget-panel {
  background: linear-gradient(180deg, #fffaf0, #fff4d6);
  border: 1px solid #f0dfaa;
  border-radius: 16px;
  padding: 1rem 1.1rem;
  margin-bottom: .75rem;
}
.budget-panel-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--warn);
  font-weight: 700;
  margin-bottom: .2rem;
}
.budget-panel-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: #7a5200;
  line-height: 1.3;
}
.panel-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 10px 28px rgba(28, 36, 48, 0.04);
}
.section-title {
  font-size: 1rem;
  font-weight: 750;
  margin-bottom: .85rem;
}
.desc-box {
  white-space: pre-wrap;
  line-height: 1.7;
  color: #2a3340;
  word-break: break-word;
}
.detail-dl {
  margin: 0;
  display: grid;
  gap: .7rem;
}
.detail-dl > div {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: .5rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid var(--line);
}
.detail-dl dt {
  color: var(--muted);
  font-weight: 600;
  font-size: .86rem;
}
.detail-dl dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  font-size: .9rem;
}
.back-link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}
.back-link:hover { text-decoration: underline; }

.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 1rem;
}

.notif-account {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .75rem 1rem;
}
.notif-email {
  font-weight: 650;
  color: var(--ink);
  word-break: break-all;
}

.notif-feed {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.notif-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
}
.notif-card.is-unread {
  border-color: color-mix(in srgb, var(--brand, #0284c7) 45%, var(--line));
  background: color-mix(in srgb, var(--brand, #0284c7) 6%, #fff);
}
.notif-card-main {
  min-width: 0;
  flex: 1;
}
.notif-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
  margin-bottom: .4rem;
  align-items: center;
}
.notif-alert-badge,
.notif-source,
.notif-query,
.notif-remote,
.notif-country {
  font-size: .72rem;
  font-weight: 650;
  line-height: 1.2;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
}
.notif-alert-badge {
  background: #0f172a;
  color: #f8fafc;
}
.notif-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 .35rem;
  color: var(--ink);
}
.notif-card-snippet {
  margin: 0 0 .55rem;
  font-size: .9rem;
  line-height: 1.45;
  color: #475569;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.notif-card-dates {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .5rem;
  font-size: .82rem;
  color: #64748b;
  margin-bottom: .45rem;
}
.notif-date-label {
  font-weight: 650;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: .68rem;
  margin-right: .2rem;
}
.notif-date-abs {
  color: #94a3b8;
  font-size: .78rem;
}
.notif-card-signals {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .75rem;
  align-items: center;
  font-size: .88rem;
}
.notif-budget {
  font-weight: 700;
  color: var(--ink);
}
.notif-comp {
  color: #64748b;
}
.notif-comp.is-hot,
.notif-card.is-hot .notif-comp {
  color: #b45309;
  font-weight: 650;
}
.notif-card-actions {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  flex-shrink: 0;
}
@media (max-width: 700px) {
  .notif-card {
    flex-direction: column;
  }
  .notif-card-actions {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
  }
}

@media (max-width: 900px) {
  .detail-hero {
    grid-template-columns: 1fr;
  }
  .job-card-top {
    flex-direction: column;
  }
  .job-row-origin {
    flex-direction: column;
    align-items: flex-start;
    gap: .15rem;
  }
  .job-origin-group {
    text-align: left;
  }
  .job-row-signals {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Panel de estado de scrape (admin) */
.changeset-panel {
  background: #fff;
  border: 1px solid #c9c9c9;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}
.changeset-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .9rem 1.1rem;
  background: linear-gradient(180deg, #f3f3f3 0%, #e8e8e8 100%);
  border-bottom: 1px solid #c9c9c9;
}
.changeset-kicker {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #706e6b;
}
.changeset-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: .1rem 0 .15rem;
  color: #080707;
}
.changeset-sub {
  font-size: .8rem;
  color: #706e6b;
}
.changeset-actions {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.cs-badge {
  display: inline-flex;
  align-items: center;
  padding: .28rem .65rem;
  border-radius: 3px;
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .03em;
  text-transform: uppercase;
  background: #e5e5e5;
  color: #3e3e3c;
  border: 1px solid #c9c9c9;
}
.cs-badge[data-status="running"] {
  background: #fe9339;
  border-color: #dd7a01;
  color: #fff;
}
.cs-badge[data-status="success"] {
  background: #2e844a;
  border-color: #236b3a;
  color: #fff;
}
.cs-badge[data-status="error"] {
  background: #ba0517;
  border-color: #8e030f;
  color: #fff;
}
.cs-badge[data-status="idle"] {
  background: #ecebea;
  color: #3e3e3c;
}
.changeset-body {
  padding: 1rem 1.1rem 1.15rem;
}
.cs-progress-wrap {
  margin-bottom: 1rem;
  padding: .75rem .85rem;
  background: #fafaf9;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
}
.cs-progress-label {
  font-size: .86rem;
  font-weight: 600;
  color: #181818;
}
.cs-progress-pct {
  font-size: .9rem;
  font-weight: 750;
  color: #0176d3;
  font-variant-numeric: tabular-nums;
}
.cs-progress-bar {
  height: 10px;
  background: #e5e5e5;
  border-radius: 999px;
  overflow: hidden;
}
.cs-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0176d3, #1b96ff);
  border-radius: 999px;
  transition: width .35s ease;
}
.cs-meta {
  margin-top: .45rem;
  font-size: .75rem;
  color: #706e6b;
}
.cs-section-title {
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #706e6b;
  margin: 0 0 .45rem;
}
.cs-table {
  font-size: .84rem;
  border: 1px solid #e5e5e5;
}
.cs-table thead th {
  background: #f3f3f3;
  border-bottom: 1px solid #c9c9c9;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #514f4d;
  font-weight: 700;
}
.cs-pill {
  display: inline-block;
  padding: .12rem .45rem;
  border-radius: 3px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  background: #ecebea;
  color: #3e3e3c;
}
.cs-pill-pending { background: #ecebea; color: #706e6b; }
.cs-pill-running { background: #fef3e5; color: #8c4b02; }
.cs-pill-done, .cs-pill-success { background: #cdefc4; color: #2e844a; }
.cs-pill-error { background: #fddde3; color: #ba0517; }
.cs-pill-idle { background: #ecebea; color: #706e6b; }
.cs-pill-skipped { background: #eef4ff; color: #0176d3; }

.cs-steps {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  background: #fafaf9;
  max-height: 22rem;
  overflow: auto;
}
.cs-step {
  display: grid;
  grid-template-columns: 1.1rem 1fr auto;
  gap: .65rem;
  align-items: start;
  padding: .55rem .75rem;
  border-bottom: 1px solid #ecebea;
}
.cs-step:last-child { border-bottom: 0; }
.cs-step-marker {
  width: .7rem;
  height: .7rem;
  margin-top: .35rem;
  border-radius: 50%;
  border: 2px solid #c9c9c9;
  background: #fff;
  justify-self: center;
}
.cs-step-running .cs-step-marker {
  border-color: #fe9339;
  background: #fe9339;
  box-shadow: 0 0 0 3px rgba(254, 147, 57, 0.25);
}
.cs-step-done .cs-step-marker {
  border-color: #2e844a;
  background: #2e844a;
}
.cs-step-error .cs-step-marker {
  border-color: #ba0517;
  background: #ba0517;
}
.cs-step-skipped .cs-step-marker {
  border-color: #0176d3;
  background: #0176d3;
}
.cs-step-running {
  background: #fff8f0;
}
.cs-step-label {
  font-size: .86rem;
  font-weight: 650;
  color: #181818;
  line-height: 1.3;
}
.cs-step-detail {
  font-size: .76rem;
  color: #706e6b;
  margin-top: .1rem;
}
.cs-step-timing {
  font-size: .72rem;
  color: #0176d3;
  font-weight: 600;
  margin-top: .15rem;
  font-variant-numeric: tabular-nums;
}
.cs-step-pending .cs-step-label { color: #706e6b; font-weight: 550; }
.cs-step-pending .cs-step-timing { color: #706e6b; font-weight: 500; }
.cs-step-done .cs-step-timing { color: #2e844a; }

/* Admin tabs */
.admin-tabs .nav-link {
  color: #5c5c5c;
  font-weight: 600;
  font-size: .9rem;
}
.admin-tabs .nav-link.active {
  color: #181818;
  border-bottom-color: #fff;
}
.admin-tabs .badge {
  font-weight: 650;
  vertical-align: middle;
}
.admin-errors-table .error-msg-cell {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-error-trace {
  margin: 0;
  padding: .85rem 1rem;
  font-size: .72rem;
  line-height: 1.4;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 22rem;
  overflow: auto;
}
