:root {
  --bg: #f2f5f9;
  --surface: #ffffff;
  --text: #17212c;
  --muted: #54636f;
  --border: #dbe2ea;
  --primary: #1d5aa3;
  --primary-hover: #154577;
  --sidebar: #ffffff;
  --sidebar-active: #e4eef9;
  --accent-blue: #1d5aa3;
  --accent-green: #1e8e5a;
  --accent-amber: #b4720a;
  --danger: #c13f3f;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 31, 0.10);
  --field-bg: #ffffff;
  --field-text: #17212c;
  --flash-bg: #dcfce7;
  --flash-text: #14532d;
  --flash-border: #86efac;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10141a;
  --surface: #1a2029;
  --text: #e8edf3;
  --muted: #9ba8b6;
  --border: #2a323c;
  --sidebar: #1a2029;
  --sidebar-active: #152538;
  --primary: #5b9ae0;
  --primary-hover: #7db0ec;
  --accent-green: #4ade95;
  --accent-amber: #f0a93d;
  --danger: #f17272;
  --field-bg: #0f141c;
  --field-text: #e8edf3;
  --flash-bg: #14532d;
  --flash-text: #bbf7d0;
  --flash-border: #166534;
}

* { box-sizing: border-box; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.92em;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* —— Přihlášení —— */
body.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
}

.login-brand .logo-dot {
  width: 28px;
  height: 28px;
  background: var(--accent-blue);
  border-radius: var(--radius-sm);
}

.login-hero { text-align: center; margin-bottom: 1.5rem; }
.login-hero h1 { margin: 0 0 .35rem; font-size: 1.75rem; font-weight: 700; }
.login-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  margin: 0 0 .35rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}
.login-hero p { margin: 0; color: var(--muted); font-size: .95rem; }

.ldap-unavailable-notice {
  margin: 0 0 1rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--warning, #d97706) 45%, var(--border));
  background: color-mix(in srgb, var(--warning, #d97706) 12%, var(--surface));
  color: var(--text);
  font-size: .92rem;
  line-height: 1.45;
}

.ldap-unavailable-notice strong {
  display: block;
  margin-bottom: .25rem;
}

.login-card .ldap-unavailable-notice {
  margin-bottom: 1rem;
}

.content > .ldap-unavailable-notice {
  margin-bottom: 1.25rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  padding: 1.75rem 1.5rem 1.25rem;
  border: 1px solid var(--border);
}

.login-card label {
  display: block;
  font-weight: 600;
  font-size: .85rem;
  margin-bottom: .35rem;
}

.login-card input {
  width: 100%;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  background: var(--field-bg);
  color: var(--field-text);
  font: inherit;
}

html[data-theme="dark"] .login-card input { background: var(--field-bg); color: var(--field-text); }

.btn-primary {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

.btn-primary:hover { background: var(--primary-hover); }

.login-foot {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--muted);
  text-align: center;
}

.login-page-version {
  margin-top: 2rem;
  font-size: .75rem;
  color: var(--muted);
}

.err { color: var(--danger); margin-bottom: 1rem; font-size: .9rem; }

/* —— App shell —— */
html.app-admin-layout,
html.app-admin-layout body {
  height: 100%;
  overflow: hidden;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem 0 2.75rem;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0 1.25rem 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.sidebar-brand .logo-dot {
  width: 24px;
  height: 24px;
  background: var(--accent-blue);
  border-radius: var(--radius-sm);
}

.mobile-nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text);
  flex-shrink: 0;
}

.nav-section {
  padding: .5rem 1rem .25rem;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--muted);
}

.sidebar nav a {
  display: block;
  padding: .55rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar nav a:hover { background: var(--sidebar-active); text-decoration: none; }

.sidebar nav a.active {
  background: var(--sidebar-active);
  border-left-color: var(--accent-blue);
  font-weight: 600;
  color: var(--primary);
}

.sidebar nav .nav-link--disabled {
  display: block;
  padding: .55rem 1.25rem;
  color: var(--muted);
  opacity: .65;
  cursor: not-allowed;
  border-left: 3px solid transparent;
  font-size: inherit;
}

.nav-module-group + .nav-module-group {
  margin-top: .15rem;
}

.nav-module-head {
  display: flex;
  align-items: stretch;
  border-left: 3px solid transparent;
}

.nav-module-group:has(.nav-module.active) .nav-module-head,
.nav-module-group:has(.nav-sub-link.active) .nav-module-head {
  border-left-color: var(--accent-blue);
  background: var(--sidebar-active);
}

.nav-module-toggle,
.nav-module-toggle-spacer {
  flex: 0 0 2rem;
  width: 2rem;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--muted);
}

.nav-module-toggle-spacer {
  cursor: default;
}

.nav-module-toggle:hover {
  color: var(--primary);
  background: color-mix(in srgb, var(--sidebar-active) 80%, transparent);
}

.nav-module-chevron {
  display: block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform .2s ease;
  transform-origin: 50% 45%;
}

.nav-module-group.is-collapsed .nav-module-chevron {
  transform: rotate(-90deg);
}

.sidebar nav .nav-module {
  flex: 1;
  display: block;
  padding: .55rem .75rem .55rem 0;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  min-width: 0;
}

.sidebar nav a.nav-module:hover {
  text-decoration: none;
  color: var(--primary);
}

.sidebar nav .nav-module.active {
  color: var(--primary);
}

.sidebar nav .nav-module--disabled {
  opacity: .65;
  color: var(--muted);
  cursor: not-allowed;
}

.nav-module-group.is-collapsed .nav-sub {
  display: none;
}

.nav-sub {
  padding: .15rem 0 .35rem;
}

.sidebar nav .nav-sub-link {
  display: block;
  padding: .4rem 1.25rem .4rem 1.85rem;
  font-size: .9rem;
  color: var(--muted);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sidebar nav .nav-sub-link:hover {
  background: var(--sidebar-active);
  color: var(--text);
  text-decoration: none;
}

.sidebar nav .nav-sub-link.active {
  background: var(--sidebar-active);
  border-left-color: var(--accent-blue);
  color: var(--primary);
  font-weight: 600;
}

.nav-sub-hint {
  display: block;
  padding: .35rem 1.25rem .45rem 1.85rem;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.35;
}

.sidebar-user {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: .85rem;
}

.sidebar-user .meta { line-height: 1.3; flex: 1; min-width: 0; }
.sidebar-user .role { color: var(--muted); font-size: .75rem; }

.sidebar-user form {
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .75rem;
  flex-shrink: 0;
}

.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.main-wrap > .page-header {
  flex-shrink: 0;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: .75rem;
  box-shadow: 0 1px 0 var(--border);
}

.page-header h1 { margin: 0; font-size: 1.35rem; font-weight: 700; flex: 0 1 auto; min-width: 8rem; max-width: 40%; }

.header-search {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 420px;
  margin: 0;
}

.header-search input[type="search"] {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.header-search input[type="search"]:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

.page-header-actions .btn,
.page-header-actions .btn-outline {
  min-height: 2.25rem;
}

.header-user {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  max-width: 14rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

.header-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .7rem;
  flex-shrink: 0;
}

.header-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-logout, .sidebar-logout { margin: 0; }

.export-dept-actions {
  display: flex;
  gap: .5rem;
  margin: .75rem 0 .5rem;
}

.export-dept-list {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .35rem .5rem;
  margin-bottom: .5rem;
}

.export-dept-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .25rem;
  font-size: .9rem;
  cursor: pointer;
}

.modal.export-modal {
  width: min(480px, 100%);
}

.modal.device-create-modal {
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  overflow-y: auto;
}

.device-create-form.settings-fields-stack {
  max-width: none;
}

.modal-form.settings-fields-stack,
.spec-sheet-form.modal-form.settings-fields-stack,
.device-detail-form.modal-form.settings-fields-stack {
  max-width: none;
}

.host-mode-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1rem;
}

.host-mode-banner__login {
  margin-left: auto;
}

.readonly-field {
  background: var(--sidebar-active);
  cursor: not-allowed;
}

.host-bindings {
  margin-bottom: 1rem;
}

.host-binding-block {
  margin: 1rem 0;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
}

.host-binding-block:first-of-type {
  border-top: none;
  padding-top: 0;
}

.host-binding-block__title {
  font-size: .95rem;
  font-weight: 700;
  margin: 0 0 .5rem;
}

.host-binding-list {
  list-style: none;
  margin: 0 0 .5rem;
  padding: 0;
}

.host-binding-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--border);
}

.host-binding-unlink {
  margin: 0;
}

.host-pick-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
}

.host-pick-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem .75rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
}

.host-pick-row-select {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  flex: 1 1 12rem;
  min-width: 0;
  cursor: pointer;
  margin: 0;
}

.host-pick-row-select input[type="checkbox"] {
  margin-top: .35rem;
  flex-shrink: 0;
}

.host-pick-batch-hint {
  margin-top: 0;
}

.host-pick-batch-actions {
  margin-top: .75rem;
  padding-top: .5rem;
  border-top: 1px solid var(--border);
}

.host-pick-list .host-pick-item {
  flex: 1 1 12rem;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.host-pick-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem .65rem;
  min-width: 0;
  flex: 1;
}

a.host-pick-item {
  text-decoration: none;
  color: inherit;
}

a.host-pick-item:hover .host-pick-item__model {
  text-decoration: underline;
  color: var(--accent-blue);
}

.device-kind-icon {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  color: var(--accent-blue, #2563eb);
  opacity: .92;
}

.device-row-name-icon {
  margin-left: 0;
}

.host-pick-item__icon {
  margin-right: .15rem;
}

.device-icon-picker {
  border: 0;
  padding: 0;
  margin: .5rem 0 1rem;
}

.device-icon-picker__grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .35rem;
}

.device-icon-picker__option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .45rem .55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  min-width: 4.5rem;
  background: var(--card);
}

