/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ── Design tokens ─────────────────────────────────────────────── */
:root {
  --table-header-color: var(--clr-surface-alt);
  --clr-indigo:       #6366f1;
  --clr-indigo-dark:  #4f46e5;
  --clr-indigo-alpha: rgba(99, 102, 241, 0.12);
  --clr-surface:      #ffffff;
  --clr-surface-alt:  #f8fafc;
  --clr-bg:           #f0f2f5;
  --clr-border:       #e2e8f0;
  --clr-text:         #1e293b;
  --clr-text-2:       #64748b;
  --clr-text-muted:   #94a3b8;
  --clr-info:         #1565c0;
  --clr-success:      #2e7d32;
  --clr-danger:       #c62828;
  --clr-link:         #0a58ca;
  --radius-sm:        8px;
  --radius-md:        10px;

  /* Kompat shim pro framework/context-menu.css (jediný zbývající
     framework soubor, který používá --link-color). Po nahrazení
     context-menu vlastní implementací lze smazat. */
  --link-color:       var(--clr-link);
}

/* ── Reset framework defaultů ─────────────────────────────────────
   Tato sekce přepisuje defaulty z framework gemu (Imagine CSS).
   Funguje bez !important díky pořadí v layoutu — application.css
   se loaduje POZDĚJI než všechny framework/*.css, takže stejná
   specificita stačí.

   Když gem zmizí (separátní vlna), celá tato sekce může jít taky. */

/* Nadpisy: framework dává h1/h2 border-bottom + padding-bottom.
   Aplikace si vlastní border-bottom řeší ad hoc (.page-wrap > h1,
   .edit-title, .settings-content h1…). */
h1, h2 {
  border-bottom: none;
  padding-bottom: 0;
}

/* Marginy: framework nasazuje margin-top: 1rem na section/nav. */
section,
nav {
  margin-top: 0;
}

/* .form: framework dává antiquewhite kartičku, my chceme bez. */
.form {
  background-color: transparent;
  border: none;
  padding: 0;
}

/* Hidden inputs: framework dává display: block všem inputům. */
input[type="hidden"] {
  display: none;
  margin: 0;
}

/* HTML atribut `hidden` má být display:none, ale framework forms.css
   ho přebíjí pravidlem `input:not([type='submit']) { display:block }`. */
[hidden] {
  display: none !important;
}

/* Marginy uvnitř formulářů: framework nasazuje margin-top na
   first-of-type label/fieldset/input. Resetujeme. */
label:first-of-type,
fieldset:first-child,
fieldset label,
fieldset input,
section label:first-child,
ol input,
ol fieldset {
  margin-top: initial;
}

form input,
form label,
form ol,
form section {
  margin-top: initial;
}

/* Inputy: framework forms.css je hodně basic. Sjednocený border,
   focus ring v indigo. */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="datetime-local"],
input[type="date"],
textarea,
select {
  border: 1.5px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.93rem;
  color: var(--clr-text);
  background: var(--clr-surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
  border-color: var(--clr-indigo);
  box-shadow: 0 0 0 3px var(--clr-indigo-alpha);
}

/* Formulářové labely: malý uppercase nadpis nad inputem. */
.form label,
label.field-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--clr-text-2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* Tabulky: framework table.css je decent, ale potřebujeme jiné
   barvy hlavičky, vlastní hover a sjednocené paddingy. */
table {
  width: 100%;
  margin-top: 0;
  border-collapse: collapse;
}

table thead tr {
  border-bottom: 2px solid var(--clr-border);
}

table tr th {
  background-color: var(--clr-surface-alt);
  color: var(--clr-text-2);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.6rem 0.75rem;
  border-bottom: none;
  /* Sticky hlavička pro dlouhé tabulky (z framework/table.css). */
  position: sticky;
  top: -1px;
  vertical-align: bottom;
  text-align: left;
}

/* Akce v posledním sloupci (Upravit/Smazat) vpravo (z framework/table.css). */
table tr th:last-child:has(a),
table tr td:last-child:has(a) {
  text-align: right;
}

/* Inline formuláře v tabulce (button_to) — bez block layoutu. */
table form {
  display: inline-block;
  margin-top: 0;
}

table tr td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--clr-border);
  color: var(--clr-text);
  font-size: 0.92rem;
}

/* Třída pro buňky s dlouhým textem — povolí zalomení.
   Tabulky framework gem mají defaultně white-space: nowrap. */
table tr td.wrap {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

table tr:last-child td {
  border-bottom: none;
}

table tr:hover td {
  background-color: #f8faff;
}

/* HR: framework dává tlustou linku, my chceme jemnou. */
hr {
  border: none;
  border-top: 1px solid var(--clr-border);
  margin: 1.25rem 0;
}

/* .archived — tlumený stav záznamu (uzavřený úkol, deaktivovaný řádek).
   Z framework/helpers.css; přejato kvůli vyhození toho souboru. */
.archived {
  color: var(--clr-text-muted);
}

.archived a {
  color: var(--clr-indigo);
}

.archived button,
.archived a.button {
  color: var(--clr-text-muted);
}

/* ── Base elementy přesunuté z framework/base.css ────────────────
   Universal box-sizing, margin systém pro typografii, h1-h6 weights,
   default nav layout, h1+akce grid layout, defenzivní img.

   Vynecháno z původního: aside.left-sidebar (nepoužité), dl grid
   (.profile-meta a .candidate-preview-fields mají vlastní layouty),
   pre styling (.doc-viewer-text má vlastní). */

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

/* Margin systém pro typografii. Pozn.: section, nav z původního
   "div, section, table+h2, nav, img { margin-top: 1rem }" jsou
   vynechány — mBlue je řeší vlastním layoutem (flex/grid),
   dodatečný margin defaults nevyhovuje. */
*:first-child { margin-top: 0; }

h1, header:has(h1) { margin-top: 1.5rem; }
h2, header:has(h2) { margin-top: 1.2rem; }
h3, header:has(h3), h4 { margin-top: 1rem; }

header, h1, h2, h3, h4, h5, h6 { margin-bottom: 0; }

header form, h1 form, h2 form, h3 form,
h4 form, h5 form, h6 form { margin-top: 0; }

p, ul, pre { margin-top: 1rem; margin-bottom: 0; }
ol, ul { margin-top: 0.5rem; margin-bottom: 0; }
div, table + h2, img { margin-top: 1rem; }
fieldset { margin-top: 1.5rem; }
dl { margin-bottom: 1rem; }

/* Typography defaults pro nadpisy. font-weight: normal je default
   z gemu — mBlue komponentní CSS pak řeší silnější weights tam,
   kde to chce. */
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  text-wrap: wrap;
  font-weight: normal;
}

h4 { font-size: 1.1rem; }

/* Default link styling. */
a {
  color: var(--clr-link);
  text-decoration: none;
}

a:visited { color: var(--clr-link); }
a:hover { text-decoration: underline; }

