:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #f0efe8;
  --ink: #14201c;
  --muted: #5f6b66;
  --line: #e2e0d6;
  --brand: #0f766e;
  --brand-strong: #115e59;
  --brand-soft: #d9f2ee;
  --on-brand: #ffffff;
  --accent: #b45309;
  --accent-soft: #fdf0d5;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 32, 28, .05), 0 10px 30px rgba(20, 32, 28, .07);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1412;
    --surface: #16201d;
    --surface-2: #1d2a26;
    --ink: #e9f0ed;
    --muted: #9babA5;
    --line: #2a3a35;
    --brand: #2dd4bf;
    --brand-strong: #5eead4;
    --brand-soft: #123a35;
    --on-brand: #05201c;
    --accent: #fbbf24;
    --accent-soft: #3a2c0c;
    --danger: #f97066;
    --danger-soft: #3b1512;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html { font-size: 17px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--brand); }
svg.i { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
[hidden] { display: none !important; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1040px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  color: #fff;
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(94, 234, 212, .35), transparent 60%),
    linear-gradient(140deg, #0f766e 0%, #115e59 45%, #0b3b38 100%);
  padding: 20px 0 76px;
}
.hero::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 40px;
  background: var(--bg);
  clip-path: ellipse(75% 100% at 50% 100%);
}
.brandbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 36px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; text-decoration: none; }
.logo .mark { width: 36px; height: 36px; border-radius: 11px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; }
.logo .mark svg { width: 20px; height: 20px; }
.brandbar .place { font-size: .85rem; opacity: .8; }
.hero h1 { font-size: clamp(1.9rem, 6.5vw, 2.9rem); font-weight: 800; }
.hero .sub { margin-top: 12px; font-size: 1.08rem; opacity: .92; max-width: 34em; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.hero-stats span { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .18); border-radius: 999px; padding: 5px 13px; font-size: .88rem; }
.hero-stats b { font-weight: 700; }

.hero.compact { padding: 16px 0 56px; }
.hero.compact .brandbar { margin-bottom: 20px; }
.hero.compact h1 { font-size: clamp(1.5rem, 5vw, 2rem); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
  border: 1.5px solid transparent; border-radius: 12px;
  padding: 12px 18px; min-height: 48px;
  background: var(--brand); color: var(--on-brand);
  transition: transform .08s ease, filter .15s ease, background .15s ease;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn:focus-visible, .chip:focus-visible, .weekopt:focus-visible, .seg button:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.btn.light { background: #fff; color: #0f5e57; }
.btn.glass { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .35); }
.btn.ghost { background: transparent; color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.btn.danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.small { min-height: 40px; padding: 7px 13px; font-size: .9rem; border-radius: 10px; }
.btn.block { width: 100%; font-size: 1.05rem; min-height: 54px; }
.btn.icon { padding: 7px; min-width: 40px; }

/* ---------- Layout blocks ---------- */
main { padding: 8px 0 56px; }
.section { margin-top: 28px; }
.section > h2 { font-size: 1.35rem; font-weight: 750; }
.section > .lead { color: var(--muted); margin: 4px 0 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: -44px; position: relative; z-index: 1; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 14px; }
.step .n { width: 30px; height: 30px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 800; margin-bottom: 8px; }
.step b { display: block; font-size: .95rem; line-height: 1.25; }
.step span { color: var(--muted); font-size: .82rem; line-height: 1.35; display: block; margin-top: 3px; }
@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; gap: 8px; }
  .step { display: grid; grid-template-columns: 30px 1fr; column-gap: 12px; align-items: center; padding: 12px 14px; }
  .step .n { margin: 0; grid-row: span 2; }
}

/* ---------- Week cards ---------- */
.weeks { display: grid; gap: 10px; }
.week {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px;
  box-shadow: var(--shadow);
}
.datebadge { width: 56px; border-radius: 13px; overflow: hidden; text-align: center; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.datebadge .m { background: var(--brand); color: var(--on-brand); font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 0; }
.datebadge .d { font-size: 1.35rem; font-weight: 800; line-height: 1.6; }
.week .when { font-weight: 700; }
.week .what { color: var(--muted); font-size: .88rem; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); margin-top: 8px; overflow: hidden; max-width: 260px; }
.meter i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), #5eead4); }
.empty { color: var(--muted); padding: 18px; text-align: center; border: 1.5px dashed var(--line); border-radius: 16px; }
@media (max-width: 480px) {
  .week { grid-template-columns: auto 1fr; }
  .week > .btn { grid-column: 1 / -1; }
}