.device-icon-picker__option.is-selected,
.device-icon-picker__option:has(input:checked) {
  border-color: var(--accent-blue, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}

.device-icon-picker__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.device-icon-picker__label {
  font-size: .75rem;
  color: var(--muted);
  text-align: center;
}

.host-pick-item__type {
  font-weight: 700;
  font-size: .95rem;
  color: var(--accent-blue, #2563eb);
}

.host-pick-item__sn {
  font-weight: 600;
  font-size: .92rem;
}

.host-pick-item__model {
  font-weight: 600;
}

.host-pick-item__user {
  color: var(--muted);
  font-size: .9rem;
}

.host-pick-item__key {
  font-size: .88rem;
  color: var(--text);
}

.form-section-label {
  font-weight: 700;
  margin: .75rem 0 .25rem;
  color: var(--text);
}

.host-link-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
}

table.data-table td.device-row-badges {
  vertical-align: middle;
}

table.data-table td.device-row-badges .host-link-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem;
  max-width: 100%;
}

.host-link-badge {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--sidebar-active);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
}

.host-link-badge--linked {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}

.host-link-badge--sw {
  background: color-mix(in srgb, #6366f1 18%, var(--surface));
  border-color: color-mix(in srgb, #6366f1 40%, var(--border));
  color: #4338ca;
}

html[data-theme="dark"] .host-link-badge--sw {
  color: #c7d2fe;
}

.host-link-badge--per {
  background: color-mix(in srgb, #0d9488 16%, var(--surface));
  border-color: color-mix(in srgb, #0d9488 38%, var(--border));
  color: #0f766e;
}

html[data-theme="dark"] .host-link-badge--per {
  color: #99f6e4;
}

.host-link-badge--part {
  background: color-mix(in srgb, #b4720a 14%, var(--surface));
  border-color: color-mix(in srgb, #b4720a 35%, var(--border));
  color: #92400e;
}

html[data-theme="dark"] .host-link-badge--part {
  color: #fcd34d;
}

.host-link-badge--child {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

.host-link-badge--spec {
  text-decoration: none !important;
  background: color-mix(in srgb, var(--primary) 22%, var(--sidebar-active));
  margin-left: .25rem;
}

.host-link-badge--spec:hover {
  background: color-mix(in srgb, var(--primary) 35%, var(--sidebar-active));
}

/* Inventura: stejné pozadí na celém řádku (všechny sloupce + skupina PC/vazby) */
table.data-table--inventory tbody tr:nth-child(even) {
  background: transparent;
}

table.data-table--inventory tbody tr.device-row {
  --device-group-bg: var(--surface);
  background-color: var(--device-group-bg);
}

table.data-table--inventory tbody tr.device-row--tone-even {
  --device-group-bg: color-mix(in srgb, var(--primary) 6%, var(--surface));
}

table.data-table--inventory tbody tr.device-row--group-spec {
  --device-group-bg: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

table.data-table--inventory tbody tr.device-row > td {
  background-color: var(--device-group-bg);
  border-color: color-mix(in srgb, var(--border) 55%, var(--device-group-bg));
}

table.data-table--inventory tbody tr.device-row--has-children > td {
  border-bottom-color: color-mix(in srgb, var(--border) 45%, var(--device-group-bg));
}

table.data-table--inventory tbody tr.device-row--child > td {
  border-top: none;
}

table.data-table--inventory tbody tr.device-row--child > td:first-child {
  padding-left: 1.75rem;
  box-shadow: inset 4px 0 0 color-mix(in srgb, var(--primary) 55%, var(--border));
}

table.data-table--inventory tbody tr.device-row--child + tr.device-row--host > td,
table.data-table--inventory tbody tr.device-row--host:not(.device-row--has-children) + tr.device-row--host > td {
  border-top: 2px solid color-mix(in srgb, var(--border) 65%, var(--primary));
}

table.data-table--inventory td.device-row-badges {
  background-color: var(--device-group-bg);
}

table.data-table--inventory td.device-row-badges .host-link-badges {
  background: transparent;
}

table.data-table--inventory .host-link-badge {
  background: color-mix(in srgb, var(--primary) 14%, var(--device-group-bg, var(--surface)));
  border-color: color-mix(in srgb, var(--primary) 28%, var(--device-group-bg, var(--border)));
}

table.data-table--inventory .host-link-badge--sw {
  background: color-mix(in srgb, #6366f1 22%, var(--device-group-bg, var(--surface)));
  border-color: color-mix(in srgb, #6366f1 38%, var(--device-group-bg, var(--border)));
}

table.data-table--inventory .host-link-badge--per {
  background: color-mix(in srgb, #0d9488 20%, var(--device-group-bg, var(--surface)));
  border-color: color-mix(in srgb, #0d9488 36%, var(--device-group-bg, var(--border)));
}

table.data-table--inventory .host-link-badge--part {
  background: color-mix(in srgb, #b4720a 18%, var(--device-group-bg, var(--surface)));
  border-color: color-mix(in srgb, #b4720a 32%, var(--device-group-bg, var(--border)));
}

table.data-table--inventory .host-link-badge--child {
  background: color-mix(in srgb, var(--primary) 16%, var(--device-group-bg, var(--surface)));
}

table.data-table--inventory .host-link-badge--spec {
  background: color-mix(in srgb, var(--primary) 26%, var(--device-group-bg, var(--surface)));
}

table.data-table--inventory .host-link-badge--spec:hover {
  background: color-mix(in srgb, var(--primary) 38%, var(--device-group-bg, var(--surface)));
}

table.data-table--inventory td.device-row-badges {
  min-width: 9rem;
}

.device-row-name-wrap {
  display: flex;
  align-items: center;
  gap: .35rem;
  min-width: 0;
}

.device-row-name-wrap .device-open-link,
.device-row-name-wrap .device-row-child-link {
  min-width: 0;
}

.inventory-group-toggle-spacer {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
}

.inventory-group-toggle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--border) 80%, var(--primary));
  border-radius: .35rem;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  color: var(--text);
  cursor: pointer;
  line-height: 1;
}

.inventory-group-toggle:hover {
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
}

.inventory-group-toggle-icon {
  display: block;
  width: 0;
  height: 0;
  border-top: .28rem solid transparent;
  border-bottom: .28rem solid transparent;
  border-left: .42rem solid currentColor;
  transform: rotate(0deg);
  transition: transform .15s ease;
  margin-left: .12rem;
}

.inventory-group-toggle[aria-expanded="true"] .inventory-group-toggle-icon {
  transform: rotate(90deg);
}

table.data-table--inventory tbody tr.device-row--child.is-inventory-child-collapsed {
  display: none;
}

.device-row-child-link {
  font-weight: 500;
  color: var(--text) !important;
  text-decoration: none !important;
}

.device-row-child-link:hover {
  color: var(--accent-blue) !important;
  text-decoration: underline !important;
}

.host-pick-item__type:not(:last-child)::after,
.host-pick-item__sn:not(:last-child)::after,
.host-pick-item__model:not(:last-child)::after,
.host-pick-item__key:not(:last-child)::after,
.host-pick-item__user:not(:last-child)::after {
  content: '·';
  margin-left: .65rem;
  font-weight: 400;
  color: var(--muted);
}

.spec-preview-wrap {
  background: #525659;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.spec-preview-wrap iframe {
  display: block;
  width: 100%;
  height: min(1120px, calc(100vh - 220px));
  min-height: 520px;
  border: none;
  background: #525659;
}

.table-actions {
  white-space: nowrap;
}

.table-actions .btn-sm {
  margin: 0 .15rem .15rem 0;
}

.spec-sheet-delete-modal {
  max-width: 34rem;
}

.spec-sheet-delete-modal__actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: .65rem;
}

.spec-sheet-delete-actions-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: .65rem;
}

.spec-sheet-delete-actions-row[hidden],
.spec-sheet-delete-modal [hidden] {
  display: none !important;
}

.spec-sheet-delete-modal__actions .btn-danger {
  margin-right: 0;
}

.spec-sheet-modal .modal-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .5rem;
}

.spec-sheet-modal .modal-actions > .btn-danger {
  margin-right: 0;
}

.spec-sheet-delete-sheet-name {
  font-weight: 600;
  margin: 0 0 .5rem;
}

.spec-sheet-delete-options {
  border: none;
  margin: .75rem 0 0;
  padding: 0;
}

.spec-sheet-delete-option {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  margin: .65rem 0;
  cursor: pointer;
}

.spec-sheet-delete-option input {
  margin-top: .2rem;
  flex-shrink: 0;
}

.spec-sheet-delete-progress-title {
  text-align: center;
  font-weight: 600;
  margin: .5rem 0 .25rem;
}

.spec-sheet-delete-result {
  margin: .5rem 0 0;
  line-height: 1.45;
}

.btn-sm {
  padding: .35rem .65rem;
  font-size: .8rem;
}

.content {
  padding: 1.25rem 1.5rem;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
}

/* Seznamy: filtry a statistiky nahoře, scrolluje jen tabulka */
.content:has(> .table-scroll) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.content:has(> .table-scroll) > *:not(.table-scroll) {
  flex-shrink: 0;
}

.content:has(> .table-scroll) > .table-scroll {
  flex: 1 1 0;
  min-height: 10rem;
  overflow: auto;
  margin-bottom: 0;
}

/* Verze appky: pod tabulkou je ještě historie — scrolluje celý obsah, tabulka má vlastní max. výšku */
.content:has(> .table-scroll):has(> .mobile-changelog-panel) {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
}

.content:has(> .table-scroll):has(> .mobile-changelog-panel) > .table-scroll {
  flex: none;
  max-height: min(42vh, 22rem);
  margin-bottom: 0;
}

.mobile-changelog-panel__list {
  max-height: min(55vh, 32rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: .75rem;
  padding-right: .35rem;
  border-top: 1px solid var(--border);
}

.content:not(:has(> .table-scroll)) {
  overflow-y: auto;
}

.content:has(.page-access-layout) {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.page-access-layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 0;
}

.table-scroll--bounded {
  max-height: min(360px, 42vh);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll--bounded-lg {
  max-height: min(520px, 58vh);
}

.access-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 1rem;
  padding: .35rem;
  border-radius: .5rem;
  background: var(--surface-muted, rgba(0, 0, 0, .04));
}

.access-subnav__link {
  padding: .45rem .85rem;
  border-radius: .4rem;
  text-decoration: none;
  color: inherit;
  font-size: .9rem;
  font-weight: 500;
}

.access-subnav__link.is-active {
  background: var(--primary, #2563eb);
  color: #fff;
}

.signer-group-members__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.signer-group-members__row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem 0;
  cursor: pointer;
}

.signer-group-card__head {
  margin-bottom: .75rem;
}

.btn,
.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .5rem 1rem;
  background: var(--primary);
  color: #fff !important;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none !important;
  border: 1px solid var(--primary);
  cursor: pointer;
  font: inherit;
  transition: background .15s, border-color .15s;
}

.btn:hover,
.btn-outline:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  text-decoration: none !important;
}

.btn:disabled,
.btn-outline:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Odhlásit — jediné tlačítko v outline vzhledu */
a.header-logout.btn-outline,
.header-logout .btn-outline,
.sidebar-logout .btn-outline {
  background: var(--field-bg);
  color: var(--text) !important;
  border: 1px solid var(--border);
}

a.header-logout.btn-outline:hover,
.header-logout .btn-outline:hover,
.sidebar-logout .btn-outline:hover {
  background: var(--sidebar-active);
  border-color: var(--primary);
  color: var(--text) !important;
}

.btn-icon {
  padding: .5rem .7rem;
  font-size: 1.05rem;
  line-height: 1;
}

.data-table tr.row-unavailable td {
  color: var(--muted);
  background: color-mix(in srgb, var(--bg) 88%, var(--muted));
}

.data-table tr.row-unavailable input[type="checkbox"] {
  cursor: not-allowed;
  opacity: .45;
}

.data-table tr.row-dept-free td:first-child {
  font-weight: 500;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.stat-card .bar { height: 4px; }
.stat-card .bar.blue { background: var(--accent-blue); }
.stat-card .bar.green { background: var(--accent-green); }
.stat-card .bar.amber { background: var(--accent-amber); }

.stat-card .inner { padding: .85rem 1rem; }
.stat-card .label { font-size: .7rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; margin-top: .15rem; }
.stat-card .sub { font-size: .75rem; color: var(--muted); margin-top: .2rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.toolbar input, .toolbar select, .form-grid input, .form-grid select, .form-grid textarea,
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
select,
textarea {
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 400;
  background: var(--field-bg);
  color: var(--field-text);
}

.toolbar input, .toolbar select, .form-grid input, .form-grid select, .form-grid textarea {
  padding: .45rem .6rem;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: .65;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  max-width: 100%;
}

.table-scroll > table.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  box-shadow: 0 1px 0 var(--border);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

table.data-table th {
  text-align: left;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--muted);
  padding: .65rem .75rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

html[data-theme="dark"] table.data-table th { background: #0f172a; }

table.data-table td {
  padding: .65rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data-table tr:last-child td { border-bottom: none; }
table.data-table:not(.data-table--inventory) tbody tr:nth-child(even) {
  background: rgba(29, 90, 163, 0.04);
}

table.data-table th.data-table-th-sortable:has(a.data-table-sort-link) {
  padding: 0;
}

table.data-table a.data-table-sort-link {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .65rem .75rem;
  color: inherit;
  text-decoration: none;
  font: inherit;
  letter-spacing: inherit;
  width: 100%;
  box-sizing: border-box;
}

table.data-table a.data-table-sort-link:hover {
  color: var(--accent-blue);
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}

table.data-table th.data-table-th-sortable.is-sorted a.data-table-sort-link {
  color: var(--primary);
}

table.data-table th.data-table-th-sortable[data-sort-col] {
  cursor: pointer;
  user-select: none;
}

.data-table-sort-indicator {
  font-size: .55rem;
  opacity: .85;
}

.badge {
  display: inline-block;
  padding: .2rem .5rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
}

.badge-super { background: var(--primary); color: #fff; }
.badge-admin { background: #0d9488; color: #fff; }
.badge-local { background: #6366f1; color: #fff; }

.status-dot { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; }
.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
}
.status-dot.inactive::before { background: #94a3b8; }

.access-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.25rem;
  align-items: start;
}

.role-policy-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.role-policy-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0;
  background: color-mix(in srgb, var(--surface) 92%, var(--bg));
}

.role-policy-block legend {
  padding: 0 .35rem;
  font-size: 1rem;
}

.role-policy-basic {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  margin-bottom: .85rem;
}

.role-policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem 1.25rem;
}

.role-policy-group__title {
  margin: 0 0 .5rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.role-policy-check {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  margin: .35rem 0;
  font-size: .92rem;
  line-height: 1.35;
}

.modal.modal--wide {
  width: min(960px, 96vw);
}

.modal.modal--scroll .modal-form__body {
  max-height: min(62vh, 640px);
}

.access-roles-table .inline-form {
  display: inline-block;
  margin-left: .35rem;
  vertical-align: middle;
}

.person-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .65rem 1rem;
}

.basic-specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .65rem .85rem;
  margin-bottom: .5rem;
}

.settings-fields-stack .basic-specs-grid,
.modal-form .basic-specs-grid,
.spec-sheet-item-specs .basic-specs-grid {
  grid-template-columns: 1fr;
  width: 100%;
}

.basic-specs-grid .settings-field {
  margin: 0;
}

.spec-sheet-items-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: .75rem;
}

.spec-sheet-item-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  background: var(--surface);
}

.spec-sheet-item-card__toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .65rem;
}

.spec-sheet-item-card__num {
  max-width: 5rem;
  margin: 0;
}

.spec-sheet-item-card .settings-field {
  display: block;
  width: 100%;
  max-width: none;
  margin: 0 0 .65rem;
}

.spec-sheet-item-specs .basic-specs-grid {
  min-width: 0;
  grid-template-columns: 1fr;
  width: 100%;
}

.spec-sheet-form.modal-form .spec-sheet-item-specs .basic-specs-grid {
  grid-template-columns: 1fr;
}

.spec-sheet-form__body .spec-sheet-items-list {
  width: 100%;
}

.device-copy-prefill .hint {
  display: block;
  margin-top: .25rem;
  font-size: .85rem;
}

.device-read-only-card {
  margin-bottom: 1rem;
}

.device-read-only-fields--nested {
  margin: .5rem 0 0;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted, rgba(0, 0, 0, .03));
}

.device-read-only-fields--nested .device-read-only-row {
  margin: .25rem 0;
  font-size: .92rem;
}

.host-binding-list__item {
  margin-bottom: .75rem;
}

.host-binding-list__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

.ajax-access-denied {
  margin: 0;
  padding: 1rem 1.1rem;
}

.ajax-access-denied__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .75rem;
}

.principal-combobox {
  position: relative;
}

.principal-combobox__input {
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--field-bg);
  color: var(--field-text);
}

.principal-combobox__list {
  position: absolute;
  z-index: 400;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: .25rem 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.principal-combobox__option {
  padding: .45rem .65rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.principal-combobox__option:hover,
.principal-combobox__option.is-active {
  background: var(--sidebar-active);
}

.principal-combobox__option-label {
  font-weight: 600;
}

@media (max-width: 960px) {
  .access-grid { grid-template-columns: 1fr; }
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: 0.5rem 1rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    position: relative;
  }
  .sidebar-brand { padding: 0; margin-right: auto; }
  .sidebar nav, .nav-section { display: none; }
  .mobile-nav-toggle { display: inline-flex; }
  .sidebar.nav-open nav, .sidebar.nav-open .nav-section {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
    z-index: 20;
    box-shadow: var(--shadow);
  }
  .header-user-name { display: none; }
}

.access-aside h2 { margin: 0 0 1rem; font-size: 1rem; }
.access-aside label { display: block; font-size: .85rem; font-weight: 600; margin: .65rem 0 .25rem; }
.access-aside input, .access-aside select {
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--field-bg);
  color: var(--field-text);
}

.access-aside .hint { font-size: .78rem; color: var(--muted); margin-top: .75rem; }

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .35rem .65rem;
  background: var(--primary);
  color: #fff !important;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  line-height: inherit;
  cursor: pointer;
  text-decoration: none !important;
  transition: background .15s, border-color .15s;
}

.link-btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.section-title { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 .75rem; }

.hint { color: var(--muted); font-size: .88rem; }
.flash-auto-dismiss {
  transition: opacity .4s ease, max-height .45s ease, margin .45s ease, padding .45s ease;
  overflow: hidden;
}

.flash-auto-dismiss--hide {
  opacity: 0;
  max-height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-width: 0 !important;
}

.flash {
  background: var(--flash-bg);
  color: var(--flash-text);
  border: 1px solid var(--flash-border);
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-weight: 500;
}

.form-grid label { display: block; margin: .5rem 0; }

.app-version-pin {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 500;
  width: 240px;
  box-sizing: border-box;
  padding: .45rem 1rem .5rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  background: color-mix(in srgb, var(--sidebar) 94%, var(--primary));
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-left: none;
  border-bottom: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: color .15s, background .15s;
}

.app-version-pin:hover,
.app-version-pin:focus-visible {
  color: var(--accent-blue);
  background: color-mix(in srgb, var(--sidebar) 88%, var(--primary));
  outline: none;
}

.web-changelog-modal {
  max-width: 36rem;
  width: min(36rem, calc(100vw - 2rem));
  max-height: min(85vh, 640px);
  display: flex;
  flex-direction: column;
}

.modal-changelog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}

.web-changelog-list {
  overflow-y: auto;
  margin: 1rem 0;
  padding-right: .25rem;
  flex: 1 1 auto;
  min-height: 0;
}

.web-changelog-entry {
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}

.web-changelog-entry:last-child {
  border-bottom: none;
}

.web-changelog-entry.is-current {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
  margin: 0 -.5rem;
  padding-left: .5rem;
  padding-right: .5rem;
  border-radius: var(--radius-sm);
}

.web-changelog-entry__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .65rem;
  margin-bottom: .35rem;
}

.web-changelog-entry__ver {
  font-weight: 800;
  font-size: .95rem;
  color: var(--primary);
}

.web-changelog-entry__date {
  font-size: .8rem;
  color: var(--muted);
}

.web-changelog-entry__build {
  font-size: .72rem;
}

.web-changelog-entry__changes {
  margin: 0;
  padding-left: 1.15rem;
  font-size: .88rem;
  line-height: 1.45;
}

.web-changelog-entry__changes li + li {
  margin-top: .2rem;
}

.web-changelog-foot {
  margin-bottom: 0;
  font-size: .78rem;
}

@media (max-width: 900px) {
  .app-version-pin {
    width: auto;
    max-width: calc(100vw - 1rem);
    border-radius: 0 var(--radius-sm) 0 0;
    padding-right: .65rem;
  }
}

.settings-section { margin-bottom: 1rem; }

.settings-theme-stack {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: .75rem;
  width: 100%;
  max-width: 42rem;
}

.theme-pick-btn {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15rem;
  min-width: 7.5rem;
  padding: .75rem .85rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}

.theme-pick-btn input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-pick-btn.is-selected,
.theme-pick-btn:has(input:checked) {
  border-color: var(--primary);
  background: var(--sidebar-active);
}

.theme-pick-btn__title {
  font-weight: 600;
  font-size: .92rem;
  color: var(--text);
}

.theme-pick-btn__sub {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.3;
}

.settings-fields-stack {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  max-width: 28rem;
}

.settings-fields-stack--compact {
  max-width: 24rem;
}

.settings-sync-form {
  max-width: 32rem;
  margin-top: 1rem;
}

.settings-sync-heading {
  margin: 1rem 0 .25rem;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin: 0;
}

.settings-field__label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

.settings-field__hint {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.35;
}

.settings-field input:not([type="checkbox"]):not([type="file"]),
.settings-field select,
.settings-field textarea {
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 400;
  box-sizing: border-box;
  background: var(--field-bg);
  color: var(--field-text);
}

.settings-field input[type="file"] {
  color: var(--text);
  font-size: .88rem;
}

.settings-field input[type="file"]::file-selector-button {
  margin-right: .65rem;
  padding: .35rem .65rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.settings-field input[type="file"]::file-selector-button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.settings-field--checkbox {
  flex-direction: row;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
}

.settings-field__action {
  align-self: flex-start;
  margin-top: .25rem;
}

.settings-section .btn,
.settings-section .btn-outline,
.settings-btn-row .btn,
.settings-btn-row .btn-outline {
  min-height: 2.25rem;
  padding: .5rem 1rem;
  font-size: .875rem;
  font-weight: 600;
}

.settings-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  margin-top: .35rem;
}

.settings-logo-block {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 1.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.org-logo-thumb {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 4px;
  flex-shrink: 0;
}

.org-logo-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  color: var(--muted);
  text-align: center;
}

.settings-logo-actions {
  flex: 1;
  min-width: 14rem;
}
button.primary,
.content button:not([class]):not(.theme-pick-btn),
.content form button:not([class]),
.toolbar button:not([class]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  padding: .5rem 1rem;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  font-weight: 600;
  font: inherit;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

button.primary:hover,
.content button:not([class]):not(.theme-pick-btn):hover,
.content form button:not([class]):hover,
.toolbar button:not([class]):hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.app-busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .52);
  backdrop-filter: blur(2px);
}

