/* client/styles/00-tokens.css */
/* Design tokeny – motiv WANET (světlý/tmavý). Komponenty i aplikace používají jen tyto proměnné. */
:root {
  --font-scale: 1;
  --font: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --fs: calc(13.5px * var(--font-scale));
  --fs-sm: calc(12px * var(--font-scale));
  --fs-lg: calc(16px * var(--font-scale));
  --fs-xl: calc(22px * var(--font-scale));
  --ctl: calc(32px * var(--font-scale));       /* výška ovládacích prvků */
  --ctl-sm: calc(26px * var(--font-scale));
  --row: calc(34px * var(--font-scale));       /* výška řádku tabulky */
  --r: 12px;
  --r-sm: 8px;
  --r-xs: 5px;
  --taskbar: calc(48px * var(--font-scale));
  --titlebar: calc(36px * var(--font-scale));

  --bg: #f4f3f0;
  --bg-2: #ebe9e4;
  --surface: #ffffff;
  --surface-2: #f8f7f4;
  --surface-3: #f1efea;
  --line: #e6e3dc;
  --line-2: #d9d5cc;
  --fg: #1c1b1a;
  --fg-2: #4b4844;
  --muted: #8a867e;
  --brand: #9b0030;
  --brand-hover: #7e0027;
  --brand-soft: #fbe9ee;
  --brand-ink: #5c001d;
  --cream: #f3eee6;
  --ok: #178a4c;
  --ok-soft: #e4f5ea;
  --warn: #c7760a;
  --warn-soft: #fff1dc;
  --bad: #c92a2a;
  --bad-soft: #fde7e7;
  --info: #2b6cb0;
  --info-soft: #e5eefa;
  --sh-1: 0 1px 2px rgba(28, 27, 26, 0.05), 0 1px 1px rgba(28, 27, 26, 0.03);
  --sh-2: 0 8px 24px rgba(28, 27, 26, 0.1), 0 2px 6px rgba(28, 27, 26, 0.06);
  --sh-win: 0 18px 50px rgba(28, 27, 26, 0.22), 0 2px 8px rgba(28, 27, 26, 0.1);
  --sh-win-focus: 0 24px 60px rgba(28, 27, 26, 0.3), 0 2px 8px rgba(28, 27, 26, 0.12);
  --glass: rgba(244, 243, 240, 0.94);
  --glass-line: rgba(28, 27, 26, 0.08);
  --wallpaper: linear-gradient(135deg, #5c001d 0%, #9b0030 45%, #c9496d 100%);
  --selection: var(--brand-soft);
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121212;
  --bg-2: #181818;
  --surface: #1d1d1d;
  --surface-2: #242424;
  --surface-3: #2a2a2a;
  --line: #2c2c2c;
  --line-2: #383838;
  --fg: #ececea;
  --fg-2: #c3c1bc;
  --muted: #8d8a84;
  --brand: #e0335f;
  --brand-hover: #f04b74;
  --brand-soft: #3a1420;
  --brand-ink: #ffd3de;
  --ok-soft: #0f2d1c;
  --warn-soft: #3a2608;
  --bad-soft: #3a1515;
  --info-soft: #132742;
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --sh-2: 0 8px 24px rgba(0, 0, 0, 0.5);
  --sh-win: 0 18px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px #383838;
  --sh-win-focus: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px #4a4a4a;
  --glass: rgba(24, 24, 24, 0.94);
  --glass-line: rgba(255, 255, 255, 0.08);
  --wallpaper: linear-gradient(135deg, #1a0008 0%, #5c001d 55%, #9b0030 100%);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"],
  :root:not([data-theme]) {
    --bg: #121212;
    --bg-2: #181818;
    --surface: #1d1d1d;
    --surface-2: #242424;
    --surface-3: #2a2a2a;
    --line: #2c2c2c;
    --line-2: #383838;
    --fg: #ececea;
    --fg-2: #c3c1bc;
    --muted: #8d8a84;
    --brand: #e0335f;
    --brand-hover: #f04b74;
    --brand-soft: #3a1420;
    --brand-ink: #ffd3de;
    --ok-soft: #0f2d1c;
    --warn-soft: #3a2608;
    --bad-soft: #3a1515;
    --info-soft: #132742;
    --sh-1: 0 1px 2px rgba(0, 0, 0, 0.35);
    --sh-2: 0 8px 24px rgba(0, 0, 0, 0.5);
    --sh-win: 0 18px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px #383838;
    --sh-win-focus: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px #4a4a4a;
    --glass: rgba(24, 24, 24, 0.94);
    --glass-line: rgba(255, 255, 255, 0.08);
    --wallpaper: linear-gradient(135deg, #1a0008 0%, #5c001d 55%, #9b0030 100%);
    color-scheme: dark;
  }
}

/* branding zákazníka: akcent (omezený jen na akcentovou barvu) */
:root[data-branded] {
  --brand: var(--brand-custom);
  --brand-hover: var(--brand-custom);
}

:root[data-density="compact"] {
  --ctl: calc(28px * var(--font-scale));
  --row: calc(28px * var(--font-scale));
}

/* client/styles/10-base.css */
/* Základ: reset, typografie, tlačítka, pole, odznaky, tabulka */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  /* aplikace: žádné přiblížení stránky dvojitým klepnutím ani štípnutím (čitelnost řeší velikost písma v Přizpůsobit) */
  touch-action: manipulation;
}
body {
  font: var(--fs) / 1.45 var(--font);
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
#app {
  height: 100%;
}
a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
h1,
h2,
h3 {
  margin: 0 0 8px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
h1 {
  font-size: var(--fs-xl);
}
h2 {
  font-size: var(--fs-lg);
}
h3 {
  font-size: var(--fs);
  color: var(--fg-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--fs-sm);
  margin-top: 14px;
}
p {
  margin: 0 0 10px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: var(--fs-sm);
}
.mono {
  font-family: var(--mono);
  font-size: 0.95em;
}
.right {
  text-align: right;
}
.center {
  text-align: center;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--r-xs);
}

.icon {
  width: 1.2em;
  height: 1.2em;
  flex: 0 0 auto;
  vertical-align: -0.2em;
}
.icon.big {
  width: 2.4em;
  height: 2.4em;
}

/* tlačítka */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--ctl);
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover {
  background: var(--surface-2);
}
.btn:active {
  transform: translateY(0.5px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}
.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn.primary:hover {
  background: var(--brand-hover);
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
}
.btn.ghost:hover {
  background: var(--surface-2);
}
.btn.danger {
  color: var(--bad);
}
.btn.danger.primary {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}
.btn.sm {
  height: var(--ctl-sm);
  padding: 0 9px;
  font-size: var(--fs-sm);
}
.btn.wide {
  width: 100%;
}
.btn .icon {
  width: 1.15em;
  height: 1.15em;
}

/* pole */
.input {
  width: 100%;
  height: var(--ctl);
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
}
.input.sm {
  height: var(--ctl-sm);
  font-size: var(--fs-sm);
  width: auto;
}
textarea.input {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
  min-height: 60px;
}
select.input {
  padding-right: 28px;
}
.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input:read-only:not(select) {
  background: var(--surface-2);
}
.field {
  display: block;
  margin: 0 0 10px;
}
.field-label {
  display: block;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0 0 4px;
  font-weight: 500;
}
.field-label .req {
  color: var(--bad);
}
.field-help {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 4px;
}
.field-error {
  font-size: var(--fs-sm);
  color: var(--bad);
  margin-top: 4px;
  min-height: 0;
}
.field.invalid .input {
  border-color: var(--bad);
}
.field-view {
  min-height: var(--ctl);
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  white-space: pre-wrap;
  word-break: break-word;
}
.field-view.multiline {
  min-height: 60px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  margin: 0;
}
.check.inline {
  margin: 8px 0 4px;
  font-size: var(--fs-sm);
}
.row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* odznaky a avatary */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 500;
  background: var(--surface-3);
  color: var(--fg-2);
  line-height: 1.5;
}
.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge.bad,
.badge.error {
  background: var(--bad-soft);
  color: var(--bad);
}
.badge.info {
  background: var(--info-soft);
  color: var(--info);
}
.badge.count {
  background: var(--brand);
  color: #fff;
  padding: 0 5px;
  min-width: 16px;
  justify-content: center;
  font-size: 10px;
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: var(--fs);
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}
.avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 11px;
}

