:root {
  /* "Paleta konstrukce" (2a) – jednotný barevný systém pro interní appky
     (nástroje, finance, péče), zavedený 2026-09-12. Hodnoty jsou stejné
     v denním i nočním režimu, mění se jen to, k čemu se který tón váže.
     Games a pilar tenhle systém nepoužívají – tam zůstává oranžový akcent. */
  --tg-fog: #f2f2f0;
  --tg-cement: #dcdcd8;
  --tg-mist: #9aa3b0;
  --tg-slate: #2c3038;
  --tg-ink: #141619;
  --tg-accent: #3e6c9b;
  --tg-accent-light: #79a9db;

  --ink: var(--tg-ink);
  --ink-soft: var(--tg-slate);
  --paper: var(--tg-fog);
  --surface: #ffffff;
  --surface-2: #f7f7f5;
  --border: var(--tg-cement);
  --text: var(--tg-slate);
  /* Mist má jen 2.3:1 kontrast a je určený "na tmavém" – jako muted text na
     světlém pozadí byl špatně čitelný (ověřeno vizuálně 2026-09-12, viz
     stejná poznámka v pece/style.css). Muted tón proto mícháme ze Slate+Fog. */
  --text-muted: color-mix(in srgb, var(--tg-slate) 65%, var(--tg-fog) 35%);
  --heading: var(--tg-ink);
  --accent: var(--tg-accent);
  --accent-ink: #ffffff;
  --danger: #b3261e;
  --shadow: 0 1px 2px rgba(20, 18, 12, 0.04), 0 6px 16px rgba(20, 18, 12, 0.04);
  --radius: 3px;
  --section-bg: #e6e6e2; /* panel sekce dlaždic – o odstín tmavší než papír */
  --border-strong: var(--tg-mist);
  /* Topbar je vždy tmavá (Ink) bez ohledu na denní/noční režim stránky, proto
     má tenhle akcent jedinou pevnou hodnotu (světlejší modrošedá, ať je
     čitelná na tmavém podkladu) – stejně jako dřív měl jedinou pevnou
     oranžovou bez ohledu na režim. */
  --chrome-accent: var(--tg-accent-light);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: var(--tg-ink);
    --surface: var(--tg-slate);
    --surface-2: #24282e;
    --border: var(--tg-slate);
    --text: var(--tg-mist);
    --text-muted: var(--tg-mist);
    --heading: var(--tg-fog);
    --accent: var(--tg-accent-light);
    --accent-ink: var(--tg-ink);
    --danger: #e5675f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.35);
    --border-strong: var(--tg-mist);
    --section-bg: #1f2227;
  }
}
:root[data-theme="dark"] {
  --paper: var(--tg-ink);
  --surface: var(--tg-slate);
  --surface-2: #24282e;
  --border: var(--tg-slate);
  --text: var(--tg-mist);
  --text-muted: var(--tg-mist);
  --heading: var(--tg-fog);
  --accent: var(--tg-accent-light);
  --accent-ink: var(--tg-ink);
  --danger: #e5675f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 20px rgba(0, 0, 0, 0.35);
  --border-strong: var(--tg-mist);
  --section-bg: #1f2227;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, button, input, select, textarea {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Paleta konstrukce: nadpisy mají vlastní (nejtmavší/nejsvětlejší) tón,
   odlišný od běžného textu (--text) – Ink v denním režimu, Fog v nočním. */
h1, h2, h3 {
  color: var(--heading);
}

/* ---- Topbar / brand (sdíleno se všemi appkami TallGuys) ---- */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: var(--ink);
  border-bottom: 1px solid var(--ink-soft);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  color: #fff;
}

.brand-text strong {
  font-size: 14px;
  letter-spacing: 0.04em;
}

.brand-text span {
  font-size: 11px;
  color: #a9a89f;
  letter-spacing: 0.06em;
}

.topbar-spacer { flex: 1; }

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  color: #d8d6cd;
  font-size: 13px;
  font-weight: 600;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid #3a3a42;
  color: #e7e5dc;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.topbar-btn:hover {
  border-color: var(--chrome-accent);
  color: #fff;
}

/* ---- Login (sdílený vzhled se všemi appkami TallGuys) ---- */

.login-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.login-card input {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  background: var(--paper);
  color: var(--text);
}
@media (max-width: 640px) { .login-card input { font-size: 16px; max-width: 100%; } } /* iOS při fokusu zoomuje pole pod 16 px */

