:root{
  --blue:#2563eb; --blue-d:#1d4ed8; --green:#16a34a; --green-l:#dcfce7;
  --bg:#f1f5f9; --card:#fff; --ink:#0f172a; --muted:#64748b; --line:#e2e8f0;
  --red:#dc2626; --radius:14px;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  background:var(--bg); color:var(--ink); line-height:1.45;
}
a{color:var(--blue); text-decoration:none}

/* Topbar */
.topbar{
  position:sticky; top:0; z-index:10;
  display:flex; align-items:center; justify-content:space-between; gap:.5rem;
  padding:.7rem 1rem; background:var(--blue); color:#fff;
  padding-top:max(.7rem, env(safe-area-inset-top));
}
.brand{color:#fff; font-weight:700; font-size:1.05rem}
.nav{display:flex; align-items:center; gap:.85rem; flex-wrap:wrap}
.nav a{color:#dbeafe}
.nav .who{color:#bfdbfe; font-size:.85rem}
.btn-link{background:none; border:0; color:#fff; cursor:pointer; font:inherit; padding:0; text-decoration:underline}
.btn-link.danger{color:var(--red)}
.inline{display:inline}

/* Layout */
.container{max-width:680px; margin:0 auto; padding:1rem 1rem 3rem}
.footer{text-align:center; color:var(--muted); padding:1.5rem}

/* Impersonace banner */
.impersonate-bar{
  display:flex; align-items:center; justify-content:space-between; gap:.8rem; flex-wrap:wrap;
  background:#fef3c7; border:1px solid #f59e0b; color:#92400e;
  border-radius:10px; padding:.6rem .9rem; margin-bottom:1rem; font-weight:600;
}
.impersonate-bar .imp-real{font-weight:400; color:#b45309; font-size:.85rem}
.btn-stop-imp{
  background:#92400e; color:#fff; border:0; border-radius:8px;
  padding:.45rem .8rem; font:inherit; font-weight:700; cursor:pointer; white-space:nowrap;
}
.btn-stop-imp:hover{background:#7c2d12}

/* Flash */
.flash{padding:.7rem 1rem; border-radius:10px; margin-bottom:1rem; font-weight:500}
.flash.ok{background:var(--green-l); color:#166534}
.flash.err{background:#fee2e2; color:#991b1b}

/* Cards */
.card{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:1rem 1.1rem; margin-bottom:1rem; box-shadow:0 1px 2px rgba(15,23,42,.04);
}
.card h2{margin:.1rem 0 .6rem; font-size:1.15rem}
.empty{color:var(--muted); text-align:center}

/* Day head */
.day-head{display:flex; align-items:center; justify-content:space-between; gap:1rem; margin:.4rem 0 1rem}
.day-head h1{font-size:1.4rem; margin:0}
.muted{color:var(--muted)}
.small,.muted.small{font-size:.85rem}

/* Progress badge */
.progress-badge{
  background:#e2e8f0; color:#334155; font-weight:700; border-radius:999px;
  padding:.35rem .85rem; font-size:1rem; white-space:nowrap;
}
.progress-badge.all-done{background:var(--green); color:#fff}

/* Slots (dítě) – řádek s výběrem odpovědi */
.activity h2{display:flex; align-items:center}
.slot-row{border:2px solid var(--line); border-radius:12px; padding:.7rem .8rem; margin-bottom:.7rem}
.slot-row.done{background:var(--green-l); border-color:var(--green)}
.slot-row.answered-neg{background:#fff7ed; border-color:#fdba74}
.slot-row-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:.55rem}
.slot-time{font-size:1.2rem; font-weight:700}
.slot-status{font-weight:600; color:var(--muted)}
.slot-row.done .slot-status{color:var(--green)}
.slot-row.answered-neg .slot-status{color:#c2410c}

.radio-group{display:flex; flex-wrap:wrap; gap:.5rem}
.radio-btn{
  position:relative; flex:1 1 auto; min-width:7rem; text-align:center;
  padding:.7rem .9rem; border:2px solid var(--line); border-radius:10px;
  background:#fff; cursor:pointer; font-weight:600; user-select:none;
  -webkit-tap-highlight-color:transparent; transition:.12s;
}
.radio-btn input{position:absolute; opacity:0; pointer-events:none}
.radio-btn:active{transform:scale(.98)}
.radio-btn.checked.pos{background:var(--green); color:#fff; border-color:var(--green)}
.radio-btn.checked.neg{background:#ea580c; color:#fff; border-color:#ea580c}
.radio-btn.checked{box-shadow:0 1px 4px rgba(0,0,0,.15)}

/* Parent overview list */
.child-row-head{display:flex; align-items:center; justify-content:space-between}
.slot-list{list-style:none; margin:.6rem 0; padding:0; display:flex; flex-direction:column; gap:.35rem}
.slot-list li{display:flex; align-items:center; gap:.6rem; padding:.35rem 0; border-bottom:1px solid var(--line)}
.slot-list li:last-child{border-bottom:0}
.slot-list .dot{width:10px; height:10px; border-radius:50%; background:#cbd5e1; flex:0 0 auto}
.slot-list li.done .dot{background:var(--green)}
.slot-list .t{font-weight:700; min-width:3.2rem}
.slot-list .n{flex:1; color:#334155}
.slot-list .st{font-weight:700; color:var(--muted)}
.slot-list li.done .st{color:var(--green)}
.slot-list li.answered-neg .dot{background:var(--red)}
.slot-list li.answered-neg .st{color:var(--red)}

/* Buttons */
.btn{display:inline-block; border:0; border-radius:10px; padding:.7rem 1.1rem;
  font:inherit; font-weight:600; cursor:pointer; text-align:center}
.btn-primary{background:var(--blue); color:#fff}
.btn-primary:active{background:var(--blue-d)}
.btn-ghost{background:#eef2ff; color:var(--blue)}
.btn-block{width:100%}
.btn-sm{padding:.45rem .8rem; font-size:.9rem}

/* Forms */
.form{display:flex; flex-direction:column; gap:.9rem}
.form label{display:flex; flex-direction:column; gap:.3rem; font-weight:600; font-size:.95rem}
.form input,.form select,input[type=time]{
  padding:.7rem .8rem; border:1px solid #cbd5e1; border-radius:10px; font:inherit; background:#fff;
}
.login-card{max-width:380px; margin:2rem auto}
.login-card h1{margin-top:0}

/* Manage */
.child-tabs{display:flex; gap:.5rem; flex-wrap:wrap; margin-bottom:1rem}
.child-tabs .tab{padding:.45rem .9rem; border-radius:999px; background:#e2e8f0; color:#334155; font-weight:600}
.child-tabs .tab.active{background:var(--blue); color:#fff}
.section-title{font-size:1.05rem; margin:.5rem 0 .8rem; color:#334155}
.activity.inactive{opacity:.6}
.activity-head{display:flex; align-items:flex-start; justify-content:space-between; gap:.5rem}
.activity-head h3{margin:.1rem 0}
.activity-actions{display:flex; gap:.8rem; flex:0 0 auto}
.badge{font-size:.7rem; background:#fde68a; color:#92400e; padding:.1rem .4rem; border-radius:6px; vertical-align:middle}
.times{display:flex; flex-wrap:wrap; gap:.5rem; margin:.6rem 0}
.time-chip{display:inline-flex; align-items:center; gap:.35rem; background:#eef2ff; color:#1e3a8a;
  border-radius:999px; padding:.3rem .3rem .3rem .7rem; font-weight:700}
.time-chip.notify{background:#fef3c7; color:#92400e}
.chip-kind{font-size:.8rem}
.chip-toggle{background:rgba(255,255,255,.6); border:0; border-radius:999px; font-size:.7rem;
  font-weight:700; cursor:pointer; padding:.1rem .4rem; color:inherit}
.chip-toggle:hover{background:#fff}
.chip-x{background:none; border:0; color:inherit; font-size:1.1rem; line-height:1; cursor:pointer; padding:0 .25rem}
.reminder-times{margin:.1rem 0 .55rem; font-size:.8rem; color:#92400e}
.add-time-form{display:flex; gap:.5rem; align-items:center; margin-top:.4rem}
.times-fieldset{border:1px solid var(--line); border-radius:10px; padding:.7rem .9rem}
.times-fieldset legend{font-weight:600; font-size:.9rem; padding:0 .4rem}
.time-input-row{display:flex; gap:.5rem; margin-bottom:.5rem; align-items:center}
.time-input-row .rm{background:none;border:0;color:var(--red);font-size:1.2rem;cursor:pointer}

/* Formy odpovědi u činnosti */
.answers-edit{margin:.5rem 0; font-size:.9rem}
.answers-edit summary{cursor:pointer; color:#334155}
.ans-pill{display:inline-block; padding:.05rem .45rem; border-radius:999px; font-size:.8rem; font-weight:700; margin-left:.2rem}
.ans-pill.pos{background:var(--green-l); color:#166534}
.ans-pill.neg{background:#ffedd5; color:#9a3412}
.answers-form{margin-top:.6rem}
.checks{display:flex; flex-wrap:wrap; gap:.5rem; margin-bottom:.6rem}
/* vyšší specificita kvůli .form label{flex-direction:column} */
.checks .check,
label.check{
  display:inline-flex; flex-direction:row; align-items:center; gap:.5rem;
  width:auto; padding:.5rem .85rem; border:1px solid #cbd5e1; border-radius:999px;
  font-weight:600; cursor:pointer; background:#fff; transition:background .12s, border-color .12s;
}
.checks .check:hover,
label.check:hover{background:#eef2ff; border-color:#a5b4fc}
.check.pos{border-color:#86efac}
.check.neg{border-color:#fdba74}
.check.pos:hover{background:#dcfce7}
.check.neg:hover{background:#ffedd5}
.check input[type=checkbox]{width:1.15rem; height:1.15rem; margin:0; flex:0 0 auto; accent-color:var(--blue)}

/* Číselník */
.catalog-row{display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; padding:.5rem .5rem; border-radius:8px; border-bottom:1px solid var(--line); transition:background .12s}
.catalog-row:hover{background:#f8fafc}
.catalog-row.inactive{opacity:.55}
.cat-label{flex:1 1 8rem; min-width:7rem}
.catalog-row-actions{display:flex; gap:1rem; padding:.2rem 0 .8rem; border-bottom:1px solid var(--line); margin-bottom:.3rem}
.add-catalog-form{display:flex; gap:.6rem; align-items:center; flex-wrap:wrap}

/* Platnost činnosti (od–do) */
.validity-row{display:flex; gap:.8rem; flex-wrap:wrap}
.validity-form{margin-top:.6rem; display:flex; gap:.8rem; flex-wrap:wrap; align-items:flex-end}
.form .dlabel,
.dlabel{display:inline-flex; flex-direction:row; align-items:center; gap:.4rem; width:auto; font-weight:600}
.dlabel input[type=date]{padding:.5rem .6rem}

/* Historie */
.row-actions{display:flex; gap:.5rem; flex-wrap:wrap; margin-top:.4rem}
.history-filter{display:flex; gap:.8rem; align-items:flex-end; flex-wrap:wrap; margin-bottom:.8rem}
.quick-ranges{display:flex; gap:.5rem; flex-wrap:wrap; margin-bottom:1rem}
.chip-range{padding:.4rem .9rem; border-radius:999px; background:#e2e8f0; color:#334155; font-weight:600}
.chip-range:hover{background:#dbeafe}
.chip-range.active{background:var(--blue); color:#fff}
.summary-card{text-align:center}
.summary-main{display:flex; flex-direction:column; align-items:center; gap:.2rem}
.big-pct{font-size:2.4rem; font-weight:800; line-height:1}
.big-pct.good{color:var(--green)}
.big-pct.mid{color:#d97706}
.big-pct.low{color:var(--red)}
.day-card-head{display:flex; align-items:center; justify-content:space-between; gap:.6rem}
.day-card-head h2{font-size:1.05rem; margin:.1rem 0; display:flex; align-items:center; gap:.4rem}
.badge.today{background:var(--blue); color:#fff}
