/* Цвета берутся из темы Telegram (переменные ставит telegram-web-app.js), запасные — для браузера */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --link: var(--tg-theme-link-color, #2481cc);
  --button: var(--tg-theme-button-color, #2481cc);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f0f0f4);
  --section-bg: var(--tg-theme-section-bg-color, #ffffff);
  --header-bg: var(--tg-theme-header-bg-color, var(--bg));
  --separator: var(--tg-theme-section-separator-color, rgba(128, 128, 128, .22));
  --destructive: var(--tg-theme-destructive-text-color, #e5484d);
  --ok: #2fa84f;
  --warn: #e0900f;
  --claude: #d97757;
  --soft: rgba(127, 127, 127, .10);
  --soft-strong: rgba(127, 127, 127, .17);
  --code-bg: rgba(127, 127, 127, .12);
  --del-bg: rgba(229, 72, 77, .16);
  --add-bg: rgba(47, 168, 79, .18);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not(.tg) {
    --bg: #17191c;
    --text: #f2f2f2;
    --hint: #8d939b;
    --link: #5aa9ff;
    --button: #3a8ee6;
    --secondary-bg: #0f1012;
    --section-bg: #1d2024;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--secondary-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input, textarea { font: inherit; color: var(--text); }
a { color: var(--link); text-decoration: none; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 13px; }

.dot {
  display: inline-block;
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--hint);
}
.dot.on, .dot.idle { background: var(--ok); }
.dot.off { background: var(--destructive); }
.dot.wait, .dot.attention { background: var(--warn); }
.dot.busy { background: var(--link); animation: pulse 1.4s ease-in-out infinite; }
.dot.closed { background: var(--hint); opacity: .6; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }

.pill {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--soft);
  color: var(--hint);
}
.pill.busy { color: var(--link); background: color-mix(in srgb, var(--link) 14%, transparent); }
.pill.attention { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.pill.idle { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }

/* ---------- Экраны со списками ---------- */

.page { max-width: 720px; margin: 0 auto; padding: 4px 0 calc(24px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; padding: 6px 8px 0; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.01em; padding: 18px 20px 0; }
.page-sub { color: var(--hint); font-size: 14px; padding: 2px 20px 8px; }
.page-actions { padding: 12px 16px 4px; }
.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--hint);
  padding: 18px 32px 6px;
}
.section { background: var(--section-bg); border-radius: var(--radius); margin: 8px 16px; overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--separator);
  transition: background .15s;
}
.row:last-child { border-bottom: 0; }
button.row:active { background: var(--soft); }
.row-icon { flex: none; width: 26px; font-size: 20px; text-align: center; }
.row-main { flex: 1; min-width: 0; }
.row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--hint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub.wrap { white-space: normal; }
.row-end { flex: none; color: var(--hint); font-size: 20px; line-height: 1; }
.empty { color: var(--hint); padding: 16px; font-size: 15px; }

.status-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 16px 0; }
.status-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--section-bg);
  text-align: left;
}
.status-top { display: flex; align-items: center; justify-content: space-between; min-height: 30px; }
.status-icon { font-size: 22px; }
.status-name { font-weight: 600; margin-top: 4px; }
.status-text { font-size: 13px; color: var(--hint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .dot { margin: 0 2px; }

.btn {
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  background: var(--button);
  color: var(--button-text);
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(.98); opacity: .9; }
.btn.secondary { background: var(--soft-strong); color: var(--text); }
.btn.danger { background: var(--destructive); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.big { padding: 14px 16px; font-size: 16px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; }

.search {
  display: block;
  width: calc(100% - 32px);
  margin: 8px 16px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 0;
  background: var(--section-bg);
  outline: none;
}
.form-row { display: flex; gap: 8px; padding: 10px 12px; }
.form-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--separator);
  background: var(--bg);
  outline: none;
}
.form-error { color: var(--destructive); font-size: 13px; padding: 0 16px 10px; }

/* ---------- Чат ---------- */

.chat-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: var(--tg-viewport-height, 100dvh);
  background: var(--bg);
}
.chat-header {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--separator);
}
.chat-head-text { flex: 1; min-width: 0; }
.chat-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-sub { font-size: 13px; color: var(--hint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hint);
}
.icon-btn:active { background: var(--soft); }
.banner { flex: none; padding: 8px 16px; font-size: 14px; background: rgba(229, 72, 77, .12); color: var(--destructive); }
.scroller { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.messages-wrap { max-width: 760px; margin: 0 auto; padding: 14px 16px 20px; }
.messages { display: flex; flex-direction: column; gap: 10px; }

.chat-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18vh 24px 0; text-align: center; }
.chat-empty-icon { font-size: 34px; color: var(--claude); margin-bottom: 6px; }
.chat-empty .hint { color: var(--hint); font-size: 14px; }