/* tabulka */
table.t {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs);
}
table.t th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--fg-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 0 10px;
  height: var(--row);
  white-space: nowrap;
  user-select: none;
}
table.t th.right,
table.t td.right {
  text-align: right;
}
table.t th.center,
table.t td.center {
  text-align: center;
}
table.t td {
  padding: 0 10px;
  height: var(--row);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}
table.t tbody tr:hover td {
  background: var(--surface-2);
}
table.t tbody tr.selected td {
  background: var(--selection);
}
table.t tbody tr.cursor td:first-child {
  box-shadow: inset 3px 0 0 var(--brand);
}
table.t th.sortable {
  cursor: pointer;
}
table.t th.sortable:hover {
  color: var(--fg);
}
.th-label {
  margin-right: 4px;
}
.sort-icon {
  width: 0.9em;
  height: 0.9em;
  color: var(--brand);
}
.th-resize {
  position: absolute;
  right: 0;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
}
table.t th {
  position: sticky;
}
table.t th:hover .th-resize {
  background: var(--line-2);
}
.cell-check {
  color: var(--ok);
}
.cell-thumb {
  height: calc(var(--row) - 8px);
  border-radius: 3px;
  vertical-align: middle;
}

/* flash a drobnosti */
.flash {
  background: var(--bad-soft);
  color: var(--bad);
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  margin-bottom: 10px;
}
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
  height: 100%;
}
.error-state .icon.big {
  color: var(--warn);
}
.error-title {
  font-weight: 600;
  color: var(--fg);
}
.error-id {
  font-size: var(--fs-sm);
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

/* client/styles/20-components.css */
/* Komponenty: menu, dialog, toast, ribbon, záložky, strom, dělený panel, stavový řádek */

/* menu */
iw-menu {
  position: fixed;
  z-index: 10000;
  min-width: 200px;
  max-width: 360px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-2);
  font-size: var(--fs);
  outline: none;
  animation: pop 0.1s ease-out;
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
}
.menu-item {
  display: grid;
  grid-template-columns: 16px 20px 1fr auto 14px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  height: var(--ctl);
  border-radius: var(--r-xs);
  cursor: pointer;
  white-space: nowrap;
}
.menu-item:hover,
.menu-item.focus {
  background: var(--surface-2);
}
.menu-item.disabled {
  opacity: 0.45;
  cursor: default;
}
.menu-item.danger {
  color: var(--bad);
}
.menu-check,
.menu-icon,
.menu-arrow {
  display: inline-flex;
  justify-content: center;
  color: var(--fg-2);
}
.menu-item.danger .menu-icon {
  color: var(--bad);
}
.menu-check .icon {
  color: var(--brand);
}
.menu-shortcut {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-left: 16px;
}
.menu-sep {
  height: 1px;
  background: var(--line);
  margin: 4px 6px;
}

/* dialog */
dialog.iw-dialog {
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--fg);
  padding: 0;
  width: min(440px, calc(100vw - 32px));
  box-shadow: var(--sh-win);
  font: inherit;
}
dialog.iw-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
}
dialog.iw-dialog form {
  padding: 18px 20px 16px;
}
.dialog-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.dialog-title .icon {
  color: var(--warn);
}
.dialog-body {
  margin-bottom: 14px;
}
.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* toast */
.toast-host {
  position: fixed;
  right: 16px;
  bottom: calc(var(--taskbar) + 12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10001;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line-2);
  border-left-width: 4px;
  border-radius: var(--r-sm);
  box-shadow: var(--sh-2);
  max-width: 360px;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s;
  pointer-events: auto;
  cursor: pointer;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast.ok {
  border-left-color: var(--ok);
}
.toast.ok .icon {
  color: var(--ok);
}
.toast.warn {
  border-left-color: var(--warn);
}
.toast.warn .icon {
  color: var(--warn);
}
.toast.error {
  border-left-color: var(--bad);
}
.toast.error .icon {
  color: var(--bad);
}
.toast.info {
  border-left-color: var(--info);
}

/* ribbon */
iw-ribbon {
  display: block;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  user-select: none;
}
.ribbon-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  min-height: calc(var(--ctl-sm) + 8px);
}
.ribbon-tabs {
  display: flex;
  gap: 2px;
}
.ribbon-tab {
  border: 0;
  background: transparent;
  color: var(--fg-2);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--r-xs) var(--r-xs) 0 0;
  cursor: pointer;
}
.ribbon-tab.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: inset 0 -2px 0 var(--brand);
}
.ribbon-right {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  margin-left: auto;
  flex: 0 0 auto;
}
/* kompaktní lišta: malá tlačítka přímo v hlavičkovém pruhu (místo oušek) */
.ribbon-bar,
.ribbon-row {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ribbon-row::-webkit-scrollbar,
.ribbon-bar::-webkit-scrollbar {
  display: none;
}
.ribbon-bar {
  flex: 0 1 auto;
}
.ribbon-sep {
  width: 1px;
  height: 18px;
  background: var(--line-2);
  margin: 0 4px;
  flex: 0 0 auto;
}
.ribbon-collapse,
.ribbon-search-toggle {
  flex: 0 0 auto;
  width: var(--ctl-sm);
  height: var(--ctl-sm);
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ribbon-collapse:hover,
.ribbon-search-toggle:hover {
  background: var(--surface-3);
  color: var(--fg);
}
/* sbalený ribbon: jen hlavička; kliknutí na ouško dočasně vysune tělo přes obsah */
iw-ribbon.collapsed:not(.peek) .ribbon-body {
  display: none;
}
iw-ribbon.collapsed.peek {
  position: relative;
}
iw-ribbon.collapsed.peek .ribbon-body {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 20;
  box-shadow: var(--sh-2);
  border-bottom: 1px solid var(--line);
}
/* mobil: jeden posuvný řádek, hledání jako lupa */
iw-ribbon.mobile .ribbon-body {
  padding: 4px 8px;
}
iw-ribbon.mobile .ribbon-right .search-wrap {
  display: none;
}
iw-ribbon.mobile.search-open .ribbon-right .search-wrap {
  display: flex;
  position: absolute;
  left: 8px;
  right: 44px;
  top: 4px;
  width: auto;
  z-index: 2;
}
iw-ribbon.mobile .ribbon-head {
  position: relative;
}
.ribbon-head:has(.ribbon-tabs[hidden]):has(.ribbon-bar[hidden]) {
  min-height: 0;
}
/* panel odspodu */
.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: 10000;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}
.sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 80vh;
  background: var(--surface);
  border-radius: var(--r) var(--r) 0 0;
  box-shadow: var(--sh-win);
  display: flex;
  flex-direction: column;
  animation: sheet-in 0.18s ease-out;
}
@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.sheet-body {
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sheet-body .ribbon-control,
.sheet-body .ribbon-control .input.sm,
.sheet-body .filter.range .input.sm {
  width: 100%;
  max-width: none;
}
.ribbon-body {
  display: flex;
  gap: 4px;
  padding: 6px 8px 4px;
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: thin;
}
.ribbon-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 8px;
  border-right: 1px solid var(--line);
}
.ribbon-group:last-child {
  border-right: 0;
}
.ribbon-group-items {
  display: flex;
  gap: 2px;
  align-items: flex-start;
  flex-wrap: wrap;
  max-height: calc(2 * var(--ctl-sm) + 4px);
  flex-direction: column;
}
.ribbon-group-items:has(.ribbon-btn:not(.small)) {
  flex-direction: row;
  flex-wrap: nowrap;
  max-height: none;
}
.ribbon-group-label {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
}
.ribbon-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.2;
}
.ribbon-btn .ribbon-icon {
  width: 24px;
  height: 24px;
  color: var(--brand);
}
.ribbon-btn.small {
  flex-direction: row;
  min-width: 0;
  height: var(--ctl-sm);
  padding: 0 8px;
  gap: 6px;
}
.ribbon-btn.small .ribbon-icon {
  width: 16px;
  height: 16px;
}
.ribbon-btn:hover {
  background: var(--surface-2);
  border-color: var(--line);
}
.ribbon-btn.active {
  background: var(--brand-soft);
  border-color: var(--brand);
}
.ribbon-btn.danger .ribbon-icon {
  color: var(--bad);
}
.ribbon-btn.primary .ribbon-icon {
  color: var(--brand);
}
.ribbon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.ribbon-caret {
  width: 10px;
  height: 10px;
}
.search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 0 8px;
  height: var(--ctl-sm);
  width: 220px;
  color: var(--muted);
}
.search-wrap .input.search {
  border: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  box-shadow: none;
  font-size: var(--fs-sm);
}

