/* Стиль в духе Apple (iOS / macOS): системные цвета, сгруппированные списки,
   полупрозрачные панели, мгновенный отклик на нажатие, шторки снизу. */
:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .2);
  --text: #000000;
  --muted: rgba(60, 60, 67, .6);
  --border: rgba(60, 60, 67, .18);
  --sep: rgba(60, 60, 67, .29);
  --accent: #007aff;
  --accent-soft: rgba(0, 122, 255, .12);
  --accent-text: #ffffff;
  --danger: #ff3b30;
  --danger-soft: rgba(255, 59, 48, .12);
  --warn: #c76a00;
  --warn-soft: rgba(255, 149, 0, .15);
  --ok: #248a3d;
  --ok-soft: rgba(52, 199, 89, .15);
  --purple: #af52de;
  --purple-soft: rgba(175, 82, 222, .14);
  --gold: #a07400;
  --gold-soft: rgba(255, 204, 0, .2);
  --bar-bg: rgba(249, 249, 249, .78);
  --scrim: rgba(0, 0, 0, .32);
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .04);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .18), 0 2px 8px rgba(0, 0, 0, .08);
  --radius: 14px;
  --sidebar: 248px;
  --spring: cubic-bezier(.32, .72, 0, 1);   /* кривая шторок iOS */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .32);
    --text: #ffffff; --muted: rgba(235, 235, 245, .6); --border: rgba(84, 84, 88, .55); --sep: rgba(84, 84, 88, .65);
    --accent: #0a84ff; --accent-soft: rgba(10, 132, 255, .2); --danger: #ff453a; --danger-soft: rgba(255, 69, 58, .2);
    --warn: #ff9f0a; --warn-soft: rgba(255, 159, 10, .2); --ok: #30d158; --ok-soft: rgba(48, 209, 88, .2);
    --purple: #bf5af2; --purple-soft: rgba(191, 90, 242, .22); --gold: #ffd60a; --gold-soft: rgba(255, 214, 10, .18);
    --bar-bg: rgba(22, 22, 24, .78); --scrim: rgba(0, 0, 0, .55); --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --surface-2: #2c2c2e; --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .32);
  --text: #ffffff; --muted: rgba(235, 235, 245, .6); --border: rgba(84, 84, 88, .55); --sep: rgba(84, 84, 88, .65);
  --accent: #0a84ff; --accent-soft: rgba(10, 132, 255, .2); --danger: #ff453a; --danger-soft: rgba(255, 69, 58, .2);
  --warn: #ff9f0a; --warn-soft: rgba(255, 159, 10, .2); --ok: #30d158; --ok-soft: rgba(48, 209, 88, .2);
  --purple: #bf5af2; --purple-soft: rgba(191, 90, 242, .22); --gold: #ffd60a; --gold-soft: rgba(255, 214, 10, .18);
  --bar-bg: rgba(22, 22, 24, .78); --scrim: rgba(0, 0, 0, .55); --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  letter-spacing: -.01em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-optical-sizing: auto;
}
a { color: var(--accent); text-decoration: none; }
/* Крупный заголовок iOS: плотная разрядка и короткий интерлиньяж */
h1 { font-size: 30px; line-height: 1.12; margin: 0 0 4px; font-weight: 700; letter-spacing: -.025em; }
h2 { font-size: 19px; line-height: 1.25; margin: 0 0 12px; font-weight: 600; letter-spacing: -.02em; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 600; letter-spacing: 0; color: var(--muted); text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 13px; letter-spacing: 0; }
svg.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#app { display: flex; min-height: 100vh; }