.login-card input:focus {
  outline: none;
  border-color: var(--accent);
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--radius);
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button.primary:hover { filter: brightness(1.05); }
button.primary:disabled { opacity: 0.6; cursor: default; }

.btn-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.login-error {
  color: var(--danger);
  font-size: 13px;
}

/* Přihlášení PINem + dvoukrokové přihlášení (2026-10-12, stejné jako Nástroje Salon PILAR) */
.login-card .pin-input { font-size: 22px; letter-spacing: .6em; text-align: center; font-variant-numeric: tabular-nums; }
.login-mode-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; text-align: left; text-decoration: underline; text-underline-offset: 3px; transition: opacity .2s, text-underline-offset .2s; }
.login-mode-btn:hover { opacity: .8; text-underline-offset: 5px; }

/* Dvoukrokové přihlášení (2026-10-12): e-mail → PIN / heslo. Pole se rozbalují plynule (grid 0fr → 1fr + fade). */
.login-card { gap: 0; transition: opacity .3s ease, transform .3s ease; animation: login-in .45s cubic-bezier(.2,.8,.2,1) both; }
.login-card > .brand, .login-card > button.primary { margin-top: 14px; }
.login-card > .brand { margin-top: 0; }
.login-card > .login-error { margin-top: 12px; }
.login-reveal { display: grid; grid-template-rows: 0fr; opacity: 0; transform: translateY(-6px);
  transition: grid-template-rows .35s cubic-bezier(.2,.8,.2,1), opacity .25s ease, transform .35s cubic-bezier(.2,.8,.2,1), margin-top .35s; margin-top: 0; pointer-events: none; }
.login-reveal > div { overflow: hidden; min-height: 0; padding: 2px; margin: -2px; }
.login-reveal.open { grid-template-rows: 1fr; opacity: 1; transform: none; margin-top: 14px; pointer-events: auto; transition-delay: .08s; }
#emailStep.open, #whoStep.open { margin-top: 0; }
.login-card input { transition: border-color .2s, box-shadow .2s, background .2s; }
.login-card input:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); }
.login-card input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.login-card button.primary { transition: filter .2s, transform .15s, box-shadow .2s; }
.login-card button.primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.login-card button.primary:not(:disabled):active { transform: translateY(0); box-shadow: none; }
.btn-label { display: inline-block; transition: opacity .15s, transform .15s; }
.btn-label.swap { opacity: 0; transform: translateY(3px); }
.login-who { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--paper); font-size: 14px; transition: border-color .2s; }
.login-who:hover { border-color: var(--border-strong); }
.login-who-avatar { flex: none; width: 26px; height: 26px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700; border-radius: var(--radius); }
.login-who-email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.login-who-change { flex: none; border: 0; background: none; padding: 2px 4px; color: var(--accent); font: inherit; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; transition: opacity .2s; }
.login-who-change:hover { opacity: .75; text-decoration: underline; text-underline-offset: 3px; }
.login-card.shake { animation: login-shake .4s ease; }
.login-card.leaving { opacity: 0; transform: translateY(-8px) scale(.98); }
@keyframes login-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes login-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) {
  .login-card, .login-reveal, .btn-label, .login-card button.primary { transition: none !important; animation: none !important; }
}

/* ---- Dashboard: mřížka dlaždic uprostřed stránky ---- */

.dashboard-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.dashboard-inner {
  width: 100%;
  max-width: 2000px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

@media (max-width: 640px) { .dashboard-main { padding: 20px 12px 32px; align-items: flex-start; } }

.dashboard-heading {
  text-align: center;
}

.dashboard-heading h1 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: 0.01em;
}

.dashboard-heading p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  width: 100%;
}
@media (max-width: 640px) { .tile-grid { gap: 8px; } }

.tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
/* Mobil: dlaždice jako kompaktní řádek (ikona vlevo, titulek + popis vpravo) – 20+ dlaždic pod sebou se dá projet palcem. */
@media (max-width: 640px) {
  .tile { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; row-gap: 2px; align-content: center; align-items: center; padding: 10px 12px; min-height: 60px; }
}

/* Klávesová zkratka dlaždice (⌘1–⌘5) v pravém horním rohu */
.tile { position: relative; }
.tile-kbd {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font: 600 11px/1.4 "Montserrat", sans-serif;
  color: var(--text-muted);
  background: transparent;
}
.tile:hover .tile-kbd { color: var(--text); border-color: var(--accent); }
@media (hover: none) { .tile-kbd { display: none; } }

.tile-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
@media (max-width: 640px) { .tile-icon { width: 40px; height: 40px; grid-row: span 2; align-self: center; } }

