:root {
  color-scheme: light;
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --text: #1b2130;
  --muted: #6b7385;
  --border: #e3e6ec;
  --accent: #3a63e0;
  --accent-soft: #e8eefc;
  --accent-text: #ffffff;
  --ok: #17804a;
  --ok-soft: #e4f4ea;
  --bad: #c73333;
  --bad-soft: #fcebeb;
  --off: #7a8193;
  --off-soft: #eef0f3;
  --group: #8a4fd6;
  --group-soft: #f1e9fc;
  --folder: #c27a12;
  --folder-soft: #fdf1df;
  --shadow: 0 1px 2px rgba(20, 25, 40, .06), 0 4px 16px rgba(20, 25, 40, .04);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1218;
    --surface: #181c25;
    --surface-2: #1e232e;
    --text: #e6e9ef;
    --muted: #9aa3b5;
    --border: #2a303c;
    --accent: #7096ff;
    --accent-soft: #1f2a46;
    --accent-text: #0f1218;
    --ok: #4cc47a;
    --ok-soft: #14301f;
    --bad: #ff7272;
    --bad-soft: #3a1919;
    --off: #9aa3b5;
    --off-soft: #252b36;
    --group: #b88cf2;
    --group-soft: #2c2140;
    --folder: #f0b04c;
    --folder-soft: #3a2a12;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1 { font-size: 24px; margin: 0; }
h2 { font-size: 19px; margin: 0; }
.muted { color: var(--muted); margin: 2px 0 0; }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.error { color: var(--bad); margin: 0; min-height: 1.2em; font-size: 14px; }
.error:empty { min-height: 0; }

/* Přihlášení */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px; box-shadow: var(--shadow);
}

/* Horní lišta */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap;
  background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 20px;
}
.brand { font-weight: 700; display: flex; align-items: center; gap: 9px; letter-spacing: -.3px; }
.brand::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.tabs button {
  background: transparent; color: var(--muted); border: 0; border-radius: 8px;
  padding: 8px 14px; font-weight: 500;
}
.tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs button.active { color: var(--accent); background: var(--accent-soft); }
.count {
  display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 12px; text-align: center;
}
.count:empty { display: none; }
.who { color: var(--muted); font-size: 14px; }
.group-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; min-width: 0; }
.group-heading-actions button { min-width: 0; white-space: normal; }
.folder-root-names { display: grid; gap: 12px; }
.folder-root-name { padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.folder-root-name label { margin: 10px 0 0; }
.folder-root-path, .folder-root-preview { display: block; overflow-wrap: anywhere; }
.folder-root-preview { margin-top: 8px; }
.folder-rename { align-self: flex-start; margin-top: 8px; white-space: normal; }

main { max-width: 1060px; margin: 0 auto; padding: 22px 24px 64px; }
.startup-status { padding: 24px; text-align: center; color: var(--muted); }
.maintenance-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.dashboard-maintenance { margin: 22px 0; scroll-margin-top: 100px; }
.dashboard-section-head { margin-bottom: 12px; }
.maintenance-card { display: flex; flex-direction: column; align-items: stretch; gap: 12px; min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.maintenance-card h3 { margin: 0; font-size: 16px; }
.maintenance-card > p { font-size: 14px; }
.maintenance-card p { margin: 0; }
.maintenance-card-actions { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 4px; min-width: 0; }
.maintenance-card-actions > button { flex: 1; min-width: 0; white-space: normal; }
.maintenance-card-actions .help-tip { flex: none; }
.maintenance-card > .maintenance-readonly { font-size: 13px; }
.maintenance-notice { padding: 10px 12px; border-left: 3px solid var(--folder); border-radius: 8px; background: var(--folder-soft); color: var(--text); font-size: 13px; }
.repair-status p { margin: 6px 0 0; }
.repair-status ul { margin: 8px 0 0; padding-left: 20px; overflow-wrap: anywhere; }
button.compact { font-size: 13px; padding: 6px 11px; }
.state-status { padding: 12px 14px; margin: 0 0 18px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 14px; }
.state-status.error { color: var(--bad); background: var(--bad-soft); }
.state-status.success { color: var(--ok); background: var(--ok-soft); }
.list-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.search-field { width: min(100%, 380px); font-size: 12px; color: var(--muted); }
.search-field input { font-size: 14px; color: var(--text); }
.list-toolbar > span { padding-bottom: 10px; white-space: nowrap; }

.section-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}

/* Seznamy */
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; box-shadow: var(--shadow);
}
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-title { font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: 13px; }
.row-sub, .chip { overflow-wrap: anywhere; }