/* záložky */
iw-tabs {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.tabs-head {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  padding: 0 4px;
  flex: 0 0 auto;
}
.tab {
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--fg-2);
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}
.tabs-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.tab-panel {
  padding: 14px 16px;
}

/* dělený panel */
iw-split {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}
iw-split.first-hidden .split-first,
iw-split.first-hidden .split-handle,
iw-split.overlay .split-handle {
  display: none;
}
iw-split.overlay .split-first {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 5;
  width: min(280px, 80%) !important;
  box-shadow: var(--sh-2);
}
.split-first {
  flex: 0 0 220px;
  min-width: 120px;
  overflow: auto;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
}
.split-handle {
  width: 5px;
  margin: 0 -2px;
  cursor: col-resize;
  z-index: 1;
}
.split-handle:hover {
  background: var(--brand-soft);
}
.split-second {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* strom */
iw-tree {
  display: block;
  padding: 6px 4px;
  font-size: var(--fs);
  user-select: none;
}
.tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--ctl-sm);
  padding-right: 8px;
  border-radius: var(--r-xs);
  cursor: pointer;
  white-space: nowrap;
}
.tree-row:hover {
  background: var(--surface-3);
}
.tree-row.selected {
  background: var(--selection);
  color: var(--brand-ink);
}
.tree-row.drop {
  outline: 2px dashed var(--brand);
}
.tree-toggle {
  width: 16px;
  display: inline-flex;
  justify-content: center;
  color: var(--muted);
}
.tree-toggle .icon {
  width: 12px;
  height: 12px;
}
.tree-icon {
  color: var(--brand);
}
.tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* stavový řádek */
.statusbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--ctl-sm);
  padding: 0 10px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  font-size: var(--fs-sm);
  color: var(--fg-2);
  flex: 0 0 auto;
}
.status-part:empty {
  display: none;
}
.status-part:last-child {
  margin-left: auto;
}
.pager {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ovládací prvky v ribbonu, štítky filtrů, vysouvací panel */
.ribbon-group.has-controls .ribbon-group-items {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  max-height: calc(2 * var(--ctl-sm) + 6px);
  max-width: 560px;
  gap: 4px 6px;
}
.ribbon-control {
  display: inline-flex;
  align-items: center;
}
.ribbon-control .input.sm {
  min-width: 100px;
  max-width: 170px;
}
.ribbon-control .filter.range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ribbon-control .filter.range .input.sm {
  min-width: 0;
  width: 122px;
}
.filter-dash {
  color: var(--muted);
}
.filter-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: var(--ctl-sm);
  padding: 0 6px 0 10px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  white-space: nowrap;
}
.chip-label {
  color: var(--muted);
}
.chip .icon {
  width: 12px;
  height: 12px;
}
.ribbon-popover {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-2);
  animation: pop 0.1s ease-out;
}
.ribbon-popover .ribbon-control,
.ribbon-popover .ribbon-btn {
  width: 100%;
  justify-content: flex-start;
}
.ribbon-popover .ribbon-control .input.sm {
  max-width: none;
  width: 100%;
}
/* posuvný řádek: položky se nikdy nesmršťují ani nelámou – řádek se posouvá */
.ribbon-row > .ribbon-btn,
.ribbon-row > .ribbon-control,
.ribbon-bar > .ribbon-btn {
  flex: 0 0 auto;
}
.ribbon-body > .ribbon-group {
  flex: 0 0 auto;
}
.sheet-body .filter.range {
  flex-wrap: wrap;
}
.sheet-body .filter.range .input.sm {
  flex: 1 1 120px;
  width: auto;
}

/* adresní řádek (okna typu Průzkumník): navigace + cesta pod ribbonem */
iw-addressbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex: 0 0 auto;
}
iw-addressbar .crumbs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 6px;
  padding: 0 6px;
  height: var(--ctl-sm);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  overflow: hidden;
  white-space: nowrap;
}
.crumb {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--fg);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  cursor: pointer;
  white-space: nowrap;
}
.crumb:hover {
  background: var(--surface-2);
}
.crumb-sep {
  width: 12px;
  height: 12px;
  color: var(--muted);
  flex: 0 0 auto;
}
.tree-toggle.active {
  background: var(--brand-soft);
  color: var(--brand);
}
.address-extra {
  display: flex;
  gap: 4px;
  margin-left: 6px;
}

/* složená pole: opakované řádky, štítky, obrázek */
.rows-row {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin-bottom: 6px;
}
.rows-row .input {
  width: auto;
  min-width: 0;
}
.rows-row .btn {
  flex: 0 0 auto;
  padding: 0 6px;
}
.rows-view-row {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}
.rows-type {
  color: var(--muted);
  font-size: var(--fs-sm);
  min-width: 70px;
}
.tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.tag-chip {
  gap: 4px;
}
.tag-x {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0 2px;
  color: var(--muted);
}
.tags-input {
  width: 220px;
}
.image-field {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.image-box {
  width: 112px;
  height: 112px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
}
.image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-empty {
  color: var(--muted);
}
@media (max-width: 600px) {
  .rows-row {
    flex-wrap: wrap;
  }
}

/* režim výběru (dotyk): zaškrtávátko před položkou */
.sel-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--line-2);
  background: var(--surface);
  color: transparent;
  flex: 0 0 auto;
  margin-right: 6px;
  vertical-align: middle;
}
.sel-check .icon {
  display: none;
  width: 14px;
  height: 14px;
}
tr.selected .sel-check,
.tile.selected .sel-check,
.desktop-icon.selected .sel-check {
  background: var(--brand);
  border-color: var(--brand);
}
tr.selected .sel-check .icon,
.tile.selected .sel-check .icon,
.desktop-icon.selected .sel-check .icon {
  display: block;
  color: #fff;
  stroke: #fff;
}
.di-check {
  position: absolute;
  left: -6px;
  top: -6px;
}
.tile .sel-check {
  position: absolute;
  left: 6px;
  top: 6px;
  margin: 0;
}
.tile {
  position: relative;
}

/* barva: vzorník + vlastní */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0;
}
.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--c);
  cursor: pointer;
  padding: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.color-swatch.selected {
  border-color: var(--fg);
  box-shadow: 0 0 0 2px var(--surface), inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.color-swatch.custom {
  background: var(--c, var(--surface-2));
  color: var(--fg);
  border-style: dashed;
  border-color: var(--line-2);
}
.color-swatch.custom.selected {
  border-style: solid;
  border-color: var(--fg);
}
.color-swatch.custom .icon {
  width: 14px;
  height: 14px;
  pointer-events: none;
  mix-blend-mode: difference;
  color: #fff;
}
.color-custom {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.color-view {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  font-size: var(--fs-sm);
}
.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--c);
  display: inline-block;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* seznam: levý panel vrstev (zaškrtávátka s barvou) a dlaždice */
.list-view.has-side iw-split {
  flex: 1;
  min-height: 0;
}
.list-view.has-side .list-content {
  height: 100%;
}
.list-side {
  padding: 10px;
  font-size: var(--fs-sm);
  overflow: auto;
  height: 100%;
}
.list-side h3 {
  margin: 0 0 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.layer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
}
.layer input {
  accent-color: var(--brand);
  margin: 0;
}
.layer-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.layer .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}
.layer-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* cíl přetažení řádků (stejně jako složky ve stromu) */
.layer.drop {
  outline: 2px dashed var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}
