/* CMS Installer – design system (Apple-like). Sdílí instalátor i administrace. */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-strong: rgba(120, 120, 128, 0.2);
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8e8e93;
  --separator: rgba(60, 60, 67, 0.14);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --green: #28a745;
  --green-soft: rgba(52, 199, 89, 0.14);
  --orange: #c76a00;
  --orange-soft: rgba(255, 149, 0, 0.14);
  --red: #e0352b;
  --red-soft: rgba(255, 59, 48, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.16);
  --glass: rgba(255, 255, 255, 0.72);
  --segment-active: #ffffff;
  --icon-plate: #ffffff;
  --logo-shadow: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .28)) drop-shadow(0 0 .5px rgba(0, 0, 0, .25));

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

/* Tmavý vzhled: buď podle systému (bez volby), nebo vynucený přepínačem (data-theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --fill: rgba(120, 120, 128, 0.24);
    --fill-strong: rgba(120, 120, 128, 0.36);
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8e8e93;
    --separator: rgba(84, 84, 88, 0.45);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, 0.18);
    --orange: #ff9f0a;
    --orange-soft: rgba(255, 159, 10, 0.18);
    --red: #ff453a;
    --red-soft: rgba(255, 69, 58, 0.18);
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.4);
    --glass: rgba(28, 28, 30, 0.72);
    --segment-active: #636366;
    --icon-plate: #f2f2f7;
    --logo-shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --fill: rgba(120, 120, 128, 0.24);
  --fill-strong: rgba(120, 120, 128, 0.36);
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #8e8e93;
  --separator: rgba(84, 84, 88, 0.45);
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-soft: rgba(10, 132, 255, 0.18);
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, 0.18);
  --orange: #ff9f0a;
  --orange-soft: rgba(255, 159, 10, 0.18);
  --red: #ff453a;
  --red-soft: rgba(255, 69, 58, 0.18);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.4);
  --glass: rgba(28, 28, 30, 0.72);
  --segment-active: #636366;
  --icon-plate: #f2f2f7;
  --logo-shadow: none;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.47 var(--font);
  letter-spacing: -0.01em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
[hidden] { display: none !important; }
svg.i { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.022em; }
.display { font-size: clamp(34px, 5vw, 56px); line-height: 1.07; font-weight: 700; letter-spacing: -0.035em; }
.title-1 { font-size: 28px; line-height: 1.15; font-weight: 700; }
.title-2 { font-size: 22px; line-height: 1.2; }
.title-3 { font-size: 19px; line-height: 1.25; }
.headline { font-size: 15px; font-weight: 600; }
.subhead { font-size: 13px; color: var(--text-2); }
.footnote { font-size: 12px; color: var(--text-3); }
.muted { color: var(--text-2); }
.lead { font-size: 19px; color: var(--text-2); line-height: 1.42; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- layout */
.container { width: min(1120px, 100% - 40px); margin-inline: auto; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 12px); }
.row { display: flex; align-items: center; gap: var(--gap, 12px); }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: var(--gap, 16px); }

/* --------------------------------------------------------------- toolbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: var(--glass);
  border-bottom: 1px solid var(--separator);
}
.topbar-inner { height: 52px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; object-fit: contain; filter: var(--logo-shadow); }

/* --------------------------------------------------------------- buttons */
.btn {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 980px;
  font-size: 14px; font-weight: 500; white-space: nowrap;
  background: var(--fill); color: var(--text);
  transition: background .2s, transform .1s, opacity .2s;
}
.btn:hover { background: var(--fill-strong); text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--red); }
.btn.danger.filled { background: var(--red); color: #fff; }
.btn.plain { background: transparent; color: var(--accent); padding: 0 8px; }
.btn.plain:hover { background: var(--accent-soft); }
.btn.large { height: 48px; padding: 0 26px; font-size: 17px; }
.btn.small { height: 28px; padding: 0 12px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.large svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------ inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--separator); border-radius: 10px;
  background: var(--bg-elevated); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input::placeholder { color: var(--text-3); }
.field.invalid .input, .field.invalid .select { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.field-error { font-size: 12px; color: var(--red); }
.field-hint { font-size: 12px; color: var(--text-3); }
.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 76px; }
.input-group .addons { position: absolute; right: 4px; top: 4px; bottom: 4px; display: flex; gap: 2px; }
.input-group .addons button { border: 0; background: transparent; color: var(--text-2); width: 32px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.input-group .addons button:hover { background: var(--fill); color: var(--text); }
.input-group .addons svg { width: 16px; height: 16px; }

/* Grouped form rows (iOS Settings) */
.group { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.group-title { padding: 0 4px 8px; font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: none; }
.group > .cell { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 16px; position: relative; }
.group > .cell + .cell::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator); }
.cell .cell-label { flex: 1; min-width: 0; }
.cell .cell-label small { display: block; font-size: 12px; color: var(--text-3); }
.cell.clickable { cursor: pointer; transition: background .15s; }
.cell.clickable:hover { background: var(--fill); }

/* Toggle (switch) */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--fill-strong); border-radius: 31px; transition: background .25s var(--ease); }
.switch span::after { content: ""; position: absolute; width: 27px; height: 27px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .25s var(--ease); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent-soft); outline-offset: 2px; }

/* Segmented control */
.segmented { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--fill); gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; height: 28px; padding: 0 14px; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--segment-active); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); }