.appear { animation: appear .22s var(--ease); }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } }

.msg { overflow-wrap: anywhere; }
.msg.user {
  align-self: flex-end;
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 18px 18px 6px 18px;
  background: var(--button);
  color: var(--button-text);
  white-space: pre-wrap;
}
.msg.user.queued, .msg.user.sending { opacity: .7; }
.msg.user.cancelled { opacity: .5; }
.msg.user.cancelled .msg-text { text-decoration: line-through; }
.msg.user.failed { background: var(--destructive); color: #fff; }
.msg-meta { margin-top: 2px; font-size: 12px; opacity: .85; text-align: right; }
.msg-images { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.msg-images img { display: block; max-width: 160px; max-height: 160px; border-radius: 12px; }
.msg.assistant { align-self: stretch; padding: 0 2px; }
.msg.assistant.streaming > :last-child::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--claude);
  vertical-align: middle;
  animation: pulse 1s ease-in-out infinite;
}

.typing { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--hint); font-size: 14px; }
.typing-dots { display: inline-flex; gap: 4px; }
.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--claude);
  animation: bounce 1.2s ease-in-out infinite;
}
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* Markdown */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 9px; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 16px 0 6px; line-height: 1.25; }
.md h1 { font-size: 20px; }
.md h2 { font-size: 18px; }
.md h3 { font-size: 17px; }
.md h4, .md h5, .md h6 { font-size: 16px; }
.md ul, .md ol { margin: 0 0 9px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li > ul, .md li > ol { margin: 3px 0 0; }
.md code { font-family: var(--mono); font-size: 13.5px; background: var(--code-bg); padding: 1px 5px; border-radius: 6px; }
.md blockquote { margin: 0 0 9px; padding: 2px 12px; border-left: 3px solid var(--separator); color: var(--hint); }
.md hr { border: 0; border-top: 1px solid var(--separator); margin: 14px 0; }
.md .table { overflow-x: auto; margin: 0 0 9px; }
.md table { border-collapse: collapse; font-size: 14px; }
.md th, .md td { border: 1px solid var(--separator); padding: 5px 9px; text-align: left; vertical-align: top; }
.md th { background: var(--code-bg); }

.code { margin: 0 0 10px; border-radius: 12px; background: var(--code-bg); overflow: hidden; }
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px 5px 12px;
  font-size: 12px;
  color: var(--hint);
  border-bottom: 1px solid var(--separator);
}
.copy { font-size: 12px; color: var(--link); padding: 2px 6px; border-radius: 6px; }
.copy:active { background: var(--soft); }
.code pre { margin: 0; padding: 10px 12px; overflow-x: auto; }
.code pre code { background: none; padding: 0; font-size: 12.5px; line-height: 1.5; white-space: pre; }

