:root {
  --bg:#F4ECE0; --surface:#FBF6EF; --ink:#3A2E24; --muted:#8A7A66;
  --accent:#A9694A; --accent-2:#6B4F3A; --ok:#6E7F58; --warn:#C98A3C; --danger:#9A4B3F;
  --radius:11px; --shadow:0 1px 3px rgba(58,46,36,.12), 0 6px 20px rgba(58,46,36,.06);
  --navh:60px;
}
* { box-sizing:border-box; }
html, body { max-width:100%; overflow-x:hidden; }
body { margin:0; background:var(--bg); color:var(--ink);
  font:15px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; }
h1,h2,h3 { color:var(--accent-2); font-weight:650; margin:0 0 .5em; }

/* Phone is primary. Content area reserves room for the fixed bottom nav. */
.app { max-width:1100px; margin:0 auto; padding:16px;
  padding-bottom:calc(var(--navh) + env(safe-area-inset-bottom) + 16px); }

.card { background:var(--surface); border-radius:var(--radius); box-shadow:var(--shadow); padding:16px; }

.btn { border:1px solid var(--muted); background:var(--surface); color:var(--ink);
  border-radius:9px; padding:10px 14px; cursor:pointer; font:inherit;
  min-height:44px; display:inline-flex; align-items:center; justify-content:center; }
