:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  color-scheme: light dark;
}

html, body, #root {
  margin: 0;
  width: 100%;
  min-width: 100%;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: var(--tg-theme-secondary-bg-color, #f3f5f8);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  min-height: 100dvh;
}

button, input, textarea, select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }

:root {
  --bg: var(--tg-theme-secondary-bg-color, #f1f3f7);
  --surface: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #14171c);
  --muted: var(--tg-theme-hint-color, #79818d);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --border: color-mix(in srgb, var(--text) 8%, transparent);
  --shadow: 0 8px 28px rgba(20, 25, 35, 0.08);
  --radius: 20px;
}

body { color: var(--text); }
button, input, textarea, select { color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .5; cursor: default; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
}


.app-shell { min-height: 100vh; background: var(--bg); color: var(--text); }
.content { width: min(100%, 680px); margin: 0 auto; padding: 18px 14px 105px; }
.home-content { padding-top: max(18px, env(safe-area-inset-top)); }

.hero-header, .page-header, .section-title, .item-card-head, .toolbar, .meta-row, .message-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.hero-header { margin-bottom: 18px; }
.hero-header p, .page-header p { margin: 0 0 3px; color: var(--muted); font-size: 13px; }
.hero-header h1, .page-header h1 { margin: 0; font-size: 25px; line-height: 1.15; }
.avatar { width: 48px; height: 48px; border: 0; border-radius: 16px; overflow: hidden; background: #111827; color: #fff; font-weight: 800; font-size: 18px; flex: 0 0 auto; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.page-header { justify-content: flex-start; margin-bottom: 18px; }
.page-header-copy { min-width: 0; }
.icon-button { width: 42px; height: 42px; border: 0; border-radius: 14px; background: var(--surface); font-size: 30px; line-height: 1; box-shadow: 0 2px 12px rgba(0,0,0,.04); }

.today-card { margin: 0 0 24px; padding: 20px; border-radius: 25px; color: #fff; background: linear-gradient(135deg, #141820, #2d3542); box-shadow: 0 14px 32px rgba(17,24,39,.18); }
.today-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 24px; }
.today-top span { font-size: 12px; opacity: .65; }
.today-top h2 { margin: 2px 0 0; font-size: 24px; }
.today-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.today-stats > * { min-width: 0; border: 0; color: inherit; background: rgba(255,255,255,.08); border-radius: 15px; padding: 12px 8px; text-align: left; }
.today-stats strong { display: block; font-size: 21px; }
.today-stats span { display: block; margin-top: 2px; opacity: .72; font-size: 10px; }

section { margin-bottom: 22px; }
.section-title { margin-bottom: 10px; }
.section-title h2, .panel h2, .form-panel h2 { margin: 0; font-size: 17px; }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick-grid button { min-height: 84px; border: 0; border-radius: 18px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.035); font-size: 11px; font-weight: 700; }
.app-icon { font-size: 23px; }

.menu-list, .cards-list { display: flex; flex-direction: column; gap: 9px; }
.menu-card, .item-card, .panel, .message-card, .metric-card, .device-card { border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 12px rgba(0,0,0,.045); }
.menu-card { width: 100%; display: flex; align-items: center; gap: 13px; padding: 14px; text-align: left; }
.menu-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--bg); font-size: 21px; flex: 0 0 auto; }
.menu-copy { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.menu-copy strong { font-size: 15px; }
.menu-copy small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chevron { color: var(--muted); font-size: 26px; }

.panel, .form-panel { padding: 16px; }
.form-panel h2, .panel h2 { margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
.field-label > span { padding-left: 2px; font-weight: 600; }
.field-label input { color: var(--text); }
input, textarea, select { width: 100%; min-height: 48px; border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 12px 13px; outline: none; font-size: 16px; }
textarea { resize: vertical; min-height: 48px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checks-row { display: flex; gap: 18px; flex-wrap: wrap; }
.checks-row label, .toggle-label { display: inline-flex; flex-direction: row; align-items: center; gap: 7px; color: var(--text); font-size: 12px; }
.checks-row input, .toggle-label input { width: 22px; min-height: 22px; height: 22px; flex: 0 0 22px; accent-color: var(--accent); }

.primary-button { min-height: 46px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-text); padding: 12px 15px; font-weight: 750; }
.primary-button.compact { padding: 8px 11px; font-size: 12px; }
.ghost-button { border: 1px solid var(--border); border-radius: 12px; background: transparent; padding: 8px 11px; font-size: 12px; }
.ghost-button.light { color: #fff; border-color: rgba(255,255,255,.2); }
.search-bar { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 0 0 15px; }
.search-bar button { border: 0; border-radius: 13px; padding: 0 14px; background: var(--text); color: var(--surface); }
.toolbar { margin: 0 0 12px; }

.item-card { padding: 14px; text-align: left; }
.item-card p { margin: 9px 0; color: color-mix(in srgb, var(--text) 86%, var(--muted)); font-size: 13px; line-height: 1.5; }
.item-card-head strong { font-size: 14px; }
.priority-high { border-left: 4px solid #d85858; }
.priority-low { border-left: 4px solid #7aa27c; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; background: var(--bg); padding: 5px 8px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.meta-row { margin-top: 8px; color: var(--muted); font-size: 10px; }
.action-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 11px; }
.action-row button { border: 0; border-radius: 10px; background: var(--bg); padding: 7px 9px; font-size: 10px; }
.action-row .danger-text, .danger-text { color: #c64d4d; }
.sticky-actions { position: sticky; bottom: 90px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); padding: 9px; border-radius: 14px; box-shadow: var(--shadow); }
.clickable-card { width: 100%; }
.note-card .tag-line, .tag-line { margin-top: 8px; color: var(--accent); font-size: 11px; }
.pre-wrap { white-space: pre-wrap; }
.steps-list { margin: 0; padding-left: 24px; }
.steps-list li { padding: 7px 0; line-height: 1.45; }
.history-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 11px; }
.history-row span { color: var(--muted); }
.empty-state { background: var(--surface); color: var(--muted); border-radius: 16px; padding: 20px; text-align: center; font-size: 12px; }

.tabs { display: flex; gap: 7px; margin-bottom: 14px; scrollbar-width: none; }
.tabs::-webkit-scrollbar, .horizontal-scroll::-webkit-scrollbar { display: none; }
.tabs button { border: 0; border-radius: 999px; background: var(--surface); color: var(--muted); padding: 9px 12px; white-space: nowrap; }
.tabs button.active { background: var(--text); color: var(--surface); }
.horizontal-scroll { overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.mood-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.mood-row button { border: 0; background: var(--bg); border-radius: 14px; padding: 12px 6px; font-size: 24px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row > div { display: flex; flex-direction: column; min-width: 0; }
.list-row small { color: var(--muted); margin-top: 2px; }
.list-row button { border: 0; border-radius: 10px; background: var(--bg); padding: 7px 9px; }
.memory-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.memory-row span { color: var(--muted); font-size: 11px; margin-left: 8px; }
.memory-row p { margin: 5px 0 0; font-size: 12px; }

.message-card { padding: 12px 14px; max-width: 92%; }
.message-card.mine { margin-left: auto; background: color-mix(in srgb, var(--accent) 11%, var(--surface)); }
.message-card.theirs { margin-right: auto; }
.message-meta, .message-status { color: var(--muted); font-size: 9px; }
.message-card p { margin: 8px 0; font-size: 13px; line-height: 1.45; }

.ai-page { display: flex; min-height: calc(100vh - 78px); flex-direction: column; }
.chat-list { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.chat-bubble { max-width: 88%; padding: 12px 14px; border-radius: 18px; font-size: 13px; line-height: 1.5; }
.chat-bubble p { margin: 0; white-space: pre-wrap; }
.chat-bubble.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 6px; }
.chat-bubble.assistant { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 6px; }
.proposal { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.proposal strong { display: block; margin-bottom: 3px; }
.proposal small { display: block; color: var(--muted); }
.proposal details { margin: 9px 0; }
.proposal summary { cursor: pointer; color: var(--accent); font-size: 11px; }
.proposal pre { max-height: 220px; overflow: auto; white-space: pre-wrap; font-size: 9px; background: var(--bg); border-radius: 10px; padding: 8px; }
.chat-composer { position: sticky; bottom: 80px; display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 14px; padding: 9px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.chat-composer textarea { min-height: 48px; }

.setup-card code { font-size: 11px; word-break: break-all; }
.device-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.device-card { padding: 12px; }
.device-card > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.device-card small { color: var(--muted); font-size: 9px; word-break: break-all; }
.state-pill { display: inline-flex; margin: 9px 0 2px; padding: 5px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 10px; }
.state-pill.on { background: color-mix(in srgb, #2f9c61 16%, var(--surface)); color: #2d7e50; }

.finance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.metric-card { padding: 14px; }
.metric-card span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.metric-card strong { font-size: 17px; }
.release-card h2 { margin: 9px 0 4px; font-size: 15px; }
.release-card > small { color: var(--muted); }
.release-card ul { margin: 12px 0 0; padding-left: 20px; }
.release-card li { margin: 6px 0; font-size: 12px; line-height: 1.45; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.stats-grid > div { border-radius: 13px; background: var(--bg); padding: 10px; min-width: 0; }
.stats-grid strong { display: block; font-size: 17px; }
.stats-grid span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.25; overflow-wrap: anywhere; }
.admin-user { display: grid; grid-template-columns: minmax(0, 1fr) 110px 44px; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.admin-user > div { min-width: 0; display: flex; flex-direction: column; }
.admin-user small { color: var(--muted); }
.admin-user select { padding: 8px; font-size: 10px; }
.switch input { display: none; }
.switch span { display: block; width: 40px; height: 24px; border-radius: 999px; background: #c9ced6; position: relative; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: .18s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }

.bottom-nav { position: fixed; z-index: 40; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 680px); height: calc(78px + env(safe-area-inset-bottom)); padding: 6px 8px max(6px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(18px); border-top: 1px solid var(--border); }
.bottom-nav button { min-height: 48px; border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 15px; }
.bottom-nav button span { font-size: 19px; }
.bottom-nav button small { font-size: 9px; }
.bottom-nav button.active { color: var(--accent); }
.bottom-nav .ai-nav { margin: -13px 4px 7px; background: #111827; color: #fff; box-shadow: 0 7px 18px rgba(0,0,0,.22); }
.bottom-nav .ai-nav.active { color: #fff; outline: 2px solid color-mix(in srgb, var(--accent) 70%, #fff); }

.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 28px), 620px); padding: 12px 14px; border-radius: 14px; background: #111827; color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.22); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.toast.ok { background: #216a43; }
.toast.error { background: #8b3131; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; gap: 8px; text-align: center; padding: 28px; background: var(--bg); color: var(--text); }
.boot-screen h1 { margin: 0; }
.boot-screen p { margin: 0; color: var(--muted); max-width: 420px; }
.boot-logo { width: 64px; height: 64px; display: grid; place-items: center; justify-self: center; margin-bottom: 8px; border-radius: 22px; background: #111827; color: #fff; font-size: 28px; box-shadow: var(--shadow); }
.boot-screen.error .boot-logo { background: #8b3131; }

@media (max-width: 420px) {
  .content { padding-left: 12px; padding-right: 12px; }
  .quick-grid { gap: 6px; }
  .quick-grid button { font-size: 10px; }
  .two-columns { grid-template-columns: 1fr; }
  .device-grid { grid-template-columns: 1fr; }
  .admin-user { grid-template-columns: minmax(0, 1fr) 92px 42px; }
}

.reply-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--tg-theme-secondary-bg-color, #eef1f5);
}
.reply-banner > div { min-width: 0; display: grid; gap: 3px; }
.reply-banner small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tg-theme-hint-color, #7a828c); }

.file-picker {
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px dashed rgba(127, 127, 127, 0.35);
  border-radius: 14px;
  cursor: pointer;
  background: var(--tg-theme-secondary-bg-color, #f3f5f8);
}
.file-picker input { display: none; }
.file-picker span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-button { border: 0; cursor: pointer; }


@media (hover: hover) {
  .menu-card:hover, .quick-grid button:hover, .ghost-button:hover, .action-row button:hover {
    filter: brightness(.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Instruction media loaded from Telegram through the protected API proxy. */
.instruction-media-panel {
  overflow: hidden;
}

.instruction-media-list {
  display: grid;
  gap: 14px;
}

.instruction-media-item {
  min-width: 0;
  overflow: hidden;
  border-radius: 18px;
  background: var(--tg-theme-secondary-bg-color, #f2f2f7);
}

.instruction-video,
.instruction-photo {
  display: block;
  width: 100%;
  max-height: 520px;
  border: 0;
  background: #000;
  object-fit: contain;
}

.instruction-photo {
  background: transparent;
}

.instruction-media-caption {
  margin: 0;
  padding: 12px 14px;
  color: var(--tg-theme-text-color, #111827);
  font-size: 14px;
  line-height: 1.45;
}

.instruction-document {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 12px 14px;
  color: var(--tg-theme-link-color, #2481cc);
  font-weight: 700;
  text-decoration: none;
}

.instruction-card-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.media-badge {
  white-space: nowrap;
}

/* v4.0 production additions */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.memory-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: var(--tg-theme-bg-color, #fff);
  color: inherit;
  text-align: left;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.memory-card img, .memory-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--tg-theme-secondary-bg-color, #f1f3f6);
}
.memory-placeholder { display: grid; place-items: center; font-size: 34px; }
.memory-copy { display: flex; flex-direction: column; gap: 5px; padding: 12px; }
.memory-copy small { color: var(--tg-theme-hint-color, #7b828b); }
.admin-tabs { overflow-x: auto; flex-wrap: nowrap; }
.admin-tabs button { white-space: nowrap; }
.activity-list { display: flex; flex-direction: column; gap: 8px; }
.activity-row { padding: 12px 0; border-bottom: 1px solid rgba(127,127,127,.14); }
.activity-row:last-child { border-bottom: 0; }
.activity-row div { display: flex; flex-direction: column; gap: 4px; }
.activity-row small { color: var(--tg-theme-hint-color, #7b828b); }
.status-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.upload-update { display: flex; align-items: center; justify-content: center; margin-top: 12px; cursor: pointer; }
.upload-update input { display: none; }
.upload-update.disabled { opacity: .6; pointer-events: none; }
.mono-small { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
@media (max-width: 390px) { .memory-grid { grid-template-columns: 1fr; } }


/* v4.0.2 — stabilization and mobile layout fixes */
html, body, #root { width: 100%; max-width: 100%; overflow-x: hidden; }
*, *::before, *::after { box-sizing: border-box; }
.content { max-width: 680px; overflow-x: clip; }
.stack > *, .form-panel input, .form-panel textarea, .form-panel select, .two-columns > *, .two-columns label { min-width: 0; max-width: 100%; }
input, textarea, select, button { font: inherit; }
input[type="date"], input[type="time"] { width: 100%; min-height: 48px; }
select { text-overflow: ellipsis; }
.page-header-copy h1, .menu-copy strong, .menu-copy small, .list-row strong { overflow-wrap: anywhere; }
.admin-tabs { width: calc(100% + 28px); margin-left: -14px; padding: 0 14px 6px; scroll-padding-inline: 14px; overscroll-behavior-inline: contain; }
.admin-tabs::before, .admin-tabs::after { content: ""; flex: 0 0 1px; }
.backup-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.backup-row:last-child { border-bottom: 0; }
.backup-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.backup-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backup-main small { color: var(--muted); }
.backup-size { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.ai-toolbar { display: flex; justify-content: flex-end; margin: -8px 0 10px; }
.chat-list { overflow-anchor: none; padding-bottom: 8px; }
.chat-bubble.error { border: 1px solid color-mix(in srgb, #b84b4b 55%, transparent); }
.chat-composer textarea { width: 100%; resize: none; }
.quiet-hours label { min-width: 0; }
@media (max-width: 420px) {
  .admin-tabs { width: calc(100% + 24px); margin-left: -12px; padding-left: 12px; padding-right: 12px; }
  .chat-composer { grid-template-columns: minmax(0, 1fr) minmax(104px, auto); }
  .chat-composer .primary-button { padding-left: 14px; padding-right: 14px; }
  .backup-row { gap: 8px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* v4.3.0 — persistent AI assistant */
.ai-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.ai-sync-label{font-size:12px;color:var(--muted,#8b93a7)}
.ai-quick-prompts{display:flex;gap:8px;overflow-x:auto;padding:2px 0 8px;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.ai-quick-prompts::-webkit-scrollbar{display:none}
.ai-quick-prompts button{flex:0 0 auto;border:1px solid rgba(148,163,184,.25);background:rgba(148,163,184,.08);color:inherit;border-radius:999px;padding:9px 12px;font-size:13px;white-space:nowrap}
.ai-quick-prompts button:disabled{opacity:.55}
.proposal-summary{white-space:pre-wrap;overflow-wrap:anywhere;margin:10px 0;padding:10px;border-radius:10px;background:rgba(15,23,42,.18);font:12px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace}
.chat-bubble .pre-wrap{white-space:pre-wrap;overflow-wrap:anywhere}
.chat-composer{position:sticky;bottom:calc(74px + env(safe-area-inset-bottom));z-index:5;background:var(--tg-theme-bg-color,#111827);padding-top:8px;padding-bottom:4px}
@media (max-width:420px){.ai-toolbar .ghost-button{width:auto}.chat-composer{grid-template-columns:1fr}.chat-composer .primary-button{width:100%}}

/* v4.3.0 — AI voice and multimodal attachments */
.ai-attachment-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.ai-composer-v430{gap:10px}
.ai-composer-v430 .recording{border-color:#ef4444;color:#ef4444;animation:voicePulse 1.1s ease-in-out infinite}
.ai-speak-button{margin-top:8px;border:0;background:transparent;color:var(--muted,#9ca3af);font-size:13px;padding:4px 0;cursor:pointer}
.visually-hidden{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
@keyframes voicePulse{50%{opacity:.55}}

/* v4.3.2 diagnostics */
.diagnostic-report{white-space:pre-wrap;word-break:break-word;max-height:420px;overflow:auto;padding:14px;border-radius:14px;background:#0b0b0c;border:1px solid rgba(255,255,255,.1);font:12px/1.45 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;color:#d1d5db}
\n\n/* v4.3.5 — AI mobile stabilization */\n.ai-quick-prompts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;overflow:visible;padding:2px 0 10px}\n.ai-quick-prompts button{min-width:0;white-space:normal;text-align:left;line-height:1.25;padding:8px 10px}\n.ai-quick-prompts button:last-child:nth-child(odd){grid-column:1/-1}\n.ai-composer-v430{grid-template-columns:auto minmax(0,1fr) auto;align-items:end;gap:7px;padding:8px}\n.ai-composer-v430 .ai-attachment-actions{display:grid;grid-template-columns:1fr;gap:5px;align-self:stretch}\n.ai-composer-v430 .ai-attachment-actions button{min-height:34px;padding:5px 8px;white-space:nowrap}\n.ai-composer-v430 textarea{min-height:72px;max-height:128px;padding:10px 12px}\n.ai-composer-v430>.primary-button{min-height:44px;padding:10px 12px}\n.ai-speak-button{display:inline-flex;align-items:center;gap:5px;margin-top:6px;padding:3px 5px;border-radius:8px;font-size:11px}\n.ai-speak-button.speaking{color:var(--accent,#4d8dff);background:rgba(77,141,255,.08)}\nbody:has(.ai-composer-v430 textarea:focus) .bottom-nav{display:none}\nbody:has(.ai-composer-v430 textarea:focus) .ai-composer-v430{bottom:max(6px,env(safe-area-inset-bottom))}\n@media(max-width:420px){\n  .ai-page{padding-bottom:96px}\n  .ai-toolbar{align-items:center;flex-wrap:nowrap}\n  .ai-toolbar .ghost-button{font-size:11px;padding:7px 9px}\n  .ai-quick-prompts{grid-template-columns:1fr 1fr}\n  .ai-quick-prompts button{font-size:11px}\n  .chat-bubble{max-width:92%;font-size:12px;padding:10px 12px}\n  .chat-composer.ai-composer-v430{grid-template-columns:72px minmax(0,1fr);bottom:calc(72px + env(safe-area-inset-bottom))}\n  .ai-composer-v430 .ai-attachment-actions{grid-column:1;grid-row:1 / span 2}\n  .ai-composer-v430 textarea{grid-column:2;grid-row:1;min-height:66px}\n  .ai-composer-v430>.primary-button{grid-column:2;grid-row:2;width:100%;min-height:38px}\n}\n
/* v4.5.3 — Aqara connection wizard */
.aqara-connect-card{display:flex;flex-direction:column;gap:12px}
.integration-form,.auth-code-box{padding-top:6px}
.integration-form input,.auth-code-box input{width:100%}
.auth-code-box{border-top:1px solid rgba(127,127,127,.18);padding-top:12px}
