/* ═══════════════════════════════════════════════════════════════
   RSR Portfolio — Core Design System v4
   Identita: "přístrojová deska" — hodinový fond jako měřicí přístroj.
   Samostatný soubor. Nezasahuje do rsr-style.css (staré stránky beze změny).
   ═══════════════════════════════════════════════════════════════ */

@font-face { font-family: 'Outfit'; font-display: swap; src: local('Outfit'); }

:root {
  /* ── Plocha ── */
  --paper:        #F7F7F4;
  --card:         #FFFFFF;
  --sunk:         #F1F1EC;
  --rule:         #E4E4DE;
  --rule-soft:    #EFEFEA;

  /* ── Text ── */
  --ink:          #101013;
  --ink-2:        #55555E;
  --ink-3:        #8A8A93;
  --ink-4:        #B6B6BD;

  /* ── Signál (přístrojová paleta — tlumená, tisková) ── */
  --pine:         #2F6F4E;   /* v normě */
  --pine-soft:    #E6F0EA;
  --amber:        #B4761A;   /* pozor */
  --amber-soft:   #FBF0DE;
  --alarm:        #C0392F;   /* přečerpáno */
  --alarm-soft:   #FAE9E7;
  --indigo:       #3A47B8;   /* kumulace / měsíc */
  --indigo-soft:  #E8EAF9;
  --violet:       #6D4AA8;   /* cenová nabídka */

  /* ── Rytmus ── */
  --u:            4px;
  --r-sm:         8px;
  --r:            12px;
  --r-lg:         18px;
  --r-pill:       999px;

  /* ── Stín: papír na papíře, ne "material" ── */
  --lift-1:       0 1px 2px rgba(16,16,19,.05);
  --lift-2:       0 1px 3px rgba(16,16,19,.05), 0 8px 22px rgba(16,16,19,.045);
  --lift-3:       0 24px 60px rgba(16,16,19,.16);

  /* ── Písmo ── */
  --ui:   'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --num:  'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  --tap:  44px;   /* minimální dotyková plocha */
}

/* ── Tmavý režim: zadávají se záznamy až do 23:00 ── */
@media (prefers-color-scheme: dark) {
  :root {
    --paper:     #121215;
    --card:      #1A1A1F;
    --sunk:      #222228;
    --rule:      #2E2E36;
    --rule-soft: #26262D;
    --ink:       #F2F2F0;
    --ink-2:     #A8A8B2;
    --ink-3:     #7C7C87;
    --ink-4:     #55555E;
    --pine:      #5FBE8B;  --pine-soft:   #17301F;
    --amber:     #E0A94D;  --amber-soft:  #33270F;
    --alarm:     #F0776B;  --alarm-soft:  #331816;
    --indigo:    #8E9AF0;  --indigo-soft: #1C1F3D;
    --violet:    #A98BE0;
    --lift-1:    0 1px 2px rgba(0,0,0,.4);
    --lift-2:    0 1px 3px rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.3);
    --lift-3:    0 24px 60px rgba(0,0,0,.6);
  }
}
html[data-theme="dark"] {
  --paper:#121215; --card:#1A1A1F; --sunk:#222228; --rule:#2E2E36; --rule-soft:#26262D;
  --ink:#F2F2F0; --ink-2:#A8A8B2; --ink-3:#7C7C87; --ink-4:#55555E;
  --pine:#5FBE8B; --pine-soft:#17301F; --amber:#E0A94D; --amber-soft:#33270F;
  --alarm:#F0776B; --alarm-soft:#331816; --indigo:#8E9AF0; --indigo-soft:#1C1F3D;
  --violet:#A98BE0;
  --lift-1:0 1px 2px rgba(0,0,0,.4);
  --lift-2:0 1px 3px rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.3);
  --lift-3:0 24px 60px rgba(0,0,0,.6);
}
html[data-theme="light"] {
  --paper:#F7F7F4; --card:#FFFFFF; --sunk:#F1F1EC; --rule:#E4E4DE; --rule-soft:#EFEFEA;
  --ink:#101013; --ink-2:#55555E; --ink-3:#8A8A93; --ink-4:#B6B6BD;
  --pine:#2F6F4E; --pine-soft:#E6F0EA; --amber:#B4761A; --amber-soft:#FBF0DE;
  --alarm:#C0392F; --alarm-soft:#FAE9E7; --indigo:#3A47B8; --indigo-soft:#E8EAF9;
  --violet:#6D4AA8;
}