/* dialog „Přesunout do…“ – výběr vrstvy */
.layer-pick {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 50vh;
  overflow: auto;
}
.layer-pick .layer {
  padding: 6px 4px;
  border-radius: 4px;
}
.layer-pick .layer:hover {
  background: var(--surface-2);
}
/* obnovený rozpracovaný záznam: lišta nad formulářem */
.record-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  font-size: var(--fs-sm);
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
  border-bottom: 1px solid var(--border);
}
.record-notice span {
  flex: 1;
}
/* pomoc s textem (kap. 34): tlačítko AI u pole a dialog s návrhem */
.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--brand);
  border-radius: 999px;
  padding: 0 7px;
  height: 20px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0.75;
}
.ai-btn .icon {
  width: 13px;
  height: 13px;
}
.ai-btn:hover,
.field:focus-within .ai-btn {
  opacity: 1;
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
}
.ai-off .ai-btn {
  display: none;
}
.ai-dialog {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 60vh;
  overflow: auto;
}
.ai-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.ai-text {
  white-space: pre-wrap;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
}
.ai-original .ai-text {
  max-height: 140px;
  overflow: auto;
  background: transparent;
  border: 1px dashed var(--border);
}
.ai-result .ai-text {
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
}
.ai-working {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  padding: 8px 0;
}
.ai-note {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-note .icon {
  width: 14px;
  height: 14px;
}
.ai-error {
  color: var(--danger);
}
.icon.spin {
  animation: ai-spin 1.4s linear infinite;
}
@keyframes ai-spin {
  to {
    transform: rotate(360deg);
  }
}
iw-cards {
  display: block;
  height: 100%;
  overflow: auto;
  outline: none;
  padding: 10px;
  box-sizing: border-box;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
.card {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: default;
  user-select: none;
  min-width: 0;
}
.card:hover {
  background: var(--surface-2);
}
.card.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.card-media {
  flex: 0 0 auto;
}
.card-img,
.card-initials {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  color: var(--muted);
  font-weight: 600;
  font-size: 18px;
}
.card-body {
  min-width: 0;
  flex: 1;
}
.card-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-sub,
.card-line {
  font-size: var(--fs-sm);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-badge {
  margin-top: 4px;
}
.card .sel-check {
  position: absolute;
  left: 6px;
  top: 6px;
  margin: 0;
}
.card.selected .sel-check {
  background: var(--brand);
  border-color: var(--brand);
}
.card.selected .sel-check .icon {
  display: block;
  color: #fff;
  stroke: #fff;
}
@media (max-width: 600px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

/* zaškrtávátka po skupinách */
.checks-field {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 18px;
}
.checks-group {
  break-inside: avoid;
}
.checks-group h3 {
  margin: 8px 0 4px;
}
.checks-group .check {
  display: flex;
  padding: 3px 0;
}
.checks-field.view .check input {
  display: none;
}
.checks-field.view .check::before {
  content: "•";
  color: var(--brand);
  margin-right: 6px;
}

/* client/styles/30-window.css */
/* Okno (Win 11 styl): zaoblené rohy, jemný stín, titulek s tlačítky vpravo */
.windows-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.windows-layer > * {
  pointer-events: auto;
}
iw-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: var(--sh-win);
  overflow: hidden;
  min-width: 320px;
  min-height: 200px;
  outline: none;
  transition: opacity 0.12s, transform 0.12s;
  animation: win-in 0.14s ease-out;
}
@keyframes win-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
}
iw-window.focused {
  box-shadow: var(--sh-win-focus);
  border-color: var(--line-2);
}
iw-window:not(.focused) .win-titlebar {
  color: var(--muted);
}
iw-window.minimized {
  opacity: 0;
  transform: translateY(40px) scale(0.9);
  pointer-events: none;
}
iw-window.closing {
  opacity: 0;
  transform: scale(0.97);
}
iw-window.maximized {
  border-radius: 0;
  border: 0;
}
iw-window.dragging {
  transition: none;
  user-select: none;
}
iw-window.has-modal {
  pointer-events: none;
  filter: saturate(0.7) brightness(0.96);
}
iw-window.modal {
  z-index: 5000 !important;
}
iw-window.dirty .win-title::after {
  content: " •";
  color: var(--brand);
}
.win-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--titlebar);
  padding: 0 4px 0 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  user-select: none;
  cursor: default;
  flex: 0 0 auto;
}
iw-window.focused .win-titlebar {
  background: var(--surface);
}
.win-icon {
  display: inline-flex;
  color: var(--brand);
}
.win-title {
  flex: 1;
  font-weight: 600;
  font-size: var(--fs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.win-identity {
  font-size: var(--fs-sm);
  color: var(--warn);
  font-weight: 600;
}
iw-window.run-as {
  border-color: var(--warn);
}
.win-buttons {
  display: flex;
}
.win-btn {
  width: calc(var(--titlebar) + 8px);
  height: calc(var(--titlebar) - 4px);
  border: 0;
  background: transparent;
  color: var(--fg-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
}
.win-btn .icon {
  width: 14px;
  height: 14px;
}
.win-btn:hover {
  background: var(--surface-3);
  color: var(--fg);
}
.win-btn.close:hover {
  background: var(--bad);
  color: #fff;
}
.win-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}
.win-resize {
  position: absolute;
  z-index: 3;
}
.win-resize.n,
.win-resize.s {
  left: 8px;
  right: 8px;
  height: 6px;
  cursor: ns-resize;
}
.win-resize.n {
  top: -3px;
}
.win-resize.s {
  bottom: -3px;
}
.win-resize.e,
.win-resize.w {
  top: 8px;
  bottom: 8px;
  width: 6px;
  cursor: ew-resize;
}
.win-resize.e {
  right: -3px;
}
.win-resize.w {
  left: -3px;
}
.win-resize.ne,
.win-resize.nw,
.win-resize.se,
.win-resize.sw {
  width: 12px;
  height: 12px;
}
.win-resize.ne {
  top: -4px;
  right: -4px;
  cursor: nesw-resize;
}
.win-resize.nw {
  top: -4px;
  left: -4px;
  cursor: nwse-resize;
}
.win-resize.se {
  bottom: -4px;
  right: -4px;
  cursor: nwse-resize;
}
.win-resize.sw {
  bottom: -4px;
  left: -4px;
  cursor: nesw-resize;
}
iw-window.maximized .win-resize,
iw-window.force-max .win-resize {
  display: none;
}
.snap-hint {
  position: absolute;
  inset: 0;
  border: 2px solid var(--brand);
  background: var(--brand-soft);
  opacity: 0.5;
  border-radius: var(--r-sm);
  pointer-events: none;
  z-index: 9000;
}
.snap-hint[data-zone="left"] {
  right: 50%;
}
.snap-hint[data-zone="right"] {
  left: 50%;
}

/* pohledy uvnitř okna */
.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.list-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}
.list-view.loading .list-content {
  opacity: 0.6;
}
iw-table {
  display: block;
  position: relative;
}
.table-scroll {
  overflow: auto;
}
.table-empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
.filter.range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.filter-label {
  color: var(--muted);
}
.record-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.record-view .tab-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  align-content: flex-start;
}
.record-view .field.w-full {
  flex: 1 1 100%;
}
.record-view .field.w-half {
  flex: 1 1 calc(50% - 8px);
  min-width: 200px;
}
.record-view .field-bool {
  padding-top: 6px;
}
.record-view:not(.editing) .field-bool input {
  pointer-events: none;
}

