:root {
  --brand: #5b4cdb; --brand-600: #4c3fc4; --brand-50: #f0eeff; --brand-100: #e2defe;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e5e7ef; --line-2: #eef0f6;
  --bg: #f5f6fb; --card: #ffffff; --ok: #059669; --ok-50: #ecfdf5; --warn: #d97706; --warn-50: #fffbeb;
  --bad: #dc2626; --bad-50: #fef2f2; --info: #2563eb; --info-50: #eff6ff;
  --pa: #7c3aed; --pb: #0d9488;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }

/* ---------- layout */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 14px; }
.brand b { font-size: 18px; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); font-size: 11.5px; margin-top: -2px; }
.nav-group { margin-top: 10px; }
.nav-group > span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; font-weight: 600; padding: 6px 10px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 500; font-size: 14px; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.active { background: var(--brand-50); color: var(--brand-600); font-weight: 600; }
.nav a .count { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center; }
.nav a .count.soft { background: var(--brand-100); color: var(--brand-600); }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.me div { min-width: 0; }
.me b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--muted); font-size: 12px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.topbar .title { flex: 1; min-width: 0; }
.topbar .title h1 { font-size: 22px; }
.topbar .title p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.content { padding: 8px 28px 48px; max-width: 1320px; width: 100%; }
.btn.menu-btn { display: none; }
.bottom-nav { display: none; }
.drawer-bg { display: none; }

/* ---------- primitives */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; }
.card-h h2 { flex: 1; }
.card-b { padding: 14px 18px 18px; }
.card.pad { padding: 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.lg { gap: 16px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 650; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 12px; } .mt-lg { margin-top: 20px; } .mb { margin-bottom: 12px; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.pre { white-space: pre-wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; text-decoration: none !important; }
.btn:hover { background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: #fecaca; }
.btn.danger:hover { background: var(--bad-50); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-50); color: var(--ok); }
.badge.warn { background: var(--warn-50); color: #b45309; }
.badge.bad { background: var(--bad-50); color: var(--bad); }
.badge.info { background: var(--info-50); color: var(--info); }
.badge.brand { background: var(--brand-50); color: var(--brand-600); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 24px; font-weight: 750; letter-spacing: -.02em; margin-top: 4px; }
.stat .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-2); }
.li:first-child { border-top: 0; }
.li .grow > b { display: block; font-weight: 600; }
.date-chip { width: 46px; flex-shrink: 0; text-align: center; border-radius: 10px; background: var(--brand-50); color: var(--brand-600); padding: 4px 0; line-height: 1.1; }
.date-chip b { display: block; font-size: 17px; }
.date-chip small { font-size: 10.5px; text-transform: uppercase; font-weight: 700; letter-spacing: .05em; }

table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fafbff; }
.table-wrap { overflow-x: auto; }

/* ---------- forms */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 11.5px; }
.input, select.input, textarea.input { width: 100%; border: 1px solid #d8dbe6; background: #fff; border-radius: 10px; padding: 9px 11px; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
textarea.input { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--brand-600); border-bottom-color: var(--brand); }