/* H1/H2/H3 s akcemi (div.buttons) nebo nav — grid layout pro
   hlavičky stránek se skupinou tlačítek. Konkrétně používáno např.
   "Výkazy <div class=buttons>Report Vykázat</div>". */
h1:has(div.buttons), h1:has(nav),
h2:has(div.buttons), h2:has(nav),
h3:has(div.buttons), h3:has(nav) {
  display: grid;
  grid-template-columns: max-content max-content;
  justify-content: space-between;
  align-items: center;
}

h1 div.buttons, h2 div.buttons, h3 div.buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

h1 nav, h2 nav, h3 nav {
  grid-column: 1 / span 2;
  font-size: 1rem;
  margin-top: 0;
}

/* Hlavička index stránky.

   Layout (template-areas):
     ┌──────────┬──────────┬────────────┬─────────┐
     │ title    │ (spacer) │ filter     │ buttons │  ← row 1
     ├──────────┼──────────┴────────────┴─────────┤
     │ chips    │ (volné)                         │  ← row 2
     └──────────┴─────────────────────────────────┘

   Filter se přilepí těsně k buttonům (sloupce 3 a 4 jsou max-content,
   2. sloupec 1fr je spacer). Mezi filter a buttons je vertikální
   oddělovač přes border-left.  Chips slot pod h1 má min-height, aby
   přidání tagu nedrcnulo tabulkou dolů. */
.page-header {
  display: grid;
  /* Sloupec 3 (filter) je minmax(0, max-content) — při širokém viewportu
     se roztáhne na svou přirozenou šířku, při užším se smrští a inputy
     uvnitř .index-filter wrappnou (flex-wrap). */
  grid-template-columns: max-content 1fr minmax(0, max-content) max-content;
  grid-template-areas:
    "title  .      filter  buttons"
    "chips  chips  chips   chips";
  column-gap: 1rem;
  align-items: center;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--clr-border);
}

.page-header > h1 {
  grid-area: title;
  margin: 0;
}

.page-header__chips {
  grid-area: chips;
  min-height: 1.75rem;
  margin-top: 0.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.page-header > .index-filter {
  grid-area: filter;
  margin: 0;
  min-width: 0;
}

.page-header > .buttons {
  grid-area: buttons;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  border-left: 1px solid var(--clr-border);
  padding-left: 1rem;
}

/* Default nav layout (mBlue header nav má vlastní override). */
nav {
  display: flex;
  gap: 0.2rem 0.7rem;
  flex-wrap: wrap;
}

/* Defenzivní img default. */
img {
  max-width: 100%;
}

/* ── Forms baseline (přesunuto z framework/forms.css) ────────────
   mBlue specifické vstupy (border, focus ring, padding) jsou v reset
   sekci nahoře. Tady jen univerzální layout, fieldset, checkbox/radio
   wrapper, disabled state.

   Vynecháno z původního: form.inline / form.bold (nepoužité),
   form section/small styling (nepoužité), label+.multiselect (nepoužité),
   margin systém formulářů (mBlue ho vědomě potlačuje pro .field layout). */

/* Block layout default — formulářové prvky přes celou šíři kontejneru.
   mBlue v praxi wrapuje v .field/.edit-field-row pro grid layout. */
select,
input:not([type='submit']),
textarea {
  display: block;
  width: 100%;
}

/* Inline hint pod inputem (<input> <small>Tip</small>). */
input + small,
textarea + small,
select + small {
  display: block;
  margin-top: 0.1rem;
}

/* fieldset jako flex container — používá se v users/_form.html.erb. */
fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  border: 0;
  padding: 0;
  padding-inline: 0;
  padding-block: 0;
  margin-inline: 0;
}

fieldset div,
fieldset select,
fieldset input:not([type='submit']),
fieldset textarea {
  flex: 1;
}

fieldset div {
  margin-top: 0;
}

fieldset:has(input[type='radio']),
fieldset:has(input[type='checkbox']) {
  gap: 0.5rem;
  align-items: center;
}

fieldset.grid {
  display: grid;
}

fieldset.grid input,
fieldset.grid select {
  width: 100%;
}

/* Custom checkbox/radio wrapper. Použito např. v users/_form.html.erb
   pro "Deaktivovaný" toggle. */
label:has(input[type="checkbox"]),
label:has(input[type="radio"]) {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background-color: var(--clr-surface);
  padding: 5px 11px;
  white-space: nowrap;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  cursor: pointer;
}

label:has(input[type="checkbox"]):has(input[disabled]),
label:has(input[type="radio"]):has(input[disabled]) {
  background-color: #fdf5eb;
  cursor: default;
}

label:has(input[type="checkbox"]):has(input:checked),
label:has(input[type="radio"]):has(input:checked) {
  border-color: var(--clr-indigo);
}

label:has(input[type="checkbox"]) input,
label:has(input[type="radio"]) input {
  margin-top: 0;
  width: auto;
}

input[type="checkbox"]:hover,
input[type="radio"]:hover {
  cursor: pointer;
}

/* Disabled/readonly state — beige bg (z frameworku). */
input[disabled],
textarea[disabled],
input[readonly="readonly"],
textarea[readonly="readonly"],
select[disabled],
select[readonly="readonly"],
trix-editor[disabled],
trix-editor[readonly="readonly"] {
  color: var(--clr-text-muted);
  background-color: #fdf5eb;
}

/* Rails .button_to wrapper — pro DELETE link helpery. */
.button_to {
  display: inline-block;
  margin-top: 0;
}

.button_to input[type="submit"] {
  margin-top: 0;
}

/* Defenzivní placeholder font-weight. */
::placeholder {
  font-weight: normal;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0px;
  background: var(--clr-bg);
  font-family: system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1;
  padding: 1rem;
  background: var(--clr-bg);
}

body > header {
  grid-column: 1 / span 2;
  padding: 0px;
  background-color: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);

  div {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    gap: 1.75rem;

    > a:first-child {
      display: flex;
      align-items: center;
      padding-right: 1.75rem;
      border-right: 1px solid var(--clr-border);
    }

    img {
      width: 120px;
    }

    nav {
      margin-left: 0;
      margin-top: 0px;
      display: flex;
      align-items: flex-start;
      gap: 1.75rem;

      span {
        display: flex;
        flex-direction: column;
        gap: 0.1rem;
        line-height: 1;
      }

      span > a {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--clr-text);
        text-decoration: none;
      }

      span > a:hover { color: var(--clr-indigo); }

      span.is-active > a {
        color: #000;
        font-weight: 800;
      }

      span.is-active small a {
        color: #000;
        font-weight: 700;
        opacity: 1;
      }

      small {
        font-size: 0.65rem;
      }

      small a {
        color: var(--clr-indigo);
        text-decoration: none;
        font-weight: 500;
        opacity: 0.75;
      }

      small a:hover { opacity: 1; }
    }
  }
}