.app-busy-overlay[hidden] {
  display: none !important;
}

.app-busy-dialog {
  width: min(420px, 94vw);
  padding: 1.35rem 1.5rem 1.25rem;
  border-radius: var(--radius, 10px);
  background: var(--card, #fff);
  border: 1px solid var(--border, #e2e8f0);
  box-shadow: var(--shadow, 0 12px 40px rgba(15, 23, 42, .18));
  text-align: center;
}

.app-busy-spinner {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto .85rem;
  border: 3px solid var(--border, #e2e8f0);
  border-top-color: var(--accent-blue, #2563eb);
  border-radius: 50%;
  animation: app-busy-spin .75s linear infinite;
}

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

.app-busy-title {
  margin: 0 0 .35rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.app-busy-detail {
  margin: 0;
  min-height: 1.35em;
  font-size: .92rem;
}

.app-busy-steps {
  margin: .85rem 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
  font-size: .88rem;
}

.app-busy-steps li {
  position: relative;
  padding: .2rem 0 .2rem 1.35rem;
  color: var(--muted);
}

.app-busy-steps li.is-active {
  color: var(--text);
  font-weight: 600;
}

.app-busy-steps li.is-done {
  color: var(--muted);
}

.app-busy-steps li::before {
  content: '';
  position: absolute;
  left: .15rem;
  top: .55rem;
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: var(--border);
}

.app-busy-steps li.is-active::before {
  background: var(--accent-blue, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .2);
}

.app-busy-steps li.is-done::before {
  background: #16a34a;
}

body.app-busy-active {
  overflow: hidden;
}

.modal-overlay.modal-overlay--confirm {
  z-index: 1250;
}

.app-confirm-modal {
  width: min(440px, 94vw);
}

.app-confirm-message {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .45);
}

.modal-overlay[hidden] {
  display: none !important;
}

.device-detail-modal {
  width: min(880px, 96vw);
  max-height: min(92vh, 960px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.1rem 1.25rem;
}

.device-detail-modal .device-detail-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.device-detail-modal .device-detail-modal-body > .device-detail-modal-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.device-detail-modal .modal-actions {
  flex-shrink: 0;
  z-index: 2;
  background: var(--surface);
}

.device-detail-modal-layout {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.device-detail-modal-layout__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: .15rem;
}

.spec-sheet-modal {
  width: min(1100px, 98vw);
  max-height: min(92vh, 960px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.1rem 1.25rem;
}

.spec-sheet-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.spec-sheet-modal-body > .spec-sheet-modal-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.spec-sheet-modal .modal-actions {
  flex-shrink: 0;
  background: var(--surface);
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin-top: 0;
}

.modal-panel-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1rem;
  padding-bottom: .75rem;
  margin-bottom: .5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  z-index: 4;
}

.modal-panel-header .section-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.modal-panel-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  flex-shrink: 0;
}

.spec-sheet-modal-layout {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.spec-sheet-modal-layout__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: .15rem;
}

.spec-sheet-form__body .table-scroll {
  margin-bottom: .5rem;
}

.device-detail-toolbar {
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-top: 1rem;
}

.device-reclassify-form {
  display: inline-flex;
  margin: 0;
}

.device-transfer-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .5rem .75rem;
  margin: 0;
  padding: .65rem 0;
  border-top: 1px solid var(--border);
  width: 100%;
}

.device-transfer-form__field {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  margin: 0;
  min-width: 12rem;
  flex: 1 1 12rem;
}

.device-transfer-form__label {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted);
}

.device-transfer-form__field select {
  min-width: 0;
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field-bg);
  color: var(--field-text);
  font: inherit;
}

.device-detail-toolbar {
  flex-direction: column;
  align-items: stretch;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.modal {
  width: min(760px, 96vw);
  max-height: min(90vh, 920px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
}

.modal-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-form__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: .15rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: .5rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-actions > .btn-danger,
.modal-actions > button.btn-danger {
  margin-right: auto;
}

.modal-actions .modal-actions-lead {
  margin-right: auto;
}

.btn-danger,
button.btn-danger {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: #fff !important;
}

.btn-danger:hover,
button.btn-danger:hover {
  background: color-mix(in srgb, var(--danger) 88%, #000) !important;
  border-color: color-mix(in srgb, var(--danger) 88%, #000) !important;
  color: #fff !important;
}

.page-back-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: 0 0 1rem;
  font-size: .95rem;
}

.page-back-nav a {
  font-weight: 600;
}

a.sidebar-brand {
  text-decoration: none;
  color: inherit;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.module-tile {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: 1.15rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  position: relative;
  min-height: 140px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}

a.module-tile:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(29, 90, 163, .12);
  transform: translateY(-1px);
}

.module-tile--disabled {
  opacity: .55;
  filter: grayscale(.35);
  cursor: not-allowed;
  background: color-mix(in srgb, var(--surface) 92%, var(--muted));
}

.module-tile__icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--sidebar-active);
  margin-bottom: .25rem;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1.35rem;
}

.module-tile__icon--it {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%231d5aa3' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z'/%3E%3C/svg%3E");
}

.module-tile__icon--purchases {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2354636f' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z'/%3E%3C/svg%3E");
}

.module-tile__icon--phone {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2354636f' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z'/%3E%3C/svg%3E");
}

.module-tile__icon--cctv {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2354636f' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z'/%3E%3C/svg%3E");
}

.module-tile__icon--token {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2354636f' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z'/%3E%3C/svg%3E");
}

.module-tile__title {
  font-weight: 700;
  font-size: 1.02rem;
}

.module-tile__subtitle {
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.35;
}

.module-tile__badge {
  position: absolute;
  top: .75rem;
  right: .75rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: .15rem .45rem;
  border-radius: 999px;
}

.scope-banner {
  margin-bottom: 1rem;
  padding: .75rem 1rem;
}

.access-dept-picker {
  margin: .5rem 0;
  font-size: .85rem;
}

.access-dept-picker summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-blue);
}