/* ---------- modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 24px 60px rgba(15,23,42,.25); animation: pop .18s; }
.modal.wide { width: min(860px, 100%); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-h h2 { flex: 1; }
.modal-b { padding: 10px 20px 20px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 550; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: pop .2s; max-width: 380px; display: flex; gap: 8px; align-items: center; }
.toast.err { background: var(--bad); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; border: 1px solid; }
.alert.info { background: var(--info-50); border-color: #bfdbfe; color: #1e3a8a; }
.alert.warn { background: var(--warn-50); border-color: #fde68a; color: #78350f; }
.alert.bad { background: var(--bad-50); border-color: #fecaca; color: #7f1d1d; }
.alert.ok { background: var(--ok-50); border-color: #a7f3d0; color: #064e3b; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .ic { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-50); color: var(--brand); display: inline-grid; place-items: center; margin-bottom: 8px; }

/* ---------- dashboard */
.hero { position: relative; overflow: hidden; border-radius: 18px; padding: 22px 24px; color: #fff; background: linear-gradient(120deg, var(--hero-a, #7c3aed), var(--hero-b, #5b4cdb)); box-shadow: 0 10px 30px rgba(91,76,219,.25); }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.1); }
.hero .k { text-transform: uppercase; letter-spacing: .1em; font-size: 11.5px; font-weight: 700; opacity: .85; }
.hero h2 { font-size: 24px; margin-top: 4px; }
.hero p { opacity: .92; margin-top: 6px; }
.hero .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; position: relative; z-index: 1; }
.hero .chip { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-strip .d { border-radius: 12px; padding: 8px 6px; text-align: center; border: 1px solid var(--line); background: #fff; position: relative; }
.week-strip .d .n { font-size: 18px; font-weight: 700; }
.week-strip .d .w { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.week-strip .d .who { margin-top: 4px; font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 2px 0; color: #fff; }
.week-strip .d.today { outline: 2px solid var(--brand); }
.week-strip .d .sw { position: absolute; top: 4px; right: 5px; font-size: 10px; }

/* ---------- calendar */
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-head h2 { font-size: 19px; min-width: 170px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.month .wd { padding: 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafbfe; }
.month .cell { min-height: 112px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0 0 4px; position: relative; cursor: pointer; display: flex; flex-direction: column; min-width: 0; }
.month .cell:hover { background: #fcfcff; }
.month .cell.out { background: #fafafa; }
.month .cell.out .num { color: #b6bccb; }
.month .custody { height: 5px; }
.month .num { font-size: 12.5px; font-weight: 700; padding: 4px 7px 2px; display: flex; align-items: center; gap: 4px; }
.month .cell.today .num span:first-child { background: var(--brand); color: #fff; border-radius: 999px; padding: 0 7px; }
.month .who { font-size: 10.5px; font-weight: 700; margin-left: auto; padding: 0 6px; border-radius: 6px; }
.ev { display: block; margin: 1px 4px; padding: 1px 6px; border-radius: 6px; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; background: var(--line-2); color: var(--ink-2); }
.ev.school { border-color: #6366f1; background: #eef2ff; }
.ev.medical { border-color: #ef4444; background: #fef2f2; }
.ev.activity { border-color: #22c55e; background: #f0fdf4; }
.ev.family { border-color: #f59e0b; background: #fffbeb; }
.ev.handover { border-color: #0f172a; background: #f1f5f9; font-weight: 650; }
.ev.occasion { border-color: #ec4899; background: #fdf2f8; }
.ev.holiday { border-color: #0ea5e9; background: #f0f9ff; }
.ev.other { border-color: #94a3b8; }
.ev.more { border: 0; background: none; color: var(--muted); font-weight: 600; }
.band { margin: 1px 0; padding: 0 6px; font-size: 10.5px; font-weight: 650; background: #e0f2fe; color: #075985; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.band.term { background: #f1f5f9; color: #475569; }
.week-view { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week-view .col { background: #fff; border: 1px solid var(--line); border-radius: 12px; min-height: 360px; overflow: hidden; display: flex; flex-direction: column; }
.week-view .col .hd { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.week-view .col .hd b { font-size: 18px; }
.week-view .col.today { outline: 2px solid var(--brand); }
.week-view .item { margin: 6px 8px 0; padding: 6px 8px; border-radius: 8px; font-size: 12px; border-left: 3px solid; background: var(--line-2); }
.week-view .item b { display: block; font-size: 12.5px; }

/* ---------- messages */
.back-btn { display: none !important; }
.chat { display: grid; grid-template-columns: 300px 1fr; min-height: 560px; height: calc(100vh - 160px); overflow: hidden; }
.threads { border-right: 1px solid var(--line); overflow-y: auto; }
.thread-item { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink); cursor: pointer; }
.thread-item:hover { background: #fafbff; text-decoration: none; }
.thread-item.on { background: var(--brand-50); }
.thread-item b { display: block; font-size: 13.5px; }
.thread-item .pv { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-item .unread { width: 8px; height: 8px; background: var(--brand); border-radius: 50%; display: inline-block; }
.conv { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.conv-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: #fbfbfe; }
.msg { max-width: 72%; }
.msg.mine { align-self: flex-end; }
.msg .bubble { padding: 10px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word; }
.msg.mine .bubble { background: var(--brand); color: #fff; border-color: var(--brand); border-bottom-right-radius: 4px; }
.msg:not(.mine) .bubble { border-bottom-left-radius: 4px; }
.msg .meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.msg.mine .meta { justify-content: flex-end; }
.composer { border-top: 1px solid var(--line); padding: 12px 14px; background: #fff; }
.composer textarea { min-height: 64px; }
.tone-bar { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-top: 8px; }
.tone-bar > .bold { white-space: nowrap; }
@media (max-width: 520px) { .tone-bar .meter { display: none; } }
.meter { flex: 0 0 120px; height: 6px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; transition: width .2s, background .2s; }

/* ---------- misc components */
.progress { height: 8px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bars .bar-row { display: grid; grid-template-columns: 150px 1fr 100px; gap: 10px; align-items: center; font-size: 13px; }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding-top: 10px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .stackbar { width: 100%; max-width: 46px; border-radius: 8px 8px 3px 3px; overflow: hidden; display: flex; flex-direction: column-reverse; }
.chart .col small { font-size: 11px; color: var(--muted); font-weight: 600; }
.pattern { display: flex; gap: 3px; flex-wrap: wrap; }
.pattern i { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 700; color: #fff; cursor: default; }
.pattern.edit i { cursor: pointer; }
.pattern-card { cursor: pointer; border: 2px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.pattern-card:hover { border-color: var(--brand-100); }
.pattern-card.on { border-color: var(--brand); background: var(--brand-50); }
.kid-card { display: flex; gap: 14px; align-items: center; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-2); }
.check-item:first-child { border-top: 0; }
.check-item.done .txt { text-decoration: line-through; color: var(--muted); }
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline .ti { position: relative; padding: 0 0 12px; font-size: 13px; }
.timeline .ti::before { content: ""; position: absolute; left: -17px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }
.file-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; background: #fff; color: var(--ink-2); }
.notice-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login .art { background: linear-gradient(140deg, #4c1d95, #5b4cdb 50%, #0f766e); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login .art h1 { font-size: 40px; line-height: 1.1; letter-spacing: -.03em; max-width: 520px; }
.login .art ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; max-width: 460px; }
.login .art li { display: flex; gap: 10px; align-items: center; opacity: .95; }
.login .art li .ic { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.14); display: grid; place-items: center; flex-shrink: 0; }
.login .panel { display: grid; place-items: center; padding: 32px; }
.login form { width: min(420px, 100%); }
.demo-acc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-acc button { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.demo-acc button:hover { border-color: var(--brand); background: var(--brand-50); }
.demo-acc b { display: block; font-size: 13px; }
.demo-acc small { color: var(--muted); font-size: 11.5px; }

/* ---------- responsive */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
  .chat { grid-template-columns: 240px 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 60; transform: translateX(-105%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .shell.drawer .sidebar { transform: none; }
  .shell.drawer .drawer-bg { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 50; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .topbar .title h1 { font-size: 19px; }
  .topbar .title p { display: none; }
  .content { padding: 4px 14px 96px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 0; position: relative; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav a .count { position: absolute; top: 0; right: 22%; background: var(--bad); color: #fff; font-size: 10px; border-radius: 999px; padding: 0 5px; }
  .month .cell { min-height: 74px; }
  .month .ev { font-size: 10px; padding: 0 3px; }
  .month .who { display: none; }
  .week-view { grid-template-columns: 1fr; }
  .week-view .col { min-height: auto; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .threads { border-right: 0; border-bottom: 1px solid var(--line); }
  .chat.has-conv .threads, .chat.no-conv .conv { display: none; }
  .conv-h { flex-wrap: wrap; }
  .conv-h .grow { flex: 1 1 calc(100% - 60px); min-width: 0; }
  .back-btn { display: inline-flex !important; font-size: 20px; padding: 0 10px; }
  .msgs { min-height: 340px; }
  .msg { max-width: 88%; }
  .login { grid-template-columns: 1fr; }
  .login .art { padding: 28px; }
  .login .art h1 { font-size: 28px; }
  .login .art ul { display: none; }
  .bars .bar-row { grid-template-columns: 110px 1fr 80px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr 1fr; }
  .stat .value { font-size: 20px; }
  .demo-acc { grid-template-columns: 1fr; }
  .week-strip { gap: 3px; }
  .week-strip .d { padding: 6px 2px; }
}
@media print {
  .sidebar, .topbar .actions, .bottom-nav, .btn { display: none !important; }
  .shell { display: block; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