/* Framework fixy (h1/h2 border-bottom, inputy, tabulky, form margins, hr…)
   jsou v samostatném souboru: app/assets/stylesheets/framework_fixes.css */

/* Framework nastavuje margin-top: 1rem na všechny divy — oprava */
div {
  margin-top: initial;
}

/* Oprava zarovnání posledního sloupce v tabulkách, pokud obsahuje odkazy */
table {
  & tr {
    & th, & td {
      &:last-child:has(a) {
        text-align: left;
      }
    }
  }
}

/* o pravu frameworku: submit tlačítko u hledání */
form input[type="submit"] {
  margin-top: initial;
}

/* Fix linky pod nadpisem v modálu */
dialog h1 {
  border-bottom: initial;
}

/* ── Back link nad h1 (návrat o úroveň výš) ─────────────────────── */
.page-back-link {
  display: inline-block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  color: var(--clr-text-muted);
  text-decoration: none;
  line-height: 1.2;
}

.page-back-link:hover {
  color: var(--clr-indigo);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Chip ukazující předvyplněnou vazbu v modálu ─────────────────── */
.dialog-binding-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  padding: 0.3rem 0.65rem;
  background: var(--clr-indigo-alpha);
  color: var(--clr-indigo-dark);
  border: 1px solid color-mix(in srgb, var(--clr-indigo) 25%, transparent);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.3;
}

.dialog-binding-chip[hidden] { display: none; }

.dialog-binding-chip-label {
  color: var(--clr-text-2);
  font-weight: 500;
}

.dialog-binding-chip-value {
  font-weight: 700;
}

a.plain { color: inherit; text-decoration: none; font-weight: 500; cursor: pointer; }
a.plain[target="_blank"]::after,
a.plain[href^="tel:"]::after,
a.plain[href^="mailto:"]::after {
  font-size: 0.7em;
  color: #aaa;
  margin-left: 0.2em;
  vertical-align: 0.35em;
  opacity: 0;
  transition: opacity 0.15s;
}
a.plain[target="_blank"]:hover::after,  a.plain[target="_blank"]:active::after,
a.plain[href^="tel:"]:hover::after,     a.plain[href^="tel:"]:active::after,
a.plain[href^="mailto:"]:hover::after,  a.plain[href^="mailto:"]:active::after { opacity: 1; }
a.plain[target="_blank"]::after { content: "↗"; }
a.plain[href^="tel:"]::after    { content: "☎"; }
a.plain[href^="mailto:"]::after { content: "✉"; }

/* ── Tag / activity-chip base ─────────────────────────────────────
   Pill štítek pro typy aktivit (.tag.tag--blue z activity_type_class)
   a podobně. Modifikátory definují barvu pozadí.
   Z framework/tags.css; přejato kvůli vyhození toho souboru. */
.tag {
  display: inline-block;
  border-radius: 12px;
  padding: 2px 10px;
  color: #fff;
  background-color: var(--clr-text-2);
  white-space: nowrap;
  font-size: 0.9rem;
}

.tag--green { background-color: var(--clr-success); }
.tag--blue  { background-color: var(--clr-info); }
.tag--gray  { background-color: #9e9e9e; }

/* Tag size modifiers. */
.tag--xs { font-size: 0.7rem; }
.tag--sm { font-size: 0.75rem; }

.timeline {
  max-width: 760px;
}

.timeline__day {
  margin-bottom: 2rem;
}

.timeline__date {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #999;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #ebebeb;
}

.timeline__item {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f5f5f5;
}

.timeline__item:last-child {
  border-bottom: none;
}

.timeline__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #bbb;
  margin-top: 0.45rem;
}

.timeline__content {
  flex: 1;
  min-width: 0;
}

.timeline__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin-bottom: 0.2rem;
}

.timeline__note {
  font-size: 0.9rem;
  color: #222;
  margin-bottom: 0.2rem;
}

.timeline__actions {
  margin-top: 0.1rem;
}

/* ── Dashboard ──────────────────────────────────────────────────
   Hero KPI proužek (bez kartiček, jen border-left jako separator),
   2/1 grid (aktivity vlevo, úkoly vpravo), sekce nadpisy. */

.dashboard-hero {
  display: flex;
  gap: 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--clr-border);
  margin-bottom: 1.5rem;
}

.dashboard-hero-tile {
  padding: 0 1.5rem;
  border-left: 1px solid var(--clr-border);
}

.dashboard-hero-tile:first-child {
  padding-left: 0;
  border-left: none;
}

.dashboard-hero-number {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--clr-text-2);  /* neutral default (pro firmy) */
}

.dashboard-hero-number--info    { color: var(--clr-info); }
.dashboard-hero-number--success { color: var(--clr-success); }
.dashboard-hero-number--danger  { color: var(--clr-danger); }

.dashboard-hero-label {
  margin-top: 0.2rem;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  color: var(--clr-text-muted);
}

.dashboard-hero-actions {
  font-size: 0.8rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: start;
}

.dashboard-section {
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--clr-border);
  font-size: 1rem;
  font-weight: 600;
}

.dashboard-section--with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard-section--spaced {
  margin-top: 1.5rem;
}

/* Activity feed tabulka (chip + datum + autor + popis + akce).
   Použito v dashboardu a na show stránkách (companies, candidates…). */
.activity-feed-table { width: 100%; }

.activity-feed-table td:nth-child(1) { width: 2.5rem; }