.access-dept-list {
  max-height: 160px;
  overflow: auto;
  margin: .5rem 0;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.access-dept-list label {
  display: block;
  margin: .2rem 0;
  font-weight: 400;
}

.sync-last-run {
  margin: 1rem 0 1.25rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated, rgba(0, 0, 0, 0.03));
}

.sync-last-run--error {
  border-color: color-mix(in srgb, var(--err, #c62828) 45%, var(--border));
  background: color-mix(in srgb, var(--err, #c62828) 8%, transparent);
}

.sync-last-run--warning {
  border-color: color-mix(in srgb, #d97706 45%, var(--border));
  background: color-mix(in srgb, #d97706 10%, transparent);
}

.sync-last-run__warning {
  margin: .75rem 0 0;
  font-size: .88rem;
  color: #b45309;
}

.sync-last-run__title {
  margin: 0 0 .65rem;
  font-size: .95rem;
  font-weight: 700;
}

.sync-metrics {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.sync-metrics__row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: .88rem;
}

.sync-metrics__row dt {
  margin: 0;
  font-weight: 500;
  color: var(--text-muted, #666);
}

.sync-metrics__row dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.sync-last-run__error {
  margin: .75rem 0 0;
  font-size: .88rem;
}

.system-log-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.system-log-filters input[type="text"],
.system-log-filters input[type="search"],
.system-log-filters input[type="date"],
.system-log-filters select {
  min-width: 8rem;
  max-width: 100%;
}

.system-log-event {
  font-weight: 600;
  font-size: 0.92rem;
}

.sync-log-page h1 {
  margin-top: 0;
}

.sync-log-subtitle {
  font-size: 1rem;
  margin: 1.25rem 0 .5rem;
}

.sync-device-chips {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.sync-device-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .65rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--device-color, #64748b) 55%, var(--border));
  background: color-mix(in srgb, var(--device-color, #64748b) 12%, transparent);
  font-size: .82rem;
}

.sync-device-chip__dot,
.sync-log-device__dot {
  width: .55rem;
  height: .55rem;
  border-radius: 50%;
  background: var(--device-color, #64748b);
  flex-shrink: 0;
}

.sync-device-chip__ver,
.sync-device-chip__seen {
  opacity: .75;
  font-size: .78rem;
}

.sync-log-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

.sync-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.sync-log-table th,
.sync-log-table td {
  padding: .45rem .5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.sync-log-table th {
  text-align: left;
  font-weight: 600;
}

.sync-log-device {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--device-color, #64748b) 14%, transparent);
}

.sync-log-level {
  font-size: .72rem;
  font-weight: 700;
  padding: .12rem .35rem;
  border-radius: 4px;
}

.dept-row-duplicate td:first-child {
  border-left: 3px solid var(--warning, #c27a12);
}

.sync-mobile-admin-actions .inline-form {
  display: inline-block;
  margin: 0 .25rem .25rem 0;
  vertical-align: middle;
}

.sync-log-level--info {
  background: color-mix(in srgb, #2563eb 15%, transparent);
  color: #1d4ed8;
}

.sync-log-level--warning {
  background: color-mix(in srgb, #d97706 18%, transparent);
  color: #b45309;
}

.sync-log-level--error {
  background: color-mix(in srgb, var(--err, #c62828) 18%, transparent);
  color: var(--err, #c62828);
}

.audit-log-detail {
  white-space: normal;
  line-height: 1.45;
  font-size: 0.9rem;
}

.audit-log-detail-cell .sync-log-details {
  margin-top: 0.35rem;
}

.sync-log-details summary {
  cursor: pointer;
  font-size: .78rem;
  margin-top: .25rem;
}

.sync-log-details pre {
  font-size: .72rem;
  max-height: 12rem;
  overflow: auto;
  margin: .35rem 0 0;
}

/* —— Výdejky / zápůjčky —— */
.handover-type-badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  border: 1px solid transparent;
}

.handover-type-badge--issue {
  background: color-mix(in srgb, var(--accent-green) 16%, var(--surface));
  border-color: color-mix(in srgb, var(--accent-green) 40%, var(--border));
  color: #166534;
}

html[data-theme="dark"] .handover-type-badge--issue {
  color: #86efac;
}

.handover-type-badge--loan {
  background: color-mix(in srgb, #7c3aed 14%, var(--surface));
  border-color: color-mix(in srgb, #7c3aed 38%, var(--border));
  color: #5b21b6;
}

html[data-theme="dark"] .handover-type-badge--loan {
  color: #ddd6fe;
}

table.data-table tbody tr.handover-row--issue {
  background: color-mix(in srgb, var(--accent-green) 6%, var(--surface));
}

table.data-table tbody tr.handover-row--loan {
  background: color-mix(in srgb, #7c3aed 7%, var(--surface));
}

table.data-table tbody tr.handover-row--loan-active {
  box-shadow: inset 3px 0 0 #7c3aed;
}

.handover-state--loaned {
  font-weight: 700;
  color: #5b21b6;
}

html[data-theme="dark"] .handover-state--loaned {
  color: #c4b5fd;
}

.handover-num-warn {
  color: var(--danger);
  cursor: help;
}

.handover-expand-cell {
  width: 2rem;
  text-align: center;
  vertical-align: middle;
}

.handover-expand-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.25rem 0.35rem;
  color: var(--text-muted);
}

.handover-expand-btn:hover {
  color: var(--text);
}

.handover-detail-row td {
  background: color-mix(in srgb, var(--border) 25%, var(--surface));
  padding-top: 0;
  padding-bottom: 0.75rem;
}

.handover-detail-panel {
  padding: 0.5rem 0.25rem 0.25rem 2rem;
  font-size: 0.92rem;
}

.handover-detail-lines {
  margin: 0.35rem 0 0.5rem;
  padding-left: 1.25rem;
}

.handover-status-card--issue {
  border-left: 4px solid var(--accent-green);
}

.handover-status-card--loan {
  border-left: 4px solid #7c3aed;
}

.handover-status-card--loan-active {
  background: color-mix(in srgb, #7c3aed 8%, var(--surface));
}

.handover-items-table-wrap--loaned .handover-items-table tbody tr.handover-line--loaned {
  background: color-mix(in srgb, #7c3aed 12%, var(--surface));
}

.host-link-badge--issue {
  background: color-mix(in srgb, #0d9488 18%, var(--surface));
  border-color: color-mix(in srgb, #0d9488 42%, var(--border));
  color: #0f766e;
}

html[data-theme="dark"] .host-link-badge--issue {
  color: #99f6e4;
}

.host-link-badge--loan {
  background: color-mix(in srgb, #7c3aed 18%, var(--surface));
  border-color: color-mix(in srgb, #7c3aed 42%, var(--border));
  color: #5b21b6;
}

html[data-theme="dark"] .host-link-badge--loan {
  color: #ddd6fe;
}

table.data-table--inventory tbody tr.device-row--loaned {
  --device-group-bg: color-mix(in srgb, #7c3aed 10%, var(--surface));
  background: var(--device-group-bg);
  box-shadow: inset 3px 0 0 #7c3aed;
}

table.data-table--inventory tbody tr.device-row--issued {
  --device-group-bg: color-mix(in srgb, #0d9488 10%, var(--surface));
  background: var(--device-group-bg);
  box-shadow: inset 3px 0 0 #0d9488;
}

.status-dot--issue {
  font-weight: 600;
  color: #0f766e;
}

.status-dot--issue::before {
  background: #0d9488;
}

html[data-theme="dark"] .status-dot--issue {
  color: #99f6e4;
}

.status-dot--loan {
  font-weight: 600;
  color: #5b21b6;
}

.status-dot--loan::before {
  background: #7c3aed;
}

html[data-theme="dark"] .status-dot--loan {
  color: #ddd6fe;
}

.handover-loan-device-banner {
  border-left: 4px solid #7c3aed;
  background: color-mix(in srgb, #7c3aed 10%, var(--surface));
  margin-bottom: .75rem;
  padding: .75rem 1rem;
}

/* Profil uživatele */
a.header-user { text-decoration: none; color: inherit; }
a.header-user:hover .header-user-name { text-decoration: underline; }
.header-user .avatar--photo { object-fit: cover; display: block; }
.profile-card { display: flex; gap: 2rem; flex-wrap: wrap; align-items: flex-start; }
.profile-photo { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; max-width: 260px; }
.profile-photo__img { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 2.4rem; font-weight: 700; }
.profile-fields { flex: 1 1 320px; max-width: 520px; }

/* ===== Tonery a tiskárny ===== */
.toner-bars { display: flex; flex-direction: column; gap: .3rem; min-width: 180px; }
.toner-bar { display: grid; grid-template-columns: 12px 1fr 3.2rem; align-items: center; gap: .45rem; font-size: .8rem; }
.toner-bars .toner-bar:has(.toner-bar__name) { grid-template-columns: 12px minmax(7rem, 14rem) 1fr 3.2rem 4.5rem; }
.toner-bar__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toner-bar__pct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.toner-bar__eta { color: var(--muted); font-size: .75rem; }
.toner-meter { display: block; height: 8px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--border) 70%, transparent); }
.toner-meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent-green); }
.toner-bar.is-warn .toner-meter > span { background: var(--accent-amber); }
.toner-bar.is-low .toner-meter > span { background: var(--danger); }
.toner-bar.is-low .toner-bar__pct { color: var(--danger); }
.toner-bar.is-unknown .toner-meter > span { background: transparent; }
.toner-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px;
  border: 1px solid color-mix(in srgb, var(--border) 60%, #000 10%); background: #94a3b8; flex: none; }
.toner-dot--black { background: #1f2937; }
.toner-dot--cyan { background: #06b6d4; }
.toner-dot--magenta { background: #d946ef; }
.toner-dot--yellow { background: #eab308; }
.toner-dot--other { background: #94a3b8; }
.toner-chip { display: inline-flex; align-items: center; gap: .25rem; margin-right: .6rem; font-size: .8rem; white-space: nowrap; }
.toner-status { display: inline-block; padding: .1rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.toner-status--ok { background: color-mix(in srgb, var(--accent-green) 18%, transparent); color: var(--accent-green); }
.toner-status--err { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.toner-low-text { color: var(--danger); }
.toner-table td { vertical-align: top; }
.toner-table tr.is-inactive td, .data-table tr.is-inactive td { opacity: .55; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.toner-alert-card { border-left: 4px solid var(--accent-amber); line-height: 1.8; }
.toner-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.toner-dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.toner-dl dt { color: var(--muted); font-size: .85rem; }
.toner-dl dd { margin: 0; }
.toner-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1rem; }
.toner-span-2 { grid-column: 1 / -1; }
.toner-compat-list, .toner-import-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .35rem 1rem; margin: .5rem 0; }
.toner-compat-list label, .toner-import-list label { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.toner-receive { display: inline-flex; gap: .35rem; align-items: center; }
.toner-receive input[type=number] { width: 4.5rem; }
.toner-presets { font-size: .85rem; color: var(--muted); }
.toner-months { display: flex; align-items: flex-end; gap: .5rem; height: 170px; overflow-x: auto; padding-top: 1rem; }
.toner-month { flex: 0 0 56px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .25rem; }
.toner-month__bar { width: 70%; max-width: 46px; background: var(--accent-blue); border-radius: 4px 4px 0 0; }
.toner-month__val { font-size: .7rem; color: var(--muted); white-space: nowrap; }
.toner-month__lbl { font-size: .75rem; color: var(--muted); }
.toner-howto li { margin: .35rem 0; }
.toner-pre { background: color-mix(in srgb, var(--border) 40%, transparent); padding: .5rem .75rem; border-radius: 6px; overflow-x: auto; font-size: .82rem; margin: .4rem 0; }
@media (max-width: 640px) {
  .toner-bars .toner-bar:has(.toner-bar__name) { grid-template-columns: 12px 1fr 3.2rem; }
  .toner-bars .toner-bar:has(.toner-bar__name) .toner-meter, .toner-bar__eta { display: none; }
}
.toner-ip-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.toner-ip-row input { flex: 1 1 170px; min-width: 170px; }
.toner-ip-row .btn { white-space: nowrap; }
.toner-probe-result { margin: .25rem 0 .75rem; padding: .6rem .8rem; border-radius: 8px; font-size: .88rem;
  border: 1px solid color-mix(in srgb, var(--accent-green) 40%, var(--border)); background: color-mix(in srgb, var(--accent-green) 8%, var(--surface)); }
.toner-probe-result.is-error { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); color: var(--danger); }
.toner-probe-result ul { margin: .35rem 0; padding-left: 1.2rem; }
input.toner-filled { outline: 2px solid color-mix(in srgb, var(--accent-green) 60%, transparent); }
.toner-table td .inline-form { display: inline-block; margin-right: .25rem; }
.toner-dept-table input { width: 100%; min-width: 120px; }
.toner-dept-table td { vertical-align: middle; }
.toner-doc-links { margin-top: .3rem; font-size: .75rem; white-space: nowrap; }
.toner-doc-links a { margin-right: .5rem; }
.toner-doc-links a::before { content: "⤓ "; }

/* Tonery: menu (a na přehledu i souhrnné karty) zůstávají při posouvání nahoře */
.toner-sticky {
  position: sticky;
  top: -1.25rem;
  z-index: 60;
  background: var(--bg);
  margin: -1.25rem -1.5rem 1rem;
  padding: 1.25rem 1.5rem .1rem;
  box-shadow: 0 8px 10px -10px rgba(15, 23, 42, .35);
}
.toner-sticky > .access-subnav { margin-bottom: .75rem; }
.toner-sticky > .stats-row { margin-bottom: .75rem; }
@media (max-width: 640px), (max-height: 560px) {
  /* na malé obrazovce by karty zabraly většinu výšky — nahoře zůstane jen menu */
  .toner-sticky--stats { position: static; box-shadow: none; }
}

.module-tile__icon--printer {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%231d5aa3' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z'/%3E%3C/svg%3E");
}

/* ---- Správa PC a serverů ---- */
.module-tile__icon--server {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%231d5aa3' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2m-2-4h.01M17 16h.01'/%3E%3C/svg%3E");
}
.pc-pill { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.pc-pill--ok { background: color-mix(in srgb, var(--accent-green) 16%, transparent); color: var(--accent-green); }
.pc-pill--warning { background: color-mix(in srgb, var(--accent-amber) 18%, transparent); color: var(--accent-amber); }
.pc-pill--danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.pc-pill--muted { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.pc-bar { display: inline-block; width: 4.5rem; height: .5rem; border-radius: 999px; background: color-mix(in srgb, var(--border) 70%, transparent); overflow: hidden; vertical-align: middle; }
.pc-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent-green); }
.pc-bar--warning > span { background: var(--accent-amber); }
.pc-bar--danger > span { background: var(--danger); }
.pc-bar--wide { width: 100%; max-width: 18rem; }
.pc-row--ignored { opacity: .55; }
.pc-head { border-left: 4px solid var(--accent-green); }
.pc-head--warning { border-left-color: var(--accent-amber); }
.pc-head--danger { border-left-color: var(--danger); }
.pc-head .pc-pill { vertical-align: middle; margin-left: .35rem; }
.pc-issues { margin: .6rem 0 0; padding-left: 1.1rem; }
.pc-issue { margin: .15rem 0; }
.pc-issue--danger { color: var(--danger); font-weight: 600; }
.pc-issue--warning { color: var(--accent-amber); }
table.pc-kv { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.pc-kv th { text-align: left; font-weight: 500; color: var(--muted); padding: .28rem .75rem .28rem 0; width: 42%; vertical-align: top; }
table.pc-kv td { padding: .28rem 0; vertical-align: top; word-break: break-word; }
table.pc-kv tr + tr > * { border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.pc-code { font-family: 'IBM Plex Mono', monospace; font-size: .82rem; word-break: break-all; }
.pc-alert-types summary { cursor: pointer; white-space: nowrap; font-size: .85rem; }
.pc-alert-types[open] summary { margin-bottom: .3rem; }
.pc-alert-types label { font-size: .85rem; }
.pc-alert-eff { margin: 0 0 .75rem; padding: .5rem .75rem; border-radius: 8px; background: color-mix(in srgb, var(--muted) 10%, transparent); font-size: .88rem; }
.pc-inv-table td, .pc-inv-table th { vertical-align: top; }
.pc-inv-table input:not([type=checkbox]), .pc-inv-table textarea { font: inherit; padding: .3rem .45rem; }
.pc-inv--same { opacity: .6; }
.pc-inv--diff .pc-inv-cur { color: var(--accent-amber); }
table.pc-kv td { white-space: pre-line; }

/* Kamery, NAS a switche (web 1.1.236) */
.stat-card .bar.red { background: var(--danger); }
.infra-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.infra-ch { border: 1px solid var(--border); border-radius: .6rem; padding: .45rem .6rem; display: flex; flex-direction: column; gap: .15rem; }
.infra-ch--danger { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: color-mix(in srgb, var(--danger) 7%, transparent); }
.infra-ch--ok { border-color: color-mix(in srgb, var(--accent-green) 40%, transparent); }
.infra-ch--muted { opacity: .6; }
.infra-ch label { font-size: .78rem; color: var(--muted); }
.infra-port-down td { color: var(--danger); }
/* Panel portů switche */
.sw-panel { display: flex; gap: .9rem; align-items: flex-start; flex-wrap: wrap; padding: .6rem .7rem; border-radius: .6rem;
  background: color-mix(in srgb, var(--border) 35%, transparent); width: max-content; max-width: 100%; overflow-x: auto; }
.sw-panel__group { display: grid; gap: 4px; }
.sw-port { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 22px; border-radius: 4px;
  font-size: .68rem; font-weight: 700; line-height: 1; text-decoration: none; font-style: normal; box-sizing: border-box;
  background: color-mix(in srgb, var(--muted) 22%, transparent); color: var(--muted); border: 1px solid transparent; }
.sw-port--ge { background: #2fb36b; color: #fff; }
.sw-port--fe { background: #b7d63a; color: #20300a; }
.sw-port--xg { background: #2f7fe0; color: #fff; }
.sw-port--down { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }
.sw-port--disabled { background: transparent; border: 1px dashed color-mix(in srgb, var(--muted) 55%, transparent); color: color-mix(in srgb, var(--muted) 70%, transparent); }
.sw-port--watch { box-shadow: 0 0 0 2px var(--accent-blue); }
.sw-port--warn { background: var(--accent-amber); color: #2a1a00; }
.sw-port--down.sw-port--warn { background: var(--danger); color: #fff; }
.sw-port:hover { filter: brightness(1.12); outline: 2px solid var(--accent-blue); outline-offset: 1px; }
.sw-panel--small { padding: .35rem .45rem; gap: .5rem; }
.sw-panel--small .sw-panel__group { gap: 2px; }
.sw-panel--small .sw-port { width: 12px; height: 11px; border-radius: 2px; font-size: 0; }
.sw-panel--small .sw-port--watch { box-shadow: 0 0 0 1px var(--accent-blue); }
.sw-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .5rem; align-items: center; }
.sw-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.sw-legend .sw-port { width: 16px; height: 13px; }
tr:target td { background: color-mix(in srgb, var(--accent-blue) 14%, transparent); }

/* Kamerový systém / NAS a switche (web 1.1.242) */
.module-tile__icon--network {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%231d5aa3' stroke-width='1.8'%3E%3Crect x='3' y='4' width='18' height='6' rx='1.5'/%3E%3Crect x='3' y='14' width='18' height='6' rx='1.5'/%3E%3Cpath stroke-linecap='round' d='M7 7h.01M10 7h.01M13 7h.01M7 17h.01M10 17h.01M13 17h.01M17 7h1M17 17h1'/%3E%3C/svg%3E");
}
.infra-advice { border-left: 3px solid var(--accent-blue); padding: .4rem .75rem; background: color-mix(in srgb, var(--accent-blue) 7%, transparent); border-radius: .4rem; }

/* Trezor hesel (web 1.1.243) */
.module-tile__icon--lock {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%231d5aa3' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z'/%3E%3C/svg%3E");
}
.vault-secret { display: inline-block; min-width: 6.5rem; padding: .1rem .4rem; border-radius: .35rem; background: color-mix(in srgb, var(--border) 45%, transparent); font-family: 'IBM Plex Mono', monospace; user-select: all; }

/* Formuláře dříve v modálních oknech — zobrazené normálně na stránce (karta nahoře v obsahu) */
.modal-overlay.modal-overlay--inline {
  position: static;
  inset: auto;
  z-index: auto;
  display: block;
  padding: 0;
  margin: 0 0 1.25rem;
  background: none;
}
.modal-overlay.modal-overlay--inline > .modal {
  width: auto;
  max-width: none;
  max-height: none;
  box-shadow: none;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent, var(--primary, #1d5aa3));
}
.modal-overlay.modal-overlay--inline .modal-form__body,
.modal-overlay.modal-overlay--inline.modal--scroll .modal-form__body,
.modal-overlay.modal-overlay--inline .modal.modal--scroll .modal-form__body {
  max-height: none;
  overflow: visible;
}

/* =====================================================================================
   Jednotný vzhled formulářů (web 1.1.258)
   - formulář na stránce = karta; pole ve sloupcích (popisek nad polem), šířka pole = sloupec
   - delší pole (poznámka, specifikace, sekce, skupiny) přes celou šířku karty
   - tlačítka nikdy přes celou šířku; řádek Uložit drží dole při rolování
   ===================================================================================== */
:root { --form-max: 64rem; --form-col: 17rem; }

/* 1) kontejnery s poli → mřížka */
.settings-fields-stack,
.modal-overlay--inline .modal-form__body,
:is(main.content form, .card, fieldset, .spec-sheet-form, .device-detail-form):has(> .settings-field) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--form-col)), 1fr));
  gap: .85rem 1.5rem;
  align-items: start;
}
.settings-fields-stack { max-width: none; }
.settings-fields-stack--compact { max-width: 34rem; }
:is(.settings-fields-stack, .modal-overlay--inline .modal-form__body, :is(main.content form, .card, fieldset, .spec-sheet-form, .device-detail-form):has(> .settings-field))
  > :not(.settings-field):not(label) {
  grid-column: 1 / -1;
}
.settings-field:has(textarea),
.settings-field:has(.basic-specs-grid),
.settings-field--checkbox,
.settings-field--wide {
  grid-column: 1 / -1;
}
.settings-field textarea { min-height: 4.5rem; }

/* specifikace (CPU, RAM, disk…) i uvnitř formuláře ve sloupcích */
.settings-fields-stack .basic-specs-grid,
.device-detail-form .basic-specs-grid,
.modal-overlay--inline .basic-specs-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--form-col)), 1fr));
  gap: .85rem 1.5rem;
}

/* 2) formulář přímo na stránce vypadá jako karta */
main.content form:has(.settings-field, > label, > .form-grid, > .toner-form-grid):not(.card):not(.card *):not(.modal *):not(.toolbar):not(.inline-form):not(:has(.card)) {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-sizing: border-box;
}
.modal-overlay--inline > .modal { max-width: none; }

/* 3) jednoduché mřížky s labely (form-grid / toner-form-grid): popisek nad polem */
.toner-form-grid,
.form-grid:not(.read-only-detail) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--form-col)), 1fr));
  gap: .85rem 1.5rem;
  align-items: start;
}
:is(.toner-form-grid, .form-grid:not(.read-only-detail)) > label:not(:has(> input[type="checkbox"], > input[type="radio"])) {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin: 0;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}
:is(.toner-form-grid, .form-grid:not(.read-only-detail)) > label > :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  box-sizing: border-box;
  font-weight: 400;
  font-size: 1rem;
}
:is(.toner-form-grid, .form-grid:not(.read-only-detail)) > label:has(> input[type="checkbox"], > input[type="radio"]) {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  font-weight: 500;
}
:is(.toner-form-grid, .form-grid:not(.read-only-detail)) > :is(.toner-span-2, .settings-btn-row, p, h2, h3, fieldset, details, .hint) {
  grid-column: 1 / -1;
}
.form-grid label textarea, .toner-form-grid label textarea { min-height: 4.5rem; }
/* popisek tučně, ale pole, nápovědy a texty zaškrtávacích polí normálně */
:is(.toner-form-grid, .form-grid, .settings-field) label :is(input, select, textarea, small, .hint, .muted, span:not(.settings-field__label)),
:is(.toner-form-grid, .form-grid) > :is(label, div) :is(input, select, textarea) { font-weight: 400; }
:is(.toner-form-grid, .form-grid) label :is(small, .hint, .muted) { color: var(--muted, #64748b); font-size: .8rem; }
:is(.toner-form-grid, .form-grid) label:has(> input[type="checkbox"], > input[type="radio"]) { font-weight: 400; font-size: .9rem; }

/* 4) tlačítka nikdy přes celou šířku */
.btn, .btn-outline, .btn-danger, button.btn, a.btn { width: auto; max-width: 100%; }
:is(.settings-fields-stack, .modal-form__body, .toner-form-grid, .form-grid, main.content form, .card, fieldset) > :is(button, .btn, a.btn, input[type="submit"]) {
  justify-self: start;
  align-self: start;
}
.settings-field > :is(button, .btn) { align-self: flex-start; }
.device-detail-toolbar {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
}
.device-detail-toolbar > form { margin: 0; }
.device-transfer-form__field { flex: 0 1 22rem; }

/* 5) řádek Uložit drží u spodního okraje karty (není nutné rolovat dolů) */
main.content form:has(.settings-field, > label, > .form-grid, > .toner-form-grid):not(.card):not(.card *):not(.modal *):not(.toolbar):not(.inline-form):not(:has(.card)) > :is(.settings-btn-row, .modal-actions):last-child {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: .5rem -1.5rem -1.25rem;
  padding: .75rem 1.5rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  justify-content: flex-start;
}
.modal-overlay--inline .modal-actions { justify-content: flex-start; }

/* 6) skupiny polí uvnitř formuláře (např. přihlašovací údaje) */
form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem 1rem;
  margin: .25rem 0;
  min-width: 0;
}
form fieldset > legend { padding: 0 .4rem; font-weight: 700; font-size: .9rem; }
form :is(h2, h3).section-title { margin: .75rem 0 0; }

@media (max-width: 720px) {
  main.content form:has(.settings-field, > label, > .form-grid, > .toner-form-grid):not(.card):not(.card *):not(.modal *):not(.toolbar):not(.inline-form):not(:has(.card)) {
    padding: 1rem;
  }
  main.content form:not(.card):not(.card *):not(.modal *) > .settings-btn-row:last-child { margin: .5rem -1rem -1rem; padding: .75rem 1rem; }
}
/* hodnoty v polích vždy normálním písmem (popisky zůstávají tučné) */
.settings-field input:not([type="checkbox"]):not([type="file"]),
.settings-field select,
.settings-field textarea,
.form-grid label input:not([type="checkbox"]):not([type="radio"]),
.form-grid label select,
.form-grid label textarea { font-weight: 400; }
/* položky specifikačního listu: pole ve sloupcích, číslo položky úzké */
.spec-sheet-item-card {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--form-col)), 1fr));
  gap: .85rem 1.5rem;
  align-items: start;
}
.spec-sheet-item-card > :not(.settings-field) { grid-column: 1 / -1; }
.spec-sheet-item-card > .settings-field { margin: 0; }
.spec-sheet-item-card .spec-sheet-item-card__toolbar { margin-bottom: 0; }
.spec-sheet-item-card .spec-sheet-item-card__toolbar > .spec-sheet-item-card__num { width: 6rem; max-width: 6rem; margin: 0; }
/* sériová čísla dílů (sklad): stejně velké pole jako ostatní, roste podle počtu řádků */
.settings-field:has(> textarea[name="serial_numbers"]) { grid-column: auto; }
.settings-field:has(> textarea[name="serial_numbers"]) > .settings-field__hint { order: 2; } /* nápověda pod polem — pole zarovnané s ostatními */
.settings-field > textarea[name="serial_numbers"] {
  min-height: 2.32rem;
  max-height: 10rem;
  field-sizing: content;
  resize: vertical;
  line-height: 1.4;
}
@supports not (field-sizing: content) {
  .settings-field > textarea[name="serial_numbers"] { height: 2.32rem; }
}

/* ===================== Nákupy a objednávky (web 1.1.263) ===================== */
.num { text-align: right; white-space: nowrap; }
.purchase-head__title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.purchase-status { color: #fff; }
.purchase-status--draft { background: #64748b; }
.purchase-status--open { background: var(--accent-green, #16a34a); }
.purchase-status--closed { background: var(--accent-amber, #d97706); }
.purchase-status--ordered { background: var(--primary, #1d4ed8); }
.purchase-filter { align-items: center; flex-wrap: wrap; }
.purchase-filter input[type="search"] { flex: 1 1 16rem; min-width: 12rem; }
.purchase-filter__check { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.purchase-state { margin: 0 0 .75rem; padding: .6rem .9rem; border-radius: var(--radius-sm, 8px); background: var(--surface-2, rgba(100,116,139,.12)); }
.purchase-state--done { background: rgba(22,163,74,.12); }
.purchase-table td { vertical-align: middle; }
.purchase-table .purchase-qty { width: 6rem; text-align: right; }
.purchase-table tr.is-picked td { background: rgba(37,99,235,.07); }
.purchase-table tr.is-picked .purchase-item__name { font-weight: 600; }
.purchase-table__group td { background: var(--surface-2, rgba(100,116,139,.12)); font-weight: 700; font-size: .85rem; letter-spacing: .02em; }
.purchase-item__info { display: flex; flex-wrap: wrap; gap: .15rem .9rem; margin-top: .15rem; }
.purchase-request__bar { align-items: center; flex-wrap: wrap; gap: .5rem; }
.purchase-request__sum { margin-right: auto; }
.purchase-section-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.purchase-import__table th { vertical-align: top; min-width: 11rem; }
.purchase-import__col { font-weight: 700; margin-bottom: .35rem; white-space: normal; }
.purchase-import__role { width: 100%; font-weight: 400; }
.purchase-status-form { display: inline-flex; align-items: center; gap: .5rem; margin: 0; }
.budget-priority--required { background: #dc2626; color: #fff; }
.budget-priority--needed { background: #d97706; color: #fff; }
.budget-priority--wanted { background: #64748b; color: #fff; }
.budget-row--rejected td { opacity: .55; text-decoration: line-through; }
.budget-row--approved td:first-child, .budget-row--purchased td:first-child { box-shadow: inset 3px 0 0 var(--accent-green, #16a34a); }
.budget-bar { display: block; height: .55rem; border-radius: 999px; background: var(--primary, #1d4ed8); min-width: 2px; }
.mobile-purchase-depts summary { cursor: pointer; font-size: .85rem; }
.mobile-purchase-depts__form { display: flex; flex-direction: column; gap: .25rem; margin-top: .4rem; }
.mobile-purchase-depts__form label { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.mobile-purchase-depts__form .btn { align-self: flex-start; margin-top: .25rem; }
.budget-quick__table td { vertical-align: middle; }
.budget-quick__table input[name="desc[]"] { width: 100%; min-width: 16rem; }
.budget-quick__table input[name="reason[]"] { width: 100%; min-width: 10rem; }
.budget-quick .settings-btn-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.budget-quick__table select { width: auto; max-width: 11rem; }
.toner-sticky > .toolbar.card { margin-bottom: .75rem; }
.header-sum { font-size: .85rem; color: var(--muted); white-space: nowrap; padding: .35rem .65rem; border-radius: 8px; background: var(--bg); }
.header-sum strong { color: var(--text); }
.page-header-actions [hidden] { display: none; }

/* Nákupy: rozbalovací nabídka exportu (Náhled / PDF / Excel) */
.export-menu { position: relative; display: inline-block; }
.export-menu > summary { list-style: none; cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: .35rem; }
.export-menu > summary::-webkit-details-marker { display: none; }
.export-menu__caret { font-size: .75em; opacity: .75; }
.export-menu[open] > summary .export-menu__caret { transform: rotate(180deg); }
.export-menu__list {
  position: fixed; z-index: 1000; min-width: 15rem; padding: .35rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .08);
}
.export-menu__list a, .export-menu__list button {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none; white-space: nowrap; font-size: .9rem; font-weight: 500;
}
.export-menu__list button { width: 100%; border: 0; background: none; font: inherit; cursor: pointer; text-align: left; }
.export-menu__list a:hover, .export-menu__list a:focus-visible, .export-menu__list button:hover, .export-menu__list button:focus-visible { background: var(--sidebar-active); outline: none; }
.export-menu__tag {
  display: inline-block; min-width: 3.6rem; text-align: center; padding: .12rem .35rem; border-radius: 999px;
  font-size: .68rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.export-menu__tag--view { background: #e8f0fe; color: #1d5aa3; }
.export-menu__tag--pdf { background: #fdecec; color: #b42318; }
.export-menu__tag--xlsx { background: #e6f4ea; color: #1e7b3a; }
.export-menu__tag--csv { background: #e0f5f2; color: #0f766e; }
.export-menu__tag--print { background: #eef1f5; color: #475569; }
html[data-theme="dark"] .export-menu__tag--view { background: #17304f; color: #9cc3f5; }
html[data-theme="dark"] .export-menu__tag--pdf { background: #4a1f1f; color: #f5a3a3; }
html[data-theme="dark"] .export-menu__tag--xlsx { background: #173a26; color: #8fe0b0; }
html[data-theme="dark"] .export-menu__tag--csv { background: #133b37; color: #7fdccf; }
html[data-theme="dark"] .export-menu__tag--print { background: #273140; color: #c3cdd9; }
.table-actions .export-menu .btn-sm { white-space: nowrap; }
.export-menu > summary.btn-sm { display: inline-flex; }
.page-header-actions .export-menu > summary { min-height: 2.25rem; }

/* Nákupy: karty exportu v souhrnu objednávky */
.export-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: .75rem; margin-top: .9rem; }
.export-card { border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem .9rem; background: color-mix(in srgb, var(--primary) 3%, var(--surface)); }
.export-card__head { display: flex; gap: .7rem; align-items: center; margin-bottom: .7rem; }
.export-card__head strong { display: block; }
.export-card__head span:not(.export-card__icon) { display: block; color: var(--muted); font-size: .85rem; }
.export-card__icon { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 10px; position: relative; }
.export-card__icon--order { background: linear-gradient(135deg, #1d5aa3, #3f86d6); }
.export-card__icon--summary { background: linear-gradient(135deg, #1e7b3a, #3fb06a); }
.export-card__icon::before, .export-card__icon::after { content: ""; position: absolute; left: .55rem; right: .55rem; height: 2px; background: rgba(255, 255, 255, .9); border-radius: 2px; }
.export-card__icon::before { top: .75rem; box-shadow: 0 .3rem 0 rgba(255, 255, 255, .9); }
.export-card__icon::after { top: 1.35rem; right: 1rem; }
.export-card__btns { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

/* Hlavní menu / domů: Výdejky a zápůjčky, Archiv */
.module-tile__icon--handover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2354636f' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4'/%3E%3C/svg%3E");
}
.module-tile__icon--archive {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2354636f' stroke-width='1.8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4'/%3E%3C/svg%3E");
}

/* Trezor hesel: filtr a seskupení podle druhu / střediska */
.vault-filter { flex-wrap: wrap; }
.vault-filter__group { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .9rem; }
.vault-group-row td {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  color: var(--primary); font-weight: 700; font-size: .85rem; letter-spacing: .02em;
  border-top: 2px solid color-mix(in srgb, var(--primary) 35%, transparent);
}
.vault-kind { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--text); }
.vault-kind--pc { background: color-mix(in srgb, #1d5aa3 14%, transparent); color: #1d5aa3; }
.vault-kind--peripheral { background: color-mix(in srgb, #0f766e 14%, transparent); color: #0f766e; }
.vault-kind--part { background: color-mix(in srgb, #9a5b00 14%, transparent); color: #9a5b00; }
.vault-kind--software { background: color-mix(in srgb, #5b3fb0 14%, transparent); color: #5b3fb0; }
.vault-kind--token { background: color-mix(in srgb, #b42318 12%, transparent); color: #b42318; }
.vault-kind--network { background: color-mix(in srgb, #1e7b3a 14%, transparent); color: #1e7b3a; }
html[data-theme="dark"] .vault-kind--pc { color: #8fb9ef; }
html[data-theme="dark"] .vault-kind--peripheral { color: #6fd6c9; }
html[data-theme="dark"] .vault-kind--part { color: #f0b45d; }
html[data-theme="dark"] .vault-kind--software { color: #b9a5f2; }
html[data-theme="dark"] .vault-kind--token { color: #f5a3a3; }
html[data-theme="dark"] .vault-kind--network { color: #8fe0b0; }
#vault-table td:first-child { min-width: 11rem; }
/* Trezor: hlavička (souhrn + filtr) a záhlaví tabulky zůstávají při posouvání nahoře */
.vault-sticky > .stats-row { margin-bottom: .75rem; }
.vault-sticky > .toolbar.card { margin: 0 0 .75rem !important; }
.vault-sticky > .card { margin: 0 0 .75rem !important; }
@media (min-width: 1000px) and (min-height: 561px) {
  .vault-table-wrap:not(.is-wide), .vault-table-wrap:not(.is-wide) #vault-table { overflow: visible; }
  .vault-table-wrap.is-wide { overflow-x: auto; }
  .vault-table-wrap:not(.is-wide) #vault-table thead th { position: sticky; top: var(--vault-head-top, 0px); z-index: 5; box-shadow: inset 0 -1px 0 var(--border); }
}

/* —— Topologie sítě (NAS a switche) —— */
.topo-wrap { overflow-x: auto; padding: .5rem 0 .25rem; }
.topo, .topo ul { list-style: none; margin: 0; padding: 0; }
.topo ul { margin-left: .4rem; padding-left: 1.6rem; border-left: 2px solid var(--border); }
.topo li { position: relative; padding: .35rem 0; }
.topo li::before { content: ""; position: absolute; left: -1.6rem; top: 1.05rem; width: 1.6rem; border-top: 2px solid var(--border); }
.topo > li::before { display: none; }
.topo > li { padding-left: 0; }
.topo-node { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .45rem .75rem; box-shadow: var(--shadow); }
.topo-port { font-family: 'IBM Plex Mono', monospace; font-size: .8rem; color: var(--accent-blue); background: color-mix(in srgb, var(--accent-blue) 12%, transparent); border-radius: var(--radius-sm); padding: .1rem .4rem; }

/* —— Schéma sítě (SVG): krabičky, spoje, stavy —— */
.topo-svg { display: block; max-width: 100%; height: auto; }
.topo-link { fill: none; stroke: var(--border); stroke-width: 2; }
.topo-box { fill: var(--surface); stroke: var(--border); stroke-width: 1.2; }
.topo-stripe { fill: var(--primary); }
.kind-nas .topo-stripe { fill: var(--accent-green); }
.kind-dvr .topo-stripe { fill: var(--accent-amber); }
.topo-name { fill: var(--text); font-size: 13px; font-weight: 600; font-family: 'Inter', system-ui, sans-serif; }
.topo-sub { fill: var(--muted); font-size: 11px; font-family: 'Inter', system-ui, sans-serif; }
.topo-port { fill: var(--primary); font-size: 11px; font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.topo-dot { stroke: var(--surface); stroke-width: 2; }
.topo-node.is-ok .topo-dot { fill: var(--accent-green); }
.topo-node.is-warning .topo-dot { fill: var(--accent-amber); }
.topo-node.is-danger .topo-dot { fill: var(--danger); }
.topo-node.is-muted .topo-dot { fill: var(--muted); }
.topo-node { cursor: pointer; }
.topo-node:hover .topo-box { stroke: var(--primary); }
.topo-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: .75rem; }
.topo-key { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; background: var(--muted); }
.topo-key.is-ok { background: var(--accent-green); }
.topo-key.is-warning { background: var(--accent-amber); }
.topo-key.is-danger { background: var(--danger); }
