/* ============================================================
   Jedna báseň — Směny | Design systém
   Brand vychází z webu jedna-basen.cz: vínová #831517,
   bílá/krémová plochy, serifové nadpisy (Lora).
   ============================================================ */

:root {
  --brand:        #831517;
  --brand-dark:   #520c0d;
  --brand-bright: #be1e19;
  --brand-soft:   #fae7ea;

  --ink:      #1f1a18;
  --muted:    #6b625f;
  --bg:       #ffffff;
  --surface:  #faf7f6;
  --surface-2:#f4f2f2;
  --border:   #e6e1e0;

  --success:  #2e7d4f;
  --success-soft: #e6f3ec;
  --warning:  #9a6a09;
  --warning-soft: #fdf1da;
  --danger:   #be1e19;
  --danger-soft:  #fae7ea;
  --info:     #3f5a73;
  --info-soft:    #e9eff5;

  --radius:   12px;
  --radius-sm: 8px;
  --shadow:   0 1px 3px rgba(31,26,24,.08), 0 6px 18px rgba(31,26,24,.05);
  --shadow-sm:0 1px 2px rgba(31,26,24,.08);

  --font-head: 'Lora', Georgia, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --maxw: 1100px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--surface);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; color: var(--ink); }
h1 { font-size: 1.7rem; margin: 0 0 .25rem; }
h2 { font-size: 1.3rem; margin: 0 0 .75rem; }
h3 { font-size: 1.08rem; margin: 0 0 .5rem; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- Topbar ---------- */
.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 50;
}
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; }
.brand img { height: 44px; width: auto; display: block; }
.brand__name { font-family: var(--font-head); font-weight: 600; color: var(--brand); font-size: 1.05rem; }
.brand__name span { display: block; font-family: var(--font-body); font-size: .72rem; color: var(--muted); font-weight: 400; }

.nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav a {
  color: var(--ink); padding: .45rem .7rem; border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-dark); }

.topbar__spacer { flex: 1 1 auto; }
.usermenu { display: flex; align-items: center; gap: .6rem; font-size: .9rem; }
.usermenu .who { color: var(--muted); }
.usermenu .who strong { color: var(--ink); }

/* ---------- Layout ---------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head p { margin: 0; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

/* ---------- Karty ---------- */
.card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.25rem;
}
.card + .card { margin-top: 1rem; }
.card__title { margin-top: 0; }

/* ---------- Statistiky ---------- */
.stat {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.25rem;
}
.stat .num { font-family: var(--font-head); font-size: 2rem; color: var(--brand); line-height: 1; }
.stat .lbl { color: var(--muted); font-size: .9rem; margin-top: .35rem; }