.tile-title {
  font-size: 15px;
  font-weight: 700;
}

.tile-description {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
@media (max-width: 640px) {
  .tile-title { grid-column: 2; }
  .tile-description { grid-column: 2; font-size: 12.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 40px 0;
}

/* ---- Nastavení ---- */

.settings-main {
  flex: 1;
  padding: 32px 40px 60px;
  display: flex;
  justify-content: center;
}

.settings-inner {
  width: 100%;
  max-width: 2000px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 28px;
}

.settings-section h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

@media (max-width: 1024px) { .settings-main { padding: 24px 20px 48px; } }
@media (max-width: 640px) {
  .settings-main { padding: 16px 10px 40px; }
  .settings-section { padding: 18px 14px; }
}

.settings-section .section-hint {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-muted);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.data-table th,
table.data-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

table.data-table tbody tr {
  transition: background-color 0.12s ease;
}

table.data-table tbody tr:hover {
  background: var(--paper);
}

table.data-table td input[type="text"],
table.data-table td input[type="number"],
table.data-table td select {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  width: 100%;
  transition: border-color 0.12s ease;
}

table.data-table td input[type="text"]:focus,
table.data-table td input[type="number"]:focus,
table.data-table td select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Pořadí a ikona jsou krátká pole – nemusí zabírat celou šířku buňky. */
table.data-table td .order-input { width: 64px; }
table.data-table td .icon-input { width: 64px; text-align: center; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--border);
}

.form-row input,
.form-row select {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 11px;
  font-size: 13px;
  background: var(--paper);
  color: var(--text);
  width: 100%;
  transition: border-color 0.12s ease;
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.btn:disabled { opacity: 0.6; cursor: default; }

.btn:hover { border-color: var(--accent); }

.btn.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.btn.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.icon-input { max-width: 70px; text-align: center; }

.access-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.access-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}

.role-admin-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.restricted-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}

table.data-table td .restricted-edit-input { width: 18px; height: 18px; }

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
}

/* Řádek s chybovou hláškou pod konkrétním řádkem tabulky – bez okraje/
   paddingu, dokud je prázdný (skrytý), ať nevytváří vizuální mezeru navíc. */
.row-error-tr td { padding: 0; border-bottom: none; }
.row-error-tr td .row-error:not([hidden]) { padding: 0 0 10px; }

.form-success {
  color: #2f7a4f;
  font-size: 13px;
  margin-top: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .form-success { color: #62c98a; }
}
:root[data-theme="dark"] .form-success { color: #62c98a; }

/* ---- Sekce dlaždic na dashboardu ---- */
.tile-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}
.tile-section {
  background: var(--section-bg);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
}
@media (max-width: 640px) { .tile-section { padding: 12px 10px; } .tile-sections { gap: 12px; } }
.tile-section-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
/* auto-fill (ne auto-fit): ať mají dlaždice ve všech sekcích stejnou šířku,
   i když má sekce jen jednu dvě. */
.tile-sections .tile-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ---- Strom dlaždic v Nastavení (sekce → dlaždice, drag & drop) ---- */
.tile-tree { display: flex; flex-direction: column; gap: 12px; }
.tree-section {
  background: var(--section-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px 10px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.tree-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px 8px;
  cursor: grab;
}
.tree-section-head:active { cursor: grabbing; }
@media (max-width: 640px) { .tree-section-head { flex-wrap: wrap; row-gap: 6px; } }
.tree-section-name {
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 3px 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--heading);
  cursor: text;
}
.tree-section-name:hover { border-color: var(--border-strong); }
.tree-rename {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 4px 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  background: var(--surface);
  color: var(--heading);
  outline: none;
  min-width: min(220px, 100%);
}
.tree-count { font-size: 12px; color: var(--text-muted); }
.tree-spacer { flex: 1; }
.tree-handle { color: var(--text-muted); font-size: 16px; line-height: 1; cursor: grab; user-select: none; }
.tree-children { display: flex; flex-direction: column; gap: 6px; padding-left: 22px; }
@media (max-width: 640px) { .tree-children { padding-left: 6px; } }
.tree-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color 0.12s ease;
  min-width: 0;
}
.tree-tile:hover, .tree-tile.open { border-color: var(--accent); }
.tree-tile[draggable="true"] { cursor: grab; }
.tree-tile[draggable="true"]:active { cursor: grabbing; }
.tree-icon { width: 22px; text-align: center; flex-shrink: 0; }
.tree-title { font-weight: 700; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 0 0 220px; width: 220px; } /* pevná šířka – adresy (.tree-url) začínají u všech dlaždic na stejném místě */
@media (max-width: 640px) { .tree-title, .tree-sub .tree-title { flex: 1 1 auto; width: auto; min-width: 0; } .tree-url { display: none; } }
.tree-url { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.tree-lock { font-size: 12px; }
.tree-chevron { color: var(--text-muted); font-size: 11px; width: 12px; }
.tree-empty { font-size: 12.5px; color: var(--text-muted); padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.tree-add {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 2px;
  cursor: pointer;
}
.tree-add:hover { text-decoration: underline; }
.tree-edit {
  display: grid;
  grid-template-columns: 70px 1fr 1.4fr 1.4fr auto;
  gap: 10px 12px;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px;
  margin: -2px 0 4px;
}
.tree-field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--text-muted); min-width: 0; }
.tree-field input {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  background: var(--paper);
  color: var(--text);
  width: 100%;
}
.tree-field input:focus { outline: none; border-color: var(--accent); }
.tree-edit .restricted-label { padding-bottom: 9px; }
.tree-edit-buttons { grid-column: 1 / -1; display: flex; gap: 8px; }
.tree-edit-buttons .tree-delete { margin-left: auto; }
.tree-edit .tree-form-error { grid-column: 1 / -1; margin: 0; }
@media (max-width: 900px) {
  .tree-edit { grid-template-columns: 70px 1fr; }
  .tree-field-wide { grid-column: 1 / -1; }
}
.tree-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.tree-status { font-size: 12.5px; color: var(--text-muted); }
.tree-status.error { color: var(--danger); }

