:root {
  --bg: #f4f1eb;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --gold: #b98a52;
  --gold-soft: #f4e9dc;
  --danger: #a13d3d;
  --danger-soft: #f7e8e8;
  --shadow: 0 10px 30px rgba(17, 24, 39, .07);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, textarea, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 720px; margin: 0 auto; min-height: 100vh; padding-bottom: 92px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 20px 14px;
}
.eyebrow { font-size: 11px; letter-spacing: .24em; color: var(--gold); font-weight: 800; }
h1 { margin: 0; font-family: Georgia, serif; font-size: 34px; letter-spacing: -.04em; }
h2, h3, p { margin-top: 0; }
main { padding: 0 16px 22px; }
.card { background: var(--surface); border: 1px solid rgba(17,24,39,.05); border-radius: 24px; box-shadow: var(--shadow); }
.hero { padding: 22px; display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.hero h2 { margin-bottom: 8px; font-size: 25px; }
.hero p:last-child { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.muted { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.status-pill { white-space: nowrap; padding: 8px 10px; background: #eaf5ee; color: #2f6d43; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-pill span { display: inline-block; width: 8px; height: 8px; background: #3e9c5b; border-radius: 50%; margin-right: 5px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.stat-card { background: var(--surface); border-radius: 18px; padding: 16px 12px; text-align: center; border: 1px solid rgba(17,24,39,.05); }
.stat-card.warning { background: var(--danger-soft); }
.stat-value { display: block; font-size: 24px; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 12px; }
.quick-compose, .rules-card, main > section.card:not(.hero) { padding: 20px; margin-top: 14px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading h3 { margin-bottom: 0; font-size: 19px; }
.badge { background: var(--gold-soft); color: #7b572d; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
textarea { width: 100%; min-height: 110px; border: 1px solid var(--line); border-radius: 16px; padding: 14px; resize: vertical; background: #fbfbfa; color: var(--ink); }
textarea:focus, select:focus { outline: 2px solid rgba(185,138,82,.25); border-color: var(--gold); }
.compose-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 10px; }
select { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; }
.primary-btn, .install-btn { border: 0; background: var(--ink); color: #fff; border-radius: 14px; padding: 12px 16px; font-weight: 800; }
.install-btn { padding: 10px 13px; font-size: 13px; }
.text-btn { border: 0; background: transparent; color: var(--gold); font-weight: 800; padding: 4px; }
.assistant-result { margin-top: 14px; border-radius: 16px; padding: 14px; background: #f8f6f2; border: 1px solid #ebe5dc; }
.result-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.assistant-result p { line-height: 1.55; margin-bottom: 0; white-space: pre-wrap; }
.safety-note { margin-top: 10px; border-radius: 12px; padding: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13px; font-weight: 700; }
.queue-list { display: grid; gap: 12px; }
.queue-item { display: flex; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; transition: .2s ease; }
.queue-item.handled { opacity: .45; transform: scale(.98); }
.avatar { width: 42px; height: 42px; border-radius: 14px; background: var(--gold-soft); display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #74502a; flex: 0 0 42px; }
.queue-content { min-width: 0; flex: 1; }
.queue-top { display: flex; justify-content: space-between; gap: 10px; }
.queue-top span { color: var(--muted); font-size: 12px; }
.queue-item p { color: #4b5563; margin: 5px 0 9px; line-height: 1.4; }
.queue-tag { display: inline-block; background: #eef2f7; color: #4b5563; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 5px 8px; }
.queue-tag.alert { background: var(--danger-soft); color: var(--danger); }
.rules-card ul { margin: 0; padding-left: 20px; color: #4b5563; line-height: 1.55; }
.rules-card li + li { margin-top: 8px; }
.bottom-nav { position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: min(720px, 100%); display: grid; grid-template-columns: repeat(4, 1fr); background: rgba(255,255,255,.94); backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
.nav-item { border: 0; background: transparent; color: var(--muted); font-size: 11px; padding: 7px 3px; border-radius: 12px; }
.nav-item span { display: block; font-size: 20px; margin-bottom: 2px; }
.nav-item.active { color: var(--ink); background: #f4f1eb; font-weight: 800; }
@media (max-width: 420px) {
  .hero { flex-direction: column; }
  .status-pill { align-self: flex-start; }
  .compose-actions { grid-template-columns: 1fr; }
}