/* Подсветка кода (highlight.js) */
.hljs-keyword, .hljs-selector-tag, .hljs-type, .hljs-doctag { color: #cf222e; }
.hljs-string, .hljs-regexp, .hljs-meta .hljs-string { color: #0a3069; }
.hljs-comment, .hljs-quote, .hljs-meta { color: #6e7781; font-style: italic; }
.hljs-number, .hljs-literal, .hljs-attr, .hljs-attribute, .hljs-symbol { color: #0550ae; }
.hljs-title, .hljs-title.function_, .hljs-section, .hljs-selector-class { color: #8250df; }
.hljs-built_in, .hljs-variable, .hljs-template-variable, .hljs-params { color: #953800; }
.hljs-name, .hljs-tag, .hljs-selector-id { color: #116329; }
.hljs-addition { color: #116329; background: var(--add-bg); }
.hljs-deletion { color: #82071e; background: var(--del-bg); }
[data-scheme="dark"] .hljs-keyword, [data-scheme="dark"] .hljs-selector-tag,
[data-scheme="dark"] .hljs-type, [data-scheme="dark"] .hljs-doctag { color: #ff7b72; }
[data-scheme="dark"] .hljs-string, [data-scheme="dark"] .hljs-regexp { color: #a5d6ff; }
[data-scheme="dark"] .hljs-comment, [data-scheme="dark"] .hljs-quote, [data-scheme="dark"] .hljs-meta { color: #8b949e; }
[data-scheme="dark"] .hljs-number, [data-scheme="dark"] .hljs-literal, [data-scheme="dark"] .hljs-attr,
[data-scheme="dark"] .hljs-attribute, [data-scheme="dark"] .hljs-symbol { color: #79c0ff; }
[data-scheme="dark"] .hljs-title, [data-scheme="dark"] .hljs-section,
[data-scheme="dark"] .hljs-selector-class { color: #d2a8ff; }
[data-scheme="dark"] .hljs-built_in, [data-scheme="dark"] .hljs-variable,
[data-scheme="dark"] .hljs-template-variable, [data-scheme="dark"] .hljs-params { color: #ffa657; }
[data-scheme="dark"] .hljs-name, [data-scheme="dark"] .hljs-tag, [data-scheme="dark"] .hljs-selector-id { color: #7ee787; }
[data-scheme="dark"] .hljs-addition { color: #aff5b4; }
[data-scheme="dark"] .hljs-deletion { color: #ffdcd7; }

/* Карточка действий Claude: подряд идущие инструменты */
.activity, .plan-card {
  border-radius: 12px;
  background: var(--soft);
  font-size: 14px;
  overflow: hidden;
}
.act-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 7px 12px;
  text-align: left;
  color: var(--hint);
}
.act-head:active { background: var(--soft); }
.act-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity.running .act-title { color: var(--text); }
.act-status { flex: none; width: 16px; text-align: center; font-size: 13px; font-weight: 700; }
.act-status.ok { color: var(--ok); }
.act-status.err { color: var(--destructive); }
.act-chips { flex: none; font-size: 12.5px; white-space: nowrap; }
.act-errors { flex: none; font-size: 12px; color: var(--destructive); }
.chev { flex: none; width: 14px; font-size: 18px; line-height: 1; text-align: center; transition: transform .2s var(--ease); }
.chev.open { transform: rotate(90deg); }
.act-body { padding: 2px 10px 8px; animation: appear .18s var(--ease); }

.tool { color: var(--hint); }
.tool-head { display: flex; align-items: center; gap: 6px; min-height: 30px; }
.tool-head.clickable { cursor: pointer; }
.tool-icon { flex: none; width: 20px; text-align: center; }
.tool-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 12.5px;
}
.tool.error .tool-label { color: var(--destructive); }
.tool-status { flex: none; font-size: 12px; }
.tool-status.err { color: var(--destructive); }
.tool-body { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 8px 26px; }
.tool-desc { font-size: 13px; }
.tool-body pre, .perm pre {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--code-bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}
.tool-body pre.err { color: var(--destructive); }
.spin {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--separator);
  border-top-color: var(--link);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spin.small { width: 11px; height: 11px; }
@keyframes spin { to { transform: rotate(360deg); } }

.todo { padding: 10px 12px; border-radius: 12px; background: var(--soft); font-size: 14px; }
.todo-title { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.todo-count { color: var(--hint); font-weight: 400; }
.todo-item { display: flex; gap: 8px; padding: 2px 0; }
.todo-mark { flex: none; width: 14px; text-align: center; color: var(--hint); }
.todo-item.completed { color: var(--hint); }
.todo-item.completed .todo-mark { color: var(--ok); }
.todo-item.in_progress { font-weight: 600; }
.todo-item.in_progress .todo-mark { color: var(--link); }
.todo.old { padding: 6px 12px; background: none; color: var(--hint); font-size: 13px; }

.plan { max-height: 50vh; overflow: auto; padding: 10px 12px; border-radius: 10px; background: var(--soft); font-size: 15px; }
.plan-card .plan { margin: 0 10px 10px; background: var(--bg); }

.perm {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  border: 1.5px solid color-mix(in srgb, var(--link) 70%, transparent);
  border-radius: 16px;
  background: var(--section-bg);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .08);
}
.perm.done { border-color: var(--separator); box-shadow: none; }
.perm-title { font-weight: 600; }
.perm-label { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.perm-desc { font-size: 14px; color: var(--hint); }
.perm-buttons { display: flex; gap: 8px; }
.perm-buttons .btn { flex: 1; }
.perm-stack { display: flex; flex-direction: column; gap: 8px; }
.perm-hint { font-size: 12px; color: var(--hint); text-align: center; }
.perm-state { font-size: 14px; }
.perm-state.allow { color: var(--ok); }
.perm-state.deny, .perm-state.timeout { color: var(--destructive); }
.perm-state.cancelled { color: var(--hint); }

.diff { display: flex; flex-direction: column; gap: 6px; }
.diff-block {
  max-height: 360px;
  overflow: auto;
  border-radius: 8px;
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}
.diff-line { display: flex; padding: 0 8px 0 4px; }
.diff-line .sign { flex: none; width: 14px; color: var(--hint); user-select: none; }
.diff-line .diff-text { flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; }
.diff-line.add { background: var(--add-bg); }
.diff-line.del { background: var(--del-bg); }
.diff-line.gap { color: var(--hint); }

.result {
  align-self: center;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--hint);
  font-size: 12.5px;
}
.result.error { color: var(--destructive); }
.note { align-self: center; text-align: center; color: var(--hint); font-size: 13px; }
.note.error, .note.warning { color: var(--warn); }
.divider { display: flex; align-items: center; gap: 8px; color: var(--hint); font-size: 12px; margin: 4px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--separator); }

/* Поле ввода */
.composer {
  flex: none;
  padding: 6px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--separator);
  background: var(--bg);
}
.composer-inner { max-width: 760px; margin: 0 auto; }
.composer-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 6px; }
.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 10px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--hint);
  font-size: 13px;
}
.mode-chip .chev { font-size: 14px; transform: rotate(90deg); }
.mode-chip.mode-auto { color: var(--claude); background: color-mix(in srgb, var(--claude) 14%, transparent); }
.mode-chip.mode-acceptEdits { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.mode-chip.mode-plan { color: var(--link); background: color-mix(in srgb, var(--link) 13%, transparent); }
.queue-info { font-size: 12px; color: var(--hint); }
.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--separator);
  border-radius: 24px;
  background: var(--secondary-bg);
}
.composer-box textarea {
  flex: 1;
  min-width: 0;
  max-height: 160px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  outline: none;
  resize: none;
  font-size: 16px;
  line-height: 1.35;
}
.round-btn {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  transition: transform .1s, opacity .15s;
}
.round-btn:active { transform: scale(.92); }
.round-btn.send { background: var(--button); color: var(--button-text); }
.round-btn.stop { background: var(--text); }
.round-btn.stop i { width: 11px; height: 11px; border-radius: 2px; background: var(--bg); }
.round-btn.attach { color: var(--hint); font-size: 18px; }
.round-btn:disabled { opacity: .35; }
.previews { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 2px 8px; }
.previews:empty { display: none; }
.preview { position: relative; }
.preview img { display: block; width: 58px; height: 58px; object-fit: cover; border-radius: 10px; }
.preview button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .65);
  color: #fff;
  font-size: 11px;
}
.closed-panel { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; color: var(--hint); font-size: 14px; text-align: center; }

/* ---------- Окна поверх ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .35);
  animation: fade .15s ease;
}
.overlay-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  padding: 22px;
  border-radius: 16px;
  background: var(--section-bg);
  text-align: center;
}
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--separator);
  border-top-color: var(--link);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes fade { from { opacity: 0; } }
.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: 420px;
  margin: 0 auto;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(30, 30, 30, .92);
  color: #fff;
  font-size: 14px;
  animation: appear .2s var(--ease);
  transition: opacity .4s;
}
.toast.error { background: rgba(200, 40, 40, .95); }
.toast.hide { opacity: 0; }
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, .35);
  animation: fade .15s ease;
}
.sheet-overlay.closing { opacity: 0; transition: opacity .15s; }
.sheet {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 6px 8px calc(12px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--secondary-bg);
  animation: slide-up .22s var(--ease);
}
@keyframes slide-up { from { transform: translateY(100%); } }
.sheet-title { padding: 10px 16px 4px; color: var(--hint); font-size: 13px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .section { margin: 6px 0; }
.sheet-row .row-title { white-space: normal; }
.sheet-row.danger .row-title { color: var(--destructive); }
.sheet-row.cancel { justify-content: center; color: var(--link); font-weight: 600; }
.sheet-row.checked .row-title { font-weight: 600; }
.check { flex: none; color: var(--link); font-weight: 700; }
.fatal { padding: 48px 24px; color: var(--hint); text-align: center; }