/* ---------- Form ---------- */
.field { margin-top: 18px; }
.field:first-child { margin-top: 0; }
.field > label, .field > .label { display: block; font-weight: 650; margin-bottom: 6px; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .84rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

input[type="text"], input[type="tel"], input[type="number"], input[type="password"], textarea {
  width: 100%; font: inherit; color: inherit;
  padding: 13px 14px; min-height: 50px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface-2);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
input:focus, textarea:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); }
textarea { min-height: 84px; resize: vertical; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip {
  font: inherit; font-weight: 650; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 8px 15px; min-height: 42px;
}
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.volrow { display: flex; align-items: center; gap: 10px; }
.volrow input { max-width: 140px; }
.volrow span { color: var(--muted); }

.weekpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; }
.weekopt {
  font: inherit; text-align: left; cursor: pointer; color: var(--ink);
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.weekopt b { font-size: .95rem; }
.weekopt small { color: var(--muted); font-size: .8rem; }
.weekopt.has small { color: var(--accent); font-weight: 650; }
.weekopt[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand) inset; }

.check { display: flex; gap: 12px; align-items: flex-start; margin-top: 20px; padding: 14px; border-radius: 14px; background: var(--surface-2); font-size: .92rem; cursor: pointer; }
.check input { width: 24px; height: 24px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }
.hp { position: absolute; left: -9999px; }

.msg { border-radius: 12px; padding: 12px 14px; margin-top: 16px; font-weight: 550; }
.msg.err { background: var(--danger-soft); color: var(--danger); }
.msg.ok { background: var(--brand-soft); color: var(--brand); }

.success { text-align: center; padding: 32px 20px; }
.success .tick { width: 72px; height: 72px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto 16px; animation: pop .4s cubic-bezier(.2, 1.4, .4, 1); }
.success .tick svg { width: 36px; height: 36px; stroke-width: 2.6; }
.success h2 { font-size: 1.4rem; }
.success .detail { margin: 14px auto; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); max-width: 26em; }
.success p.note { color: var(--muted); margin-bottom: 18px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.mine { background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 220px; margin: 0; }

footer.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 0 16px 36px; }
footer.foot a { color: inherit; }

/* ---------- Koordinator ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: -40px; position: relative; z-index: 1; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 14px 16px; }
.stat .v { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat .k { color: var(--muted); font-size: .82rem; margin-top: 2px; }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr 1fr; } }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin: 22px 0 6px; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { font: inherit; font-weight: 650; font-size: .9rem; border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 9px; cursor: pointer; min-height: 38px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.toolbar .acts { display: flex; gap: 8px; flex-wrap: wrap; }

.group { margin-top: 16px; padding: 0; overflow: hidden; }
.group-head { display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.group-head .t { flex: 1 1 180px; }
.group-head h2 { font-size: 1.1rem; }
.group-head .total { color: var(--muted); font-size: .88rem; }

.row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.group-head + .row { border-top: 0; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 750; font-size: .9rem; }
.row .who { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .sub { color: var(--muted); font-size: .88rem; }
.row .note { margin-top: 4px; font-size: .86rem; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 3px 9px; display: inline-block; }
.row .acts { display: flex; gap: 8px; align-items: center; }
.pill { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.row.done .avatar { background: var(--surface-2); color: var(--muted); }
.row.done .who > span:first-child { color: var(--muted); }
@media (max-width: 600px) {
  .row { grid-template-columns: auto 1fr; }
  .row .acts { grid-column: 1 / -1; }
  .row .acts .btn { flex: 1; }
  .row .acts .btn.icon { flex: 0 0 auto; }
}

/* ---------- Plan potreba (firma) ---------- */
.updated { color: var(--muted); font-size: .88rem; }
.plan-total { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.vols { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 14px 18px; }
.vols-label { color: var(--muted); font-size: .88rem; margin-right: 4px; }
.plan-note { color: var(--muted); font-size: .9rem; margin-top: 20px; text-align: center; }

.login { max-width: 420px; margin: -40px auto 0; position: relative; z-index: 1; }

@media print {
  .hero, .toolbar, .row .acts, footer.foot, .group-head .btn, .avatar { display: none !important; }
  .stats { margin-top: 0; }
  .stat { box-shadow: none; }
  .vols { padding: 8px 0; }
  body { background: #fff; color: #000; font-size: 11pt; }
  main { padding: 0; }
  .card, .group { box-shadow: none; border: 0; border-radius: 0; break-inside: avoid; }
  .group-head { padding: 12px 0 6px; border-bottom: 2px solid #000; }
  .row { grid-template-columns: 1fr; padding: 8px 0; border-top: 1px solid #999; }
  .row .sub a { color: #000; text-decoration: none; }
  .row .note, .pill { background: none; color: #000; border: 0; padding: 0; }
}