/* mobil / tablet: okna přes celou plochu, větší cíle */
:root[data-mode="mobile"] iw-window {
  border-radius: 0;
  border: 0;
}
:root[data-mode="mobile"] .win-btn:not(.close) {
  display: none;
}
:root[data-mode="mobile"] .record-view .field.w-half {
  flex-basis: 100%;
}
:root[data-mode="tablet"] .win-btn,
:root[data-mode="mobile"] .win-btn {
  width: 44px;
}
@media (pointer: coarse) {
  :root {
    --ctl: calc(40px * var(--font-scale));
    --row: calc(40px * var(--font-scale));
  }
}

/* client/styles/40-shell.css */
/* Plocha, hlavní panel, Start, zámek */
.desktop {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.desktop.taskbar-top {
  flex-direction: column-reverse;
}
.desktop-area {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.desktop-wallpaper {
  position: absolute;
  inset: 0;
  background: var(--wallpaper);
  background-size: cover;
  background-position: center;
  transition: background 0.3s;
}
.desktop-area.drop::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px dashed rgba(255, 255, 255, 0.8);
  border-radius: var(--r);
  pointer-events: none;
}
.desktop-icons {
  position: absolute;
  inset: 0;
  padding: 12px;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 96px);
  grid-auto-columns: 92px;
  gap: 6px;
  align-content: start;
  justify-content: start;
}
.desktop-icons[data-size="small"] {
  grid-template-rows: repeat(auto-fill, 72px);
  grid-auto-columns: 76px;
}
.desktop-icons[data-size="large"] {
  grid-template-rows: repeat(auto-fill, 120px);
  grid-auto-columns: 112px;
}
.di-shared {
  position: absolute;
  right: -4px;
  bottom: -2px;
  width: 16px;
  height: 16px;
  padding: 2px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--sh-1);
}
.di-icon {
  position: relative;
}
.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: var(--fs-sm);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  cursor: default;
  width: 100%;
  overflow: hidden;
}
.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}
.desktop-icon.selected {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.5);
}
.di-icon {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
}
.desktop-icons[data-size="small"] .di-icon {
  width: 30px;
  height: 30px;
}
.desktop-icons[data-size="large"] .di-icon {
  width: 60px;
  height: 60px;
}
.di-icon .icon {
  width: 100%;
  height: 100%;
  stroke-width: 1.6;
}
.di-shortcut {
  position: relative;
  display: inline-flex;
  width: 100%;
  height: 100%;
}
.di-arrow {
  position: absolute;
  left: -4px;
  bottom: -4px;
  width: 18px;
  height: 18px;
  background: #fff;
  color: var(--brand);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.di-arrow .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
}
.di-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}
.di-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
  text-align: center;
  word-break: break-word;
}

/* hlavní panel */
.taskbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--taskbar);
  padding: 0 8px;
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.3);
  border-top: 1px solid var(--glass-line);
  z-index: 9500;
  flex: 0 0 auto;
  user-select: none;
}
.desktop.taskbar-top .taskbar {
  border-top: 0;
  border-bottom: 1px solid var(--glass-line);
}
.tb-left,
.tb-right {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.tb-left {
  flex: 1;
}
.desktop.taskbar-center .tb-left {
  justify-content: center;
}
.tb-start,
.tb-pin,
.tb-tray-btn,
.tb-user,
.tb-clock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--taskbar) - 10px);
  min-width: calc(var(--taskbar) - 10px);
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font: inherit;
  position: relative;
}
.tb-start:hover,
.tb-pin:hover,
.tb-tray-btn:hover,
.tb-user:hover,
.tb-clock:hover,
.tb-task:hover {
  background: var(--surface-3);
}
.tb-start.active {
  background: var(--surface-3);
}
.tb-logo {
  width: 22px;
  height: 22px;
  color: var(--brand);
}
.tb-pin .icon,
.tb-tray-btn .icon {
  width: 20px;
  height: 20px;
}
.tb-pin .icon {
  color: var(--brand);
}
.tb-pinned {
  display: flex;
  gap: 2px;
  padding-right: 6px;
  margin-right: 4px;
  border-right: 1px solid var(--glass-line);
}
.tb-pinned:empty {
  display: none;
}
.tb-running {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}
.tb-task {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: calc(var(--taskbar) - 10px);
  max-width: 200px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--fg);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 -3px 0 var(--line-2);
}
.tb-task .icon {
  width: 18px;
  height: 18px;
  color: var(--brand);
  flex: 0 0 auto;
}
.tb-task-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tb-task.active {
  background: var(--surface);
  box-shadow: inset 0 -3px 0 var(--brand);
}
.tb-task.minimized {
  opacity: 0.7;
}
.tb-task .badge.count {
  position: absolute;
  top: 2px;
  right: 2px;
}
.tb-tray {
  display: flex;
  gap: 2px;
}
.tb-tray-btn .badge.count {
  position: absolute;
  top: 2px;
  right: 2px;
}
.tb-conn {
  display: inline-flex;
  padding: 0 6px;
  color: var(--muted);
}
.tb-conn.bad {
  color: var(--bad);
}
.tb-clock {
  flex-direction: column;
  line-height: 1.15;
  font-size: var(--fs-sm);
  padding: 0 10px;
}
.tb-time {
  font-weight: 600;
}
.tb-date {
  color: var(--muted);
  font-size: 11px;
}

/* Start */
.start-menu {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--taskbar) + 10px);
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100vh - var(--taskbar) - 30px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--glass-line);
  border-radius: var(--r);
  box-shadow: var(--sh-win);
  z-index: 9600;
  animation: start-in 0.14s ease-out;
  overflow: hidden;
}
.desktop:not(.taskbar-center) .start-menu {
  left: 10px;
  transform: none;
}
.desktop.taskbar-top .start-menu {
  bottom: auto;
  top: calc(var(--taskbar) + 10px);
}
@keyframes start-in {
  from {
    opacity: 0;
    transform: translateX(var(--sx, -50%)) translateY(10px);
  }
}
.desktop:not(.taskbar-center) .start-menu {
  --sx: 0;
}
.start-search {
  height: var(--ctl);
  border-radius: 999px;
  padding: 0 16px;
}
.start-section {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--fg-2);
  margin-top: 4px;
}
.start-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 4px;
  overflow: auto;
  max-height: 300px;
}
.start-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  text-align: center;
}
.start-tile:hover {
  background: var(--surface-3);
}
.start-tile .icon.big {
  width: 32px;
  height: 32px;
  color: var(--brand);
}
.start-tile span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.start-recent {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}
.start-recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--ctl);
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: var(--fs-sm);
  border-radius: var(--r-xs);
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
}
.start-recent-item:hover {
  background: var(--surface-3);
}
.start-recent-item .icon {
  color: var(--brand);
}
.start-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-line);
}
.start-user {
  flex: 1;
  font-weight: 500;
}

/* zámek a znovupřihlášení */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--wallpaper);
  color: #fff;
}
.lock-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  backdrop-filter: blur(20px);
  background: rgba(0, 0, 0, 0.35);
}
.lock-screen > * {
  position: relative;
}
.lock-clock {
  font-size: 64px;
  font-weight: 200;
  letter-spacing: -0.02em;
}
.lock-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(320px, calc(100vw - 32px));
  color: var(--fg);
  background: var(--surface);
  padding: 24px;
  border-radius: var(--r);
  box-shadow: var(--sh-win);
}
.lock-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
}
.lock-name {
  font-size: var(--fs-lg);
  font-weight: 600;
}
.lock-hint {
  text-align: center;
  font-size: var(--fs-sm);
}

/* přizpůsobení */
.personalize .field {
  margin-bottom: 12px;
}
.personalize input[type="range"] {
  width: 100%;
}

/* mobil */
:root[data-mode="mobile"] .desktop-icons {
  grid-auto-flow: row;
  grid-template-columns: repeat(auto-fill, 84px);
  grid-template-rows: none;
  grid-auto-columns: auto;
}
:root[data-mode="mobile"] .tb-task {
  max-width: 48px;
  padding: 0 12px;
}
:root[data-mode="mobile"] .tb-clock .tb-date,
:root[data-mode="mobile"] .tb-conn {
  display: none;
}
:root[data-mode="mobile"] .start-menu {
  left: 8px;
  right: 8px;
  width: auto;
  transform: none;
}

