:root {
  --ink: #171717; --muted: #555; --line: #d4d4d4; --paper: #fff; --surface: #f3f3f3;
  --action: #1d4ed8; --action-soft: #eff6ff; --action-ink: #1e40af;
  --warning: #92400e; --warning-soft: #fffbeb;
  --error: #b91c1c; --error-soft: #fef2f2;
  --success: #166534; --success-soft: #f0fdf4;
}
* { box-sizing: border-box; }
body { margin: 0; background: #e9e9e9; color: var(--ink); font-size: 16px; line-height: 1.5; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; min-height: 46px; border: 1px solid #999; border-radius: 10px; background: #fff; padding: 9px 13px; font-weight: 600; }
button:disabled { cursor: not-allowed; color: #656565; background: #eee; border-color: #ccc; }
button.primary { background: var(--action); color: #fff; border-color: var(--action); }
button[aria-pressed="true"], button[aria-current="page"] { background: var(--action); color: white; border-color: var(--action); }
button.primary:disabled { color: #656565; background: #eee; border-color: #ccc; }
:focus-visible { outline: 3px solid var(--action); outline-offset: 3px; }
input { accent-color: var(--action); }
.tabs button[aria-pressed="true"], .filters button[aria-pressed="true"] { box-shadow: inset 0 -3px #102b77; }
input, textarea, select { width: 100%; min-height: 48px; padding: 12px; border: 1px solid #888; border-radius: 9px; background: #fff; }
textarea { min-height: 102px; resize: vertical; }
label { display: block; font-weight: 600; margin: 15px 0 6px; }
h1 { font-size: 26px; line-height: 1.25; margin: 8px 0 16px; letter-spacing: -.6px; }
h2 { font-size: 20px; margin: 0 0 10px; } h3 { font-size: 17px; margin: 8px 0; }
p { margin: 8px 0 14px; } small, .meta { font-size: 14px; color: var(--muted); }
.crm-shell { width: min(100%, 430px); min-height: 100dvh; margin: auto; background: var(--paper); box-shadow: 0 0 0 1px #ccc; }
.lab { font-size: 12px; font-weight: 600; letter-spacing: .5px; text-align: center; background: #e7e7e7; padding: 7px 8px; }
.brandbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.brandbar img { width: 98px; height: auto; } .brandbar span { flex: 1; font-size: 14px; } .brandbar button { font-size: 14px; padding: 8px 10px; }
main { padding: 18px 16px 100px; overflow-wrap: anywhere; }
#nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 430px); display: flex; gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); z-index: 5; }
#nav button { flex: 1; font-size: 14px; border-color: transparent; }
.filters, .actions, .tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.filters button { font-size: 14px; flex: 1; padding-inline: 8px; } .tabs button { flex: 1; font-size: 14px; }
.summaryline { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 16px; }
.summaryline strong { font-size: 16px; }
.conversation { display: block; text-align: left; width: 100%; padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-weight: 400; }
.conversation .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.conversation strong { font-size: 17px; } .conversation p { margin: 6px 0 10px; }
.badge { display: inline-block; font-size: 13px; padding: 3px 8px; border-radius: 5px; background: #eee; font-weight: 600; }
.badge.warning { background: var(--warning-soft); color: var(--warning); border: 1px solid var(--warning); }
.badge.error { background: var(--error-soft); color: var(--error); border: 1px solid var(--error); }
.badge.success { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.badge.info { background: var(--action-soft); color: var(--action-ink); border: 1px solid var(--action-ink); }
.statusline { margin: 8px 0; }
.panel { background: #f5f5f5; padding: 15px; border-radius: 12px; margin: 14px 0; }
.alert { border: 2px solid var(--warning); color: var(--warning); padding: 14px; margin: 14px 0; border-radius: 10px; background: var(--warning-soft); }
.alert.error { border-color: var(--error); color: var(--error); background: var(--error-soft); }
.alert.info { border-color: var(--action-ink); color: var(--action-ink); background: var(--action-soft); }
.alert strong { display: block; } .alert p { margin: 6px 0; }
.control { position: sticky; top: 0; z-index: 3; background: white; padding: 8px 0; border-bottom: 1px solid var(--line); }
.control .actions { margin: 8px 0; } .control .primary { width: 100%; }
.bubble { max-width: 94%; padding: 12px 14px; border-radius: 12px 12px 12px 2px; background: #f0f0f0; margin: 14px 0; }
.bubble.out { margin-left: auto; border-radius: 12px 12px 2px 12px; background: var(--action-soft); border: 1px solid #93b4ea; }
.bubble.failed { border: 2px solid var(--error); background: var(--error-soft); }
.bubble.failed small { color: var(--error); }
.bubble.discarded { background: var(--surface); border-color: #999; border-style: dashed; }
.panel.internal-note { border-left: 4px solid #777; }
.bubble p { white-space: pre-wrap; margin: 6px 0; } .bubble .actions button { font-size: 14px; }
.composer { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 18px; }
.composer .primary { width: 100%; } .composer label { margin-top: 0; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 400; }
.check input { width: 21px; min-height: 21px; height: 21px; }
.task { padding: 14px 0; border-bottom: 1px solid var(--line); } .task button { width: 100%; margin-top: 8px; }
.task.pending > strong, .task.pending > h2 { color: var(--warning); }
.task.completed { background: var(--success-soft); border-left: 4px solid var(--success); padding: 14px 12px; border-radius: 8px; margin: 10px 0; }
.task.completed > strong { color: var(--success); }
.error-text { color: var(--error); }
.numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .number { background: #f1f1f1; padding: 14px; border-radius: 10px; } .number strong { display: block; font-size: 28px; }
dl { margin: 8px 0; } dt { font-size: 14px; color: #555; } dd { margin: 0 0 12px; font-weight: 600; white-space: pre-wrap; }
details { margin: 16px 0; border-top: 1px solid var(--line); padding-top: 12px; } summary { cursor: pointer; min-height: 44px; padding: 8px 0; font-weight: 600; }
.empty { padding: 28px 12px; text-align: center; background: #f4f4f4; border-radius: 12px; }
#notice:not(:empty) { position: fixed; left: 50%; transform: translateX(-50%); bottom: 88px; width: min(calc(100% - 28px), 402px); background: #171717; color: white; padding: 12px 16px; border-radius: 10px; z-index: 12; box-shadow: 0 3px 14px #0003; }
#notice[data-tone="error"] { background: var(--error); }
#notice[data-tone="success"] { background: var(--success); }
#storage-warning:not([hidden]) { margin: 12px; padding: 14px; border: 2px solid var(--error); color: var(--error); background: var(--error-soft); }
dialog { width: min(calc(100% - 24px), 410px); max-height: 88dvh; border: 1px solid #777; border-radius: 16px; padding: 22px; overflow: auto; }
dialog::backdrop { background: #0008; } dialog .actions { margin-bottom: 0; } dialog .actions button { flex: 1; }
#dialog-error:not(:empty) { border-left: 4px solid var(--error); background: var(--error-soft); color: var(--error); padding: 10px; font-weight: 600; }
.choice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid #aaa; padding: 12px; border-radius: 8px; font-weight: 400; } .choice input { width: 20px; height: 22px; min-height: 22px; flex-shrink: 0; }
@media (prefers-reduced-motion: no-preference) { button { transition: background .12s; } }
@media (max-width: 350px) { main { padding-inline: 12px; } .brandbar { gap: 8px; } .brandbar span { display: none; } .brandbar button { margin-left: auto; } }
