/*
 * nowera – sklenená téma (spoločná pre appku, klientsky portál a prihlásenie)
 * Tokeny: farby, sklo, zaoblenia, typografia. Prepínače na <html>:
 *   data-theme="light|dark" (bez neho podľa systému), data-wallpaper="aurora|sand|sage|graphite",
 *   data-glass="clear|tinted", data-reduce="1" (plné plochy bez priehľadnosti).
 */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 22px;
  --fs-title: clamp(28px, 1.2vw + 20px, 34px);
  --r-sm: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --ease: cubic-bezier(.25, .1, .25, 1);
  --spring: cubic-bezier(.32, .72, 0, 1);

  /* svetlá téma (systémové farby Apple: zoskupené pozadie, biele karty, vlasové čiary) */
  --bg: #f2f2f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #8a8a8e;
  --field-line: #d1d1d6;
  --accent: #7d16ff;
  --accent-2: #8a2cff;
  --accent-ink: #ffffff;
  --accent-text: #6a0fe0;
  --accent-soft: rgba(125, 22, 255, .1);
  --danger: #d70015;
  --danger-soft: rgba(255, 59, 48, .12);
  --warn: #b25000;
  --warn-soft: rgba(255, 149, 0, .14);
  --ok: #248a3d;
  --blue: #007aff;
  --indigo: #5856d6;
  --purple: #af52de;
  --pink: #ff2d55;
  --orange: #ff9500;
  --green: #34c759;
  --teal: #30b0c7;
  --yellow: #ffcc00;
  --fill: rgba(120, 120, 128, .12);
  --fill-2: rgba(120, 120, 128, .2);
  --sep: rgba(60, 60, 67, .16);
  --glass-a: 1;
  --glass: #ffffff;
  --glass-chrome: rgba(250, 250, 252, .82);
  --glass-solid: #ffffff;
  --glass-input: #ffffff;
  --blur: 20px;
  --sat: 180%;
  --rim: 0 0 0 .5px rgba(0, 0, 0, .05);
  --sheen: linear-gradient(transparent, transparent);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lift: 0 6px 20px -8px rgba(0, 0, 0, .14);
  --glow: 0 0 0 0 transparent;
  --scrim: rgba(0, 0, 0, .32);
  --wp-1: transparent;
  --wp-2: transparent;
  --wp-3: transparent;
  color-scheme: light;
}

/* tmavá téma: explicitne, alebo podľa systému, ak nie je zvolená svetlá */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #8d8d93;
    --field-line: #48484a;
    --accent: #7d16ff;
    --accent-2: #9d4dff;
    --accent-ink: #ffffff;
    --accent-text: #bf8cff;
    --accent-soft: rgba(157, 77, 255, .18);
    --danger: #ff453a;
    --danger-soft: rgba(255, 69, 58, .16);
    --warn: #ff9f0a;
    --warn-soft: rgba(255, 159, 10, .16);
    --ok: #30d158;
    --blue: #0a84ff;
    --indigo: #5e5ce6;
    --purple: #bf5af2;
    --pink: #ff375f;
    --orange: #ff9f0a;
    --green: #30d158;
    --teal: #40c8e0;
    --yellow: #ffd60a;
    --fill: rgba(118, 118, 128, .24);
    --fill-2: rgba(118, 118, 128, .34);
    --sep: rgba(84, 84, 88, .65);
    --glass-a: 1;
    --glass: #1c1c1e;
    --glass-chrome: rgba(28, 28, 30, .78);
    --glass-solid: #1c1c1e;
    --glass-input: #1c1c1e;
    --rim: 0 0 0 .5px rgba(255, 255, 255, .06);
    --sheen: linear-gradient(transparent, transparent);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lift: 0 8px 24px -8px rgba(0, 0, 0, .7);
    --glow: 0 0 0 0 transparent;
    --scrim: rgba(0, 0, 0, .55);
    --wp-1: transparent;
    --wp-2: transparent;
    --wp-3: transparent;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #8d8d93;
  --field-line: #48484a;
  --accent: #7d16ff;
  --accent-2: #9d4dff;
  --accent-ink: #ffffff;
  --accent-text: #bf8cff;
  --accent-soft: rgba(157, 77, 255, .18);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, .16);
  --warn: #ff9f0a;
  --warn-soft: rgba(255, 159, 10, .16);
  --ok: #30d158;
  --blue: #0a84ff;
  --indigo: #5e5ce6;
  --purple: #bf5af2;
  --pink: #ff375f;
  --orange: #ff9f0a;
  --green: #30d158;
  --teal: #40c8e0;
  --yellow: #ffd60a;
  --fill: rgba(118, 118, 128, .24);
  --fill-2: rgba(118, 118, 128, .34);
  --sep: rgba(84, 84, 88, .65);
  --glass-a: 1;
  --glass: #1c1c1e;
  --glass-chrome: rgba(28, 28, 30, .78);
  --glass-solid: #1c1c1e;
  --glass-input: #1c1c1e;
  --rim: 0 0 0 .5px rgba(255, 255, 255, .06);
  --sheen: linear-gradient(transparent, transparent);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lift: 0 8px 24px -8px rgba(0, 0, 0, .7);
  --glow: 0 0 0 0 transparent;
  --scrim: rgba(0, 0, 0, .55);
  --wp-1: transparent;
  --wp-2: transparent;
  --wp-3: transparent;
  color-scheme: dark;
}

/* tapety sú vypnuté: pozadie je čisté systémové */

/* tónované sklo: menej priehľadnosti */

