/* Rolefit: minimal, dark by default. Tokens first; components below. */
:root,
:root[data-theme="dark"] {
  --bg: #0e0f11;
  --surface: #16181b;
  --surface-2: #1d2024;
  --border: #2a2d32;
  --text: #e8e9eb;
  --muted: #959aa2;
  --accent: #8b97ff;
  --accent-text: #0e0f11;
  --green: #3fb950;
  --yellow: #d9b310;
  --orange: #e8833a;
  --red: #e5534b;
  --badge-text: #0e0f11;
  --warn-bg: #2b2414;
  --warn-text: #e9c46a;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #f1f1f3;
  --border: #e4e4e7;
  --text: #18181b;
  --muted: #6b6f76;
  --accent: #4f5bd5;
  --accent-text: #ffffff;
  --green: #1f8a3b;
  --yellow: #b08d00;
  --orange: #c4621c;
  --red: #c93c35;
  --badge-text: #ffffff;
  --warn-bg: #fdf4dc;
  --warn-text: #7a5a00;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; }
h3 { font-size: 16px; font-weight: 600; margin: 0; line-height: 1.35; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 64px; }

/* nav */
.nav { border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.nav-inner { display: flex; align-items: center; gap: 16px; height: 52px; }
.brand { font-weight: 650; text-decoration: none; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand-icon { display: block; border-radius: 5px; }
.nav nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav nav a {
  text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 6px; white-space: nowrap; font-size: 14px;
}
.nav nav a:hover { color: var(--text); background: var(--surface-2); }
.nav nav a.active { color: var(--text); background: var(--surface-2); }
.nav .lang-toggle { font-size: 12px; font-weight: 650; letter-spacing: 0.04em; padding-inline: 8px; }
@media (max-width: 560px) {
  .brand-text, .long { display: none; }
  .nav-inner { gap: 4px; }
  .nav nav a { padding: 6px 8px; }
}

/* layout bits */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grow { flex: 1; }
section + section { margin-top: 32px; }

/* buttons & inputs */
button, .btn {
  font: inherit; font-size: 14px; cursor: pointer; border-radius: 7px; padding: 6px 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px;
}
button:hover, .btn:hover { background: var(--surface-2); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 550; }
button.primary:hover { filter: brightness(1.08); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); background: var(--surface-2); }
button.danger:hover { color: var(--red); }
button.on { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, var(--border)); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 550; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.big { font-size: 15px; padding: 9px 18px; min-height: 42px; }
button.danger-solid { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, var(--border)); }
button.danger-solid:hover { background: var(--red); color: var(--badge-text); }

input[type="text"], input[type="url"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 10px; min-height: 34px; max-width: 100%;
}
textarea { width: 100%; min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-weight: 550; font-size: 14px; margin-bottom: 4px; }
.hint { color: var(--muted); font-size: 13px; margin: -2px 0 6px; }
.field + .field { margin-top: 18px; }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 18px; }
.field-row[hidden], .field[hidden] { display: none; }
.field-row .field + .field { margin-top: 0; }
.check.day { min-width: 64px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filters select, .filters input { flex: 1 1 140px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); }
.list > .card + .card, .list > .card + .load-more { margin-top: 10px; }
.card-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; }
.card-meta .company { color: var(--text); font-weight: 550; }
.favicon { width: 16px; height: 16px; border-radius: 3px; flex: none; }
.vacancy-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.vacancy-head .grow { min-width: 0; }
.vacancy-head h3 { margin-top: 4px; overflow-wrap: anywhere; }
.vacancy-head h3 a { text-decoration: none; }
.vacancy-head h3 a:hover { text-decoration: underline; }
.summary { margin-top: 8px; }
.missing { margin-top: 4px; color: var(--muted); font-size: 14px; }
.missing b { color: var(--orange); font-weight: 550; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.card-foot .spacer { flex: 1; }
.desc-text {
  white-space: pre-line; margin-top: 10px; padding: 12px; background: var(--surface-2); border-radius: 8px;
  max-height: 360px; overflow: auto; font-size: 14px;
}

/* score badge */
.badge {
  flex: none; min-width: 38px; height: 38px; border-radius: 9px; display: inline-grid; place-items: center;
  font-weight: 700; font-size: 16px; color: var(--badge-text);
}
.badge.green { background: var(--green); }
.badge.yellow { background: var(--yellow); }
.badge.orange { background: var(--orange); }
.badge.red { background: var(--red); }
.badge.none { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* pills */
.pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.pill.ok { color: var(--green); }
.pill.error { color: var(--red); }
.pill.paused { color: var(--yellow); }
.pill.accent { color: var(--accent); }

/* companies */
.company-row { display: flex; gap: 12px; align-items: flex-start; }
.company-row .grow { min-width: 0; }
.company-row .favicon { margin-top: 3px; }
.error-text { color: var(--red); font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.grid .card { display: flex; flex-direction: column; gap: 6px; }
.grid .card .actions { margin-top: auto; padding-top: 6px; display: flex; gap: 6px; }

/* discovery progress */
.progress { margin-bottom: 16px; display: grid; gap: 10px; }
.search-log { margin: 0; padding-left: 22px; display: grid; gap: 4px; font-size: 14px; }
.search-log li span + span { margin-left: 6px; }

/* banners, status */
.banner { background: var(--warn-bg); color: var(--warn-text); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-bottom: 16px; }
.run-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); border: 1px dashed var(--border); border-radius: 10px; }
.load-more { display: flex; justify-content: center; margin-top: 12px; }

#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; font-size: 14px; display: none; max-width: calc(100% - 32px);
}
#toast.show { display: block; }