/* ═══════════ Reset ═══════════ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}
h1,h2,h3,h4 { margin: 0; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ── Fokus: viditelný, ale ne křiklavý ── */
:where(a,button,input,select,textarea,[tabindex]):focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

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

/* ═══════════ Typografická stupnice ═══════════ */
.eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
}
.num       { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.num-xl    { font-family: var(--num); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 44px; letter-spacing: -.055em; line-height: 1; }
.num-lg    { font-family: var(--num); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 26px; letter-spacing: -.05em; line-height: 1; }
.num-md    { font-family: var(--num); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px; letter-spacing: -.03em; }
.num-sm    { font-family: var(--num); font-variant-numeric: tabular-nums; font-weight: 500; font-size: 12.5px; letter-spacing: -.02em; }
.muted     { color: var(--ink-3); }
.dim       { color: var(--ink-2); }

/* ═══════════ Nosné plochy ═══════════ */
.shell { max-width: 1180px; margin: 0 auto; padding: 24px 20px 96px; }
@media (max-width: 720px) { .shell { padding: 12px 12px 120px; } }

.panel {
  background: var(--card);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-2);
}
.panel-pad { padding: 22px; }
@media (max-width: 720px) { .panel-pad { padding: 16px 14px; } }

.divider { height: 1px; background: var(--rule-soft); border: 0; margin: 0; }

/* ═══════════ Formulářové prvky ═══════════ */
.field {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field::placeholder { color: var(--ink-4); }
.field:hover { border-color: var(--ink-4); }
.field:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 8%, transparent);
}
textarea.field { resize: vertical; min-height: 76px; line-height: 1.55; }
select.field {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* ═══════════ Tlačítka ═══════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 18px;
  border: 1.5px solid transparent; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; letter-spacing: -.01em;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary  { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--paper)); }