/* mřížka ikon s explicitními pozicemi, výběr rámečkem, dlaždice tapet */
.desktop-icons {
  grid-auto-flow: column dense;
}
.marquee {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.18);
  pointer-events: none;
  z-index: 2;
}
.wp-tiles {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.wp-tile {
  width: 56px;
  height: 36px;
  border: 2px solid var(--line-2);
  border-radius: var(--r-xs);
  background-size: cover;
  cursor: pointer;
}
.wp-tile:hover {
  border-color: var(--brand);
}
.picker-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  outline: none;
}
.picker-list.drop {
  outline: 2px dashed var(--brand);
  outline-offset: -4px;
}
.picker-buttons {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.personalize .check {
  display: flex;
  margin: 6px 0;
}

.personalize-view {
  padding: 16px 18px;
  overflow: auto;
}

/* okno Nahrávání */
.upload-view {
  padding: 12px 14px;
  gap: 8px;
}
.up-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}
.up-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.up-row {
  display: grid;
  grid-template-columns: 20px 1fr auto 90px;
  grid-template-areas: "i n s st" "i b b b";
  align-items: center;
  gap: 2px 8px;
  padding: 6px 8px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  font-size: var(--fs-sm);
}
.up-row .icon {
  grid-area: i;
  color: var(--brand);
}
.up-name {
  grid-area: n;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.up-size {
  grid-area: s;
}
.up-state {
  grid-area: st;
  text-align: right;
}
.up-state .icon.ok {
  color: var(--ok);
}
.up-row.error {
  background: var(--bad-soft);
}
.up-row.error .up-state {
  color: var(--bad);
}
.up-bar {
  grid-area: b;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.up-bar.total {
  height: 8px;
}
.up-bar-fill {
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 0.15s;
}
.up-row.ok .up-bar-fill {
  background: var(--ok);
}

/* Spustit jako: pruh nahoře */
.runas-bar {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px;
  border-radius: 0 0 var(--r-md) var(--r-md);
  background: var(--warn);
  color: #1d1d1f;
  font-size: var(--fs-sm);
  box-shadow: var(--sh-2);
}

/* client/styles/50-login.css */
/* Přihlášení: vlevo vínový panel s větrem, vpravo formulář (podle it.wanet.cz/prihlaseni) */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  overflow: auto;
  background: var(--bg);
}
.login-art {
  background: var(--brand-ink);
  background: linear-gradient(160deg, var(--brand-ink) 0%, var(--brand) 100%);
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-art canvas.wind {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.login-art > :not(canvas):not(.deco) {
  position: relative;
  z-index: 1;
}
.login-art .wlogo {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.login-art .wlogo svg {
  width: 56px;
  height: 56px;
}
.login-art .brand-logo {
  max-width: 220px;
  max-height: 80px;
  object-fit: contain;
}
.login-art .big {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  max-width: 520px;
}
.login-art .art-sub {
  opacity: 0.8;
  max-width: 420px;
  margin-top: 14px;
  font-size: var(--fs-lg);
}
.login-art .art-foot {
  opacity: 0.7;
  font-size: 12px;
}
.login-art .art-foot a {
  color: #fff;
}
.login-art .deco {
  position: absolute;
  right: -140px;
  bottom: -140px;
  width: 520px;
  opacity: 0.08;
}
.login-form {
  display: grid;
  place-items: center;
  padding: 40px;
}
.login-form .box {
  width: 100%;
  max-width: 380px;
}
.login-form h1 {
  font-size: 24px;
  margin-bottom: 4px;
}
.login-form .lead {
  margin: 0 0 16px;
}
.login-form .btn.wide {
  height: 38px;
  margin-top: 18px;
}
.login-form .foot {
  font-size: 12px;
  text-align: center;
  margin-top: 14px;
}
.login-form .mlogo {
  display: none;
}
.login-fields.hidden-form {
  display: none;
}
.account-tiles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.account-tile {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "a n" "a l";
  column-gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.account-tile:hover {
  background: var(--surface-2);
  border-color: var(--brand);
}
.account-tile .avatar {
  grid-area: a;
}
.tile-name {
  grid-area: n;
  font-weight: 600;
}
.tile-login {
  grid-area: l;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.powered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.powered-logo {
  display: inline-flex;
  color: var(--muted);
}
.powered-logo svg {
  height: 11px;
  width: auto;
}
.powered-logo:hover {
  color: var(--brand);
}
@media (max-width: 900px) {
  .login-wrap {
    grid-template-columns: minmax(0, 1fr);
  }
  .login-art {
    display: none;
  }
  .login-form {
    padding: 28px 16px;
    align-content: start;
  }
  .login-form .mlogo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--brand);
    font-size: 22px;
    font-weight: 650;
    margin: 4px 0 24px;
  }
  .login-form .mlogo svg {
    width: 34px;
    height: 34px;
  }
}
@media (pointer: coarse) {
  .login-form input:not([type="checkbox"]) {
    font-size: 16px;
  }
}

/* apps/Ai/client/ai.css */
/* Asistent (kap. 34) */
.ai-view { display: flex; flex-direction: column; height: 100%; background: var(--surface); }
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.ai-log { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 92%; padding: 8px 12px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; line-height: 1.4; }
.ai-msg.user { align-self: flex-end; background: color-mix(in srgb, var(--brand) 14%, var(--surface)); border-bottom-right-radius: 4px; }
.ai-msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.ai-msg .ai-working { margin-top: 6px; }
.ai-action { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--brand) 8%, var(--surface)); font-size: var(--fs-sm); display: flex; align-items: center; gap: 6px; }
.ai-examples { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ai-example { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; font-size: var(--fs-sm); color: inherit; }
.ai-example:hover { background: var(--surface-2); }
.ai-foot { border-top: 1px solid var(--border); padding: 8px 10px; }
.ai-compose { display: flex; gap: 8px; align-items: flex-end; }
.ai-input { flex: 1; resize: none; min-height: 40px; }
.ai-buttons { display: flex; flex-direction: column; gap: 4px; }
.ai-send .icon { width: 18px; height: 18px; }
.ai-status { margin-top: 4px; }
.ai-error { color: var(--danger); }
.ai-action.ai-done { flex-direction: column; align-items: stretch; gap: 4px; }
.ai-done-head { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.ai-changes { display: flex; flex-direction: column; gap: 2px; padding-left: 22px; }
.ai-change.derived { background: color-mix(in srgb, var(--warning, #c47f00) 14%, transparent); border-radius: 4px; padding: 0 4px; margin-left: -4px; }
.ai-check { font-size: var(--fs-xs, 0.8em); }
.ai-done-buttons { display: flex; gap: 6px; padding-left: 22px; margin-top: 2px; }

/* apps/Desktop/client/desktop.css */
/* Správce úloh, O systému, Vlastnosti */
.tasks-view .t {
  font-size: var(--fs-sm);
}
.about-view,
.props-view {
  padding: 18px 20px;
  overflow: auto;
}
.about-head,
.props-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.about-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.props-head .icon.big {
  color: var(--brand);
  width: 44px;
  height: 44px;
}
.about-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  word-break: break-word;
}
.about-apps {
  margin: 0;
  padding: 0 0 0 18px;
}
.about-apps li {
  padding: 2px 0;
}
.about-apps .badge {
  margin-left: 6px;
}
.about-foot {
  margin-top: 16px;
}

/* Vlastnosti: sdílení a verze */
.props-view iw-tabs {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.share-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.share-row.expired .share-name {
  color: var(--muted);
  text-decoration: line-through;
}
.share-row .icon {
  color: var(--brand);
}
.share-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-row select {
  width: auto;
}
.share-add {
  margin-top: 14px;
}
.share-add .row > * {
  flex: 0 1 auto;
}
.share-add .subj {
  min-width: 140px;
  max-width: 220px;
}
.version-actions {
  white-space: nowrap;
}
.version-actions .btn {
  padding: 0 6px;
}

/* Hesla aplikací */
.apppw-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.apppw-row .icon {
  color: var(--brand);
}
.apppw-info {
  flex: 1;
  min-width: 0;
}
.apppw-list {
  margin: 12px 0;
}
.apppw-new {
  margin: 12px 0;
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--ok-soft);
}
.apppw-secret {
  display: flex;
  align-items: center;
  gap: 8px;
}
.apppw-secret code {
  font-size: 18px;
  letter-spacing: 0.04em;
  font-family: var(--mono);
  user-select: all;
}
.apppw-guide {
  margin-top: 18px;
}
/* synchronizace zařízení: karta služby = hodnoty + QR, pod tím postup */
.sync-card,
.apppw-section {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.sync-card h3,
.apppw-section h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
}
.sync-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.sync-values {
  flex: 1 1 320px;
  min-width: 0;
}
.sync-values code {
  font-family: var(--mono);
  user-select: all;
  word-break: break-all;
}
.sync-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.sync-qr {
  width: 132px;
  height: 132px;
  padding: 6px;
  background: #fff;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.sync-qr svg {
  width: 100%;
  height: 100%;
  display: block;
}
.sync-steps {
  margin: 8px 0 0;
  padding-left: 20px;
  font-size: var(--fs-sm);
}
.sync-steps li {
  margin: 2px 0;
}
.apppw-guide code {
  font-family: var(--mono);
  user-select: all;
}

/* Dvoufázové ověření */
.totp-qr {
  display: inline-block;
  padding: 8px;
  background: #fff;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  margin: 6px 0;
}
.totp-secret {
  font-family: var(--mono);
  user-select: all;
}
.totp-setup .input {
  width: 140px;
  font-size: 18px;
  letter-spacing: 0.1em;
  text-align: center;
}
.totp-backup {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--warn-soft);
}
.totp-codes {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 4px 24px;
  margin: 8px 0;
  font-family: var(--mono);
  font-size: 15px;
}

/* apps/Kalendar/client/kalendar.css */
/* Kalendář */
.cal-view {
  /* výplň události = barva kalendáře míchaná s podkladem (pastel), rámeček sytější; v tmavém motivu víc barvy */
  --ev-mix: 30%;
  --ev-mix-hover: 44%;
  --ev-line: 55%;
  --off-bg: color-mix(in srgb, var(--fg) 4%, transparent);
}
:root[data-theme="dark"] .cal-view {
  --ev-mix: 42%;
  --ev-mix-hover: 56%;
  --ev-line: 70%;
  --off-bg: color-mix(in srgb, var(--fg) 5%, transparent);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .cal-view,
  :root:not([data-theme]) .cal-view {
    --ev-mix: 42%;
    --ev-mix-hover: 56%;
    --ev-line: 70%;
    --off-bg: color-mix(in srgb, var(--fg) 5%, transparent);
  }
}
.cal-view iw-split {
  min-height: 0;
}
.cal-side {
  padding: 10px;
  font-size: var(--fs-sm);
}
.cal-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.cal-mini-title {
  font-weight: 600;
  text-transform: capitalize;
}
.cal-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  text-align: center;
}
.cal-mini-dow {
  color: var(--muted);
  font-size: 10px;
  padding: 2px 0;
}
.cal-mini-day {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 11px;
  padding: 3px 0;
  border-radius: var(--r-xs);
  cursor: pointer;
  color: var(--fg);
}
.cal-mini-day.other {
  color: var(--muted);
  opacity: 0.6;
}
.cal-mini-day.in-range {
  background: var(--brand-soft);
}
.cal-mini-day.today {
  font-weight: 700;
  color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}
.cal-mini-day:hover {
  background: var(--surface-3);
}
.cal-cals {
  margin-top: 14px;
}
.cal-cal {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
}
.cal-cal.drop {
  outline: 2px dashed var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}
.cal-cal input {
  accent-color: var(--brand);
  margin: 0;
}
.cal-cal-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--ev, var(--brand));
}
.cal-head {
  padding: 8px 14px 4px;
}
.cal-title {
  margin: 0;
  font-size: var(--fs-lg);
}
.cal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* den / týden */
.cal-days {
  display: grid;
  border-bottom: 1px solid var(--line);
}
.cal-dayhead {
  border: 0;
  background: transparent;
  font: inherit;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  color: var(--fg);
}
.cal-dayhead .dow {
  font-size: var(--fs-sm);
  color: var(--muted);
  text-transform: capitalize;
}
.cal-dayhead .num {
  font-size: 20px;
  font-weight: 600;
  width: 34px;
  height: 34px;
  line-height: 34px;
  border-radius: 50%;
}
.cal-dayhead.today .num {
  background: var(--brand);
  color: #fff;
}
.cal-dayhead.off .dow,
.cal-dayhead.off:not(.today) .num,
.cal-month-dow.off {
  opacity: 0.6;
}
.cal-allday {
  display: grid;
  border-bottom: 1px solid var(--line);
  min-height: 26px;
  background: var(--surface-2);
}
.cal-gutter-label {
  font-size: 10px;
  color: var(--muted);
  padding: 4px 6px;
  text-align: right;
}
.cal-allday-lanes {
  display: grid;
  gap: 2px;
  padding: 2px;
  grid-auto-rows: 20px;
}
.cal-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}
.cal-grid {
  display: grid;
  position: relative;
}
.cal-gutter {
  position: relative;
}
.cal-hour-label {
  position: absolute;
  right: 6px;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--muted);
}
.cal-col {
  position: relative;
  border-left: 1px solid var(--line);
  touch-action: pan-y;
}
.cal-col.today {
  background: color-mix(in srgb, var(--brand) 4%, transparent);
}
.cal-col.off-day {
  background: var(--off-bg);
}
.cal-off {
  position: absolute;
  left: 0;
  right: 0;
  background: var(--off-bg);
  pointer-events: none;
}
.cal-hour {
  position: absolute;
  left: 0;
  right: 0;
  height: 48px;
  border-top: 1px solid var(--line);
  box-sizing: border-box;
}
.cal-hour::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 24px;
  border-top: 1px dashed color-mix(in srgb, var(--line) 60%, transparent);
}
.cal-ev {
  position: absolute;
  box-sizing: border-box;
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--ev) var(--ev-mix), var(--surface));
  border: 1px solid color-mix(in srgb, var(--ev) var(--ev-line), var(--surface));
  color: var(--fg);
  padding: 2px 5px;
  font-size: var(--fs-sm);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  z-index: 1;
  line-height: 1.25;
}
.cal-ev:hover,
.cal-ev.dragging {
  z-index: 3;
  box-shadow: var(--sh-2);
  background: color-mix(in srgb, var(--ev) var(--ev-mix-hover), var(--surface));
}
.cal-ev.ro,
.cal-chip.ro {
  cursor: default;
  border-style: dotted;
}
.cal-ev.tentative,
.cal-chip.tentative {
  border-style: dashed;
}
.cal-ev.cancelled .cal-ev-title,
.cal-chip.cancelled,
.cal-agenda-row.cancelled .cal-agenda-title {
  text-decoration: line-through;
  opacity: 0.7;
}
.cal-ev-time {
  font-size: 10px;
  color: color-mix(in srgb, var(--fg) 70%, transparent);
}
.cal-ev-title {
  font-weight: 600;
}
.cal-ev-loc {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-ev-resize {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  cursor: ns-resize;
}
.cal-now {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px solid var(--bad);
  z-index: 2;
  pointer-events: none;
}
.cal-now::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bad);
}
.cal-sel {
  position: absolute;
  left: 2px;
  right: 2px;
  background: var(--brand-soft);
  border: 1px dashed var(--brand);
  border-radius: var(--r-xs);
  font-size: 10px;
  color: var(--brand);
  padding: 2px 4px;
  z-index: 2;
  pointer-events: none;
}