/* account menu */
.avatar {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; font-weight: 650;
}
.avatar:hover, .avatar.active { border-color: var(--accent); }

/* auth & narrow pages */
.narrow { max-width: 440px; margin: 24px auto 0; }
.auth-form { margin-top: 16px; }
.auth-form input { width: 100%; }
.form-message { margin-top: 12px; padding: 9px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-text); font-size: 14px; }
.form-message.ok { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--text); }
.form-message-slot:empty { display: none; }
.error-page { text-align: left; margin-top: 48px; }
.error-code { font-size: 13px; font-weight: 650; color: var(--accent); letter-spacing: 0.06em; margin-bottom: 4px; }

/* admin */
.table-wrap { overflow-x: auto; margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 550; color: var(--muted); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: top; }
.table tr:first-child td { border-top: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.muted td { color: var(--muted); }
.actions-cell { text-align: right; min-width: 180px; }
.actions-cell button { min-height: 28px; padding: 3px 8px; font-size: 13px; }
.table td.muted, .table td .muted { white-space: nowrap; }
.copy-row { display: flex; gap: 8px; margin-top: 10px; }
.copy-row input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 13px; }

/* landing */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; padding: 40px 0 24px; }
.hero h1 { font-size: clamp(28px, 4.4vw, 40px); line-height: 1.12; letter-spacing: -0.02em; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 12px; }
.lead { font-size: 17px; color: var(--muted); margin-top: 16px; max-width: 34em; }
.hero-demo { display: grid; gap: 10px; }
.hero-demo .card { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); }
.hero-demo .faded { opacity: 0.55; transform: scale(0.97); transform-origin: top center; }
.landing-section { margin-top: 56px; }
.section-title { font-size: 20px; margin-bottom: 16px; letter-spacing: -0.01em; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.steps .card { display: grid; gap: 6px; align-content: start; }
.step-num {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent);
}
.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 32px; }
.features h3 { margin-bottom: 4px; }
.for-who { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 24px; }
.for-who .section-title { margin-bottom: 8px; font-size: 17px; }
.site-footer { border-top: 1px solid var(--border); padding: 20px 0 32px; }
@media (max-width: 760px) {
  .hero, .for-who { grid-template-columns: 1fr; }
  .hero { padding-top: 16px; gap: 28px; }
  .steps, .features { grid-template-columns: 1fr; }
  .landing-section { margin-top: 40px; }
}