.avatar {
  flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 650;
}
.avatar.group { background: var(--group-soft); color: var(--group); border-radius: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 10px; font-size: 13px;
}
.chip.rw { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip.ro { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.tag {
  display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 6px; vertical-align: 2px;
  background: var(--group-soft); color: var(--group); font-size: 12px; font-weight: 600;
}
.summary { margin: 2px 0 0; color: var(--muted); font-size: 13px; font-weight: 400; }
.pill { flex: none; border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 500; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: var(--off-soft); color: var(--off); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

.empty {
  text-align: center; padding: 40px 20px; border: 2px dashed var(--border); border-radius: 14px;
}
.empty p { margin: 6px 0 0; }

/* Databázové účty */
.database-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.database-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.database-toolbar label { color: var(--muted); font-size: 12px; }
.database-toolbar input, .database-toolbar select { color: var(--text); font-size: 14px; }
.database-hint { margin: 10px 0 14px; }
.database-account .row-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.database-account .row-title .pill { font-weight: 400; }
.database-account .row-sub { margin: 0; }
.database-grants { display: flex; flex-direction: column; gap: 12px; }
.database-grants h3 { margin: 0 0 6px; font-size: 14px; }
.database-grants ul { margin: 0; padding-left: 20px; }
.database-grants li { margin: 4px 0; overflow-wrap: anywhere; font-size: 13px; }
.database-grants .state-status { margin-bottom: 0; }
.database-access-list { max-height: 310px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.database-access-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; }
.database-access-row + .database-access-row { border-top: 1px solid var(--border); }
.database-access-row label { flex: 1; min-width: 0; flex-direction: row; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.database-access-row input[type="checkbox"] { width: 18px; height: 18px; flex: none; }
.database-access-row select { width: 170px; font-size: 13px; }
.database-warning { background: var(--folder-soft); color: var(--text); border-radius: 10px; padding: 12px; font-size: 13px; }
.database-warning p { margin: 3px 0; }
.database-password { display: flex; flex-direction: column; gap: 8px; }
.database-password .input-row { flex-wrap: wrap; }
.database-password .input-row input { min-width: 120px; }
.database-dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Oznámení */
.settings-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; align-items: start; }
.settings-fields { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 12px; }
.settings-fields label { min-width: 0; }
.settings-full { grid-column: 1 / -1; }
.settings-card-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.settings-card-actions h2 { margin-right: auto; }
.settings-card-actions .help-tip { margin-left: auto; }
.settings-repositories { display: grid; gap: 12px; }
.settings-repository { display: flex; align-items: start; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--border); min-width: 0; }
.settings-repository-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; overflow-wrap: anywhere; }
.settings-repository-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.settings-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 20px 0; }
.brand { max-width: 260px; overflow-wrap: anywhere; }
@media (max-width: 850px) { .settings-layout { grid-template-columns: minmax(0, 1fr); } }
.notifications-layout { width: 100%; max-width: 720px; }
#notifications-form .notifications-actions > button { flex: 1 1 0; width: auto; }
.notifications-card { display: flex; flex-direction: column; gap: 16px; min-width: 0; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.notifications-card p { margin: 0; }
.notifications-card .state-status { margin: 0; }
.notifications-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.notifications-secondary { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--border); }
.notifications-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.notifications-modal-head h2 { margin: 0; overflow-wrap: anywhere; }
.notifications-modal-head button { flex: none; }
.notifications-modal-section { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding-top: 18px; border-top: 1px solid var(--border); }
.notifications-modal-section p, .notifications-modal-section h3 { margin: 0; }
.notifications-modal-section h3 { font-size: 16px; }
.notifications-modal .state-status { margin: 0; }
#notifications-settings-dialog { width: min(680px, calc(100vw - 32px)); }
.notifications-events { min-width: 0; padding: 0; margin: 0; border: 0; }
.notifications-events legend { font-weight: 600; margin-bottom: 12px; }
#notifications-event-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
#notifications-event-options label { flex-direction: row; align-items: flex-start; font-weight: 400; gap: 9px; }
#notifications-event-options input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.notifications-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.notifications-counts > div { padding: 10px 6px; background: var(--surface-2); border-radius: 8px; text-align: center; }
.notifications-counts strong { display: block; font-size: 21px; }
.notifications-counts span { color: var(--muted); font-size: 12px; }
.notifications-detail { overflow-wrap: anywhere; margin-top: 10px !important; font-size: 13px; }
.notifications-setup { margin-top: 18px; }
.notifications-setup ol { margin: 0; padding-left: 22px; }
.notifications-setup li + li { margin-top: 8px; }
.notifications-copy { display: flex; gap: 10px; align-items: flex-end; }
.notifications-copy label { min-width: 0; flex: 1; }
.notifications-copy button { flex: none; }
.notifications-repositories { display: flex; gap: 8px 16px; flex-wrap: wrap; overflow-wrap: anywhere; }
.notifications-repositories a { color: var(--accent); }
.notifications-repository-status { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); overflow-wrap: anywhere; font-size: 13px; }