.activity-feed-table td:nth-child(2) {
  width: 6rem;
  color: var(--clr-text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.activity-feed-table td:nth-child(3) {
  width: 3.5rem;
  color: var(--clr-text-2);
  font-size: 0.85rem;
}

.activity-feed-table td:nth-child(4) {
  font-size: 0.9rem;
}

.activity-feed-table .tag {
  font-size: 0.7rem;
}

/* Krátký prázdný stav (světlejší než .empty-state, který má větší marginy). */
.muted-empty {
  color: var(--clr-text-muted);
  font-size: 0.9rem;
}

/* Pagination control (Předchozí / Strana N / Další). */
.paginator {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
  font-size: 0.85rem;
}

.paginator-info {
  color: var(--clr-text-muted);
}

/* ── Timesheet (Výkazy) index tabulka ─────────────────────────── */

.timesheet-table-wrap {
  overflow-x: auto;
}

.timesheet-table {
  table-layout: fixed;
  width: 100%;
  min-width: 56rem;
}

.timesheet-table .col-date,
.timesheet-table .col-user,
.timesheet-table .col-duration,
.timesheet-table .col-actions {
  white-space: nowrap;
}

.timesheet-table th.col-date,
.timesheet-table td.col-date { width: 6rem; }

.timesheet-table th.col-user,
.timesheet-table td.col-user { width: 8rem; }

.timesheet-table th.col-project { width: 14rem; }

.timesheet-table th.col-tags { width: 11rem; }

.timesheet-table .col-duration {
  width: 5rem;
  text-align: right;
}

.timesheet-table td.col-duration {
  font-variant-numeric: tabular-nums;
}

.timesheet-table .col-actions {
  width: 5.5rem;
  text-align: right;
}

.timesheet-table td.col-date {
  color: var(--clr-text-2);
}

/* Sub-popisek (název firmy pod projektem) v projektovém sloupci. */
.timesheet-company-sub {
  color: var(--clr-text-muted);
  font-size: 0.85rem;
}

/* ── Entity show stránka — sdílené layouty ───────────────────────
   Dvousloupcový grid pro show stránky (companies, projects…),
   key-value tabulka pro info (IČO, DIČ, email, telefon, web…). */

.entity-show-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.entity-info-table { width: 100%; }

.entity-info-table td:first-child {
  width: 3.5rem;
  font-weight: 500;
}

/* Řádek s vícenásobným obsahem (Poznámka): label nahoře, hodnota
   may wrap a má top padding. */
.entity-info-table tr.entity-info-row--top td {
  vertical-align: top;
  padding-top: 0.25rem;
}

.entity-info-note {
  color: var(--clr-text-2);
}

/* Modifikátor: tighter grid (gap 2rem 1.5rem) pro projects/show
   apod., kde 3rem je moc. */
.entity-show-grid--tight { gap: 2rem 1.5rem; }

.entity-info-link {
  color: var(--clr-link);
}

/* Sekce ohraničená nahoře (Kontakty, Aktivity… na show stránce). */
.entity-section--bordered {
  padding-top: 1.25rem;
  border-top: 1px solid var(--clr-border);
}

.entity-section-heading {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  font-size: 1rem;
}

.entity-section-heading .muted-count {
  font-weight: normal;
}

/* Body popisku entity nad info tabulkou. */
.entity-description {
  padding: 1rem 0.75rem;
  margin-bottom: 1.5rem;
  color: var(--clr-text-2);
  font-size: 0.9rem;
}

/* Meta atributy entity: klíč a hodnota na jednom řádku vedle sebe. */
.entity-meta {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.entity-meta-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.entity-meta-row dt {
  flex: 0 0 9rem;
  margin: 0;
  color: var(--clr-text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.entity-meta-row dd {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
  color: var(--clr-text);
}

/* Hierarchická tabulka: projekt → pozice jako sub-řádek. */
.entity-projects-list tr.is-child {
  color: var(--clr-text-2);
  font-size: 0.9rem;
}

.entity-projects-list tr.is-child td {
  padding-left: 1rem;
  padding-top: 0;
  padding-bottom: 0.2rem;
}

.entity-projects-list .entity-projects-arrow {
  color: var(--clr-text-muted);
  margin-right: 0.4rem;
}

.entity-projects-list tr.is-child a {
  color: var(--clr-text-2);
}

.entity-projects-list .entity-projects-name td {
  font-weight: 500;
  padding-bottom: 0.1rem;
}

.entity-projects-list .entity-projects-status {
  text-align: right;
  padding-top: 0;
  padding-bottom: 0.2rem;
}

.entity-projects-historical {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

/* Kontakty řádek (jméno + role + email + tel + akce). */
.entity-contacts-table .entity-contacts-name {
  font-weight: 500;
}

.entity-contacts-table .entity-contacts-role {
  color: var(--clr-text-2);
  font-size: 0.9rem;
}

.tag-primary-mark {
  font-size: 0.7rem;
  margin-left: 0.4rem;
}

/* ── Index page helpers (filtry, souhrn, prázdný stav) ──────────── */

/* Filter bar pod h1 (užito tam, kde je víc filtrů než se vejde do .buttons) */
.index-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem 1rem;
  margin: 1rem 0;
}

.index-filters .field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.index-filters label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--clr-text-muted);
}

.index-filters input,
.index-filters select {
  font-size: 0.88rem !important;
  padding: 0.4rem 0.6rem !important;
}

.index-filters .index-filters__reset {
  align-self: flex-end;
  padding-bottom: 0.5rem;
  font-size: 0.82rem;
  color: var(--clr-text-muted);
  text-decoration: underline;
}

.index-filters .index-filters__reset:hover { color: var(--clr-indigo); }

/* Krátký souhrnový řádek nad tabulkou (počet, suma…) */
.list-summary {
  margin: 0 0 0.75rem !important;
  font-size: 0.85rem;
  color: var(--clr-text-muted);
}

.list-summary strong {
  color: var(--clr-text);
  font-weight: 600;
}

/* Prázdný stav (žádné záznamy / žádné hledání) */
.empty-state {
  margin: 1rem 0;
  color: var(--clr-text-muted);
  font-size: 0.9rem;
}

/* ── Patička s developer odkazy ─────────────────────────────────── */
.dev-footer {
  grid-column: 1 / -1;
  padding: 0.6rem 1.5rem;
  font-size: 0.7rem;
  color: var(--clr-text-muted);
  border-top: 1px solid var(--clr-border);
  background: var(--clr-surface);
}

.dev-footer span { margin-right: 0.4rem; opacity: 0.7; }

.dev-footer a {
  color: var(--clr-text-muted);
  text-decoration: none;
}

.dev-footer a:hover {
  color: var(--clr-indigo);
  text-decoration: underline;
}

/* ── Globální hledání (modal) ───────────────────────────────────── */
dialog.global-search-dialog {
  width: 600px;
  max-width: 90vw;
  height: fit-content;
  max-height: 80vh;
  top: 12vh;
  padding: 1.25rem 1.5rem;
}

dialog.global-search-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem 0;
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--clr-border);
}

dialog.global-search-dialog header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-text);
}

dialog.global-search-dialog header form[method="dialog"] {
  margin: 0;
}

dialog.global-search-dialog .dialog-close {
  background: transparent;
  color: var(--clr-text-muted);
  border: none;
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s, color 0.15s;
}

dialog.global-search-dialog .dialog-close:hover {
  background: var(--clr-indigo-alpha);
  color: var(--clr-indigo);
  box-shadow: none;
}

.global-search-form {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0 0.25rem;
}

.global-search-form input[type="text"] {
  flex: 1;
}

.global-search-hint {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--clr-text-muted);
}

/* ── Výkaz (modal + form) ───────────────────────────────────────── */
dialog.time-entry-dialog {
  width: 540px;
  max-width: 90vw;
  height: fit-content;
  max-height: 85vh;
  top: 10vh;
  padding: 1.25rem 1.5rem;
}

dialog.time-entry-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem 0;
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--clr-border);
}

dialog.time-entry-dialog header h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--clr-text);
}

dialog.time-entry-dialog header form[method="dialog"] {
  margin: 0;
}

dialog.time-entry-dialog .dialog-close {
  background: transparent;
  color: var(--clr-text-muted);
  border: none;
  border-radius: 6px;
  padding: 0.1rem 0.5rem;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}