.btn-accent { background:var(--accent); border-color:var(--accent); color:#fff; }
.btn:disabled { opacity:.5; cursor:default; }

.pill { display:inline-block; padding:2px 8px; border-radius:999px; font-size:12px; background:#0000000d; }
.pill.ok{background:#6E7F5822;color:var(--ok);} .pill.warn{background:#C98A3C22;color:var(--warn);}
.pill.danger{background:#9A4B3F22;color:var(--danger);}

.row { display:flex; gap:8px; align-items:center; }

label { display:block; font-size:13px; color:var(--muted); margin-top:8px; }
input,select,textarea { width:100%; padding:11px 12px; border:1px solid var(--muted);
  border-radius:8px; background:#fff; font-size:16px; /* no iOS zoom-on-focus */
  color:var(--ink); min-height:44px; }

/* Wide content (week grid, report tables) scrolls in its own container. */
.hscroll { overflow-x:auto; -webkit-overflow-scrolling:touch; }

/* Bottom nav bar — phone. Top nav row appears only on desktop. */
.nav { position:fixed; bottom:0; left:0; right:0; z-index:20;
  display:flex; background:var(--surface); border-top:1px solid #0000001a;
  padding-bottom:env(safe-area-inset-bottom); box-shadow:0 -2px 10px rgba(58,46,36,.08); }
.nav a, .nav button { flex:1; min-height:var(--navh); border:0; background:none;
  color:var(--muted); font:inherit; font-size:12px; cursor:pointer;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; }
.nav a.btn-accent { background:none; color:var(--accent); font-weight:650; }

/* Bottom sheet — panels/details on phone. */
.sheet-backdrop { position:fixed; inset:0; background:#3a2e2455; z-index:30; }
.sheet { position:fixed; inset:auto 0 0 0; z-index:31; background:var(--surface);
  max-height:90dvh; overflow-y:auto; border-radius:16px 16px 0 0; padding:16px;
  padding-bottom:calc(16px + env(safe-area-inset-bottom)); }
.sheet .close { position:absolute; top:10px; right:12px; }
body.sheet-open { overflow:hidden; }

.chip { cursor:pointer; display:inline-flex; gap:4px; align-items:center; margin:2px;
  padding:8px 10px; min-height:36px; background:#0000000a; border-radius:7px; }
.dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.dot.ok{background:var(--ok);} .dot.warn{background:var(--warn);}
.dot.muted{background:var(--muted);} .dot.danger{background:var(--danger);}

.muted-note { color:var(--muted); font-size:12px; }

/* Schedule controls */
.sched-bar { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
.move-banner { background:#C98A3C22; color:var(--accent-2); border-radius:8px;
  padding:10px 12px; margin-bottom:12px; font-size:14px; }
.move-banner a { color:var(--accent); }

/* Day view (phone) */
.day-switch { position:sticky; top:0; z-index:10; display:flex; align-items:center;
  justify-content:space-between; gap:8px; background:var(--bg); padding:8px 0; }
.day-switch > div { font-size:15px; }
.day-list { display:flex; flex-direction:column; gap:10px; }
.slot { background:var(--surface); border-radius:var(--radius); box-shadow:var(--shadow); padding:12px; }
.slot.target { outline:2px dashed var(--accent); cursor:pointer; }
.slot-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.slot .chips { display:flex; flex-wrap:wrap; gap:4px; }

/* Week table (desktop) */
table.week { border-collapse:collapse; width:100%; min-width:720px; }
table.week th, table.week td { border:1px solid #0000001f; padding:6px; vertical-align:top; text-align:left; }
table.week th { background:var(--surface); font-weight:600; font-size:13px; }
table.week th.is-today { color:var(--accent); }
.wcell { min-width:96px; }
.wcell.target { outline:2px dashed var(--accent); cursor:pointer; }
.wcell-cap { font-size:11px; color:var(--muted); margin-bottom:4px; }

/* Attendance sheet */
.sheet .radios { display:flex; flex-direction:column; gap:4px; margin:8px 0; }
.sheet .radio { display:flex; align-items:center; gap:8px; min-height:44px; font-size:15px; color:var(--ink); }
.sheet .radio input { width:auto; min-height:0; }

.list { display:flex; flex-direction:column; gap:10px; margin-top:12px; }
.client-row { cursor:pointer; }
.bar { background:#0000000f; border-radius:999px; height:8px; overflow:hidden; margin-top:4px; }
.bar span { display:block; height:100%; background:var(--accent); }
.chip-x { border:0; background:none; color:var(--muted); cursor:pointer; font-size:13px;
  padding:0 0 0 4px; min-height:0; }

table.rep { border-collapse:collapse; width:100%; }
.rep th, .rep td { border-bottom:1px solid #0000001a; padding:6px 8px; text-align:left; font-size:13px; }

.minibar { display:inline-block; width:10px; background:var(--accent); border-radius:2px; margin-right:2px; vertical-align:bottom; }

.app-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.app-head h1 { margin:0; }
ul.plain { list-style:none; padding:0; margin:6px 0 12px; }
ul.plain li { padding:6px 0; border-bottom:1px solid #0000000f; }
.btn-mini { min-height:32px; padding:4px 8px; font-size:12px; }
.card + .card { margin-top:12px; }

/* ── Desktop enhancement. Single breakpoint token, defined once. ── */
@media (min-width: 760px) {
  .app { padding:24px; padding-bottom:24px; }
  .btn { min-height:38px; padding:7px 12px; }
  .nav { position:static; box-shadow:none; border:0; background:none;
    gap:8px; margin-bottom:16px; flex-wrap:wrap; padding:0; }
  .nav a, .nav button { flex:0 0 auto; min-height:38px; font-size:15px;
    flex-direction:row; border:1px solid var(--muted); border-radius:9px; padding:7px 12px; }
  .nav a.btn-accent { background:var(--accent); color:#fff; border-color:var(--accent); }
  .nav button#logout { margin-left:auto; }
  .sheet { position:fixed; inset:0 0 0 auto; width:380px; max-height:none;
    border-radius:0; box-shadow:var(--shadow); }
}

/* TODO: prefers-color-scheme: dark pass */

/* Слоты — выбор дней недели */
.preset-row { display:flex; flex-wrap:wrap; gap:6px; margin:6px 0; }
.wd-toggle { display:flex; gap:4px; margin:4px 0 4px; }
.wd-toggle .wd { flex:1; min-height:40px; border:1px solid var(--muted); background:var(--surface);
  color:var(--ink); border-radius:8px; font:inherit; cursor:pointer; }
.wd-toggle .wd[aria-pressed="true"] { background:var(--accent); border-color:var(--accent); color:#fff; }

.chk-list { display:flex; flex-direction:column; gap:6px; margin-top:4px; }
.chk { display:flex; align-items:center; gap:8px; min-height:40px; font-size:15px; color:var(--ink); }
.chk input { width:auto; min-height:0; }