.btn-quiet    { background: var(--sunk); color: var(--ink-2); }
.btn-quiet:hover { background: var(--rule); color: var(--ink); }
.btn-line     { background: transparent; border-color: var(--rule); color: var(--ink-2); }
.btn-line:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-danger   { background: var(--alarm-soft); color: var(--alarm); }
.btn-sm       { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-icon     { min-height: var(--tap); min-width: var(--tap); padding: 0; }
.btn:disabled { opacity: .45; pointer-events: none; }

/* ═══════════ Klávesová zkratka v UI ═══════════ */
kbd {
  font-family: var(--num); font-size: 10.5px; font-weight: 600;
  padding: 2px 5px; border-radius: 5px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  line-height: 1.4; letter-spacing: 0;
}

/* ═══════════ Toast ═══════════ */
#rsr-toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 9000; display: flex; flex-direction: column-reverse; gap: 8px;
  align-items: center; pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  pointer-events: all;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--paper);
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--lift-3);
  animation: toast-in .22s cubic-bezier(.2,.9,.3,1.2);
}
.toast[data-kind="error"] { background: var(--alarm); color: #fff; }
.toast[data-kind="warn"]  { background: var(--amber); color: #fff; }
.toast.leaving { animation: toast-out .18s ease-in forwards; }
.toast button {
  background: color-mix(in srgb, currentColor 20%, transparent);
  border: 0; color: inherit; border-radius: var(--r-pill);
  padding: 4px 11px; font-size: 12px; font-weight: 700;
}
@keyframes toast-in  { from { opacity:0; transform: translateY(14px) scale(.96); } }
@keyframes toast-out { to   { opacity:0; transform: translateY(8px)  scale(.97); } }

/* ═══════════ Modál ═══════════ */
.scrim {
  position: fixed; inset: 0; z-index: 8000;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.scrim.open { opacity: 1; pointer-events: all; }
.sheet {
  background: var(--card); border-radius: var(--r-lg);
  box-shadow: var(--lift-3); width: 100%; max-width: 460px;
  transform: scale(.96); transition: transform .18s cubic-bezier(.2,.9,.3,1.2);
  max-height: 86vh; overflow: auto;
}
.scrim.open .sheet { transform: scale(1); }

/* ═══════════ Skip link ═══════════ */
.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 9999;
  background: var(--ink); color: var(--paper);
  padding: 10px 16px; border-radius: var(--r-sm); font-weight: 600;
}
.skip:focus { left: 8px; }

/* ═══════════ Skeleton ═══════════ */
.skel {
  background: linear-gradient(90deg, var(--sunk) 25%, var(--rule-soft) 37%, var(--sunk) 63%);
  background-size: 400% 100%;
  animation: skel 1.3s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes skel { to { background-position: -135% 0; } }

/* ═══════════ Utility ═══════════ */
.row     { display: flex; align-items: center; }
.row-gap { display: flex; align-items: center; gap: 10px; }
.spread  { display: flex; align-items: center; justify-content: space-between; }
.grow    { flex: 1 1 auto; min-width: 0; }
.wrap    { flex-wrap: wrap; }
.truncate{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hidden  { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Navigační lišta (rsr-shell.js) — jen práce, vedení pod ☰
   ═══════════════════════════════════════════════════════════════ */
.shell-bar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--rule-soft);
}
.shell-in {
  max-width: 1280px; margin: 0 auto; padding: 7px 16px;
  display: flex; align-items: center; gap: 10px; min-height: 46px;
}
@media (max-width: 720px) { .shell-in { padding: 6px 10px; gap: 7px; min-height: 42px; } }

.shell-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none; text-decoration: none;
  background: var(--ink); color: var(--paper); display: grid; place-items: center;
  font-family: var(--num); font-weight: 700; font-size: 13px;
}

/* Odkazy: na širokém vedle sebe, na úzkém jen aktivní (zbytek je pod ☰) */
.shell-nav { display: flex; gap: 2px; min-width: 0; overflow: hidden; }
.shell-link {
  padding: 6px 12px; border-radius: var(--r-pill); text-decoration: none;
  font-size: 13.5px; font-weight: 600; color: var(--ink-3);
  transition: background .14s, color .14s; white-space: nowrap;
}
.shell-link:hover { background: var(--sunk); color: var(--ink); }
.shell-link.is-active { background: var(--ink); color: var(--paper); }
@media (max-width: 640px) {
  .shell-link { display: none; }
  .shell-link.is-active { display: block; }   /* na mobilu jen kde jsem */
}

.shell-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.shell-who {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  padding: 4px 10px; background: var(--sunk); border-radius: var(--r-pill);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (max-width: 480px) { .shell-who { display: none; } }

.shell-icon {
  width: 38px; height: 38px; border-radius: var(--r-sm); flex: none;
  border: 1.5px solid var(--rule); background: transparent;
  color: var(--ink-2); font-size: 15px; display: grid; place-items: center;
}
.shell-icon:hover { border-color: var(--ink-3); color: var(--ink); }

/* ── Zásuvka ──
   [hidden] MUSÍ přebít display, jinak je zásuvka vidět pořád. */
.shell-drawer {
  position: absolute; right: 12px; left: 12px; z-index: 59;
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--r); box-shadow: var(--lift-3);
  padding: 6px; display: grid; gap: 1px; max-width: 320px; margin-left: auto;
}
.shell-drawer[hidden] { display: none !important; }
.shell-dgroup {
  font-size: 9.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-4); padding: 12px 13px 5px; border-top: 1px solid var(--rule-soft); margin-top: 5px;
}
.shell-dlink {
  display: block; padding: 10px 13px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--ink-2);
}
.shell-dlink:hover { background: var(--sunk); }
.shell-dlink.is-active { background: var(--ink); color: var(--paper); }
.shell-dlink b { display: block; font-size: 14px; font-weight: 600; }
.shell-dlink small { display: block; font-size: 11.5px; opacity: .65; margin-top: 1px; }
.shell-dlink-out {
  width: 100%; text-align: left; border: 0; background: transparent;
  cursor: pointer; color: var(--alarm); margin-top: 3px;
}
.shell-dlink-out:hover { background: var(--alarm-soft); }
.shell-dlink-out small { color: var(--ink-3); }
.shell-who { border: 0; cursor: pointer; font: inherit; }
.shell-who:hover { background: var(--rule); color: var(--ink); }
.shell-stamp {
  font-size: 10px; color: var(--ink-4); text-align: center;
  padding: 9px 6px 4px; letter-spacing: .06em;
  border-top: 1px solid var(--rule-soft); margin-top: 5px;
}
