/* PVL savanorių sistema – stilius. Spalvos apibrėžtos kintamaisiais (šviesi ir tamsi tema). */
:root {
  color-scheme: light;
  --page: #f6f6f3;
  --surface: #fdfdfc;
  --surface-2: #f0efeb;
  --ink: #141413;
  --ink-2: #52514e;
  --muted: #696761;
  --line: #e1e0d9;
  --line-strong: #c9c8c0;
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --accent-hover: #184f95;
  --accent-soft: #e4eefb;
  --accent-line: #86b6ef;
  --ok: #006300;
  --ok-soft: #e3f3e3;
  --warn-ink: #7a4b00;
  --warn-soft: #fdf0cf;
  --danger: #b42a2a;
  --danger-soft: #fbe6e6;
  --today: #fff6d8;
  --weekend: #f3f2ee;
  --shadow: 0 1px 2px rgba(11, 11, 11, .05), 0 6px 24px rgba(11, 11, 11, .06);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --radius: 12px;
  --side-w: 248px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0f0f0e;
    --surface: #1a1a19;
    --surface-2: #252523;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #a5a39c;
    --line: #2e2e2b;
    --line-strong: #44443f;
    --accent: #6da7ec;
    --accent-ink: #0b1a2c;
    --accent-hover: #86b6ef;
    --accent-soft: #17293f;
    --accent-line: #2f5f9b;
    --ok: #4cc04c;
    --ok-soft: #14301a;
    --warn-ink: #f0c060;
    --warn-soft: #3a2c0c;
    --danger: #f08080;
    --danger-soft: #3b1a1a;
    --today: #2e2a17;
    --weekend: #20201e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .45);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --grid: #2c2c2a;
    --axis: #44443f;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); -webkit-text-size-adjust: 100%; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 1.02rem; font-weight: 650; }
h3 { font-size: 1.02rem; font-weight: 650; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small, small { font-size: .84rem; }
.link { font-size: .88rem; text-decoration: none; }
.link:hover { text-decoration: underline; }
.icon { flex: none; vertical-align: -3px; }
.spacer { flex: 1; }
.boot, .loading { padding: 48px 24px; text-align: center; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ── Mygtukai ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 7px 14px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 550; font-size: .93rem; text-decoration: none; cursor: pointer;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-on { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.btn-on:hover { background: var(--ok-soft); filter: brightness(.97); }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-soft); filter: brightness(.97); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .86rem; border-radius: 8px; }
.btn-icon { padding: 0; width: 38px; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }

/* ── Karkasas ── */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px 12px; background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; color: var(--ink); text-decoration: none; font-weight: 700; line-height: 1.2; }
.brand-mark { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px;
  color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: .95rem;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.nav-text { flex: 1; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  font-size: .74rem; font-weight: 700; display: inline-grid; place-items: center;
}
.side-user { display: flex; align-items: center; gap: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.user-chip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 9px; color: var(--ink); text-decoration: none; }
.user-chip:hover { background: var(--surface-2); }
.user-meta { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.user-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.user-meta small { color: var(--muted); }
.avatar {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .8rem;
}
.main { min-width: 0; padding: 28px 32px 56px; }
.page { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.bottom-nav { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 20px; flex-wrap: wrap; }
.page-head h1 + p { margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Kortelės, plytelės ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 0; }
.card-body { padding: 14px 18px 18px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 18px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-label { color: var(--ink-2); font-size: .84rem; }
.tile-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.tile-sub { color: var(--muted); font-size: .84rem; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 3px; background: var(--series-1); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.page > .empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 48px 20px; }
.count-pill { flex: none; white-space: nowrap; font-size: .8rem; color: var(--ink-2); background: var(--surface-2); padding: 2px 9px; border-radius: 10px; }

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rows-scroll { max-height: 380px; overflow-y: auto; margin-right: -8px; padding-right: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; padding-top: 2px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title::first-letter { text-transform: uppercase; }
.row-sub { color: var(--ink-2); font-size: .86rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-badge { flex: none; width: 42px; height: 44px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.date-badge b { font-size: 1.05rem; }
.date-badge small { color: var(--muted); font-size: .72rem; }
.announce { padding: 10px 0; border-top: 1px solid var(--line); }
.announce:first-child { border-top: 0; padding-top: 0; }
.announce p { white-space: pre-wrap; overflow-wrap: anywhere; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 10px;
  background: var(--surface-2); color: var(--ink-2); font-size: .76rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.tag-aag::before, .tag-supervizija::before, .tag-mokymai::before, .tag-susirinkimas::before, .tag-renginys::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--series-1);
}
.tag-supervizija::before { background: var(--series-2); }
.tag-mokymai::before { background: var(--series-3); }
.tag-susirinkimas::before { background: var(--series-4); }
.tag-renginys::before { background: var(--series-5); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn-ink); }
.tag-off { background: var(--surface-2); color: var(--muted); }
.tag-now { background: var(--accent-soft); color: var(--accent); }
th .tag, .msg-head .tag { margin-left: 6px; }

/* ── Grafikas ── */
.month-nav { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.month-title { min-width: 156px; text-align: center; font-size: 1.05rem; }
.month-title::first-letter { text-transform: uppercase; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-2); font-size: .84rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.cell {
  display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; min-height: 32px;
  padding: 4px 8px; border-radius: 8px; border: 1px solid transparent; background: none;
  font-size: .86rem; line-height: 1.2; text-align: center; min-width: 0;
}
.cell-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.cell { cursor: pointer; }
.cell.lg { width: 30px; min-height: 20px; padding: 0; border-radius: 6px; flex: none; }
.cell-free { border: 1px dashed var(--accent-line); color: var(--accent); font-weight: 550; }
button.cell-free:hover { background: var(--accent-soft); border-style: solid; }
.cell-mine { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
button.cell-mine:hover { background: var(--accent-hover); }
.cell-taken { background: var(--surface-2); color: var(--ink); }
button.cell-taken:hover, button.cell-closed:hover, button.cell-missed:hover { border-color: var(--line-strong); }
.cell-closed { color: var(--muted); font-size: .8rem; background: repeating-linear-gradient(135deg, transparent 0 5px, var(--surface-2) 5px 10px); }
.cell-missed { color: var(--muted); border: 1px dashed var(--line); }
.cell-none { color: var(--muted); }

.sched-wrap { overflow: auto; max-height: calc(100dvh - 24px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sched { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 980px; table-layout: fixed; }
.sched th, .sched td { padding: 3px 3px; border-bottom: 1px solid var(--line); }
.sched thead th {
  position: sticky; top: 0; z-index: 3; background: var(--surface); padding: 9px 6px 8px; text-align: center;
  font-size: .8rem; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--line-strong); vertical-align: bottom;
}
.slot-head { border-left: 1px solid var(--line); }
.slot-label { display: flex; align-items: center; justify-content: center; gap: 5px; }
.slot-time { display: block; color: var(--ink); font-size: .92rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sched .col-day { width: 68px; position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; padding-left: 8px; }
.sched thead .col-day { z-index: 4; text-align: left; padding-left: 14px; }
.sched .col-notes { width: 22%; text-align: left; padding-left: 12px; font-size: .84rem; border-left: 1px solid var(--line); }
.sched thead .col-notes { text-align: left; padding-left: 12px; }
.sched td.slot-start { border-left: 1px solid var(--line); }
.sched tbody tr:last-child > * { border-bottom: 0; }
.day-btn {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 6px; border: 0; background: none; border-radius: 7px;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
button.day-btn { cursor: pointer; }
button.day-btn:hover { background: var(--surface-2); }
.day-btn b { font-size: .98rem; min-width: 1.3em; text-align: right; }
.day-btn span { color: var(--muted); font-size: .8rem; font-weight: 500; }
.is-weekend > *, .sched .is-weekend .col-day { background: var(--weekend); }
.is-weekend .day-btn span { color: var(--danger); }
.is-today > *, .sched .is-today .col-day { background: var(--today); }
.is-today .col-day { box-shadow: inset 3px 0 0 var(--accent); }
.is-past .cell-taken, .is-past .cell-mine { opacity: .62; }
.col-notes .tag, .day-info .tag { margin: 1px 4px 1px 0; white-space: normal; }
.day-note { color: var(--ink-2); }

.day-cards { display: flex; flex-direction: column; gap: 10px; }
.day-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.day-card.is-weekend, .day-card.is-weekend > * { background: var(--weekend); }
.day-card.is-today, .day-card.is-today > * { background: var(--today); }
.day-card.is-today { border-color: var(--accent-line); }
.day-card header { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.day-full { color: var(--ink-2); font-size: .86rem; }
.day-full::first-letter { text-transform: uppercase; }
.day-info { flex-basis: 100%; font-size: .84rem; }
.day-info:empty { display: none; }
.slot-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.slot-name { flex: none; width: 104px; display: flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.slot-cells { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.slot-cells .cell { min-height: 36px; }
.audit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; }
.audit li { display: flex; gap: 12px; }
.audit small { flex: none; width: 128px; }

/* ── Renginiai ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { padding: 9px 14px; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--ink-2); font-weight: 600; cursor: pointer; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.events { display: flex; flex-direction: column; gap: 12px; }
.event { display: flex; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.event.is-past { opacity: .86; }
.event-date { flex: none; width: 62px; height: 68px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.12; }
.event-date b { font-size: 1.4rem; }
.event-date span { font-size: .82rem; color: var(--ink-2); }
.event-date small { font-size: .7rem; color: var(--muted); }
.event-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.event-top { display: flex; gap: 6px; flex-wrap: wrap; }
.event-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--ink-2); font-size: .88rem; }
.event-meta span { display: inline-flex; align-items: center; gap: 6px; }
.event-desc { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; }
.event-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.event-admin { display: flex; gap: 4px; margin-top: auto; }
.attend-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.attend-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 12px; max-height: 46vh; overflow-y: auto; padding: 4px 0; }
.attend-row { display: flex; align-items: center; gap: 8px; padding: 6px 6px; border-radius: 7px; cursor: pointer; }
.attend-row:hover { background: var(--surface-2); }

/* ── Lentelės ── */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap { border: 0; border-radius: 0; margin: 0 -18px -18px; border-top: 1px solid var(--line); }
.card .table-toggle .table-wrap { margin: 10px -18px -18px; }
.table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .9rem; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table thead th { font-size: .8rem; font-weight: 600; color: var(--ink-2); background: var(--surface); border-bottom-color: var(--line-strong); }
.table tbody th { font-weight: 600; }
.table tbody tr:last-child > *, .table tfoot tr:last-child > * { border-bottom: 0; }
.table tfoot > tr > * { border-top: 1px solid var(--line-strong); font-weight: 650; background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 700; }
.table .zero { color: var(--line-strong); }
.table tr.is-inactive > * { color: var(--muted); }
.table tr.is-future > * { color: var(--muted); }
.table tr.is-me > * { background: var(--accent-soft); }
.sticky-first th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.sticky-first tr.is-me th:first-child { background: var(--accent-soft); }
.sticky-first tfoot th:first-child { background: var(--surface-2); }
.table-summary th, .table-summary td { padding: 8px 9px; }
.row-actions { text-align: right !important; }
.row-actions .btn { margin-left: 4px; }
.table-toggle { margin-top: 10px; }
.table-toggle summary { cursor: pointer; color: var(--ink-2); font-size: .88rem; font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.search { flex: 1; min-width: 200px; max-width: 380px; }
.check-inline { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: .9rem; cursor: pointer; }

/* ── Diagramos ── */
.chart-plot { position: relative; min-height: 230px; overflow: hidden; }
.chart-svg { display: block; }
.chart-grid { stroke: var(--grid); stroke-width: 1; }
.chart-axis { stroke: var(--axis); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-col rect { outline: none; }
.chart-col.is-hover path { filter: brightness(.88); }
.chart-legend { display: flex; gap: 16px; font-size: .84rem; color: var(--ink-2); margin-bottom: 6px; }
.chart-legend span, .chart-tip-row { display: flex; align-items: center; gap: 7px; }
.chart-legend i, .chart-tip-row i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-tip {
  position: absolute; transform: translate(-50%, -100%); margin-top: -6px; pointer-events: none; z-index: 5;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; box-shadow: var(--shadow);
  padding: 8px 11px; font-size: .82rem; min-width: 150px; white-space: nowrap;
}
.chart-tip strong { display: block; margin-bottom: 3px; }
.chart-tip strong::first-letter { text-transform: uppercase; }
.chart-tip-row span { flex: 1; color: var(--ink-2); }
.chart-tip-extra { color: var(--muted); margin-top: 2px; }

/* ── Formos, dialogai ── */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=month],
input[type=tel], input[type=search], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
}
textarea { resize: vertical; line-height: 1.4; }
input[readonly] { background: var(--surface-2); color: var(--ink-2); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); flex: none; margin: 0; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; grid-column: 1 / -1; min-width: 0; }
.field-half { grid-column: auto; }
.field-label { font-size: .86rem; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); }
.field-check { flex-direction: row; align-items: center; gap: 9px; flex-wrap: wrap; cursor: pointer; }
.check-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.check-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; font-size: .88rem; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: 9px; font-size: .9rem; }
.form-inline { max-width: 560px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.copy-row { display: flex; gap: 8px; margin: 12px 0; }
.copy-input { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }

.modal {
  width: min(480px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow: hidden;
}
.modal[open] { display: flex; flex-direction: column; }
.modal-wide { width: min(680px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(10, 10, 10, .45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px 6px 20px; }
.modal-head h2 { font-size: 1.1rem; }
.modal-head h2::first-letter { text-transform: uppercase; }
.modal-body { padding: 8px 20px 20px; overflow-y: auto; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.confirm-text { margin-bottom: 14px; }

#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast {
  display: flex; align-items: center; gap: 9px; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--page);
  box-shadow: var(--shadow); font-size: .92rem; font-weight: 550; animation: toast-in .18s ease-out; max-width: 100%;
}
.toast-err { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Prisijungimas ── */
.auth { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px 26px 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 20px; }
.auth-card h1 { font-size: 1.3rem; }
.auth-foot { color: var(--muted); font-size: .84rem; text-align: center; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); color: var(--ink); border-radius: var(--radius); padding: 12px 16px; font-size: .93rem; }
.notice .icon { color: var(--accent); margin-top: 2px; }

.more-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.more-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); text-decoration: none; font-weight: 550; text-align: left; cursor: pointer; }
.more-item:first-child { border-top: 0; }
.more-item .icon:last-child { margin-left: auto; color: var(--muted); }

/* ── Pokalbiai ── */
.main.page-pokalbiai { padding: 0; height: 100dvh; }
.page-pokalbiai .page { max-width: none; height: 100%; gap: 0; }
.chat { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: 100%; min-height: 0; }
.chat-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 22px 16px 12px; }
.chat-side-head h1 { font-size: 1.25rem; }
.chan-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.chan { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.chan:hover { background: var(--surface-2); }
.chan.active { background: var(--accent-soft); }
.chan.archived { opacity: .6; }
.chan-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); }
.chan.active .chan-icon { background: var(--surface); color: var(--accent); }
.chan-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.chan-text b, .chan-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chan-text small { color: var(--muted); }
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread > .empty { margin: auto; }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.thread-title { flex: 1; min-width: 0; }
.thread-title h2 { display: flex; align-items: center; gap: 8px; font-size: 1.08rem; }
.thread-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { display: none; }
.chat-privacy { padding: 6px 20px; font-size: .78rem; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--surface); }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px 10px; display: flex; flex-direction: column; }
.msgs > .empty { margin: auto; }
.msg { display: flex; gap: 11px; padding: 7px 8px 3px; border-radius: 9px; position: relative; }
.msg.grouped { padding-top: 1px; }
.msg:hover { background: var(--surface-2); }
.msg-gutter { flex: none; width: 34px; text-align: center; font-size: .68rem; color: transparent; padding-top: 4px; font-variant-numeric: tabular-nums; }
.msg:hover .msg-gutter { color: var(--muted); }
.msg-main { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: baseline; gap: 0 8px; flex-wrap: wrap; }
.msg-head time { color: var(--muted); font-size: .76rem; }
.msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.deleted .msg-body { color: var(--muted); font-style: italic; }
.msg > .btn { position: absolute; right: 6px; top: 2px; opacity: 0; background: var(--surface); border-color: var(--line); }
.msg:hover > .btn, .msg > .btn:focus-visible { opacity: 1; }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; color: var(--muted); font-size: .78rem; font-weight: 600; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.load-more { text-align: center; padding: 4px 0 10px; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea { resize: none; min-height: 40px; max-height: 160px; }
.composer { position: relative; }
.emoji-panel {
  position: absolute; left: 12px; bottom: calc(100% + 6px); z-index: 10; width: min(360px, calc(100vw - 24px)); max-height: 300px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 12px 12px;
}
.emoji-group { font-size: .76rem; font-weight: 600; color: var(--muted); margin: 8px 0 4px; }
.emoji-group:first-child { margin-top: 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 2px; }
.emoji { border: 0; background: none; border-radius: 8px; font-size: 1.35rem; line-height: 1; padding: 6px 0; cursor: pointer; }
.emoji:hover, .emoji:focus-visible { background: var(--surface-2); }
.msg-emoji { font-size: 2rem; line-height: 1.25; }
.composer-note { justify-content: center; color: var(--muted); font-size: .9rem; }

/* ── Šventės, bandomasis laikotarpis, registras, svarbi informacija ── */
.is-holiday > *, .sched .is-holiday .col-day, .day-card.is-holiday, .day-card.is-holiday > * { background: var(--danger-soft); }
.is-holiday .day-btn b, .is-holiday .day-btn span { color: var(--danger); }
.tag-holiday { background: var(--danger-soft); color: var(--danger); }
.holiday-swatch { width: 30px; height: 20px; border-radius: 6px; background: var(--danger-soft); border: 1px solid var(--danger); flex: none; }
.notice-trial { background: var(--warn-soft); color: var(--warn-ink); }
.sched-strip { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: .95rem; color: var(--ink-2); }
.sched-strip b { color: var(--ink); }
.sched-sub { margin-top: 6px; }
.notice-fold { display: block; }
.notice-fold summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.notice-fold summary::-webkit-details-marker { display: none; }
.notice-fold summary::after { content: "Plačiau"; margin-left: auto; font-size: .84rem; text-decoration: underline; flex: none; }
.notice-fold[open] summary::after { content: "Suskleisti"; }
.notice-fold p { margin-top: 8px; }
.notice-trial .icon { color: var(--warn-ink); }
.trial-flag { margin: 0 8px 8px; padding: 5px 8px; border-radius: 7px; background: var(--warn-soft); color: var(--warn-ink); font-size: .76rem; font-weight: 650; text-align: center; }
.req { color: var(--danger); }
.field-help { color: var(--ink-2); }
.check-pills.stack { flex-direction: column; align-items: stretch; gap: 4px; }
.check-pills.stack .check-pill { border-color: transparent; padding: 5px 6px; align-items: flex-start; }
.check-pills.stack .check-pill:hover { background: var(--surface-2); }
.check-pills.stack .check-pill input { margin-top: 2px; }
.phone-hint { color: var(--accent) !important; font-weight: 600; }
.card-flush .card-body { padding: 0; }
.card-flush .table-wrap { margin: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.card-flush .card-head { padding-bottom: 12px; }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover > * { background: var(--surface-2); }
.cell-clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, Consolas, monospace; }
h3.sub { font-size: .9rem; color: var(--ink-2); margin: 14px 0 6px; }
h3.sub:first-child { margin-top: 0; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: .88rem; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(40px, 1fr) 2.2em 3.2em; gap: 8px; align-items: center; }
.bars-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bars-track i { display: block; height: 100%; border-radius: 4px; background: var(--series-1); }
.bars b { text-align: right; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 16px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-weight: 550; font-size: .86rem; cursor: pointer; }
.chip.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chip small { color: var(--muted); }
.info-list { display: flex; flex-direction: column; gap: 22px; }
.info-group { display: flex; flex-direction: column; gap: 10px; }
.info-group > h2 { font-size: 1.1rem; }
.info-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.info-item.pinned { border-color: var(--accent-line); }
.info-item header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.info-item h3 { display: flex; align-items: center; gap: 7px; }
.info-admin { display: flex; gap: 4px; flex: none; }
.info-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.info-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.info-files li { display: flex; align-items: center; gap: 6px; }
.info-files a { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); text-decoration: none; color: var(--ink); min-width: 0; }
.info-files a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Telefonai ir siauri ekranai ──
   Ta pati sistema, tik išdėstymas pritaikytas vienai rankai ir mažam ekranui: didesnis šriftas ir lietimo plotai,
   lentelės virsta kortelėmis, dialogai užima visą ekraną, navigacija – apačioje. */
.content { min-width: 0; }
.topbar { display: none; }
.sched-filters { display: none; }
.more-user {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink); text-decoration: none;
}
.more-user .user-meta { flex: 1; }
.more-user .icon { color: var(--muted); }
input[type=radio] { width: 17px; height: 17px; accent-color: var(--accent); flex: none; margin: 0; }
button, a, label, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

@media (max-width: 860px) {
  :root { font-size: 16px; --topbar-h: 52px; --nav-h: 62px; }

  /* Karkasas */
  .shell { display: block; }
  .side { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 15; height: var(--topbar-h);
    padding: 0 12px 0 14px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .topbar .brand { flex: 1; min-width: 0; padding: 0; font-size: 1rem; }
  .topbar .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
  .topbar .brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .avatar { width: 36px; height: 36px; text-decoration: none; }
  .trial-chip { flex: none; padding: 4px 10px; border-radius: 12px; background: var(--warn-soft); color: var(--warn-ink); font-size: .75rem; font-weight: 650; }
  .main { padding: 16px 14px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
  .page { gap: 14px; }
  h1 { font-size: 1.45rem; }
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-actions > .btn { flex: 1 1 auto; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line);
    padding: 4px 4px env(safe-area-inset-bottom);
  }
  .bottom-nav .nav-link { flex-direction: column; justify-content: center; gap: 3px; padding: 4px 2px; font-size: .74rem; position: relative; text-align: center; border-radius: 10px; }
  .bottom-nav .nav-link.active { background: none; }
  .bottom-nav .nav-link.active .icon { stroke-width: 2.300; }
  .bottom-nav .nav-text { flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .bottom-nav .badge { position: absolute; top: 3px; left: calc(50% + 5px); min-width: 18px; height: 18px; font-size: .68rem; }
  #toasts { bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); }
  .more-item { padding: 16px; font-size: 1.02rem; }

  /* Lietimui patogūs dydžiai; 16 px laukai – kad telefonas nepriartintų vaizdo rašant */
  .btn { min-height: 46px; padding: 9px 16px; font-size: 1rem; border-radius: 11px; }
  .btn-sm { min-height: 40px; padding: 7px 12px; font-size: .92rem; }
  .btn-icon { width: 46px; padding: 0; }
  .btn-sm.btn-icon { width: 40px; }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=month],
  input[type=tel], input[type=search], select, textarea { font-size: 16px; min-height: 48px; padding: 10px 12px; border-radius: 11px; }
  input[type=checkbox], input[type=radio] { width: 21px; height: 21px; }
  .field-label { font-size: .92rem; }
  .field small { font-size: .86rem; }
  .check-pill { padding: 10px 13px; font-size: .96rem; border-radius: 10px; }
  .check-pills { gap: 8px; }
  .check-pills.stack .check-pill { padding: 10px 6px; }
  .chip { min-height: 40px; padding: 7px 14px; font-size: .94rem; border-radius: 20px; flex: none; white-space: nowrap; }
  .tab { padding: 13px 14px; font-size: 1rem; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .field-half { grid-column: 1 / -1; }
  .toolbar { gap: 10px; }
  .search { flex: 1 1 100%; max-width: none; }
  .toolbar .chips, .sched-filters .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .toolbar .chips::-webkit-scrollbar, .sched-filters .chips::-webkit-scrollbar { display: none; }
  .toolbar .chips { flex: 1 1 100%; margin: 0 -14px; padding: 0 14px; max-width: none; }

  /* Kortelės ir plytelės */
  .cols { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .col { gap: 14px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px 13px; }
  .tile-label { font-size: .82rem; line-height: 1.3; }
  .tile-value { font-size: 1.3rem; }
  .card-head { padding: 14px 14px 0; }
  .card-body { padding: 12px 14px 14px; }
  .card .table-wrap { margin: 0 -14px -14px; }
  .card .table-toggle .table-wrap { margin: 10px -14px -14px; }
  .row { padding: 11px 0; }
  .row-title { white-space: normal; }
  .rows-scroll { max-height: none; }
  .notice { padding: 12px 14px; }
  .legend { font-size: .86rem; }
  .bars li { grid-template-columns: minmax(0, 1fr) 2.400em 3.400em; row-gap: 3px; }
  .bars-label { grid-column: 1 / -1; white-space: normal; }
  .info-item { padding: 14px; }
  .info-item header { flex-wrap: wrap; }
  .info-files a { padding: 10px 12px; }
  .event { flex-wrap: wrap; padding: 14px; gap: 12px; }
  .event-side { flex-basis: 100%; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .event-admin { margin: 0; }
  .audit li { flex-direction: column; gap: 0; }
  .copy-row { flex-direction: column; }
  .attend-row { padding: 10px 6px; }

  /* Lentelės → kortelės (langelio pavadinimas imamas iš data-label) */
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tfoot, .table-stack tr { display: block; width: 100%; }
  .table-stack tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack tr > * {
    display: flex; align-items: baseline; justify-content: flex-end; gap: 6px; padding: 3px 0; border: 0;
    white-space: normal; text-align: right; background: none; font-size: .95rem; overflow-wrap: anywhere;
  }
  .table-stack tr > *::before {
    content: attr(data-label); flex: none; max-width: 56%; margin-right: auto; padding-right: 10px; color: var(--ink-2); font-weight: 400; text-align: left;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  }
  .table-stack tr > :first-child { display: block; text-align: left; font-size: 1.05rem; font-weight: 650; padding-bottom: 5px; }
  .table-stack tr > :first-child::before, .table-stack td.row-actions::before { display: none; }
  .table-stack tr > :empty { display: none; }
  .table-stack td.row-actions { justify-content: flex-end; padding-top: 8px; }
  .table-stack .cell-clip { max-width: none; }
  .table-stack tr.is-me > * { background: none; }
  .sticky-first .table-stack th:first-child { position: static; box-shadow: none; background: none; }
  .table-click.table-stack tbody tr:active > * { background: none; }
  .table-click.table-stack tbody tr:active { background: var(--surface-2); }
  .table-click.table-stack td.row-actions { display: none; } /* visa kortelė paspaudžiama */
  .card-flush .table-wrap, .card-flush .table-toggle .table-wrap { margin: 0; }

  /* Grafikas: dienų kortelės, filtrai lieka matomi slenkant */
  .sched-legend { display: none; }
  .month-nav { margin-top: 2px; }
  .month-title { flex: 1; min-width: 0; font-size: 1.12rem; }
  .sched-filters {
    display: flex; align-items: center; gap: 8px; position: sticky; top: var(--topbar-h); z-index: 6;
    margin: 0 -14px; padding: 8px 14px; background: var(--page); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
  }
  .sched-filters::-webkit-scrollbar { display: none; }
  .sched-filters .chips { flex: none; }
  .day-cards { gap: 12px; }
  .day-card { padding: 12px 12px 10px; }
  .day-card header { margin-bottom: 8px; gap: 8px; }
  .day-btn { padding: 2px 4px; gap: 7px; }
  .day-btn b { font-size: 1.3rem; }
  .day-btn span { font-size: .88rem; }
  .day-full { font-size: .98rem; font-weight: 600; color: var(--ink); }
  .day-info { font-size: .88rem; }
  .slot-row { gap: 10px; padding: 4px 0; }
  .slot-name { width: 106px; font-size: .86rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
  .slot-cells { gap: 8px; }
  .slot-cells .cell { min-height: 48px; font-size: .95rem; border-radius: 11px; padding: 4px 6px; }
  .slot-cells .cell-text { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.15; overflow-wrap: anywhere; }
  .slot-cells .cell-closed { font-size: .86rem; }

  /* Dialogai – per visą ekraną, veiksmų mygtukai visada matomi apačioje */
  .modal, .modal-wide { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .modal-head { padding: calc(10px + env(safe-area-inset-top)) 6px 10px 16px; border-bottom: 1px solid var(--line); }
  .modal-head h2 { font-size: 1.12rem; }
  .modal-body { flex: 1; padding: 14px 16px 0; }
  .modal-body > .form, .modal-body { display: flex; flex-direction: column; }
  .modal-body > .form { flex: 1; }
  .modal-actions {
    position: sticky; bottom: 0; z-index: 2; margin: auto -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .modal-actions .spacer { display: none; }
  .modal-actions > .btn-primary, .modal-actions > .btn-default:not(.btn-sm) { flex: 1; }
  /* trumpi patvirtinimai – lapelis ekrano apačioje */
  .modal:has(.confirm-text) { height: fit-content; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .modal:has(.confirm-text) .modal-head { padding-top: 14px; border-bottom: 0; }
  .confirm-text { font-size: 1.02rem; margin-bottom: 4px; }

  /* Pokalbiai: temų sąrašas, o atidaryta tema užima visą ekraną */
  .main.page-pokalbiai { height: calc(100dvh - var(--topbar-h) - var(--nav-h) - env(safe-area-inset-bottom)); padding: 0; }
  body.chat-thread .topbar, body.chat-thread .bottom-nav { display: none; }
  body.chat-thread .main.page-pokalbiai { height: 100dvh; }
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat .thread { display: none; }
  .chat.show-thread .chat-side { display: none; }
  .chat.show-thread .thread { display: flex; }
  .chat-side-head { padding: 16px 14px 10px; }
  .chan { padding: 12px 10px; gap: 12px; }
  .chan-icon { width: 40px; height: 40px; border-radius: 11px; }
  .chan-text b { font-size: 1.02rem; }
  .chan-text small { font-size: .88rem; }
  .back { display: inline-flex; }
  .thread-head { padding: calc(6px + env(safe-area-inset-top)) 8px 6px 4px; }
  .msgs { padding: 10px 10px 8px; }
  .msg { padding: 8px 6px 4px; }
  .msg-body { font-size: 1rem; line-height: 1.4; }
  .composer { padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); gap: 4px; }
  .composer textarea { min-height: 46px; }
  .emoji-panel { left: 8px; right: 8px; width: auto; max-height: 46dvh; }
  .emoji-grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .emoji { font-size: 1.6rem; padding: 8px 0; }
  .chat-privacy { padding: 6px 12px; }
  .msg > .btn { opacity: 1; position: static; align-self: flex-start; min-height: 36px; width: 36px; background: none; border-color: transparent; color: var(--muted); }
  .msg:hover { background: none; }

  /* Diagramos */
  .chart-legend { flex-wrap: wrap; gap: 6px 14px; }
  .chart-tip { white-space: normal; max-width: 240px; }
}
@media (max-width: 380px) {
  .slot-name { width: 98px; font-size: .8rem; }
  .tiles { gap: 8px; }
  .tile-value { font-size: 1.18rem; }
  .bottom-nav .nav-link { font-size: .68rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