/* společný čip (celodenní pruhy, měsíc): stejná pastelová výplň jako událost v mřížce */
.cal-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  height: 20px;
  border: 1px solid color-mix(in srgb, var(--ev) var(--ev-line), var(--surface));
  text-align: left;
  font: inherit;
  font-size: var(--fs-sm);
  line-height: 1;
  padding: 0 5px;
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--ev) var(--ev-mix), var(--surface));
  color: var(--fg);
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}
.cal-chip:hover {
  background: color-mix(in srgb, var(--ev) var(--ev-mix-hover), var(--surface));
}
.cal-chip-time {
  color: color-mix(in srgb, var(--fg) 65%, transparent);
  font-size: 10px;
  flex: 0 0 auto;
}
.cal-chip-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* měsíc */
.cal-month {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(6, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.cal-month-dow {
  padding: 4px;
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--muted);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-transform: capitalize;
}
.cal-week {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  position: relative;
  min-height: 0;
}
.cal-cell {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 2px;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cal-cell.other {
  background: var(--surface-2);
  color: var(--muted);
}
.cal-cell.off-day:not(.other) {
  background: var(--off-bg);
}
.cal-cell-lanes {
  flex: 0 0 auto;
}
/* pruhy přes dny: vrstva nad buňkami týdne, pod číslem dne */
.cal-month-lanes {
  position: absolute;
  left: 0;
  right: 0;
  top: 27px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: 21px;
  pointer-events: none;
  padding: 0 1px;
}
.cal-month-lanes .cal-chip {
  pointer-events: auto;
  margin: 0 3px 1px;
}
.cal-cell.drop {
  background: var(--brand-soft);
}
.cal-cell-num {
  align-self: flex-end;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--fs-sm);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  color: inherit;
}
.cal-cell.today .cal-cell-num {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}
.cal-more {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 10px;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  padding: 0 6px;
}

/* agenda */
.cal-agenda {
  flex: 1;
  overflow: auto;
  padding: 6px 14px 20px;
}
.cal-agenda-day {
  margin-bottom: 14px;
}
.cal-agenda-date {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.cal-agenda-day.today .cal-agenda-date b {
  color: var(--brand);
}
.cal-agenda-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  border-radius: var(--r-xs);
  cursor: pointer;
}
.cal-agenda-row:hover {
  background: var(--surface-2);
}
.cal-agenda-time {
  width: 110px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.cal-agenda-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* nastavení zobrazení (dialog) */
.cal-settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.cal-settings-label {
  width: 130px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.cal-settings-days {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.cal-settings-hours {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
@media (max-width: 600px) {
  .cal-dayhead .num {
    font-size: 16px;
    width: 28px;
    height: 28px;
    line-height: 28px;
  }
  .cal-agenda-time {
    width: 80px;
  }
}

/* apps/Kontakty/client/kontakty.css */
/* Kontakty */
.kontakty-import {
  padding: 18px 20px;
  overflow: auto;
}
.kontakty-import .import-file {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kontakty-import .import-result {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* apps/Prohlizec/client/prohlizec.css */
/* Prohlížeč */
.viewer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--bg-2);
  display: flex;
}
.viewer-img-wrap {
  margin: auto;
  padding: 12px;
}
.viewer-img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  transform-origin: center;
  transition: transform 0.1s;
  box-shadow: var(--sh-2);
  background: var(--surface);
}
.viewer-img.zoomed {
  max-width: none;
  max-height: none;
}
.viewer-frame {
  flex: 1;
  border: 0;
  width: 100%;
  height: 100%;
}
.viewer-text {
  flex: 1;
  border: 0;
  resize: none;
  padding: 14px 16px;
  font: 13px/1.5 var(--mono);
  background: var(--surface);
  color: var(--fg);
  outline: none;
}
.viewer-text:read-only {
  background: var(--surface-2);
}
.viewer-media {
  margin: auto;
  max-width: 100%;
  max-height: 100%;
}

/* obrázek: posun a štípnutí prstem řeší komponenta, prohlížeč nesmí stránku přibližovat */
.viewer-img-wrap {
  touch-action: none;
  user-select: none;
  position: relative;
  margin: auto;
  padding: 12px;
  cursor: grab;
}
.viewer-img-wrap.dragging {
  cursor: grabbing;
}
.viewer-img,
.viewer-canvas {
  max-width: 100%;
  max-height: calc(100% - 24px);
  display: block;
  transform-origin: 0 0;
  box-shadow: var(--sh-2);
  background: var(--surface);
}
.viewer-stage {
  position: relative;
  display: inline-block;
}
.crop-frame {
  position: absolute;
  border: 1px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
  cursor: move;
  touch-action: none;
}
.crop-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, transparent calc(33.33% - 0.5px), rgba(255, 255, 255, 0.4) calc(33.33% - 0.5px), rgba(255, 255, 255, 0.4) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px), transparent calc(66.66% - 0.5px), rgba(255, 255, 255, 0.4) calc(66.66% - 0.5px), rgba(255, 255, 255, 0.4) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px)),
    linear-gradient(to bottom, transparent calc(33.33% - 0.5px), rgba(255, 255, 255, 0.4) calc(33.33% - 0.5px), rgba(255, 255, 255, 0.4) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px), transparent calc(66.66% - 0.5px), rgba(255, 255, 255, 0.4) calc(66.66% - 0.5px), rgba(255, 255, 255, 0.4) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px));
  pointer-events: none;
}
.crop-handle {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  touch-action: none;
}
.crop-handle.nw { left: -9px; top: -9px; cursor: nwse-resize; }
.crop-handle.ne { right: -9px; top: -9px; cursor: nesw-resize; }
.crop-handle.sw { left: -9px; bottom: -9px; cursor: nesw-resize; }
.crop-handle.se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.crop-handle.n { left: calc(50% - 9px); top: -9px; cursor: ns-resize; }
.crop-handle.s { left: calc(50% - 9px); bottom: -9px; cursor: ns-resize; }
.crop-handle.w { left: -9px; top: calc(50% - 9px); cursor: ew-resize; }
.crop-handle.e { right: -9px; top: calc(50% - 9px); cursor: ew-resize; }
.viewer-view.editing .viewer-body {
  background: #2a2a2a;
}