.time-entry-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0;
}

.time-entry-form__row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.time-entry-form__row label {
  font-size: 0.8rem;
  color: var(--clr-text-muted);
}

.time-entry-form__row input,
.time-entry-form__row select,
.time-entry-form__row textarea {
  width: 100%;
}

.time-entry-form__duration {
  display: flex;
  gap: 0.5rem;
}

.time-entry-form__duration select {
  flex: 1;
}

.time-entry-form__hint {
  font-size: 0.75rem;
  color: var(--clr-text-muted);
}

.time-entry-form__hint code {
  background: var(--clr-bg-alt, #f3f3f3);
  padding: 0 0.25rem;
  border-radius: 3px;
}

.time-entry-form__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
  width: 100%;
}

.time-entry-form__actions .time-entry-form__delete {
  margin: 0 auto 0 0;
}

/* ── Time entry tag picker ─────────────────────────────────────── */
.te-tags {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.te-tags__selected {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.te-tags__selected:empty {
  display: none;
}

.te-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--tag-color, #4f46e5);
  border: 1px solid var(--tag-color, #4f46e5);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
}

.te-tag-chip.is-hidden {
  display: none;
}

.te-tag-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.7;
}

.te-tag-chip__remove:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

.te-tag-chip--static {
  cursor: default;
}

/* Toggle varianta — pro výběr ve formuláři (opacity přepínač) */
.te-tag-chip--toggle {
  cursor: pointer;
  user-select: none;
  opacity: 0.42;
  transition: opacity 0.12s, box-shadow 0.12s;
}

.te-tag-chip--toggle:hover {
  opacity: 0.78;
}

.te-tag-chip--toggle.is-selected {
  opacity: 1;
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--tag-color, #4f46e5) 55%, transparent),
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.35);
}

.te-tag-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.te-tag-list--stacked {
  flex-direction: column;
  align-items: flex-start;
}

.te-tags__search {
  position: relative;
}

.te-tags__input {
  width: 100%;
}

.te-tags__dropdown {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid var(--clr-border, #d4d4d4);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  max-height: 240px;
  overflow-y: auto;
}

.te-tags__dropdown[hidden] {
  display: none;
}

.te-tags__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  font-size: 0.88rem;
}

.te-tags__option::before {
  content: '';
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--tag-color, transparent);
}

.te-tags__option:hover,
.te-tags__option.is-focused {
  background: #f1f5f9;
}

.te-tags__option.is-checked {
  background: #eef2ff;
  color: #4338ca;
}

.te-tags__option.is-checked.is-focused {
  background: #dfe6ff;
}