/* Боковая панель как в macOS: полупрозрачный материал */
#sidebar {
  width: var(--sidebar); flex: none; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--bar-bg); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  border-right: .5px solid var(--sep);
}
#sidebar:empty { display: none; }
#main { flex: 1; min-width: 0; padding: 28px 32px 110px; max-width: 1280px; }
#bottomnav { display: none; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: -.02em; padding: 4px 10px 14px; }
.me-card { margin: 0 4px 16px; padding: 12px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.me-card .name { font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 9px; color: var(--text); margin-bottom: 1px; transition: background-color 120ms ease; }
.nav a:hover { background: var(--fill); }
.nav a:active { background: var(--fill-2); }
.nav a.active { background: var(--accent); color: #fff; font-weight: 500; }
.nav a.active .ico { color: #fff; }
.nav .ico { width: 22px; display: inline-flex; color: var(--accent); }
.nav .ico svg.i { width: 20px; height: 20px; }
.nav .badge-count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 10px; font-size: 12px; font-weight: 600; min-width: 20px; text-align: center; padding: 1px 6px; }
.nav a.active .badge-count { background: #fff; color: var(--accent); }

@media (max-width: 860px) {
  #sidebar { display: none; }
  #main { padding: 18px 16px 100px; }
  /* Таб-бар iOS: контент прокручивается под полупрозрачной панелью */
  #bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    padding: 6px 4px calc(4px + env(safe-area-inset-bottom));
    background: var(--bar-bg); -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
    border-top: .5px solid var(--sep);
  }
  #bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 10.5px; font-weight: 500; letter-spacing: .01em; padding: 3px 0; transition: transform 100ms ease-out; }
  #bottomnav a .ico { display: inline-flex; }
  #bottomnav a .ico svg.i { width: 26px; height: 26px; }
  #bottomnav a:active { transform: scale(.92); }
  #bottomnav a.active { color: var(--accent); }
  h1 { font-size: 28px; }
}

.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 200px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.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)); }
@media (max-width: 1000px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } .grid { gap: 12px; } }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.hello { background: linear-gradient(135deg, #0a84ff 0%, #5e5ce6 100%); color: #fff; border: none; padding: 20px; }
.hello.owner { background: linear-gradient(135deg, #1c1c1e 0%, #3a3a3c 55%, #8a6d1f 100%); }
.hello .muted { color: rgba(255, 255, 255, .78); }
.hello h1 { color: #fff; }
.hello .grow { flex: 1; min-width: 0; }
.hello .btn { background: rgba(255, 255, 255, .2); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.hello .btn:hover { background: rgba(255, 255, 255, .3); }
.stat { padding: 14px 16px; }
.stat .v { font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 13px; letter-spacing: 0; margin-top: 2px; }
.stat.danger .v { color: var(--danger); }

/* Кнопки: отклик на нажатие (pointer-down), а не на отпускание */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none;
  background: var(--fill); color: var(--accent); padding: 9px 16px; border-radius: 10px;
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 38px;
  transition: transform 100ms ease-out, background-color 120ms ease, opacity 120ms ease;
}
.btn:hover { background: var(--fill-2); }
.btn:active { transform: scale(.97); opacity: .85; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); background: var(--danger-soft); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.sm { padding: 5px 12px; font-size: 13px; min-height: 30px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--fill); border: none; border-radius: 10px;
  padding: 10px 12px; width: 100%; min-height: 42px; transition: box-shadow 120ms ease, background-color 120ms ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 88px; }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 20px; height: 20px; min-height: 0; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin: 0 0 5px 4px; letter-spacing: 0; }
.check { display: flex; gap: 10px; align-items: center; }
.check input { width: 20px; }

/* Сегментированный контрол */
.tabs { display: flex; gap: 2px; width: max-content; max-width: 100%; overflow-x: auto; padding: 2px; margin-bottom: 14px; background: var(--fill); border-radius: 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: none; background: transparent; padding: 6px 14px; border-radius: 8px; color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color 160ms ease, box-shadow 160ms ease; }
.tabs button:active { opacity: .6; }
.tabs button.active { background: var(--surface); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
:root[data-theme="dark"] .tabs button.active { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs button.active { background: #636366; } }

.pill { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; letter-spacing: 0; background: var(--fill); color: var(--muted); white-space: nowrap; }
.pill.new { background: var(--accent-soft); color: var(--accent); }
.pill.in_progress { background: var(--warn-soft); color: var(--warn); }
.pill.review { background: var(--purple-soft); color: var(--purple); }
.pill.done { background: var(--ok-soft); color: var(--ok); }
.pill.overdue, .pill.urgent { background: var(--danger-soft); color: var(--danger); }
.pill.high { background: var(--warn-soft); color: var(--warn); }
.pill.owner { background: var(--gold-soft); color: var(--gold); }
.pill.manager { background: var(--accent-soft); color: var(--accent); }

/* Сгруппированный список: разделители с отступом слева, как в Настройках iOS */
.list { display: flex; flex-direction: column; }
.item { position: relative; display: flex; gap: 12px; align-items: center; padding: 11px 6px; cursor: pointer; border-radius: 10px; transition: background-color 100ms ease; }
.item + .item::before { content: ""; position: absolute; top: 0; left: 6px; right: 0; height: .5px; background: var(--sep); }
.item:hover { background: var(--fill); }
.item:active { background: var(--fill-2); }
.item:hover::before, .item:hover + .item::before { opacity: 0; }
.item .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.item .meta { font-size: 13px; color: var(--muted); letter-spacing: 0; }
.item .body { flex: 1; min-width: 0; }
.prio-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--fill-2); }
.prio-dot.medium { background: var(--accent); }
.prio-dot.high { background: var(--warn); }
.prio-dot.urgent { background: var(--danger); }
.empty { color: var(--muted); text-align: center; padding: 28px 20px; }

/* Иконки разделов в стиле Настроек iOS */
.tile { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.tile svg.i { width: 19px; height: 19px; stroke-width: 2; }
.chev { color: var(--muted); opacity: .6; font-size: 20px; line-height: 1; }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.col { background: var(--fill); border-radius: var(--radius); padding: 10px; min-height: 120px; scroll-snap-align: start; transition: box-shadow 150ms ease; }
.col-head { display: flex; justify-content: space-between; font-weight: 600; font-size: 13px; margin: 2px 4px 10px; }
.col.drop { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.kcard { background: var(--surface); border-radius: 12px; padding: 12px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); transition: transform 120ms ease-out, box-shadow 120ms ease; }
.kcard:active { transform: scale(.98); }
.kcard .t { font-weight: 500; margin-bottom: 4px; }

.progress { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.progress.bad > i { background: var(--danger); }

.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .track { height: 12px; background: var(--fill); border-radius: 6px; overflow: hidden; }
.bar-row .track i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
@media (max-width: 640px) { .bar-row { grid-template-columns: 110px 1fr 70px; } }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 10px; }
.chart .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.chart .c i { width: 100%; max-width: 40px; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 2px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: .5px solid var(--sep); font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .dow { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 0; text-transform: uppercase; }
.cal .day { background: var(--surface); border-radius: 10px; min-height: 92px; padding: 5px; font-size: 11px; overflow: hidden; }
.cal .day.other { opacity: .4; }
.cal .num { font-weight: 600; font-size: 13px; margin-bottom: 3px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal .day.today .num { background: var(--danger); color: #fff; }
.cal .ev { background: var(--accent-soft); color: var(--accent); border-radius: 5px; padding: 1px 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; font-weight: 500; }
.cal .ev.overdue { background: var(--danger-soft); color: var(--danger); }
.cal .ev.done { background: var(--ok-soft); color: var(--ok); text-decoration: line-through; }
@media (max-width: 640px) { .cal .day { min-height: 58px; } .cal .ev { font-size: 0; height: 5px; padding: 0; border-radius: 3px; } }

/* Модальные окна: на телефоне — шторка снизу, на компьютере — окно по центру.
   Появляются и уходят по одному пути. */
.modal-back {
  position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 16px; animation: fade-in 220ms ease both;
}
.modal {
  background: var(--surface); border-radius: 16px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  padding: 22px; box-shadow: var(--shadow-lg); animation: pop-in 320ms var(--spring) both; transform-origin: 50% 60%;
}
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-back.closing { animation: fade-out 200ms ease both; }
.modal-back.closing .modal { animation: pop-out 200ms ease-in both; }
@media (max-width: 640px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal {
    max-width: none; max-height: 92vh; border-radius: 14px 14px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
    animation: sheet-in 420ms var(--spring) both;
  }
  .modal::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 0 auto 14px; }
  .modal .actions { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); margin: 14px -18px 0; padding: 12px 18px calc(18px + env(safe-area-inset-bottom)); background: var(--surface); border-top: .5px solid var(--sep); }
  .modal { padding-bottom: 0; }
  .modal .actions .btn { flex: 1; min-height: 46px; }
  .modal-back.closing .modal { animation: sheet-out 260ms ease-in both; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.94); } }
@keyframes pop-out { to { opacity: 0; transform: scale(.96); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }

/* Уведомления: полупрозрачная «пилюля», въезжает и уезжает вниз */
#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
#toast div {
  background: rgba(30, 30, 32, .86); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  color: #fff; padding: 11px 18px; border-radius: 22px; margin-top: 8px; font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .22); max-width: 90vw; animation: toast-in 380ms var(--spring) both;
}
#toast div.err { background: rgba(255, 59, 48, .92); }
#toast div.out { animation: toast-out 220ms ease-in both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px) scale(.98); } }

/* Чат в духе «Сообщений» */
.chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: 4px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 86%; padding: 9px 14px; border-radius: 19px; animation: msg-in 300ms var(--spring) both; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; transform-origin: 100% 100%; }
.msg.assistant { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 6px; box-shadow: var(--shadow); transform-origin: 0 100%; }
:root[data-theme="dark"] .msg.assistant { background: var(--surface-2); }
.msg.assistant .agent { font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.msg.assistant :is(p, ul, ol, table, pre) { margin: 6px 0; }
.msg.assistant pre { background: var(--fill); padding: 10px; border-radius: 10px; overflow-x: auto; }
@keyframes msg-in { from { opacity: 0; transform: scale(.92); } }
.chat-input { display: flex; gap: 8px; padding-top: 10px; align-items: flex-end; }
.chat-input textarea { min-height: 44px; max-height: 160px; border-radius: 22px; padding: 11px 16px; }
.chat-input .btn { border-radius: 22px; min-height: 44px; }
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.agent-card { cursor: pointer; transition: transform 100ms ease-out, box-shadow 150ms ease; }
.agent-card:active { transform: scale(.98); }
.agent-card.active { box-shadow: 0 0 0 2px var(--accent); }
.agent-card .em { font-size: 24px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--fill); border: none; border-radius: 16px; padding: 6px 12px; font-size: 13px; cursor: pointer; transition: transform 100ms ease-out, background-color 120ms ease; }
.chip:hover { background: var(--fill-2); }
.chip:active { transform: scale(.96); }
.typing { color: var(--muted); font-style: italic; }

.login { max-width: 420px; margin: 10vh auto; }
.owner-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--gold-soft); color: var(--gold); border-radius: 20px; padding: 2px 10px; font-weight: 700; font-size: 12px; }
.hello .owner-badge { background: rgba(255, 214, 10, .22); color: #ffd60a; }
.loader { padding: 40px; text-align: center; color: var(--muted); }
.checklist .ci { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.checklist .ci input { width: 20px; }
.checklist .ci.done span { text-decoration: line-through; color: var(--muted); }
.comment { padding: 10px 0; border-bottom: .5px solid var(--sep); }
.comment.report { background: var(--ok-soft); border-radius: 10px; padding: 10px; border: none; }
.file { display: flex; gap: 8px; align-items: center; padding: 6px 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 14px; }
.kv .k { color: var(--muted); }
pre.doc { white-space: pre-wrap; font: inherit; }

/* Доступность: меньше движения → мягкие затухания вместо сдвигов и масштаба */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; }
  .modal, .modal-back.closing .modal, .msg, #toast div, #toast div.out { animation-name: fade-in !important; animation-duration: 160ms !important; }
  .modal-back.closing .modal, #toast div.out { animation-name: fade-out !important; }
  .btn:active, .kcard:active, .chip:active, .agent-card:active, #bottomnav a:active { transform: none; }
}
/* Меньше прозрачности → сплошные панели без размытия */
@media (prefers-reduced-transparency: reduce) {
  #sidebar, #bottomnav, #toast div { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--surface); }
  #toast div { background: #1c1c1e; }
}
/* Повышенный контраст → заметные границы */
@media (prefers-contrast: more) {
  .card, .kcard, .cal .day, input, select, textarea { border: 1px solid var(--text); }
  :root { --sep: var(--muted); }
}
