:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --soft: #f7f7f8;
  --text: #171719;
  --muted: #6f7075;
  --line: #dedfe3;
  --accent: #9b2f82;
  --accent-dark: #74205f;
  --danger: #b42318;
  --success: #137333;
  --warning: #7d5412;
  --shadow: 0 16px 46px rgba(19, 19, 23, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

/* Prihlásenie a prvé nastavenie */
.auth-shell {
  width: min(920px, calc(100% - 28px));
  margin: 46px auto;
}
.auth-brand { margin-bottom: 20px; }
.auth-brand span,
.brand__eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.auth-brand h1,
.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -.025em;
}
.auth-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.auth-card--login { max-width: 520px; }
.auth-card h2 { margin: 0 0 8px; font-size: 20px; }
.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.auth-grid--single { grid-template-columns: 1fr; }
.auth-submit { grid-column: 1 / -1; }

/* Hlavička */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(14px);
}
.brand { min-width: 0; }
.brand h1 { font-size: 19px; }
.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* Tlačidlá */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 750;
  text-decoration: none;
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}
.btn:hover {
  border-color: #b9bac0;
  transform: translateY(-1px);
}
.btn--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}
.btn--danger { color: var(--danger); }
.btn--small {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 13px;
}

/* Rozloženie */
.layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  min-height: calc(100vh - 69px);
}
.sidebar {
  position: sticky;
  top: 69px;
  align-self: start;
  height: calc(100vh - 69px);
  overflow: auto;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #fafafb;
}
.main {
  min-width: 0;
  padding: 24px;
}
.panel {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel);
  box-shadow: 0 7px 24px rgba(20, 20, 24, .035);
}
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}
.panel__head h2,
.panel__head h3 {
  margin: 0;
  font-size: 15px;
}
.panel__body { padding: 16px; }
.help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

/* Správy */
.notice,
.status {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #b7d9c1;
  border-radius: 10px;
  background: #effaf2;
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
}
.status { display: none; }
.status.is-visible { display: block; }
.notice.is-error,
.status.is-error {
  border-color: #efc1bc;
  background: #fff3f2;
  color: var(--danger);
}
.notice.is-warning,
.status.is-warning {
  border-color: #efd7a4;
  background: #fff8e8;
  color: var(--warning);
}

/* Formuláre */
.global-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  font-size: 13px;
  font-weight: 700;
}
.switch-row--compact {
  min-height: 36px;
  padding: 5px 8px;
}
.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c8c9ce;
  transition: .2s ease;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.16);
  transition: .2s ease;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 13px;
}
.field:last-child { margin-bottom: 0; }
.field--top { margin-top: 13px; }
.field label {
  color: #35363a;
  font-size: 12px;
  font-weight: 800;
}
.field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #d5d6da;
  border-radius: 9px;
  outline: 0;
  background: #fff;
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.field input,
.field select {
  min-height: 41px;
  padding: 8px 10px;
}
.field input[type="color"] {
  padding: 4px;
  cursor: pointer;
}
.field textarea {
  min-height: 86px;
  resize: vertical;
  padding: 10px;
  line-height: 1.5;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155, 47, 130, .11);
}
.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.upload-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.upload-control > span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--text);
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.icon-btn--clear { color: var(--danger); }
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