.te-tags__option-group {
  color: var(--clr-text-muted, #888);
  font-size: 0.78rem;
}

.te-tags__empty {
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  color: var(--clr-text-muted, #888);
}

/* ── Report výkazů ───────────────────────────────────────────────── */
.report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: flex-end;
  margin: 0.5rem 0 1.25rem;
}

.report-filters__label {
  display: block;
  font-size: 0.8rem;
  color: var(--clr-text-muted, #666);
  margin-bottom: 0.15rem;
}

.report-filters .report-filters__reset {
  align-self: flex-end;
  padding-bottom: 0.5rem;
  font-size: 0.82rem;
  color: var(--clr-text-muted);
  text-decoration: underline;
}

.report-filters .report-filters__reset:hover { color: var(--clr-indigo); }

.report-timesheet {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.report-timesheet th,
.report-timesheet td {
  padding: 0.35rem 0.9rem;
  border-bottom: 1px solid #f0f0f0;
}

.report-timesheet thead th {
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid #d4d4d4;
  color: var(--clr-text-muted, #555);
}

.report-timesheet__num {
  text-align: right;
  white-space: nowrap;
}

.report-timesheet__group td {
  font-weight: 600;
}

.report-timesheet__detail td {
  color: #555;
  font-weight: 400;
}

.report-timesheet__indent {
  padding-left: 1.8rem !important;
}

.report-timesheet__sub {
  color: #888;
  font-size: 0.85rem;
  font-weight: 400;
}

.report-timesheet__divider td {
  border-bottom: 1px solid #111;
  padding: 0.15rem 0;
}

.report-timesheet__total td {
  font-weight: 700;
  border-top: 1px solid #d4d4d4;
}

/* ── Dropdown menu (details/summary) ────────────────────────────── */
details.dropdown {
  position: relative;
  display: inline-block;
}

details.dropdown > summary {
  list-style: none;
  cursor: pointer;
}

details.dropdown > summary::-webkit-details-marker { display: none; }
details.dropdown > summary::marker { content: ''; }

details.dropdown[open] > summary {
  box-shadow: 0 0 0 3px var(--clr-indigo-alpha) !important;
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 180px;
  background: var(--clr-surface, #fff);
  border: 1px solid var(--clr-border, #e2e8f0);
  border-radius: var(--radius-sm, 8px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
  padding: 0.25rem;
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.dropdown__item {
  display: block;
  padding: 0.45rem 0.8rem;
  border-radius: 5px;
  color: var(--clr-text, #1e293b) !important;
  text-decoration: none !important;
  font-size: 0.9rem;
  white-space: nowrap;
}

.dropdown__item:hover {
  background: var(--clr-indigo-alpha, #eef2ff);
  color: var(--clr-indigo, #4f46e5) !important;
}

/* ── Stránka globálního hledání ─────────────────────────────────── */
.search-form {
  margin: 1rem 0 1.5rem;
  max-width: 720px;
}

.search-form__row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.search-form__input {
  flex: 1;
}

.search-form__filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.65rem;
  font-size: 0.85rem;
  color: var(--clr-text-2);
}

.search-form__filters-label {
  color: var(--clr-text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-form__filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
}

.search-form__filter input[type="checkbox"] {
  margin: 0 !important;
  cursor: pointer;
}

.search-summary {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--clr-text-muted);
}

.search-summary strong {
  color: var(--clr-text);
  font-weight: 600;
}

.search-empty {
  margin: 1rem 0;
  color: var(--clr-text-muted);
  font-size: 0.9rem;
}

.search-results {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--clr-border);
}

.search-result {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--clr-border);
  transition: background 0.1s;
}

.search-result:hover {
  background: var(--clr-indigo-alpha);
}

.search-result__icon {
  flex-shrink: 0;
  width: 1.75rem;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.5;
  filter: grayscale(0.2);
}

.search-result__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.search-result__title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.search-result__name {
  color: var(--clr-text);
  font-weight: 600;
  font-size: 0.98rem;
  text-decoration: none;
}

.search-result__name:hover,
.search-result:hover .search-result__name {
  color: var(--clr-indigo);
  text-decoration: none;
}

.search-result__badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--clr-text-muted);
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--clr-border);
  border-radius: 999px;
  background: var(--clr-surface-alt);
}

.search-result__meta {
  font-size: 0.85rem;
  color: var(--clr-text-2);
  word-break: break-word;
}

.search-result__snippet {
  font-size: 0.82rem;
  color: var(--clr-text-muted);
  line-height: 1.4;
  word-break: break-word;
}

.search-result__docs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.search-result__doc {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.5rem;
  font-size: 0.78rem;
  color: var(--clr-text-2);
  background: var(--clr-surface-alt);
  border: 1px solid var(--clr-border);
  border-radius: 999px;
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result__doc::before {
  content: "📎";
  font-size: 0.8em;
}

.search-result__doc:hover {
  border-color: var(--clr-indigo);
  color: var(--clr-indigo);
  background: var(--clr-surface);
}

.search-results mark {
  background: #fff3a3;
  color: inherit;
  padding: 0 0.1em;
  border-radius: 2px;
}

/* ── Context menu (dropdown) ───────────────────────────────────── */
.context-menu {
  width: auto;
  min-width: 170px;
  padding: 0.3rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  background: var(--clr-surface);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.06);
  font-size: 0.88rem;
}

.context-menu a {
  display: block;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--clr-text);
  text-decoration: none;
  transition: background 0.1s;
}

.context-menu a:hover {
  background: var(--clr-indigo-alpha);
  color: var(--clr-indigo);
}

.context-menu a.context-menu-danger {
  color: var(--clr-danger);
}

.context-menu a.context-menu-danger:hover {
  background: rgba(220, 38, 38, 0.08);
  color: var(--clr-danger);
}

.context-menu hr {
  margin: 0.3rem 0 !important;
  border-top: 1px solid var(--clr-border) !important;
}

.flash-message {
  position: fixed;
  inset: unset;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  margin: 0;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
  max-width: min(90vw, 600px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.flash-message--leaving {
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
}

.flash-alert {
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  color: #856404;
}

.flash-notice {
  background: #d4edda;
  border-left: 4px solid #28a745;
  color: #155724;
}

.flash-close {
  background: transparent;
  border: none;
  border-radius: 4px;
  color: inherit;
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1;
  padding: 0.1rem 0.45rem;
  margin: 0;
  cursor: pointer;
  opacity: 0.65;
  box-shadow: none;
  transition: opacity 0.15s, background 0.15s;
}

.flash-close:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
  box-shadow: none;
}

.form-errors {
  background: #fff3cd;
  border: 1px solid #ffc107;
  color: #856404;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-sm);
}

.form-errors ul {
  margin: 0.25rem 0 0 1rem;
  padding: 0;
}

/* ── Kandidáti: split-view index ─────────────────────────────────── */
.candidates-index-toolbar {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

/* Sjednocený filter row pod h1 — kompaktní horizontální flex-wrap, jen
   placeholdery (žádné labely). Používá ho shared/_index_filter partial. */
.index-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  margin: 0.5rem 0 1rem;
}

.index-filter input,
.index-filter select {
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
}

/* Tag picker rozložíme v rámci filtru: search input zůstane na hlavním
   řádku, vybrané chipy spadnou pod celý filtr na nový řádek (flex order
   + flex-basis 100% donutí wrap). */
.index-filter .te-tags {
  display: contents;
}

.index-filter .te-tags__search {
  position: relative;
  min-width: 18rem;
}

.index-filter .te-tags__selected {
  order: 99;
  flex-basis: 100%;
  margin-top: 0.2rem;
}

.index-filter .te-tags__selected:empty {
  display: none;
}

.candidates-index-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.candidates-index-grid:has(.candidates-index-right:not([hidden])) {
  grid-template-columns: minmax(0, 1fr) minmax(380px, 480px);
}

.candidates-index-left {
  min-width: 0;
}

.candidates-index-table {
  width: 100%;
}

.candidates-index-row {
  cursor: pointer;
  outline: none;
}

.candidates-index-row:hover {
  background: rgba(0, 0, 0, 0.02);
}

.candidates-index-row:focus,
.candidates-index-row.is-active {
  background: var(--clr-indigo-alpha, rgba(99, 102, 241, 0.08));
  box-shadow: inset 3px 0 0 var(--clr-indigo, #6366f1);
}

.row-primary-link {
  font-weight: 500;
  text-decoration: none;
}

.row-primary-link:hover { text-decoration: underline; }

.col-check {
  width: 1.5rem;
  text-align: center;
  padding-right: 0;
}

.col-actions {
  white-space: nowrap;
  text-align: right;
}

.row-preview-btn {
  background: transparent;
  border: none;
  color: var(--clr-indigo, #2980b9);
  padding: 0;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  margin-right: 0.6rem;
}

.row-preview-btn:hover {
  text-decoration: underline;
}

.candidates-index-row.is-active .row-preview-btn,
.documents-index-row.is-active .row-preview-btn {
  font-weight: 600;
}

/* Search input v toolbaru (s inline clear ×). General — používá se
   v candidates/index, positions/index. */
.search-input-wrap {
  position: relative;
  display: inline-block;
}

.search-input-wrap input {
  margin-top: 0;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--clr-border-strong, #ccc);
  border-radius: 3px;
  font-size: 0.85rem;
  width: 14rem;
}

.search-input-wrap.has-query input {
  padding-right: 1.6rem;
}

.search-input-clear {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--clr-text-muted);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
}

/* Drobný select v toolbar baru (status filtr v positions). */
.toolbar-select {
  margin-top: 0;
  padding: 0.25rem 0.4rem;
  font-size: 0.85rem;
  width: auto;
}

/* Drobný filtr toolbar v h1 (search + select + clear). */
.filter-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ── Quick dialog pro založení / úpravu firmy ─────────────────── */

.company-quick-form__field {
  margin-bottom: 1rem;
}

.company-quick-form__field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--clr-text-2);
}

.company-quick-form__field input[type="text"] {
  width: 100%;
}

.company-quick-form__duplicates {
  margin-top: 1rem;
}

.company-quick-form__actions {
  margin-top: 1.25rem;
}

/* ARES name autocomplete uvnitř modalu — držet se uvnitř formu, ne výchozích 400px. */
.company-quick-form__name { position: relative; }

.company-quick-form__ares-dropdown {
  min-width: 0;
  width: 100%;
  left: 0;
  right: 0;
  top: calc(100% + 0.15rem);
}

/* ── Poslední zaměstnavatel: autocomplete picker s tlačítkem pro novou firmu ── */

.last-employer-picker {
  position: relative;
}

.last-employer-picker__row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}

.last-employer-picker__input {
  flex: 1;
}

.last-employer-picker.is-unconfirmed .last-employer-picker__input {
  border-color: var(--clr-amber, #d97706);
  background: var(--clr-amber-alpha, rgba(217, 119, 6, 0.06));
}

.last-employer-picker__hint {
  margin: 0.3rem 0 0;
  font-size: 0.85em;
  color: var(--clr-amber, #d97706);
}

.last-employer-picker__new-btn {
  flex: 0 0 auto;
  padding: 0 0.9rem;
  font-weight: 600;
}

.last-employer-picker__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 3.2rem;
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 3px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.last-employer-picker__item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--clr-border);
}

.last-employer-picker__item:last-child { border-bottom: none; }
.last-employer-picker__item:hover { background: var(--clr-indigo-alpha); }

.last-employer-picker__item--create {
  color: var(--clr-indigo);
  font-weight: 500;
}

/* ── ARES autocomplete dropdown (companies/_form) ───────────────── */

.ares-dropdown {
  display: none;
  position: absolute;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 3px;
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 100;
  min-width: 400px;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ares-dropdown.is-open { display: block; }

.ares-dropdown-empty {
  padding: 8px 12px;
  color: var(--clr-text-muted);
}

.ares-dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--clr-border);
}

.ares-dropdown-item:last-child { border-bottom: none; }

.ares-dropdown-item:hover { background: var(--clr-indigo-alpha); }

.ares-dropdown-sub {
  color: var(--clr-text-2);
}

/* IČO input + ARES tlačítko v rohu. */
.ares-ico-wrap { position: relative; }

.ares-ico-wrap input { padding-right: 4.5rem; }

.ares-ico-btn {
  position: absolute;
  right: 0.3rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.15rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.4;
  background: var(--color-indigo-100, #f0f4ff);
  border: 1px solid var(--color-indigo-200, #c5cfe8);
  border-radius: 3px;
  color: var(--clr-indigo-dark);
  cursor: pointer;
  white-space: nowrap;
}

/* Globální button:hover/:active nastavuje transform: none, což by zrušilo
   vertikální vycentrování (translateY(-50%)). Proto ho na hover/active
   držíme. */
.ares-ico-btn:hover,
.ares-ico-btn:active {
  transform: translateY(-50%);
}

/* 2-col grid pro IČO + DIČ. */
.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

/* Drobný řádek nad tabulkou: počet nalezených pro hledaný výraz. */
.candidates-index-found {
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  margin-bottom: 0.75rem;
}

/* Generic per-column styly pro index tabulky (created/closed/activity). */
.col-created,
.col-closed {
  color: var(--clr-text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.col-activity {
  font-size: 0.85rem;
}

.col-activity.is-stale {
  color: var(--clr-danger);
}

.candidates-index-contact-sub {
  color: var(--clr-text-2);
  font-size: 0.85rem;
}

/* Sloupec "Poslední aktivita" — tag typu + datum + autor + krátká poznámka */
.candidates-index-activity {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.candidates-index-activity .tag {
  font-size: 0.65rem;
}

.candidates-index-activity-date {
  color: var(--clr-text-muted);
  white-space: nowrap;
}

.candidates-index-activity-author {
  color: var(--clr-text-muted);
  white-space: nowrap;
}

.candidates-index-activity-note {
  color: var(--clr-text-2);
  margin-top: 0.2rem;
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidates-index-activity-empty {
  color: var(--clr-text-muted);
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.5rem;
  margin-bottom: 0.4rem;
  background: var(--clr-indigo-alpha, rgba(99, 102, 241, 0.08));
  border-radius: 3px;
  font-size: 0.75rem;
  line-height: 1.4;
}

.bulk-toolbar [data-bulk-count] {
  color: var(--clr-text-muted);
}

.bulk-toolbar .button.sm {
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
}

.candidates-index-right {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm, 4px);
}

.candidates-index-empty,
.candidates-index-loading {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--clr-text-muted);
}

/* preview obsah */
.candidate-preview {
  padding: 1.25rem 1.5rem;
}

.candidate-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.candidate-preview-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.candidate-preview-meta {
  font-size: 0.8rem;
  color: var(--clr-text-muted);
  margin-top: 0.2rem;
}

.candidate-preview-fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 0.75rem;
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
}

.candidate-preview-fields dt {
  color: var(--clr-text-muted);
  font-weight: 500;
}

.candidate-preview-fields dd {
  margin: 0;
}

.candidate-preview-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--clr-border);
}

.candidate-preview-section h3 {
  margin: 0 0 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.candidate-preview-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.candidate-preview-section-head h3 {
  margin: 0;
}

.candidate-preview-description {
  margin: 0;
  font-size: 0.88rem;
  color: var(--clr-text-2);
  line-height: 1.45;
}

.candidate-preview-name-link {
  color: inherit;
  text-decoration: none;
}

.candidate-preview-name-link:hover {
  color: var(--clr-indigo);
  text-decoration: underline;
}

.muted-count {
  color: #888;
  font-weight: normal;
  font-size: 0.85rem;
}

.muted {
  color: var(--clr-text-muted);
  font-size: 0.85rem;
}

.candidate-preview-activities {
  list-style: none;
  margin: 0;
  padding: 0;
}

.candidate-preview-activities li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  font-size: 0.85rem;
}

@media (max-width: 1400px) {
  .candidates-index-grid:has(.candidates-index-right:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }
  .candidates-index-right {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(480px, 100vw);
    max-height: 100vh;
    z-index: 50;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
  }
}

/* ── Soubory: split-view ─────────────────────────────────────────── */
.documents-index-toolbar {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
}

.documents-index-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.documents-index-grid:has(.documents-index-right:not([hidden])) {
  grid-template-columns: minmax(0, 1fr) minmax(420px, 600px);
}

.documents-index-left {
  min-width: 0;
}

.documents-index-row {
  cursor: pointer;
  outline: none;
}

.documents-index-row:hover {
  background: rgba(0, 0, 0, 0.02);
}

.documents-index-row:focus,
.documents-index-row.is-active {
  background: var(--clr-indigo-alpha, rgba(99, 102, 241, 0.08));
  box-shadow: inset 3px 0 0 var(--clr-indigo, #6366f1);
}

.documents-index-right {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm, 4px);
}

.document-preview {
  padding: 1.25rem 1.5rem;
}

.document-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--clr-border);
}

.document-preview-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  word-break: break-all;
}

