/* ==========================================================================
   TrhPráce Agent — design system
   Směr: statistický zpravodaj. Indigová konstrukce, zlatá = peníze/mzda.
   Fraunces (serif, charakter) · Inter (text) · IBM Plex Mono (čísla/štítky).
   ========================================================================== */

:root {
  --ink: #14172B;
  --ink-2: #464B67;
  --ink-soft: #737a95;
  --paper: #ECEEF3;
  --surface: #FFFFFF;
  --surface-2: #F7F8FB;
  --line: #E1E4EC;
  --line-strong: #CDD2DE;

  --brand: #171B3C;         /* sidebar */
  --accent: #3B4CCA;        /* indigo — interaktivní */
  --accent-600: #2E3BA6;
  --accent-weak: #E9EBFB;
  --gold: #B77F27;          /* peníze / mzda */
  --gold-ink: #8A5E12;
  --gold-weak: #F7EDD9;
  --pos: #2E7D5B;
  --neg: #C24338;

  --r: 16px;
  --r-sm: 10px;
  --r-xs: 7px;
  --shadow: 0 1px 2px rgba(20,23,43,.04), 0 6px 20px -12px rgba(20,23,43,.14);
  --shadow-lg: 0 12px 40px -16px rgba(20,23,43,.28);

  --sidebar-w: 250px;
  --content-max: 1780px;

  --font-display: "Fraunces", Georgia, serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "cv05" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- App shell : sidebar + content --------------------------------- */
.shell { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--brand);
  color: #C9CCE6;
  display: flex; flex-direction: column;
  padding: 22px 18px;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 30px; padding: 0 6px; }