/* Zoznam bannerov */
.slide-list { display: grid; gap: 9px; }
.slide-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.slide-item:hover { border-color: #b9bac0; }
.slide-item.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155, 47, 130, .09);
}
.slide-item__index {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.slide-item__name { min-width: 0; }
.slide-item__name strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slide-item__name span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.slide-item__tools { display: flex; gap: 4px; }
.footer-help {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

/* Editor a náhľad */
.editor-grid {
  display: grid;
  grid-template-columns: minmax(340px, 470px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.editor { min-width: 0; }
.preview-area {
  position: sticky;
  top: 93px;
  min-width: 0;
}
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.preview-toolbar h2 { margin: 0; font-size: 15px; }
.preview-modes {
  display: flex;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}
.preview-mode {
  min-height: 32px;
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.preview-mode.is-active { background: var(--accent); color: #fff; }
.preview-shell {
  overflow: hidden;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  transition: width .25s ease;
}
.preview-shell.is-mobile {
  width: min(390px, 100%);
  margin: 0 auto;
}
.preview-banner {
  --preview-bg: #f5f5f6;
  --preview-text: #171719;
  position: relative;
  overflow: hidden;
  min-height: 520px;
  background:
    linear-gradient(180deg, rgba(245, 246, 248, 0) 62%, rgba(245, 246, 248, .42) 80%, #f5f6f8 100%),
    radial-gradient(circle at 78% 34%, rgba(155,47,130,.08), transparent 34%),
    var(--preview-bg);
  color: var(--preview-text);
}
.preview-banner__inner {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(300px, 1.05fr);
  align-items: center;
  min-height: 520px;
  padding: 34px 58px 25px;
}
.preview-copy {
  position: relative;
  z-index: 2;
  min-width: 0;
}
.preview-label {
  display: block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.preview-title {
  margin: 0 0 15px;
  color: var(--preview-text);
  font-size: clamp(34px, 4vw, 60px);
  line-height: 1;
  letter-spacing: -.045em;
}
.preview-text {
  max-width: 520px;
  margin: 0 0 21px;
  color: color-mix(in srgb, var(--preview-text) 64%, transparent);
  font-size: 15px;
  line-height: 1.65;
}
.preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.preview-primary {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 9px 20px;
  border-radius: 999px;
  background: #000;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.preview-secondary {
  color: var(--preview-text);
  border-bottom: 1px solid currentColor;
  font-size: 12px;
  font-weight: 800;
}
.preview-visual {
  position: relative;
  display: flex;
  align-self: stretch;
  align-items: flex-end;
  justify-content: center;
  min-height: 390px;
}
.preview-visual::before {
  content: "";
  position: absolute;
  right: 7%;
  bottom: 7%;
  width: min(360px, 78%);
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(255,255,255,.25));
  box-shadow: 0 28px 70px rgba(20,20,24,.08);
  z-index: 0;
}
.preview-image {
  position: relative;
  z-index: 1;
  display: block;
  max-width: 100%;
  max-height: 470px;
  object-fit: contain;
  filter: drop-shadow(0 22px 26px rgba(20,18,20,.14));
}
.preview-image-placeholder {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(310px, 80%);
  aspect-ratio: .78;
  place-items: center;
  padding: 20px;
  border: 1px dashed #b8bac1;
  border-radius: 14px;
  background: rgba(255,255,255,.48);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
}
.preview-arrow {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(23,23,25,.12);
  border-radius: 50%;
  background: rgba(255,255,255,.88);
  box-shadow: 0 8px 22px rgba(20,20,24,.1);
  color: #171719;
  transform: translateY(-50%);
}
.preview-arrow--left { left: 10px; }
.preview-arrow--right { right: 10px; }
.preview-dots {
  position: absolute;
  right: 0;
  bottom: 14px;
  left: 0;
  z-index: 6;
  display: flex;
  justify-content: center;
  gap: 6px;
}
.preview-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(23,23,25,.22);
}
.preview-dot.is-active { width: 22px; background: var(--accent); }
.preview-shell.is-mobile .preview-banner { min-height: 0; }
.preview-shell.is-mobile .preview-banner__inner {
  grid-template-columns: 1fr;
  min-height: 0;
  padding: 24px 34px 10px;
  text-align: center;
}
.preview-shell.is-mobile .preview-title { font-size: 36px; line-height: 1.04; }
.preview-shell.is-mobile .preview-text { margin-bottom: 16px; font-size: 14px; line-height: 1.5; }
.preview-shell.is-mobile .preview-actions {
  display: grid;
  gap: 9px;
  justify-content: stretch;
}
.preview-shell.is-mobile .preview-primary { justify-content: center; }
.preview-shell.is-mobile .preview-secondary { width: fit-content; margin: 0 auto; }
.preview-shell.is-mobile .preview-visual { min-height: 225px; max-height: 255px; }
.preview-shell.is-mobile .preview-image { max-width: 88%; max-height: 250px; }
.preview-shell.is-mobile .preview-arrow { width: 36px; height: 36px; }
.preview-shell.is-mobile .preview-arrow--left { left: 6px; }
.preview-shell.is-mobile .preview-arrow--right { right: 6px; }

@media (max-width: 1180px) {
  .editor-grid { grid-template-columns: 1fr; }
  .preview-area { position: static; }
}
@media (max-width: 820px) {
  .app-header { position: static; align-items: flex-start; padding: 13px 15px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .main { padding: 16px; }
}
@media (max-width: 620px) {
  .auth-shell { margin: 18px auto; }
  .auth-grid { grid-template-columns: 1fr; }
  .app-header { display: grid; }
  .header-actions { justify-content: flex-start; }
  .header-actions .btn { flex: 1 1 auto; }
  .global-grid,
  .field-row { grid-template-columns: 1fr; }
  .preview-banner__inner { padding-right: 30px; padding-left: 30px; }
  .upload-control { align-items: flex-start; flex-wrap: wrap; }
}