.document-preview-canvas {
  min-height: 200px;
}

@media (max-width: 1400px) {
  .documents-index-grid:has(.documents-index-right:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }
  .documents-index-right {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(600px, 100vw);
    max-height: 100vh;
    z-index: 50;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
  }
}

/* ── Úkoly: chip vazby, soubory, dashboard seznam ──────────────────── */
.tasks-index-chip,
.dashboard-tasks-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  padding: 0.1rem 0.45rem;
  margin-right: 0.35rem;
  background: rgba(99, 102, 241, 0.08);
  border-radius: 3px;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: nowrap;
}

.tasks-index-chip-type,
.dashboard-tasks-chip-type {
  color: var(--clr-text-muted);
  font-size: 0.72rem;
  text-transform: lowercase;
}

.tasks-index-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.tasks-index-attachment {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.4rem;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
  font-size: 0.75rem;
  color: var(--clr-text);
  text-decoration: none;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tasks-index-attachment::before {
  content: "📎";
  margin-right: 0.25rem;
  font-size: 0.7rem;
}

.tasks-index-attachment:hover {
  background: #e5e7eb;
}

.tasks-index-table {
  width: 100%;
  margin-top: 1rem;
  /* Fixní layout: sloupec „Úkol" dostane zbylou šířku a dlouhý text se
     zalomí dovnitř buňky místo roztažení tabulky přes okraj stránky. */
  table-layout: fixed;
}

.tasks-index-table tr.archived {
  color: var(--clr-text-muted);
}

/* Per-column widths a styly v tasks index tabulce. */
.tasks-index-table th.col-user,
.tasks-index-table td.col-user,
.tasks-index-table th.col-creator,
.tasks-index-table td.col-creator { width: 8rem; }

.tasks-index-table th.col-closed,
.tasks-index-table td.col-closed {
  width: 6rem;
}

.tasks-index-table th.col-state,
.tasks-index-table td.col-state {
  width: 4rem;
  white-space: nowrap;
}

.tasks-index-table th.col-check { width: 2.5rem; }

.tasks-index-table th.col-priority,
.tasks-index-table td.col-priority { width: 6rem; }

.tasks-index-table th.col-deadline,
.tasks-index-table td.col-deadline { width: 6rem; white-space: nowrap; }

.tasks-index-table th.col-actions,
.tasks-index-table td.col-actions { width: 13rem; }

/* Hlavička řádku (vazby + název úkolu) na jedné lince, název v normální
   velikosti písma jako zbytek tabulky (ne zmenšený jako .button.link). */
.tasks-index-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
}