/* Drag & drop – stejný vzor jako Marketingový plán (akcentní rámeček/linka). */
/* Podstránky dlaždice (Překlad e-shopu → XML mapa, Slovník, …) – odsazeně pod ní, jen odkaz. */
.tree-sub { display: flex; align-items: center; gap: 12px; margin-left: clamp(10px, 4vw, 34px); padding: 6px 12px; font-size: 13px; color: var(--text); text-decoration: none; border: 1px dashed var(--border); border-radius: var(--radius); min-width: 0; }
.tree-sub:hover { border-color: var(--accent); border-style: solid; }
.tree-sub[draggable="true"] { cursor: grab; }
.tree-sub[draggable="true"]:active { cursor: grabbing; }
.tree-sub.dragging { opacity: 0.4; }
.tree-sub.drop-before { box-shadow: 0 -3px 0 0 var(--accent); }
.tree-sub.drop-after { box-shadow: 0 3px 0 0 var(--accent); }
.tree-sub-line { color: var(--text-muted); width: 10px; flex-shrink: 0; margin-left: -4px; }
.tree-sub .tree-title { font-weight: 600; flex-basis: 196px; width: 196px; }
.tree-tile.dragging, .tree-section.dragging { opacity: 0.4; }
.tree-tile.drop-before { box-shadow: 0 -3px 0 0 var(--accent); }
.tree-tile.drop-after { box-shadow: 0 3px 0 0 var(--accent); }
.tree-section.drop-before { box-shadow: 0 -3px 0 0 var(--accent); }
.tree-section.drop-after { box-shadow: 0 3px 0 0 var(--accent); }
.tree-section.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
/* Dotyková náhrada drag & drop ve stromu dlaždic (šipky ↑ ↓, přesun do sekce). Na desktopu s myší skryté – tam se přetahuje za ⠿. */
.tree-move { display: none; align-items: center; gap: 4px; flex: none; }
.tree-move-btn { min-width: 40px; min-height: 40px; padding: 0 10px; font: inherit; font-size: 15px; font-weight: 700; color: var(--heading); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; }
.tree-move-btn:disabled { opacity: .35; cursor: default; }
.tree-move-row { grid-column: 1 / -1; flex-wrap: wrap; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.tree-move-row .tree-move-btn { font-size: 13px; }
.tree-move-row label { display: inline-flex; align-items: center; gap: 6px; }
.tree-move-section { min-height: 40px; max-width: 100%; font: inherit; font-size: 16px; font-weight: 500; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--paper); color: var(--text); }
@media (max-width: 1024px), (pointer: coarse) { .tree-move { display: inline-flex; } .tree-move-row { display: flex; } }

/* ---- Podmenu Nastavení (Dlaždice dashboardu | Práva a uživatelé) ---- */
.settings-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: -12px; }
.settings-tab {
  background: transparent; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 10px 16px; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--text-muted); cursor: pointer;
}
.settings-tab:hover { color: var(--heading); }
.settings-tab.active { color: var(--heading); border-bottom-color: var(--accent); }