/* plné plochy bez rozmazania (nastavenie alebo systémová preferencia) */
:root[data-reduce="1"] { --glass: var(--glass-solid); --glass-chrome: var(--glass-solid); --blur: 0px; }
@media (prefers-reduced-transparency: reduce) {
  :root { --glass: var(--glass-solid); --glass-chrome: var(--glass-solid); --blur: 0px; }
}

/* ------------------------------------------------------------ základ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  background: transparent;
  font: var(--fs-md)/1.45 var(--font);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
}
/* tapeta: fixná vrstva (background-attachment: fixed na iOS nefunguje) */
body::before {
  content: "";
  position: fixed;
  inset: -10vmax;
  z-index: -1;
  pointer-events: none;
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }
button { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; box-shadow: 0 0 0 1px var(--accent); }

/* ------------------------------------------------------------ sklo */
.glass {
  background: var(--sheen), var(--glass);
  box-shadow: var(--rim), var(--shadow);
  border-radius: var(--r-lg);
}
.chrome {
  background: var(--sheen), var(--glass-chrome);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  box-shadow: var(--rim), var(--shadow);
}

/* ------------------------------------------------------------ tlačidlá */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--fill); box-shadow: none;
  color: var(--accent-text); font-weight: 590; font-size: var(--fs-md); white-space: nowrap; letter-spacing: -.01em;
  transition: opacity .15s var(--ease), background .2s var(--ease);
}
.btn:hover { background: var(--fill-2); }
.btn:active { opacity: .6; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 34px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; transform: none; }
.btn svg { width: 18px; height: 18px; }

.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--text-2);
  display: inline-grid; place-items: center; cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease);
}
.icon-btn:hover { background: var(--fill); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------ čipy, štítky */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px;
  background: var(--fill); font-size: 12.5px; line-height: 1.55; color: var(--text-2); white-space: nowrap; font-weight: 500;
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--fill); color: var(--text-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.ok, .pill.st-active, .pill.os-accepted { background: rgba(52, 199, 89, .14); color: var(--ok); }
.pill.warn, .pill.st-lead, .pill.st-maintenance, .pill.os-sent { background: var(--warn-soft); color: var(--warn); }
.pill.bad, .pill.os-rejected, .pill.os-expired, .pill.os-withdrawn, .pill.os-superseded { background: var(--danger-soft); color: var(--danger); }
.pill.plain::before { display: none; }

/* ------------------------------------------------------------ formuláre */
.field { display: grid; gap: 6px; }
.field > label, .field > .lbl { font-size: 13px; font-weight: 500; color: var(--text-2); }
.input, .field input[type="text"], .field input[type="url"], .field input[type="date"], .field input[type="email"], .field input[type="password"], .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--glass-input); border: 0; border-radius: var(--r-sm); outline: none;
  box-shadow: inset 0 0 0 1px var(--field-line);
  transition: box-shadow .2s var(--ease);
}
.field textarea { min-height: 90px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
::placeholder { color: var(--text-3); }

/* segmentový prepínač so sklenenou šošovkou */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--fill); }
.seg button {
  border: 0; background: transparent; border-radius: 7px; padding: 5px 14px; min-height: 30px; cursor: pointer;
  font-size: 13.5px; font-weight: 590; color: var(--text); transition: background .25s var(--ease), color .2s var(--ease);
}
.seg button small { margin-left: 6px; font-weight: 600; color: var(--text-3); }
.seg button.on { background: var(--glass-solid); color: var(--text); box-shadow: 0 0 0 .5px rgba(0, 0, 0, .04), 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); }
:root[data-theme="dark"] .seg button.on { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { background: #636366; } }

/* prepínač (switch) */
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-2); transition: background .25s var(--ease); pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .3s var(--spring); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }

/* ------------------------------------------------------------ prstence a dlaždice */
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); stroke-linecap: round; }
.ring .rb { stroke: var(--fill-2); }
.ring .rf { stroke: var(--accent); transition: stroke-dasharray .8s var(--ease); }
.ring.done .rf { stroke: var(--ok); }
.ring.blocked .rf, .ring.blocked .rb { stroke: var(--warn-soft); }
.ring b { position: absolute; font-size: 13px; font-weight: 750; letter-spacing: -.02em; }
.ring.lg b { font-size: 17px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { padding: 12px 14px; border-radius: var(--r-md); background: var(--glass); box-shadow: var(--rim); }
.tile span { display: block; font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; }
.tile b { display: block; margin-top: 2px; font-size: 26px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.tile b small { font-size: 15px; color: var(--text-3); font-weight: 600; letter-spacing: 0; }
.tile.alert b { color: var(--danger); }
a.tile { transition: transform .25s var(--spring); }
a.tile:active { transform: scale(.98); }

/* farebná ikonka (dlaždica) */
.ico { width: 29px; height: 29px; border-radius: 7px; display: inline-grid; place-items: center; flex: none; color: #fff;
  background: var(--c, var(--accent)); }
.ico svg { width: 17px; height: 17px; stroke-width: 2; }
.ico.lg { width: 44px; height: 44px; border-radius: 10px; font-weight: 600; font-size: 17px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: 13px; font-weight: 700; color: #fff;
  background: var(--c, var(--accent)); }

.bar { height: 8px; border-radius: 99px; background: var(--fill-2); overflow: hidden; }
.bar > span, .bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .8s var(--ease); }

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

input[type="file"]::file-selector-button {
  margin-right: 10px; padding: 8px 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--fill-2); color: var(--text); font: inherit; font-size: 14px; font-weight: 600;
}