/* Server */
.system-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.system-card { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.mlo-card { margin: 22px 0; }
.deployment-update-card { margin: 22px 0; }
.deployment-update-heading, .deployment-update-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.deployment-update-heading h2 { margin: 0; }
.deployment-update-actions { margin-left: auto; }
.deployment-update-actions button { min-width: 0; white-space: normal; }
.deployment-update-status { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.deployment-update-status > span:last-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.mlo-heading, .mlo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mlo-heading h2 { margin: 0; }
.mlo-heading > button, .mlo-actions > button { margin-left: auto; }
.mlo-heading .help-tip { align-self: center; }
.mlo-resources { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 8px; margin: 16px 0 12px; max-height: 280px; overflow-y: auto; }
.mlo-resource { display: flex; flex-direction: row; align-items: center; gap: 10px; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); min-width: 0; overflow-wrap: anywhere; }
.mlo-resource:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mlo-resource input { flex: 0 0 20px; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.mlo-resource span { min-width: 0; }
.mlo-preview { margin: 16px 0 12px; padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.mlo-paths { display: grid; gap: 5px; margin: 0 0 12px; }
.mlo-paths .mono { overflow-wrap: anywhere; }
.mlo-counts { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.mlo-job { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.mlo-job > span:last-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.mlo-spinner { flex: 0 0 20px; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: mlo-spin .8s linear infinite; }
@keyframes mlo-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .mlo-spinner { animation-duration: 2s; } }
.system-metric h2 { color: var(--muted); font-size: 14px; font-weight: 500; }
.system-value { display: block; margin: 8px 0; font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
.system-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.system-items { margin-top: 14px; }
.system-item { padding: 12px 0; overflow-wrap: anywhere; }
.system-item + .system-item, .system-service + .system-service { border-top: 1px solid var(--border); }
.system-item-head { display: flex; justify-content: space-between; gap: 12px; }
.system-item-head > :first-child { min-width: 0; }
.system-card meter { width: 100%; display: block; height: 12px; margin: 8px 0; accent-color: var(--accent); }
.system-network-rates { display: flex; gap: 6px 20px; flex-wrap: wrap; margin: 6px 0; }
.system-service-filters { display: flex; gap: 14px; align-items: flex-end; margin: 18px 0 12px; }
.system-service-filters > label { min-width: 0; }
.system-service-filters > label:last-child { width: 180px; font-size: 12px; color: var(--muted); }
.system-service { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 0; }
.system-service-main { min-width: 0; overflow-wrap: anywhere; }
#system-warnings p { margin: 2px 0; }

/* Historie */
.inline-help { color: var(--muted); font-size: 12px; margin: 8px 0 14px; }
.inline-help > summary { cursor: pointer; width: fit-content; }
.inline-help p { max-width: 75ch; line-height: 1.5; margin: 8px 0 0; }
.maintenance-card .inline-help { margin-bottom: 0; }
.help-tip { display: inline-flex; width: fit-content; vertical-align: middle; align-self: start; }
.help-button { padding: 2px 4px; border: 0; background: none; color: var(--muted); font-size: 17px; font-weight: 400; line-height: 1.25; }
.help-button:hover, .help-button:focus-visible { color: var(--accent); background: var(--accent-soft); }
.help-tooltip { position: fixed; z-index: 30; width: max-content; max-width: min(340px, calc(100vw - 24px)); max-height: min(360px, calc(100vh - 24px)); overflow: auto; overflow-wrap: anywhere; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-size: 12px; font-weight: 400; line-height: 1.5; white-space: pre-line; }
.help-tooltip p { margin: 0; }
.help-tooltip p + p { margin-top: 8px; }
.history-title { display: flex; align-items: center; gap: 9px; }
.history-title .help-tip { align-self: center; }
.history-capture { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 10px; padding: 10px 12px; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.history-capture .help-tip { margin-left: auto; align-self: center; }
.history-capture.warning { background: var(--folder-soft); border-color: transparent; }
.history-capture p { margin: 4px 0 0; }
.history-filters {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr) auto; gap: 12px;
  padding: 16px; margin-bottom: 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
}
.history-filters label { min-width: 0; font-size: 12px; color: var(--muted); }
.history-filters input, .history-filters select { font-size: 14px; color: var(--text); }
.history-query { grid-column: span 2; }
.history-user { grid-column: 3; }
.history-action { grid-column: 1; }
.history-result { grid-column: 2; }
.history-result .choice-options { display: flex; flex-wrap: nowrap; gap: 4px; }
.history-result .choice-button { flex: 1; padding: 10px 8px; font-size: 13px; white-space: nowrap; }
.history-action-control { min-width: 0; }
.history-action-open { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-width: 0; padding: 10px 12px; font-size: 14px; font-weight: 400; text-align: left; }
.history-action-open > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-action-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 8px; max-height: min(430px, 50vh); overflow-y: auto; padding: 3px; }
.history-action-option { background: var(--surface-2); color: var(--text); border-color: var(--border); padding: 12px; min-width: 0; white-space: normal; overflow-wrap: anywhere; text-align: left; font-size: 14px; }
.history-action-option[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.history-action-option:hover { border-color: var(--accent); }
.history-filter-actions { display: flex; align-items: flex-end; justify-content: flex-end; gap: 8px; }
.history-filter-hint { grid-column: 1 / -1; }
.history-status { margin: 0 0 12px; min-height: 1.5em; }
.history-pagination { display: flex; justify-content: center; margin-top: 18px; }
@media (max-width: 900px) {
  .history-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .history-query, .history-action { grid-column: 1; }
  .history-user, .history-result { grid-column: 2; }
  .history-filter-actions { grid-column: 1 / -1; }
}
.event {
  display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px;
}
.event-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.event-heading { display: flex; align-items: center; gap: 8px 12px; justify-content: space-between; flex-wrap: wrap; }
.event-description { margin: 6px 0; }
.event-meta { display: flex; gap: 4px 16px; flex-wrap: wrap; }
.event-error { color: var(--bad); margin: 6px 0; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
details { margin-top: 6px; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; }
pre {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin: 6px 0 0; overflow-x: auto; font-size: 12.5px; white-space: pre-wrap;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

/* Formuláře */
label, .field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.label { font-size: 14px; font-weight: 500; }
.hint { color: var(--muted); font-size: 12.5px; font-weight: 400; min-height: 1em; }
.hint:empty { display: none; }
input, select {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; min-width: 0; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.choice-control { display: grid; gap: 8px; min-width: 0; }
.choice-options { display: flex; flex-wrap: wrap; align-items: stretch; gap: 7px; min-width: 0; }
.choice-button { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 8px 11px; border-radius: 8px; font-size: 13px; white-space: normal; overflow-wrap: anywhere; text-align: left; min-width: 0; max-width: 100%; }
.choice-button[aria-checked="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.choice-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-long .choice-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); max-height: 210px; overflow-y: auto; overscroll-behavior: contain; padding: 3px; }
.choice-search { width: 100%; font-size: 13px; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; }
.input-row button { flex: none; }

/* Zaškrtávací "štítky" */
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { position: relative; font-weight: 400; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick span {
  display: inline-block; cursor: pointer; border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; background: var(--surface); user-select: none;
}
.pick input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.pick input:checked + span::before { content: "✓ "; }
.pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Oprávnění ke složce: Číst / Upravovat / Nahrávat / Mazat */
.flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag-btn {
  background: var(--surface); color: var(--muted); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; font-size: 13.5px; font-weight: 500;
}
.flag-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.flag-btn[aria-pressed="true"]::before { content: "✓ "; }

/* Složky skupiny */
.folder-editor { display: flex; flex-direction: column; gap: 10px; }
.folder-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; }
.folder-list > p { margin: 0; padding: 12px 14px; }
.folder-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.folder-row:last-child { border-bottom: 0; }
.folder-top { display: flex; align-items: flex-start; gap: 10px; }
.folder-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.folder-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.folder-tools .link { font-size: 13px; }
.tool-status.ok { color: var(--ok); }
.tool-status.bad { color: var(--bad); }
button.link.armed { color: var(--bad); font-weight: 600; }
.two-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.sub-label { font-size: 13px; color: var(--muted); }
.folder-info .path { color: var(--muted); font-size: 12.5px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; }
.icon-btn {
  background: transparent; color: var(--muted); border: 1px solid transparent; padding: 2px 10px;
  font-size: 20px; line-height: 1;
}
.icon-btn:hover { color: var(--bad); border-color: var(--border); }
.add-folder { align-self: flex-start; }
.folder-adder:empty { display: none; }
.folder-adder { display: flex; flex-direction: column; gap: 10px; }
.adder-buttons { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Výběr složky na serveru */
.browser { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.browser.loading { opacity: .6; }
.browse-path {
  padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; overflow-wrap: anywhere;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
}
.browse-path .link { font: inherit; padding: 3px 0; white-space: normal; overflow-wrap: anywhere; }
.browse-list { max-height: min(360px, 45vh); overflow-y: auto; display: flex; flex-direction: column; }
.browse-choice { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--border); }
.browse-choice:last-child { border-bottom: 0; }
.browse-choice:hover { background: var(--accent-soft); }
.browse-choice > .help-tip, .browse-current > .help-tip { align-self: center; flex: 0 0 auto; }
.flags > .help-tip { align-self: center; }
.browse-protected .browse-open { color: var(--muted); opacity: 1; }
.browse-choice input, .browse-current input { width: 20px; height: 20px; flex: 0 0 20px; margin: 0; accent-color: var(--accent); }
.browse-open { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex: 1; min-width: 0; text-align: left; padding: 10px 0; background: transparent; color: var(--text); font-weight: 400; white-space: normal; overflow-wrap: anywhere; }
.browse-open span:first-child { min-width: 0; }
.browse-current { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; padding: 12px; border-bottom: 1px solid var(--border); }
.browse-current-selection { display: flex; flex-direction: row; align-items: center; gap: 12px; flex: 1; min-width: 0; margin: 0; }
.browse-current-selection > span { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.browse-selection { display: flex; flex-wrap: wrap; gap: 6px; }
.browse-selection:empty { display: none; }
.browse-selected { display: flex; align-items: center; gap: 8px; max-width: 100%; background: var(--accent-soft); color: var(--text); border-color: var(--border); padding: 5px 9px; font-size: 12px; white-space: normal; text-align: left; }
.browse-selected span:first-child { min-width: 0; overflow-wrap: anywhere; }
.adder-buttons > [role="status"] { margin-right: auto; }
.browse-row {
  text-align: left; background: transparent; color: var(--text); border: 0; border-radius: 0;
  border-bottom: 1px solid var(--border); padding: 8px 12px; font-weight: 400; white-space: normal; overflow-wrap: anywhere;
}
.browse-row:hover { background: var(--accent-soft); }
.browse-row.up { color: var(--muted); }
.browse-empty { margin: 0; padding: 10px 12px; }
.selected-path { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.selected-path.ok { color: var(--ok); }
.selected-path.bad { color: var(--bad); }

/* Přepínač s popisem (přístup do panelu) */
.toggle {
  flex-direction: row; align-items: flex-start; gap: 12px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
.toggle input { width: 20px; height: 20px; flex: none; margin: 2px 0 0; accent-color: var(--accent); }
.toggle span { display: flex; flex-direction: column; gap: 2px; }
.toggle small { color: var(--muted); font-size: 13px; font-weight: 400; }

/* Tlačítka */
button {
  font: inherit; font-weight: 500; cursor: pointer; padding: 9px 16px; border-radius: 10px;
  border: 1px solid transparent; white-space: nowrap;
}
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button.primary:hover:not(:disabled) { filter: brightness(.94); }
input:read-only { color: var(--muted); background: var(--surface-2); }
button.primary { background: var(--accent); color: var(--accent-text); }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
button.secondary:hover { background: var(--surface-2); }
button.danger { background: transparent; color: var(--bad); padding-left: 0; padding-right: 0; }
button.danger-solid { background: var(--bad); color: #fff; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); }

/* Dialog */
dialog {
  border: 0; border-radius: 16px; padding: 0; background: var(--surface); color: var(--text);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(10, 14, 22, .5); }
.dialog-form { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.dialog-form[aria-busy="true"] { cursor: progress; }
.dialog-form > .state-status { margin-bottom: 0; }
.dialog-head p { margin-top: 4px; }
.dialog-head h2 { overflow-wrap: anywhere; }
.dialog-section {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--border); padding-top: 14px;
}
.dialog-section p { margin: 2px 0 0; }
.dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.dialog-buttons { display: flex; gap: 8px; margin-left: auto; }

/* Přístupy k účtu: skupiny a výsledný náhled */
dialog.wide { width: min(840px, calc(100vw - 32px)); }
.user-section { display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 18px; min-width: 0; }
.user-section h3 { margin: 0; font-size: 17px; }
.user-section p { margin: 0; }
.user-section h3 + p { margin-top: 5px; }
.user-account-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.user-folder-preview, .user-folder-list { display: flex; flex-direction: column; gap: 8px; }
.user-folder-card { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.user-folder-card > strong, .user-folder-source { overflow-wrap: anywhere; }
.user-folder-effect { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; }
.permission-help { font-size: 13px; color: var(--muted); }
.permission-help summary { cursor: pointer; color: var(--accent); }
.permission-help dl { display: grid; gap: 8px; margin: 12px 0; }
.permission-help dl > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; }
.permission-help dt { color: var(--text); font-weight: 600; }
.permission-help dd { margin: 0; }
.user-danger { border-style: dashed; }
.user-danger .dialog-section { padding-top: 0; border-top: 0; }
.user-danger h3 { color: var(--bad); }
dialog.wide .dialog-actions { position: sticky; bottom: 0; padding: 14px 0; background: var(--surface); border-top: 1px solid var(--border); z-index: 1; }

.credentials {
  display: grid; gap: 8px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
}
.credentials div { display: flex; justify-content: space-between; gap: 12px; }
.credentials span { color: var(--muted); }
.credentials strong { overflow-wrap: anywhere; text-align: right; min-width: 0; }
.credentials span { flex: none; }
.copy-row { display: flex; flex-wrap: wrap; gap: 8px; }
.discord-preview { max-height: 220px; overflow-y: auto; font-size: 12px; line-height: 1.5; }

/* Oznámení */
.devlog-top-actions, .devlog-secondary-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.devlog-workspace { display: grid; gap: 22px; }
.devlog-picker { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.devlog-create { display: grid; gap: 8px; min-width: 0; }
.devlog-create-buttons, .devlog-ai-scope { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.devlog-create-buttons button { white-space: normal; }
.devlog-ai-scope .text-button { font-size: 13px; text-align: left; overflow-wrap: anywhere; }
#devlog-ai-status:empty { display: none; }
#devlog-ai-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.devlog-picker label { font-weight: 600; }
.devlog-picker select { min-width: 0; }
.devlog-editor-head h2 { font-size: 18px; margin: 0; }
#devlog-form { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.devlog-editor-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
#devlog-item-status { margin: 0; display: flex; flex-direction: column; gap: 6px; overflow-wrap: anywhere; }
#devlog-item-status p, #devlog-uncertain p { margin: 0; }
#devlog-uncertain button { margin-top: 10px; white-space: normal; }
.devlog-edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, .95fr); gap: 22px; align-items: start; }
.devlog-fields { display: grid; gap: 16px; min-width: 0; }
.devlog-fields textarea { width: 100%; resize: vertical; min-height: 80px; font: inherit; font-size: 14px; line-height: 1.5; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; color: var(--text); background: var(--surface); }
.devlog-fields textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.devlog-fields textarea:disabled { opacity: .65; }
.devlog-fields p { margin: 0; }
.devlog-sources { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 16px; }
.devlog-sources > summary { color: var(--text); font-weight: 600; font-size: 15px; }
.devlog-sources > p { margin: 12px 0; }
.devlog-source-period { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.devlog-source-period > label { min-width: 200px; }
.devlog-source-dates { display: flex; gap: 10px; flex-wrap: wrap; }
.devlog-source-dates input { min-width: 0; }
.devlog-source-filters { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(160px, 1fr); gap: 5px 10px; margin: 14px 0; align-items: end; }
.devlog-source-filters label { font-size: 12px; color: var(--muted); }
.devlog-source-filters label[for="devlog-source-repository"] { grid-column: 1; grid-row: 1; }
#devlog-source-repository { grid-column: 1; grid-row: 2; }
.devlog-source-filters label[for="devlog-source-search"] { grid-column: 2; grid-row: 1; }
#devlog-source-search { grid-column: 2; grid-row: 2; }
.devlog-source-list { display: grid; gap: 10px; max-height: 520px; overflow-y: auto; }
.devlog-source-item { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; min-width: 0; }
.devlog-source-message { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; }
.devlog-source-buttons { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.devlog-source-buttons .help-tip { margin-left: auto; }
#devlog-source-undo { margin-top: 12px; }
.devlog-source-item.used { background: var(--surface-2); }
.devlog-source-item p { margin: 0; overflow-wrap: anywhere; }
.devlog-source-title { display: flex; align-items: start; gap: 8px; }
.devlog-source-title > label { display: flex; flex-direction: row; align-items: start; gap: 9px; flex: 1; min-width: 0; }
.devlog-source-title input { width: 17px; height: 17px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.devlog-source-title strong { overflow-wrap: anywhere; font-size: 14px; }
.devlog-source-item pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; margin: 8px 0 0; }
.devlog-source-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.devlog-source-meta .pill { white-space: normal; }
.devlog-source-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.devlog-source-actions label { font-size: 13px; color: var(--muted); }
.devlog-source-actions select { width: auto; }
#devlog-source-warnings { margin: 10px 0; font-size: 13px; }
#devlog-source-warnings p { margin: 4px 0; }
.devlog-preview-area { position: sticky; top: 120px; min-width: 0; }
.devlog-preview-area > h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.devlog-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.devlog-preview-heading h3 { margin: 0; font-size: 14px; color: var(--muted); }
.text-button { padding: 0; border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 400; box-shadow: none; }
.text-button:hover { text-decoration: underline; background: none; }
#sender-form { display: grid; gap: 14px; }
#sender-form input[type="file"] { max-width: 100%; font-size: 12px; padding: 8px; }
.sender-preview { display: flex; align-items: center; gap: 12px; overflow-wrap: anywhere; min-width: 0; }
.sender-preview img, #sender-avatar-empty { width: 48px; height: 48px; border-radius: 50%; flex: none; object-fit: cover; }
#sender-avatar-empty { display: grid; place-items: center; color: var(--muted); background: var(--surface-2); }
#sender-status, #sender-feedback { margin: 0; }
.devlog-preview { background: #2b2d31; color: #dbdee1; border: 1px solid #3f4147; border-radius: 10px; padding: 20px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.devlog-preview h3 { color: #fff; font-size: 24px; margin: 0 0 12px; }
.devlog-preview h4 { color: #fff; font-size: 16px; margin: 12px 0 8px; }
.devlog-preview p { margin: 4px 0; white-space: pre-wrap; }
.devlog-preview hr { border: 0; border-top: 1px solid #44444a; margin: 17px 0; }
.devlog-preview .devlog-intro { color: #b5bac1; }
.devlog-preview .devlog-bullet { padding-left: 4px; }
.devlog-preview .devlog-depth-1 { margin-left: 18px; }
.devlog-preview .devlog-depth-2 { margin-left: 36px; }
.devlog-preview .devlog-depth-3 { margin-left: 54px; }
.devlog-preview .devlog-depth-4 { margin-left: 72px; }
.devlog-join-button { display: inline-block; background: #4e5058; color: #fff; border-radius: 5px; padding: 8px 12px; text-decoration: none; }
.devlog-join-button:hover { background: #5d5f68; }
.devlog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; }
.devlog-save-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.devlog-options > summary { color: var(--muted); font-size: 13px; }
.devlog-options .devlog-secondary-actions { margin-top: 12px; }
.system-value, .system-network-rates, #system-status, #devlog-count { font-variant-numeric: tabular-nums; }
#devlog-load-status:empty { display: none; }
#devlog-item-status:empty { display: none; }
#sender-status:empty, #notifications-load-status:empty { display: none; }
.devlog-fields input, .devlog-fields textarea { scroll-margin-top: 140px; scroll-margin-bottom: 140px; }
#devlog-feedback { margin: 0; }
@media (max-width: 1050px) {
  .devlog-edit-layout { grid-template-columns: minmax(0, 1fr); }
  .devlog-preview-area { position: static; }
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px;
  background: var(--text); color: var(--bg); box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.toast.error { background: var(--bad); color: #fff; }

@media (max-width: 600px) {
  .devlog-source-filters { grid-template-columns: minmax(0, 1fr); }
  .devlog-source-filters label[for="devlog-source-repository"], #devlog-source-repository, .devlog-source-filters label[for="devlog-source-search"], #devlog-source-search, #devlog-source-refresh { grid-column: auto; grid-row: auto; }
  .devlog-source-title { flex-wrap: wrap; }
  .devlog-source-title > label { flex-basis: 100%; }
  .devlog-source-actions label { flex-basis: 100%; }
  .devlog-source-actions select, .devlog-source-actions button { flex: 1; min-width: 0; white-space: normal; }
  .devlog-workspace { grid-template-columns: minmax(0, 1fr); }
  .devlog-picker { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 8px; }
  .devlog-picker label { grid-column: 1 / -1; }
  .devlog-top-actions { width: 100%; }
  .devlog-top-actions > button, .devlog-actions > button { flex: 1; white-space: normal; }
  .devlog-actions { width: 100%; justify-content: space-between; }
  .devlog-source-period > label, .devlog-source-dates { width: 100%; }
  .devlog-source-dates > label { flex: 1; min-width: 0; }
  .devlog-secondary-actions > button { white-space: normal; }
  .devlog-preview { padding: 16px; }
  .user-section { padding: 13px; }
  .user-folder-card { padding: 12px; }
  .user-section .two-cols { grid-template-columns: minmax(0, 1fr); }
  .user-account-actions > button { white-space: normal; flex: 1; }
  .notifications-card { padding: 18px; }
  .notifications-actions > button { width: 100%; }
  .notifications-copy { flex-wrap: wrap; }
  .notifications-copy label, .notifications-copy button { width: 100%; flex-basis: 100%; }
  .database-toolbar { grid-template-columns: minmax(0, 1fr); }
  .database-actions { width: 100%; }
  .database-actions button { flex: 1; width: auto; }
  .database-access-row { flex-wrap: wrap; }
  .database-access-row label { flex-basis: 100%; }
  .database-access-row select { width: 100%; }
  .system-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .system-columns { grid-template-columns: minmax(0, 1fr); }
  .system-card { padding: 14px; }
  .system-value { font-size: 21px; }
  .system-service-filters { flex-wrap: wrap; }
  .system-service-filters > label:last-child { width: 100%; }
  .system-service .pill { padding: 3px 8px; }
  .topbar { padding: 10px 14px; }
  .who { margin-left: auto; }
  .tabs { order: 3; flex-basis: 100%; }
  .tabs button { flex: 1; padding-left: 8px; padding-right: 8px; }
  main { padding: 20px 14px 48px; }
  h1 { font-size: 22px; }
  .maintenance-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .dashboard-maintenance { scroll-margin-top: 190px; }
  .maintenance-card { padding: 18px; }
  .list-toolbar { flex-wrap: wrap; gap: 6px; }
  .search-field { width: 100%; }
  .list-toolbar > span { padding-bottom: 0; }
  .history-filters { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .history-query, .history-user, .history-action, .history-result, .history-filter-actions { grid-column: auto; }
  .history-action-options { grid-template-columns: minmax(0, 1fr); }
  .history-filter-actions { justify-content: stretch; }
  .history-filter-actions button { flex: 1; }
  .row { flex-wrap: wrap; }
  .row-main { flex-basis: calc(100% - 60px); }
  .row > button { margin-left: auto; }
  .section-head button { width: 100%; }
  .section-head { gap: 12px; }
  .dialog-form { padding: 20px 16px; }
  .dialog-section { align-items: flex-start; flex-wrap: wrap; }
  .dialog-actions { align-items: stretch; }
  .dialog-buttons { flex-wrap: wrap; }
  .copy-row button { width: 100%; white-space: normal; }
  .adder-buttons button { white-space: normal; }
  .input-row { flex-wrap: wrap; }
  .input-row input { min-width: 160px; }
  .folder-tools .link { text-align: left; white-space: normal; }
}