/* ---- Profil (profil.html) – jeden pro všechny appky ---- */
.profile-inner { max-width: 760px; }
.profile-form { display: flex; flex-direction: column; gap: 14px; }
.profile-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.profile-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.profile-form input, .profile-form select { font: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); }
@media (max-width: 640px) { .profile-form input, .profile-form select { font-size: 16px; max-width: 100%; } } /* iOS při fokusu zoomuje pole pod 16 px */
.profile-form input:focus, .profile-form select:focus { outline: none; border-color: var(--accent); }
.profile-form input:disabled { background: var(--paper); color: var(--text-muted); border-color: var(--border); }
.profile-actions { display: flex; align-items: center; gap: 14px; }
.profile-actions button.primary { width: auto; padding: 10px 22px; margin: 0; }
.profile-actions .form-success { margin: 0; }
.section-hint.small { font-size: 12px; margin: -6px 0 0; }
.notif-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.notif-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-row:last-child { border-bottom: 0; }
.notif-row.focus { box-shadow: inset 3px 0 0 var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.notif-icon { font-size: 22px; width: 30px; text-align: center; }
.notif-text { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notif-text strong { color: var(--heading); font-size: 14px; }
.notif-text span { color: var(--text-muted); font-size: 12.5px; }
.notif-none { color: var(--text-muted); }
.notif-row a.btn { text-decoration: none; }
@media (max-width: 600px) { .profile-row { grid-template-columns: 1fr; } }
.notif-controls { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.notif-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.notif-toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.notif-controls .btn { align-self: flex-start; text-decoration: none; margin-top: 4px; }

/* Profil → Úvazek a hodinová mzda (Time) */
.work-form { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.work-form h3 { margin: 0; font-size: 15px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.work-form .work-app { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 1px 6px; }
.work-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.profile-form .work-opt { flex-direction: row; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; color: var(--text); background: var(--surface, #fff); }
.profile-form .work-opt input { width: 16px; height: 16px; margin: 2px 0 0; padding: 0; flex: none; accent-color: var(--accent); }
.work-opt > span { display: flex; flex-direction: column; gap: 3px; }
.work-opt strong { font-size: 14px; }
.work-opt small { font-size: 12.5px; font-weight: 500; color: var(--text-muted); line-height: 1.45; }
.work-opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
@media (max-width: 560px) { .work-pick { grid-template-columns: 1fr; } }

/* Výzva na dashboardu: doplň si osobní údaje (datum narození, telefon, pohlaví) – viz app.js. */
.profile-notice { max-width: 720px; margin: 0 auto 18px; background: #fbeeb0; color: #5a4a05; border: 1px solid #e0cf7a; border-radius: var(--radius); padding: 10px 14px; font-size: 13px; font-weight: 600; line-height: 1.5; text-align: center; }
.profile-notice a { color: inherit; text-decoration: underline; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .profile-notice { background: #3a3320; color: #f0dc9a; border-color: #5c5030; } }
:root[data-theme="dark"] .profile-notice { background: #3a3320; color: #f0dc9a; border-color: #5c5030; }

/* PIN v Práva a uživatelé (dialog z nastaveni.js → pinButton) */
.pin-dialog-input { font-size: 22px !important; letter-spacing: .6em; text-align: center; font-variant-numeric: tabular-nums; max-width: 160px; }
.pin-dialog-actions { display: flex; gap: 8px; margin-top: 4px; }

/* =====================================================================================================
 * OBECNÉ RESPONZIVNÍ POJISTKY (nastroje-mobil, 2026-11-02) – jen pod 1024 / 640 px, desktop beze změny.
 * Selektory jsou v :where() = nulová specificita, takže jakékoli pravidlo appky má vždy přednost.
 * ===================================================================================================== */
@media (max-width: 1024px) {
  :where(img, video, iframe, canvas) { max-width: 100%; }
}
@media (max-width: 640px) {
  :where(body) { overflow-wrap: break-word; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  /* Tabulka širší než telefon scrolluje sama v sobě, ne celá stránka (výjimky: .rs-cards, .rs-noscroll). */
  :where(table:not(.rs-cards):not(.rs-noscroll)) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  :where(.rs-scroll) :where(table) { display: table; max-width: none; overflow: visible; }
  /* Dialogy se vejdou do okna. */
  :where(dialog, [role="dialog"], [aria-modal="true"]) { max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; }
  :where(pre) { white-space: pre-wrap; }
}