@media (pointer: coarse) {
  .crop-handle {
    width: 28px;
    height: 28px;
  }
  .crop-handle.nw { left: -14px; top: -14px; }
  .crop-handle.ne { right: -14px; top: -14px; }
  .crop-handle.sw { left: -14px; bottom: -14px; }
  .crop-handle.se { right: -14px; bottom: -14px; }
  .crop-handle.n { left: calc(50% - 14px); top: -14px; }
  .crop-handle.s { left: calc(50% - 14px); bottom: -14px; }
  .crop-handle.w { left: -14px; top: calc(50% - 14px); }
  .crop-handle.e { right: -14px; top: calc(50% - 14px); }
}

/* apps/Soubory/client/soubory.css */
/* Průzkumník souborů */
.files-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  outline: none;
  position: relative;
}
.files-list.drop {
  outline: 2px dashed var(--brand);
  outline-offset: -4px;
}
.files-table .name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: none;
}
.files-table .name-cell .icon {
  color: var(--brand);
  flex: 0 0 auto;
}
.files-table .w-date {
  width: 170px;
}
.files-table .w-type {
  width: 180px;
}
.files-table .w-size {
  width: 100px;
}
.files-table tr.drop td {
  background: var(--brand-soft);
}
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, 110px);
  gap: 6px;
  padding: 10px;
  align-content: start;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  text-align: center;
  font-size: var(--fs-sm);
  cursor: default;
}
.tile:hover {
  background: var(--surface-2);
}
.tile.selected {
  background: var(--selection);
  border-color: var(--brand);
}
.tile.drop {
  outline: 2px dashed var(--brand);
}
.tile .icon.big {
  width: 44px;
  height: 44px;
  color: var(--brand);
  stroke-width: 1.5;
}
.tile img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
}
.tile-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.upload-progress {
  padding: 4px 10px;
  font-size: var(--fs-sm);
  background: linear-gradient(90deg, var(--brand-soft) var(--p, 0%), transparent var(--p, 0%));
  border-top: 1px solid var(--line);
}

.shared-badge {
  width: 14px;
  height: 14px;
  color: var(--muted);
  margin-left: 2px;
}
