:root {
  color-scheme: dark;
  --bg: #0f1115;
  --surface: #161921;
  --surface-2: #1c2029;
  --surface-3: #232835;
  --border: #272c38;
  --border-strong: #353b4a;
  --text: #e9ebf1;
  --muted: #9aa2b2;
  --faint: #677084;
  --accent: #6d8cff;
  --accent-strong: #5876f5;
  --accent-soft: rgba(109, 140, 255, .14);
  --good: #2fbf71;
  --good-soft: rgba(47, 191, 113, .14);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, .14);
  --bad: #e5484d;
  --bad-soft: rgba(229, 72, 77, .14);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --top-h: 56px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.num, .tabnum { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 16px; height: 16px; }
svg.i.lg { width: 24px; height: 24px; }

/* ───────── shell ───────── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 16px 0;
  display: flex; align-items: center; gap: 10px;
  background: rgba(15, 17, 21, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; font-size: 17px; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.topbar .spacer { flex: 1; }
.mini-timer {
  display: flex; align-items: center; gap: 8px; max-width: 56vw;
  padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--text);
  border: 1px solid rgba(109, 140, 255, .35); cursor: pointer; font-size: 14px; white-space: nowrap;
}
.mini-timer .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(47,191,113,.2); animation: pulse 1.6s infinite; }
.mini-timer.paused .dot { background: var(--warn); animation: none; box-shadow: none; }
.mini-timer.ringing { background: var(--warn-soft); border-color: rgba(245,165,36,.5); }
.mini-timer .t { font-weight: 700; }
.mini-timer .n { overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(47,191,113,0); } }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .count {
  position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}

.layout { display: block; }
main.view {
  padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 28px);
  width: 100%; min-width: 0; max-width: 980px; margin: 0 auto;
}
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(19, 22, 28, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
nav.tabs button {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--faint); font-size: 11.5px; font-weight: 600; cursor: pointer;
}
nav.tabs button.on { color: var(--text); }
nav.tabs button.on svg { stroke: var(--accent); }
nav.tabs .count {
  position: absolute; top: 7px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
nav.tabs .avatar { width: 22px; height: 22px; font-size: 10px; }

@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: 220px 1fr; }
  nav.tabs {
    position: sticky; top: calc(var(--top-h) + var(--safe-t)); height: calc(100vh - var(--top-h)); bottom: auto;
    display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; border-top: 0; border-right: 1px solid var(--border);
    background: transparent;
  }
  nav.tabs button { flex-direction: row; justify-content: flex-start; gap: 12px; height: 44px; padding: 0 14px; border-radius: 12px; font-size: 15px; }
  nav.tabs button:hover { background: var(--surface-2); color: var(--text); }
  nav.tabs button.on { background: var(--surface-2); }
  nav.tabs .count { position: static; margin-left: auto; }
  main.view { padding: 24px 28px 48px; }
}

/* ───────── generic ───────── */
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 10px; }
.section-head h2 { flex: 1; }
.section-head .sub { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
}
.card.flush { padding: 0; overflow: hidden; }
.empty { text-align: center; color: var(--faint); padding: 22px 12px; font-size: 14px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 12px; cursor: pointer; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.good { background: var(--good); border-color: var(--good); color: #06150c; }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #1d1300; }
.btn.danger { background: transparent; border-color: rgba(229,72,77,.45); color: #ff8589; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.xs { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 54px; padding: 0 24px; font-size: 17px; border-radius: 16px; }
.btn.block { width: 100%; }
.btn.round { width: 42px; padding: 0; border-radius: 50%; }

.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border-strong); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 84px; resize: vertical; line-height: 1.45; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%239aa2b2' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.input.sm { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.input.big { min-height: 54px; font-size: 18px; padding: 12px 16px; border-radius: 14px; }
input[type="date"].input, input[type="time"].input, input[type="datetime-local"].input { min-width: 0; }
input::-webkit-calendar-picker-indicator { filter: invert(.8); }
.field { display: block; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 6px 2px; text-transform: uppercase; letter-spacing: .04em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2.collapse { grid-template-columns: 1fr; } }

.seg { display: flex; padding: 4px; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 13px; }
.seg button {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px; overflow: hidden; text-overflow: ellipsis;
  min-height: 38px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
@media (max-width: 420px) {
  .start-card .seg button { padding: 0 6px; gap: 4px; font-size: 13.5px; }
  .start-card .seg svg { display: none; }
}
@media (max-width: 560px) { /* scrolling tab bars hid options: wrap them instead */
  .seg.scroll { flex-wrap: wrap; overflow: visible; }
  .seg.scroll button { flex: 1 1 auto; }
}
.seg.scroll { overflow-x: auto; scrollbar-width: none; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll button { flex: 0 0 auto; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted); cursor: pointer; font-size: 13.5px; font-weight: 600;
}
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: rgba(109,140,255,.6); color: var(--text); }
.chip.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag svg.i { width: 13px; height: 13px; }
.tag.bad { background: var(--bad-soft); color: #ff9a9d; }
.tag.warn { background: var(--warn-soft); color: #ffc46b; }
.tag.good { background: var(--good-soft); color: #6be3a2; }
.tag.accent { background: var(--accent-soft); color: #a9bbff; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: #fff; text-transform: uppercase; letter-spacing: 0;
}
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 44px; height: 44px; font-size: 17px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--text); }

.toggle { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; }
.toggle .grow > div:first-child { font-weight: 600; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: .2s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #c9cfdb; transition: .2s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* ───────── auth ───────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 18px calc(24px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; text-align: center; }
.auth-logo img { width: 76px; height: 76px; border-radius: 20px; box-shadow: var(--shadow); }
.auth-logo h1 { font-size: 28px; }
.auth .recent { margin-top: 18px; }
.auth .recent .chip { height: 38px; }
.auth .msg { min-height: 22px; margin: 10px 2px 0; font-size: 14px; }
.auth .msg.err { color: #ff8589; }

/* ───────── timer view ───────── */
.timer-hero { display: flex; flex-direction: column; align-items: center; padding: 22px 16px 20px; text-align: center; }
.dial { position: relative; width: min(290px, 74vw); aspect-ratio: 1; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial .track { stroke: var(--surface-3); }
.dial .prog { stroke: var(--accent); transition: stroke-dashoffset .3s linear, stroke .3s; }
.dial .dot { fill: var(--text); }
.dial.checkin .prog { stroke: var(--good); }
.dial.paused .prog { stroke: var(--warn); }
.dial .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 18%; }
.dial .time { font-size: clamp(40px, 13vw, 58px); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; }
.dial .label { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.dial .label2 { color: var(--faint); font-size: 12.5px; }
.timer-title {
  margin-top: 16px; max-width: 100%; font-size: 19px; font-weight: 700; border: 1px dashed transparent; border-radius: 10px;
  padding: 4px 10px; background: transparent; text-align: center; color: var(--text); outline: none; width: min(520px, 100%);
}
.timer-title:hover { border-color: var(--border-strong); }
.timer-title:focus { border-color: var(--accent); border-style: solid; background: var(--bg); }
.timer-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.timer-meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sound-hint { margin-top: 14px; }

.start-card .presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.start-card .mode-help { color: var(--muted); font-size: 13.5px; margin: 10px 2px 0; min-height: 20px; }
.custom-min { display: flex; align-items: center; gap: 8px; }
.custom-min input { width: 92px; text-align: center; }

.pending-card { border-color: rgba(245,165,36,.45); background: linear-gradient(180deg, rgba(245,165,36,.07), transparent 60%), var(--surface); }
.pending-item + .pending-item { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

.entry { display: flex; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); cursor: default; }
.entry:first-child { border-top: 0; }
.entry.click { cursor: pointer; }
.entry.click:hover { background: var(--surface-2); }
.entry .when { color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.entry .title { font-weight: 650; overflow-wrap: anywhere; }
.entry .note, .task .t, .task .notes, .pending-item, .modal, .notif, .person-card { overflow-wrap: anywhere; }
.entry .note { color: var(--muted); font-size: 14px; margin-top: 2px; }
.entry .dur { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mode-ico { color: var(--faint); }

/* ───────── tasks ───────── */
.quick-add .opts { display: none; margin-top: 12px; }
.quick-add.open .opts { display: block; }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); }
.task:first-child { border-top: 0; }
.task:hover { background: var(--surface-2); }
.check {
  width: 24px; height: 24px; flex: none; margin-top: 1px; border-radius: 50%; border: 2px solid var(--border-strong);
  background: transparent; cursor: pointer; display: grid; place-items: center; color: transparent; padding: 0;
}
.check:hover { border-color: var(--good); color: var(--good); }
.check { position: relative; }
.check::before { content: ""; position: absolute; inset: -10px; }
.check.prio { border-color: #e66767; }
.check.done { background: var(--good); border-color: var(--good); color: #06150c; }
.task .body { flex: 1; min-width: 0; cursor: pointer; }
.task .t { font-weight: 600; word-break: break-word; }
.task.is-done .t { color: var(--faint); text-decoration: line-through; }
.task .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.task .notes { color: var(--muted); font-size: 13.5px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.group-label { padding: 10px 16px 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); background: var(--surface); border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.group-label:first-child { border-top: 0; }
.group-label.bad { color: #ff8589; }

/* ───────── team ───────── */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.person-card { display: flex; gap: 12px; align-items: center; padding: 12px 14px; }
.person-card.idle { opacity: .62; }
.person-card .t { font-weight: 700; font-variant-numeric: tabular-nums; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 6px; vertical-align: 1px; }
.live-dot.paused { background: var(--warn); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi .v { font-size: 24px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .k { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.bars .bar-row { display: grid; grid-template-columns: 130px 1fr 74px; align-items: center; gap: 12px; padding: 7px 0; cursor: pointer; }
.bars .bar-row:hover .bar-name { color: var(--text); }
.bars .bar-name { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; min-width: 0; }
.bars .bar-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .bar-track { height: 14px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bars .bar-fill { height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.bars .bar-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .bars .bar-row { grid-template-columns: 96px 1fr 64px; gap: 8px; } }
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-wrap .gridline { stroke: var(--border); stroke-width: 1; }
.chart-wrap .axis-label { fill: var(--faint); font-size: 11px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tooltip {
  position: fixed; z-index: 80; pointer-events: none; background: #0b0d11; border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 8px 10px; font-size: 13px; box-shadow: var(--shadow); min-width: 140px; max-width: 260px;
}
.tooltip .tt-h { font-weight: 700; margin-bottom: 4px; }
.tooltip .tt-r { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tooltip .tt-r i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.feed-day { padding: 10px 16px 8px; display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--surface); border-top: 1px solid var(--border); }
.feed-day:first-child { border-top: 0; }
.feed-day span:last-child { text-transform: none; letter-spacing: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters .seg { flex: 1 1 360px; }
.filters select.input { width: auto; min-width: 160px; flex: 0 1 auto; }

/* ───────── me ───────── */
.ring-opt { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--border); cursor: pointer; }
.ring-opt:first-child { border-top: 0; }
.ring-opt input { accent-color: var(--accent); width: 18px; height: 18px; }
.ring-opt .grow > div:first-child { font-weight: 600; }
.ring-opt.custom { flex-wrap: wrap; }
.ring-btns { display: flex; gap: 6px; align-items: center; margin-left: auto; }
@media (max-width: 480px) { .ring-opt.custom .ring-btns { flex-basis: 100%; justify-content: flex-end; } }
.person-card.sel, .bar-row.sel .bar-name { outline: 2px solid var(--accent); outline-offset: -2px; }
.bar-row.sel .bar-name { outline: 0; color: var(--text); }

/* ───────── overlays ───────── */
.overlay {
  position: fixed; inset: 0; z-index: 60; background: rgba(5, 6, 9, .66); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out;
}
@media (min-width: 640px) { .overlay { align-items: center; padding: 24px; } }
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 40px - var(--safe-t)); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(18px + var(--safe-b)); box-shadow: var(--shadow); animation: up .2s ease-out;
}
@media (min-width: 640px) { .modal { border-radius: 20px; padding: 22px; } }
.modal-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.modal-head h2 { flex: 1; font-size: 19px; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.modal-foot .grow { flex: 1; }
.ring-modal { text-align: center; }
.ring-modal .bell { width: 74px; height: 74px; border-radius: 50%; margin: 2px auto 12px; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn); animation: shake 1s infinite; }
.ring-modal .bell svg { width: 36px; height: 36px; }
.ring-modal textarea { text-align: left; }
@keyframes shake { 0%, 50%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-12deg); } 20%, 40% { transform: rotate(12deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }

.panel { position: fixed; z-index: 55; top: calc(var(--top-h) + var(--safe-t) + 6px); right: 10px; width: min(400px, calc(100vw - 20px)); max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow); }
.notif { display: flex; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: linear-gradient(90deg, var(--accent-soft), transparent 70%); }
.notif .t { font-weight: 650; font-size: 14px; }
.notif .b { color: var(--muted); font-size: 13px; }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + var(--safe-b) + 14px); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { background: #f1f3f8; color: #111318; font-weight: 600; font-size: 14px; padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); animation: up .2s ease-out; }
.toast.err { background: #ffd9da; color: #4a0b0d; }
.toast { display: flex; align-items: center; gap: 14px; }
.toast-act { border: 0; background: transparent; color: var(--accent-strong); font-weight: 750; cursor: pointer; padding: 10px 8px; margin: -10px -8px; }

.banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid rgba(109,140,255,.35); margin-bottom: 14px; font-size: 14px; }
.banner.warn { background: var(--warn-soft); border-color: rgba(245,165,36,.4); }
.banner .grow b { display: block; }

#pip-video { position: fixed; width: 2px; height: 2px; opacity: 0.01; pointer-events: none; bottom: 0; left: 0; }
