:root {
  --bg:#0b0b0c;
  --fg:#fff;
  --muted:#a7a7a7;
  --card:#16171a;
  --brand:#ffffff;
  --border:#2a2b2f;
}

/* Base */
* { box-sizing: border-box }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: 1.05rem;
}

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }

.card { background: var(--card); border-radius: 16px; padding: 24px; box-shadow: 0 8px 28px rgba(0,0,0,.35); margin-bottom: 18px; }

h1, h2 { margin: .3em 0 .5em }
h1 { font-size: 1.7rem }
h2 { font-size: 1.25rem; color: var(--muted) }
small { color: var(--muted) }

label { display: block; font-size: 1rem; margin: .6rem 0 .3rem; color: var(--muted); }
input, select { width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: #0e0f12; color: #fff; outline: none; }

button, .btn { padding: 14px 18px; border-radius: 12px; border: 0; background: var(--brand); color: #000; font-weight: 700; cursor: pointer; transition: background .2s, color .2s; }
button:hover, .btn:hover { background: #d8d8d8; color: #000; }
button[disabled], .btn[disabled] { opacity: .6; cursor: not-allowed; }

.nowrap {white-space: nowrap;}

/* Links */
.link {
  width: 100%; height: 100%;
  color: var(--brand); -webkit-text-fill-color: var(--brand);
  text-decoration: none; font-weight: 600; transition: opacity .2s, background .2s;
  padding: 10px 12px; border-radius: 10px;
}
@media (hover:hover) { .link:hover { background: rgba(255,255,255,.08); text-decoration: underline; } }
.link:active { background: rgba(255,255,255,.12); }

:focus-visible { outline: 3px solid color-mix(in oklab, var(--brand), black 15%); outline-offset: 3px; border-radius: 8px; }

.row { display: flex; gap: 14px; flex-wrap: wrap }
.col { flex: 1 1 260px }

.table { width: 100%; border-collapse: collapse; border-spacing: 0; background: transparent; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 10px; text-align: left; vertical-align: middle; }
.table thead th { position: sticky; top: 0; background: #121316; z-index: 1; padding: 10px; }
.table tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }



.badge { display: inline-block; font-size: .8rem; padding: 5px 9px; border-radius: 999px; background: #1b1e24; border: 1px solid #2a2d34; color: #e1e1e1; margin-left: 6px; }
.alert { padding: 14px; border-radius: 12px; margin-bottom: 10px; border: 1px solid transparent; }
.alert.ok { background:#113015; color:#b6f3c3; border-color:#1c6a2a }
.alert.err { background:#3a1515; color:#ffbdbd; border-color:#6a1c1c }

button, .btn, .link { min-height: 44px; }
input, select { min-height: 44px; }

.input-with-suffix { position: relative; }
.input-with-suffix > span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #a7a7a7; pointer-events: none; font-size: .9rem; }
.input-with-suffix > input { padding-right: 34px; }

.flatpickr-calendar { font-size: 16px; }
input[type="text"][data-datepicker], .flatpickr-input[readonly] { min-height: 48px !important; padding: 10px 12px !important; font-size: 16px !important; line-height: 1.2; box-sizing: border-box; appearance: none; border-radius: 8px; }

@media (max-width: 640px) {
  .container { padding: 16px; }
  .header { flex-direction: column; align-items: flex-start; gap: 8px; }
  h1 { font-size: 1.3rem; line-height: 1.2; }
  h2 { font-size: 1.05rem; }

  .row { flex-direction: column; gap: 10px; }
  .col { flex: 1 1 100%; }

  input[type="number"], input[type="text"][data-datepicker], .flatpickr-input[readonly] { width: 100% !important; }
  button, .btn { width: 100%; }

  table.table { display: block; border: 0; overflow: visible; background: transparent; }
  table.table thead { position: absolute; left: -999rem; height: 1px; width: 1px; overflow: hidden; }
  table.table tbody { display: block; }
  table.table tr { display: block; background: #141518; border: 1px solid #2a2b2f; border-radius: 12px; margin: 10px 0; padding: 0; }
  table.table td { display: block; border: 0; padding: 0; text-align: left; }

  table.table td > a.link, table.table td > .link { display: block; width: 100%; padding: 14px 16px; border-radius: 12px; position: relative; color: var(--brand); -webkit-text-fill-color: var(--brand); }
  table.table td:first-child > a.link, table.table td:first-child > .link { font-weight: 700; }
  table.table td:last-child { margin-top: 0; }
  table.table td:last-child a { display: block; word-break: break-word; }
  table.table td > a.link::after, table.table td > .link::after { content: '\203A'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); opacity: .6; }
  table.table td > a.link:active, table.table td > .link:active { background: rgba(255,255,255,.12); }


  .link, .link:visited { color: var(--brand); -webkit-text-fill-color: var(--brand); }

  /* druhá buňka méně výrazná */
  table.table td:last-child > a.link,
  table.table td:last-child > .link {
    font-size: 0.9rem;
    color: color-mix(in oklab, var(--muted) 85%, white 15%);
    -webkit-text-fill-color: color-mix(in oklab, var(--muted) 85%, white 15%);
    font-weight: 500;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .container { padding: 20px; }
  .table th, .table td { padding: 10px; }
  
  .table td.actions,
.table th.actions {
    white-space: nowrap;
    width: 1%;
}
}

@media (min-width: 1025px) {
  .table td .link { white-space: normal; }
}

.table td a.link,
.table td a.link:link,
.table td a.link:visited,
.table td a.link:hover,
.table td a.link:active,
.table td a[href^="tel:"],
.table td a[href^="mailto:"] {
  color: var(--brand) !important;
  -webkit-text-fill-color: var(--brand) !important;
  
  .table td.actions,
.table th.actions {
    white-space: nowrap;
    width: 1%;
}
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-width: 640px) {
  /* Speciální mobilní zobrazení pro tabulku časových záznamů */
  table.table.table-records {
    display: block;
    border: 0;
    overflow: visible;
    background: transparent;
  }

  table.table.table-records thead {
    display: none; /* hlavičku skryjeme, nahradí ji data-label */
  }

  table.table.table-records tbody {
    display: block;
  }

  table.table.table-records tr {
    display: block;
    background: #141518;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin: 10px 0;
    padding: 8px 10px;
  }

  table.table.table-records td {
    display: block;
    border: 0;
    padding: 4px 10px 4px 7rem; /* místo vlevo pro název */
    text-align: left;
    position: relative;
  }

  table.table.table-records td::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    top: 4px;
    font-weight: 600;
    color: var(--muted);
    white-space: nowrap;
  }

  /* buňka s akcemi – bez labelu, víc místa pro tlačítka */
  table.table.table-records td.actions {
    padding-left: 10px;
    padding-top: 8px;
  }

  table.table.table-records td.actions::before {
    content: '';
  }
}