.tasks-index-title {
  color: var(--clr-text);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: break-word;
  min-width: 0;
}

.tasks-index-title:hover {
  color: var(--clr-indigo, #6366f1);
  text-decoration: underline;
}

/* Checkboxy ve výpisu úkolů v normální velikosti (default render bývá drobný). */
.tasks-index-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--clr-indigo, #6366f1);
  cursor: pointer;
}

.priority-chip {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.8rem;
  background: #f1f3f4;
  color: #555;
}
.priority-chip.priority-medium { background: #fff3cd; color: #8a6d3b; }
.priority-chip.priority-high   { background: #f8d7da; color: #a94442; }

.overdue { color: #a94442; font-weight: 500; }

/* Inline bulk-akce form (Rails form_with -> form wrapper). */
.bulk-form-inline { display: inline; }

/* Drobný "× Zrušit filtr" link v h1 hlavičce tasks. */
.tasks-clear-filter {
  font-size: 0.85rem;
  margin-left: 0.5rem;
}

.tasks-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0 0;
}

/* Reset baseline pro inputy a selecty (display: block; width: 100%)
   přebije přirozenou inline šíři ve flex kontejneru — vrátíme auto,
   aby filtry seděly horizontálně, ne pod sebou. Původně řešeno přes
   form.inline pravidlo z framework/forms.css. */
.tasks-filter select,
.tasks-filter input {
  width: auto;
}

.tasks-filter__search {
  min-width: 16rem;
}

/* Dashboard — moje úkoly (sdílí task-checklist; tady jen drobnosti) */
.dashboard-tasks-desc {
  display: inline;
}

.dashboard-tasks-from {
  color: var(--clr-text-muted);
  font-size: 0.75rem;
}

.dashboard-tasks-empty {
  color: var(--clr-text-muted);
  font-size: 0.85rem;
  margin: 0.25rem 0;
}

/* Tasks index — split-view + preview pane (mirror candidates-index) */
.tasks-index-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-top: 1rem;
}

.tasks-index-grid:has(.tasks-index-right:not([hidden])) {
  grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
}

.tasks-index-left {
  min-width: 0;
}

.tasks-index-row {
  cursor: pointer;
  outline: none;
}

.tasks-index-row:hover {
  background: rgba(0, 0, 0, 0.02);
}

.tasks-index-row:focus,
.tasks-index-row.is-active {
  background: var(--clr-indigo-alpha, rgba(99, 102, 241, 0.08));
  box-shadow: inset 3px 0 0 var(--clr-indigo, #6366f1);
}

.tasks-index-right {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm, 4px);
}

@media (max-width: 1024px) {
  .tasks-index-grid:has(.tasks-index-right:not([hidden])) {
    grid-template-columns: minmax(0, 1fr);
  }
  .tasks-index-right {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(560px, 100vw);
    max-height: 100vh;
    z-index: 50;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.15);
  }
}

/* Úkoly: checklist (entity section + dashboard) — bez rámečků, velký checkbox */
.task-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.task-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f1f1;
  font-size: 0.9rem;
}

.task-checklist-item:last-child {
  border-bottom: none;
}

.task-checklist-item.is-closed {
  color: var(--clr-text-muted);
}

.task-checklist-item.is-closed .tasks-section-desc,
.task-checklist-item.is-closed .dashboard-tasks-desc {
  text-decoration: line-through;
}

.task-checklist-item-main {
  flex: 1;
  min-width: 0;
}

.task-checklist-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Klikatelný řádek úkolu u entity (vede na detail úkolu). */
.task-checklist-link {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  color: var(--clr-text);
}

.task-checklist-link:hover .tasks-section-desc {
  color: var(--clr-indigo, #6366f1);
  text-decoration: underline;
}

.tasks-section-desc {
  font-weight: 500;
}

.tasks-section-excerpt {
  color: var(--clr-text-2);
  font-size: 0.85rem;
  overflow-wrap: break-word;
}

.tasks-section-attrs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.tasks-section-deadline {
  color: var(--clr-text-muted);
  font-size: 0.8rem;
}

.tasks-section-meta {
  color: var(--clr-text-muted);
  font-size: 0.8rem;
}

/* Přílohy uvnitř klikatelného řádku jsou statické (ne odkazy). */
.task-checklist-link .tasks-index-attachment {
  cursor: pointer;
}

/* Velký checkbox jako tlačítko (form se posílá po kliku). */
.task-check-form {
  display: inline-flex;
  vertical-align: middle;
  margin: 0;
  padding: 0;
}

.task-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.task-check-box {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--clr-border, #d1d5db);
  border-radius: 4px;
  background: #fff;
  transition: border-color 0.12s, background 0.12s;
  position: relative;
}

.task-check:hover .task-check-box {
  border-color: var(--clr-indigo, #6366f1);
}

.task-check:hover .task-check-box::after {
  content: "";
  position: absolute;
  inset: 2px;
  background: var(--clr-indigo, #6366f1);
  opacity: 0.15;
  border-radius: 2px;
}

.task-check.is-checked .task-check-box {
  background: var(--clr-indigo, #6366f1);
  border-color: var(--clr-indigo, #6366f1);
}

.task-check.is-checked .task-check-box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