.segmented.icons button { padding: 0 9px; display: inline-grid; place-items: center; }
.segmented.icons svg.i { width: 15px; height: 15px; vertical-align: 0; }
/* plynulý přechod při ručním přepnutí vzhledu */
.theme-anim, .theme-anim * { transition: background-color .35s ease, color .35s ease, border-color .35s ease !important; }

.checkbox { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 14px; }
.checkbox input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }

/* ------------------------------------------------------------- surfaces */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 20px; }
.card.pad-lg { padding: 28px; }
.divider { height: 1px; background: var(--separator); border: 0; margin: 0; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--fill); color: var(--text-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.blue { background: var(--accent-soft); color: var(--accent); }

.app-icon { width: 44px; height: 44px; border-radius: 22.5%; background: var(--icon-plate); padding: 7px; object-fit: contain; flex: none; box-shadow: inset 0 0 0 1px var(--separator); }
.app-icon.lg { width: 72px; height: 72px; padding: 12px; }
.app-icon.sm { width: 28px; height: 28px; padding: 4px; }

/* ------------------------------------------------------------ progress */
.progress { height: 6px; border-radius: 6px; background: var(--fill); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .6s var(--ease); }
.progress.green > i { background: var(--green); }
.progress.red > i { background: var(--red); }
.progress.indeterminate > i { width: 30% !important; animation: indet 1.4s infinite var(--ease); }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--fill-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Step list */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 9px 0; color: var(--text-3); font-size: 15px; }
.steps li .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; border: 2px solid var(--fill-strong); }
.steps li .dot svg { width: 13px; height: 13px; }
.steps li.done { color: var(--text); }
.steps li.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.steps li.active { color: var(--text); font-weight: 600; }
.steps li.active .dot { border-color: var(--accent); border-top-color: transparent; animation: spin .9s linear infinite; }
.steps li.failed { color: var(--red); font-weight: 600; }
.steps li.failed .dot { background: var(--red); border-color: var(--red); color: #fff; }
.steps li.cancelled .dot { background: var(--text-3); border-color: var(--text-3); color: #fff; }

/* Check results */
.checks { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.checks li { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.checks li svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.checks .ok svg { color: var(--green); }
.checks .warning svg { color: var(--orange); }
.checks .error svg { color: var(--red); }
.checks .info svg { color: var(--text-3); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--separator); background: var(--bg-elevated); height: 28px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; cursor: pointer; font-family: var(--mono); color: var(--text); }
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* Callouts */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r); background: var(--fill); font-size: 14px; }
.callout svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.callout.red { background: var(--red-soft); }
.callout.red svg { color: var(--red); }
.callout.orange { background: var(--orange-soft); }
.callout.orange svg { color: var(--orange); }
.callout.green { background: var(--green-soft); }
.callout.green svg { color: var(--green); }
.callout.blue { background: var(--accent-soft); }
.callout.blue svg { color: var(--accent); }

/* Disclosure */
details.disclosure > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 14px; font-weight: 500; user-select: none; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary svg { width: 14px; height: 14px; transition: transform .25s var(--ease); }
details.disclosure[open] > summary svg { transform: rotate(90deg); }

/* Log */
.log { font-family: var(--mono); font-size: 12px; line-height: 1.6; background: var(--surface-2); border-radius: var(--r); padding: 12px 14px; max-height: 320px; overflow: auto; }
.log .ln { display: flex; gap: 10px; }
.log .ln time { color: var(--text-3); flex: none; }
.log .ln.warning { color: var(--orange); }
.log .ln.error { color: var(--red); }
.log .ln.debug { color: var(--text-3); }
.log pre { margin: 2px 0 6px 72px; white-space: pre-wrap; word-break: break-word; color: var(--text-2); }

/* --------------------------------------------------------- sheet/modal */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.32); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .2s; }
.sheet { background: var(--bg-elevated); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: calc(100vh - 40px); overflow: auto; animation: pop .35s var(--ease); }
.sheet-head { padding: 22px 24px 4px; }
.sheet-body { padding: 14px 24px; }
.sheet-foot { padding: 12px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }

.drawer-scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.2); animation: fade .2s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(620px, 100%); background: var(--bg); box-shadow: var(--shadow-lg); overflow: auto; animation: slide .35s var(--ease); }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--separator); }
.drawer-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

/* Toasts */
.toasts { position: fixed; z-index: 80; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-radius: 99px; background: rgba(30,30,32,.92); color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); backdrop-filter: blur(20px); animation: pop .35s var(--ease); }
.toast svg { width: 18px; height: 18px; }
.toast.ok svg { color: #30d158; }
.toast.error svg { color: #ff453a; }

/* Key/value list */
.kv { display: grid; grid-template-columns: minmax(120px, 32%) 1fr; gap: 10px 16px; font-size: 14px; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 10px 16px; border-bottom: 1px solid var(--separator); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--separator); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; transition: background .12s; }
.table tbody tr.clickable:hover { background: var(--fill); }

.empty { text-align: center; padding: 48px 20px; color: var(--text-2); }
.empty svg { width: 40px; height: 40px; color: var(--text-3); margin: 0 auto 12px; }

.skeleton { background: linear-gradient(90deg, var(--fill) 25%, var(--fill-strong) 37%, var(--fill) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