.brand__mark {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: linear-gradient(150deg, #4a5ad6, #8b96f2);
  color: #fff; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 19px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.brand__name { color: #fff; font-weight: 600; font-size: 17px; letter-spacing: -0.02em; line-height: 1.1; }
.brand__name small { display: block; font-weight: 400; font-size: 11px; color: #8f95c0; letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: #B7BBDA; font-size: 14px; font-weight: 500;
  transition: background .14s, color .14s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.is-active { background: rgba(255,255,255,.10); color: #fff; }
.nav a svg { width: 17px; height: 17px; opacity: .85; flex: none; }
.nav__section { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: #71769c; padding: 16px 12px 6px; }

.sidebar__spacer { flex: 1; }
.freshness { border-top: 1px solid rgba(255,255,255,.09); padding-top: 14px; margin-top: 14px; font-size: 11.5px; color: #8b90b8; }
.freshness__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.freshness__head b { color: #aeb2d6; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; }
.freshness__btn { background: rgba(255,255,255,.08); color: #cfd2ee; border: none; width: 24px; height: 24px; border-radius: 7px; font-size: 14px; line-height: 1; display: grid; place-items: center; transition: background .14s; }
.freshness__btn:hover { background: rgba(255,255,255,.18); }
.freshness__btn:disabled { opacity: .6; cursor: default; }
.freshness__btn.is-busy { animation: spin 1s linear infinite; }
.fresh-row { display: flex; justify-content: space-between; gap: 8px; padding: 2.5px 0; align-items: center; }
.fresh-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fresh-time { color: #6f74a0; font-family: var(--font-mono); }
.fresh-x { color: #e08a82; font-weight: 700; }
.freshness__note { color: #8f95c0; margin-top: 6px; min-height: 14px; font-style: italic; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.22); border-top-color: #cfd2ee; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.userbox { border-top: 1px solid rgba(255,255,255,.09); padding-top: 14px; margin-top: 14px; display: flex; align-items: center; gap: 10px; }
.userbox__avatar { width: 30px; height: 30px; border-radius: 50%; background: #2b2f56; color: #cfd2ee; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.userbox__name { font-size: 13px; color: #cdd0ea; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox button { background: none; border: none; color: #8f95c0; font-size: 12px; padding: 4px; }
.userbox button:hover { color: #fff; }

.content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.content__inner { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 32px 40px 64px; flex: 1; }
@media (min-width: 1500px) { .content__inner { padding: 36px 52px 72px; } }

/* Pracovní plocha: hlavní obsah + boční panel, na širokých obrazovkách vedle sebe */
.work-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1120px) { .work-grid { grid-template-columns: 1fr; } }
.rail { display: flex; flex-direction: column; gap: 18px; }

.appfoot { border-top: 1px solid var(--line); background: var(--surface); padding: 14px 34px; font-size: 12px; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 4px 20px; justify-content: space-between; margin-left: var(--sidebar-w); }

/* ---------- Page header --------------------------------------------------- */
.eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--accent-600); font-weight: 500; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px 24px; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; }
.page-title { font-family: var(--font-display); font-size: 33px; line-height: 1.05; font-weight: 500; letter-spacing: -0.02em; margin-top: 5px; color: var(--ink); }
.page-sub { color: var(--ink-2); font-size: 14.5px; margin-top: 8px; max-width: 60ch; }

/* ---------- Cards --------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card--pad { padding: 22px 24px; }
.card__title { font-weight: 600; font-size: 16px; color: var(--ink); }
.card__hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }

.grid { display: grid; gap: 18px; }
.grid--kpi { grid-template-columns: repeat(4, 1fr); }
.grid--charts { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid--kpi { grid-template-columns: repeat(2, 1fr); } .grid--charts { grid-template-columns: 1fr; } }

/* ---------- Hero pulse ---------------------------------------------------- */
.pulse { display: grid; grid-template-columns: 1.1fr 1fr; gap: 8px 40px; align-items: center;
  background: linear-gradient(120deg, #171B3C, #26305f);
  color: #fff; border-radius: var(--r); padding: 26px 30px; box-shadow: var(--shadow-lg); overflow: hidden; position: relative; }
.pulse::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(183,127,39,.28), transparent 70%); }
.pulse__big { font-family: var(--font-display); font-size: 52px; line-height: 1; font-weight: 500; letter-spacing: -0.02em; }
.pulse__big small { font-size: 22px; color: #c8ccea; font-weight: 400; }
.pulse__label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #a9aed6; margin-bottom: 8px; }
.pulse__meta { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 20px; }
.pulse__stat { }
.pulse__stat b { display: block; font-family: var(--font-mono); font-size: 21px; font-weight: 500; }
.pulse__stat span { font-size: 12px; color: #a9aed6; }
@media (max-width: 760px) { .pulse { grid-template-columns: 1fr; } .pulse__big { font-size: 40px; } }

/* ---------- KPI stat card ------------------------------------------------- */
.stat { padding: 18px 20px; }
.stat__label { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 5px; }
.stat__value { font-family: var(--font-display); font-size: 28px; font-weight: 500; letter-spacing: -0.01em; margin-top: 6px; color: var(--ink); }
.stat__value.mono { font-family: var(--font-mono); font-size: 25px; }
.stat__foot { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
.stat__foot a { color: var(--accent-600); font-weight: 500; }
.stat__foot a:hover { text-decoration: underline; }

/* ---------- Salary band (signature) --------------------------------------- */
.band-table { width: 100%; font-size: 14px; }
.band-table thead th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); font-weight: 500; padding: 0 12px 10px; border-bottom: 1px solid var(--line); }
.band-table thead th.r { text-align: right; }
.band-table tbody td { padding: 11px 12px; border-bottom: 1px solid var(--surface-2); vertical-align: middle; }
.band-table tbody tr:hover { background: var(--surface-2); }
.band-table .grp { font-weight: 500; color: var(--ink); line-height: 1.25; }
.band-table .r { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.band-table .n { color: var(--ink-soft); }
.band-table .med { font-weight: 600; color: var(--ink); }
.band-table .ispv { color: var(--gold-ink); }

.band { position: relative; height: 16px; min-width: 180px; }
.band__track { position: absolute; inset: 6px 0; background: var(--surface-2); border-radius: 99px; box-shadow: inset 0 0 0 1px var(--line); }
.band__d { position: absolute; inset: 5px auto; height: 6px; border-radius: 99px; background: var(--accent-weak); }
.band__q { position: absolute; inset: 3px auto; height: 10px; border-radius: 99px; background: linear-gradient(90deg, #7f8ce6, #4a5ad6); box-shadow: 0 1px 3px rgba(59,76,202,.35); }
.band__med { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); border-radius: 2px; }
.band__ispv { position: absolute; top: 3px; width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); box-shadow: 0 0 0 2px var(--surface); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); margin-top: 14px; }
.legend i { display: inline-block; vertical-align: middle; margin-right: 5px; }
.legend .k-d { width: 14px; height: 7px; border-radius: 99px; background: var(--accent-weak); }
.legend .k-q { width: 14px; height: 9px; border-radius: 99px; background: #4a5ad6; }
.legend .k-m { width: 2px; height: 12px; background: var(--ink); }
.legend .k-i { width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); }

/* ---------- Chips / tags -------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.chip--accent { background: var(--accent-weak); color: var(--accent-600); border-color: transparent; }
.chip--gold { background: var(--gold-weak); color: var(--gold-ink); border-color: transparent; }

/* ---------- Salary tag ---------------------------------------------------- */
.pay { display: inline-block; background: var(--gold-weak); color: var(--gold-ink); font-family: var(--font-mono); font-weight: 500; font-size: 14px; padding: 4px 10px; border-radius: var(--r-xs); }
.pay--none { background: none; color: var(--ink-soft); font-family: var(--font-sans); font-style: italic; font-size: 13px; padding: 0; }

/* ---------- Buttons ------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 500; padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); transition: border-color .14s, background .14s, transform .05s; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-600); border-color: var(--accent-600); }
.btn--ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn--sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Forms --------------------------------------------------------- */
.field label { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-soft); margin-bottom: 4px; }
.input, .select { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 8px 11px; font-size: 14px; font-family: inherit; background: var(--surface); color: var(--ink); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%237a7f9c' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 28px; }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--ink-2); }
.check input { width: 15px; height: 15px; accent-color: var(--accent); }

.filterbar { padding: 18px 20px; }
.filterbar__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 820px) { .filterbar__grid { grid-template-columns: repeat(2, 1fr); } }
.filterbar__foot { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- Job cards ----------------------------------------------------- */
.joblist { display: grid; grid-template-columns: repeat(auto-fill, minmax(470px, 1fr)); gap: 12px; }
@media (max-width: 560px) { .joblist { grid-template-columns: 1fr; } }
.job { padding: 16px 20px; display: flex; gap: 18px; justify-content: space-between; transition: border-color .14s, transform .06s; }
.job:hover { border-color: var(--accent); }
.job__title { font-weight: 600; font-size: 15.5px; color: var(--ink); line-height: 1.3; }
.job__title a:hover { color: var(--accent-600); }
.job__meta { color: var(--ink-soft); font-size: 13px; margin-top: 3px; }
.job__right { text-align: right; flex: none; }
.job__src { font-size: 12px; margin-top: 8px; }
.job__src a { color: var(--accent-600); }
.job__src a:hover { text-decoration: underline; }

/* ---------- Badges (verification) ----------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; padding: 4px 11px; border-radius: 99px; }
.badge--verified { background: #E5F3EC; color: #256B4B; }
.badge--auto { background: var(--accent-weak); color: var(--accent-600); }
.badge--pending { background: var(--gold-weak); color: var(--gold-ink); }
.badge--rejected { background: #F7E4E2; color: var(--neg); }

/* ---------- Detail -------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: 1.9fr 1fr; gap: 18px; }
@media (max-width: 880px) { .detail-grid { grid-template-columns: 1fr; } }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
@media (max-width: 560px) { .dl { grid-template-columns: 1fr; } }
.dl dt { font-size: 11.5px; color: var(--ink-soft); margin-bottom: 2px; }
.dl dd { margin: 0; font-size: 14.5px; color: var(--ink); }
.money-hero { font-family: var(--font-display); font-size: 40px; font-weight: 500; letter-spacing: -0.02em; color: var(--ink); line-height: 1; }
.compare { font-size: 14px; padding: 10px 14px; border-radius: var(--r-sm); margin-top: 14px; }
.compare--up { background: #E5F3EC; color: #256B4B; }
.compare--down { background: #FBEEE8; color: #9a4a1e; }
.compare--flat { background: var(--surface-2); color: var(--ink-2); }

/* ---------- Empty state --------------------------------------------------- */
.empty { text-align: center; padding: 54px 24px; }
.empty h3 { font-family: var(--font-display); font-size: 21px; font-weight: 500; margin-bottom: 6px; }
.empty p { color: var(--ink-soft); font-size: 14px; }

/* ---------- Explainer / details ------------------------------------------ */
.explain summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.explain summary::before { content: "＋"; font-family: var(--font-mono); color: var(--accent); }
.explain[open] summary::before { content: "－"; }
.explain > div { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }

/* ---------- Pagination ---------------------------------------------------- */
.pager { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 26px; font-size: 14px; }
.pager .muted { color: var(--ink-soft); }

/* ---------- Section spacing ----------------------------------------------- */
.stack > * + * { margin-top: 18px; }
.mb-6 { margin-bottom: 24px; }
.help { border-bottom: 1px dotted var(--line-strong); cursor: help; }

/* ---------- Reveal on load ------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(8px); animation: rise .5s cubic-bezier(.2,.7,.3,1) forwards; }
  .reveal:nth-child(2) { animation-delay: .05s; }
  .reveal:nth-child(3) { animation-delay: .1s; }
  .reveal:nth-child(4) { animation-delay: .15s; }
  @keyframes rise { to { opacity: 1; transform: none; } }
}

/* ---------- Mobile sidebar ------------------------------------------------ */
@media (max-width: 720px) {
  .sidebar { position: static; width: auto; flex-direction: row; align-items: center; flex-wrap: wrap; padding: 12px 16px; gap: 6px 14px; }
  .brand { margin: 0 auto 0 0; }
  .nav { flex-direction: row; }
  .nav__section, .sidebar__spacer, .freshness { display: none; }
  .userbox { border: none; margin: 0; padding: 0; }
  .content, .appfoot { margin-left: 0; }
  .content__inner { padding: 20px 16px 48px; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ---------- Tom Select (vícenásobný filtr) ------------------------------- */
.ts-wrapper { font-family: var(--font-sans); }
.ts-control { border: 1px solid var(--line-strong) !important; border-radius: var(--r-sm) !important; padding: 4px 8px !important; min-height: 38px; box-shadow: none !important; background: var(--surface) !important; font-size: 14px; gap: 4px; }
.ts-wrapper.focus .ts-control { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-weak) !important; }
.ts-control > .item { background: var(--accent-weak) !important; color: var(--accent-600) !important; border: none !important; border-radius: 6px !important; font-size: 12.5px; padding: 2px 4px 2px 8px !important; display: inline-flex; align-items: center; }
.ts-control > .item .remove { border-left: none !important; color: var(--accent-600) !important; opacity: .7; padding: 0 5px !important; }
.ts-control > .item .remove:hover { background: transparent !important; opacity: 1; }
.ts-control input { font-size: 14px !important; color: var(--ink) !important; }
.ts-dropdown { border: 1px solid var(--line-strong); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); font-size: 14px; margin-top: 4px; }
.ts-dropdown .option { padding: 7px 11px; }
.ts-dropdown .active { background: var(--accent-weak); color: var(--accent-600); }
.ts-wrapper.multi.has-items .ts-control { padding: 4px 8px !important; }