/* ---------- Tlačítka ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 600; cursor: pointer;
  padding: .55rem .95rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--brand); color: #fff;
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--brand); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { padding: .3rem .6rem; font-size: .82rem; }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #8f1714; }
.btn--block { width: 100%; }

/* ---------- Formuláře ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=tel], .field input[type=number], .field input[type=time],
.field input[type=date], .field select, .field textarea {
  width: 100%; padding: .55rem .7rem; font: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.field--check { display: flex; align-items: center; gap: .5rem; }
.field--check label { margin: 0; font-weight: 500; }
.field .err { color: var(--danger); font-size: .82rem; margin-top: .25rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row > .field { flex: 1 1 200px; }

/* ---------- Tabulky ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; }
.table tbody tr:hover { background: var(--surface); }
.table-wrap { overflow-x: auto; }

/* ---------- Odznaky ---------- */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.badge--ok { background: var(--success-soft); color: var(--success); }
.badge--warn { background: var(--warning-soft); color: var(--warning); }
.badge--off { background: var(--surface-2); color: var(--muted); }
.badge--brand { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Flash zprávy ---------- */
.flashes { max-width: var(--maxw); margin: 1rem auto 0; padding: 0 1rem; display: grid; gap: .5rem; }
.flash { padding: .7rem .9rem; border-radius: var(--radius-sm); border: 1px solid; font-size: .92rem; }
.flash--success { background: var(--success-soft); border-color: #bfe0cb; color: var(--success); }
.flash--danger  { background: var(--danger-soft);  border-color: #f0c2c4; color: var(--danger); }
.flash--warning { background: var(--warning-soft); border-color: #f0dcae; color: var(--warning); }
.flash--info, .flash--message { background: var(--info-soft); border-color: #cfdcea; color: var(--info); }

/* ---------- Auth (přihlášení) ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background:
  radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), transparent 60%), var(--surface); }
.auth-card { width: 100%; max-width: 400px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 2rem 1.75rem; }
.auth-card .brand { justify-content: center; margin-bottom: .25rem; }
.auth-card .brand img { height: 64px; }
.auth-claim { text-align: center; color: var(--muted); font-style: italic; font-family: var(--font-head); margin-bottom: 1.5rem; }

/* ---------- Pomocné ---------- */
.stack > * + * { margin-top: 1rem; }
.inline-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
footer.site { text-align: center; color: var(--muted); font-size: .82rem; padding: 2rem 1rem; }

/* ---------- Týdenní navigace ---------- */
.weeknav { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.weeknav .range { font-family: var(--font-head); font-size: 1.05rem; }

/* ---------- Plánovací mřížka ---------- */
.plan-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.plan-table th, .plan-table td { border: 1px solid var(--border); padding: .35rem .4rem; text-align: center; vertical-align: top; }
.plan-table thead th { background: var(--surface-2); font-size: .8rem; }
.plan-table thead th.today { background: var(--brand-soft); color: var(--brand-dark); }
.plan-table .rowhead { text-align: left; background: var(--surface); white-space: nowrap; position: sticky; left: 0; }
.plan-table .rowhead small { color: var(--muted); font-weight: 400; }
.plan-cell input[type=number] { width: 3.2rem; padding: .25rem; text-align: center; border: 1px solid var(--border); border-radius: 6px; }
.plan-cell .cov { display: block; margin-top: .25rem; font-size: .72rem; }
.plan-cell.closed { background: repeating-linear-gradient(45deg, #faf7f6, #faf7f6 6px, #f1ecec 6px, #f1ecec 12px); color: var(--muted); }
.cov-ok { color: var(--success); }
.cov-warn { color: var(--warning); }
.cov-none { color: var(--muted); }
.dot { display:inline-block; width:.5rem; height:.5rem; border-radius:50%; margin-right:.25rem; vertical-align:middle; }
.dot--draft { background: var(--muted); }
.dot--released { background: var(--success); }

/* ---------- Karta směny (brigádník) ---------- */
.offer { display: grid; gap: .75rem; }
.offer .shift-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; background: #fff; }
.offer .shift-card .when { font-family: var(--font-head); }
.offer .shift-card .meta { color: var(--muted); font-size: .88rem; }
.cap { font-weight: 600; }
.cap--free { color: var(--success); }
.cap--full { color: var(--warning); }

/* ---------- Spodní lišta (mobil, brigádník) ---------- */
.bottomnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: #fff; border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(31, 26, 24, .07);
  padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom, 0px));
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .35rem 0; color: var(--muted); font-size: .68rem; font-weight: 600;
  text-decoration: none; position: relative; min-width: 0;
}
.bottomnav a.active { color: var(--brand); }
.bottomnav a:active { background: var(--surface-2); border-radius: 10px; }
.bottomnav svg { width: 24px; height: 24px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bottomnav .nb {
  position: absolute; top: .1rem; left: calc(50% + 6px);
  background: var(--brand); color: #fff; border-radius: 999px;
  font-size: .6rem; line-height: 16px; min-width: 16px; height: 16px;
  text-align: center; padding: 0 4px;
}

.bottomnav .more { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: .35rem 0; color: var(--muted); font-size: .68rem; font-weight: 600;
  background: none; border: none; cursor: pointer; font-family: inherit; }
.bottomnav .more svg { width: 24px; height: 24px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 900px) {
  .bottomnav { display: flex; }
  body.has-bottomnav { padding-bottom: 64px; }
  body.has-bottomnav footer.site { padding-bottom: 84px; }
}

/* ============================================================
   APP SHELL — horní pruh + boční menu (managerská i brigádnická)
   ============================================================ */
:root { --topbar-h: 56px; --sidebar-w: 218px; --sidebar-w-min: 64px; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
  display: flex; align-items: center; gap: .5rem; padding: 0 .8rem;
  background: #fff; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm);
  z-index: 60;
}
.navtoggle { display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border: none; background: none; color: var(--ink);
  border-radius: 10px; cursor: pointer; }
.navtoggle:hover { background: var(--surface-2); }
.navtoggle svg { width: 22px; height: 22px; }
.topbar .brand { display: flex; align-items: center; gap: .5rem; }
.topbar .brand img { height: 34px; width: auto; display: block; }
.topbar .brand__name { font-family: var(--font-head); font-weight: 600; color: var(--brand); font-size: 1.05rem; }
.topbar__spacer { flex: 1 1 auto; }

.usercluster { display: flex; align-items: center; gap: .25rem; }
.usercluster .who { display: flex; flex-direction: column; line-height: 1.05; text-align: right; margin: 0 .4rem; }
.usercluster .who strong { font-size: .88rem; }
.usercluster .who small { color: var(--muted); font-size: .72rem; }
.iconbtn { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; color: var(--ink); }
.iconbtn:hover { background: var(--surface-2); text-decoration: none; }
.iconbtn.on { background: var(--brand-soft); color: var(--brand-dark); }
.iconbtn svg { width: 20px; height: 20px; }
.dot-badge { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--brand); color: #fff; border-radius: 999px; font-size: .62rem; line-height: 16px; text-align: center; }

.sidebar { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w);
  background: #fff; border-right: 1px solid var(--border); overflow-y: auto;
  z-index: 50; transition: width .15s ease, transform .2s ease; padding: .6rem .5rem; }
.sidenav { display: flex; flex-direction: column; gap: 2px; }
.sidenav a { position: relative; display: flex; align-items: center; gap: .7rem;
  padding: .6rem .7rem; border-radius: 10px; color: var(--ink); font-weight: 500; font-size: .95rem; white-space: nowrap; }
.sidenav a:hover { background: var(--surface-2); text-decoration: none; }
.sidenav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.sidenav a svg { width: 20px; height: 20px; flex: 0 0 auto; }
.sidenav__sep { height: 1px; background: var(--border); margin: .5rem .4rem; }
.navbadge { margin-left: auto; background: var(--brand); color: #fff; border-radius: 999px;
  font-size: .7rem; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 5px; }

.content { margin-top: var(--topbar-h); margin-left: var(--sidebar-w); transition: margin-left .15s ease; }

body.nav-collapsed .sidebar { width: var(--sidebar-w-min); }
body.nav-collapsed .sidebar .sidenav a span,
body.nav-collapsed .sidebar .navbadge { display: none; }
body.nav-collapsed .sidebar .sidenav a { justify-content: center; padding: .6rem; }
body.nav-collapsed .content { margin-left: var(--sidebar-w-min); }

.scrim { display: none; }

/* MOBIL: žádné levé menu – sbalovací zmizí, navigace je dole; „Více" vyjede jako sheet zespodu */
@media (max-width: 900px) {
  .navtoggle { display: none; }
  .sidebar {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 74vh;
    transform: translateY(110%); border-right: none; border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0; box-shadow: 0 -12px 30px rgba(0,0,0,.22); z-index: 55;
    padding: .4rem .5rem calc(72px + env(safe-area-inset-bottom, 0px));
  }
  .sidebar::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px;
    background: var(--border); margin: .35rem auto .6rem; }
  body.nav-open .sidebar { transform: none; }
  /* na mobilu sheet vždy s popisky (ignoruj desktop „sbaleno") */
  body.nav-collapsed .sidebar .sidenav a span { display: inline; }
  body.nav-collapsed .sidebar .sidenav a { justify-content: flex-start; padding: .6rem .7rem; }
  .content, body.nav-collapsed .content { margin-left: 0; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(31,26,24,.45); z-index: 50; }
  .usercluster .who { display: none; }
  .topbar .brand__name { display: none; }
}

/* Taby (např. Nastavení) */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: .6rem .9rem; font: inherit; font-weight: 600;
  color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.tabpanel { display: none; }
.tabpanel.active { display: block; }

/* ---------- Onboarding banner (instalace / push na telefonu) ---------- */
.pwa-nudge {
  position: fixed; left: .6rem; right: .6rem; z-index: 70;
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 10px 34px rgba(31,26,24,.22); padding: .85rem .9rem;
  display: flex; flex-direction: column; gap: .65rem; animation: nudgeup .25s ease;
}
@keyframes nudgeup { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.pwa-nudge__body { font-size: .9rem; line-height: 1.45; }
.pwa-nudge__body strong { display: block; margin-bottom: .15rem; font-family: var(--font-head); }
.pwa-nudge__act { display: flex; gap: .5rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
@media (min-width: 560px) { .pwa-nudge { left: auto; right: 1rem; max-width: 380px; } }
