:root {
  --petroleo: #0f5257;
  --petroleo-2: #13696f;
  --coral: #f2994a;
  --verde: #4f7a7d;
  --bg: #f5f8f8;
  --surface: #ffffff;
  --text: #1d2b2c;
  --muted: #5d7b7e;
  --line: #dde7e8;
  --danger: #b4432f;
  --warn-bg: #fff3e6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 82, 87, 0.06), 0 4px 16px rgba(15, 82, 87, 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1718;
    --surface: #142224;
    --text: #e6efef;
    --muted: #93adb0;
    --line: #23393b;
    --petroleo: #4fb3b9;
    --petroleo-2: #6cc6cb;
    --warn-bg: #3a2a18;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1718;
  --surface: #142224;
  --text: #e6efef;
  --muted: #93adb0;
  --line: #23393b;
  --petroleo: #4fb3b9;
  --petroleo-2: #6cc6cb;
  --warn-bg: #3a2a18;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.error { color: var(--danger); }
.warn { background: var(--warn-bg); padding: 8px 10px; border-radius: 10px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 500;
  min-height: 44px;
}
.btn:hover { border-color: var(--petroleo); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--petroleo); border-color: var(--petroleo); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 6px 10px; }
.link { text-decoration: none; background: none; border: 0; color: var(--petroleo); cursor: pointer; padding: 6px 0; font-weight: 500; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; cursor: pointer; font-size: 0.9rem; }
.chip-on { background: var(--petroleo); color: #fff; border-color: var(--petroleo); }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
label { display: grid; gap: 4px; font-size: 0.92rem; color: var(--muted); }
label > input, label > select, label > textarea { color: var(--text); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.tag { display: inline-block; font-size: 0.78rem; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--petroleo) 12%, transparent); color: var(--petroleo); white-space: nowrap; }
.tag-urgent, .tag-safety { background: color-mix(in srgb, var(--coral) 22%, transparent); color: #a2541a; }
.tag-handoff, .tag-lgpd_delete { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.stage-cancelado { opacity: 0.6; }
.badge { background: var(--coral); color: #fff; border-radius: 999px; font-size: 0.72rem; padding: 0 6px; min-width: 18px; height: 18px; line-height: 18px; text-align: center; align-self: center; }

/* layout */
.shell { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .logo { width: 34px; height: 34px; }
.topbar .brand { display: grid; line-height: 1.15; flex: 1; min-width: 0; }
.topbar .brand strong { color: var(--petroleo); }
.topbar .brand span { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { order: 3; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; display: grid; text-decoration: none; justify-items: center; gap: 2px; padding: 8px 2px; border: 0; background: none; color: var(--muted); font-size: 0.72rem; cursor: pointer; position: relative; }
.tabs a .icon { font-size: 1.2rem; }
.tabs a.active { color: var(--petroleo); font-weight: 600; }
.tabs .badge { position: absolute; top: 4px; right: calc(50% - 22px); }
.content { overflow-y: auto; min-height: 0; padding: 16px; max-width: 880px; width: 100%; margin: 0 auto; }

@media (min-width: 900px) {
  .shell { grid-template-columns: 220px 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .tabs { order: 0; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding: 12px 8px; gap: 4px; }
  .tabs a { flex: none; grid-auto-flow: column; justify-content: start; gap: 10px; font-size: 0.95rem; padding: 10px 12px; border-radius: 10px; }
  .tabs a.active { background: color-mix(in srgb, var(--petroleo) 10%, transparent); }
  .tabs .badge { position: static; }
  .content { padding: 24px; }
}

.center-screen { min-height: 100%; display: grid; place-items: center; padding: 16px; gap: 12px; }
.login { width: min(380px, 100%); display: grid; gap: 12px; text-align: center; }
.login h1 { margin: 0; color: var(--petroleo); }
.login p { margin: 0; }
.login label { text-align: left; }

.empty { text-align: center; padding: 40px 8px; }

/* cartões de decisão */
.cards { display: grid; gap: 14px; }
.decision header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.report { margin: 0 0 6px; font-size: 1.02rem; }
.question { margin: 0 0 10px; font-weight: 600; color: var(--petroleo); }
.facts { display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 4px 12px; margin: 8px 0; font-size: 0.92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; margin: 8px 0; }
.thumbs img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.actions { display: grid; gap: 10px; margin-top: 10px; }
.price-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.secondary { margin-top: 8px; gap: 16px; }

/* conversa */
.chat { display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.messages { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.bubble { max-width: 85%; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); overflow-wrap: anywhere; }
/* Só o texto preserva quebras de linha; a indentação do HTML não vira espaço em branco. */
.bubble.plain, .bubble > .text { white-space: pre-wrap; }
.bubble.owner { align-self: flex-end; background: var(--petroleo); color: #fff; border-color: var(--petroleo); }
.bubble.owner .muted, .bubble.owner .meta { color: rgba(255, 255, 255, 0.8); }
.bubble.assistant { align-self: flex-start; }
.bubble.typing { color: var(--muted); font-style: italic; }
.bubble .meta { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }
.bubble .inline-img { max-width: 240px; border-radius: 8px; display: block; margin-bottom: 4px; }
.confirm { border-color: var(--coral); }
.confirm ul { margin: 8px 0; padding-left: 18px; }
.composer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--bg); padding: 8px 0 0; }
.composer input { flex: 1; }
.mic { width: 48px; min-width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--coral); color: #fff; font-size: 1.2rem; cursor: pointer; }
.attach { display: grid; place-items: center; width: 48px; min-width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 1.2rem; cursor: pointer; }
.sim-head { display: grid; gap: 10px; }
.sim-head p { margin: 0; }
.mic.on { animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--coral) 25%, transparent); } }

/* agenda e listas */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.segmented a { border: 0; background: var(--surface); padding: 8px 14px; cursor: pointer; color: inherit; text-decoration: none; }
.segmented a.active { background: var(--petroleo); color: #fff; }
.period { min-width: 120px; text-align: center; font-weight: 600; }
.day h3 { text-transform: capitalize; font-size: 1rem; color: var(--petroleo); margin: 18px 0 8px; }
.order-row, .conv-row { color: inherit; text-decoration: none; width: 100%; display: flex; gap: 10px; align-items: center; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.order-row .num { font-weight: 700; color: var(--coral); min-width: 40px; }
.order-row .who, .conv-row .who { display: grid; flex: 1; min-width: 0; }
.order-row .who span, .conv-row .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); display: flex; justify-content: flex-end; z-index: 20; }
.drawer { width: min(480px, 100%); height: 100%; overflow-y: auto; background: var(--surface); padding: 20px 16px; display: grid; gap: 12px; align-content: start; position: relative; }
.drawer h2 { margin: 0; }
.drawer .close { position: absolute; right: 12px; top: 8px; border: 0; background: none; font-size: 1.8rem; cursor: pointer; color: var(--muted); }
.history { padding-left: 18px; font-size: 0.88rem; }

.settings { display: grid; gap: 14px; }
.settings .card { display: grid; gap: 10px; }
.settings h3 { margin: 0; color: var(--petroleo); }
.toggle { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 1rem; }
.toggle input { width: 22px; min-height: 22px; height: 22px; accent-color: var(--petroleo); }
.saved { position: fixed; top: 70px; right: 16px; background: var(--petroleo); color: #fff; padding: 6px 12px; border-radius: 8px; z-index: 30; }

.toasts { position: fixed; top: 64px; right: 12px; left: 12px; display: grid; gap: 8px; justify-items: end; pointer-events: none; z-index: 40; }
.toast { pointer-events: auto; max-width: 380px; background: var(--surface); border-left: 4px solid var(--coral); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); display: grid; gap: 2px; }

/* Django */
.flash { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--petroleo) 12%, transparent); }
.flash.error { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.hidden { display: none !important; }
.inline { display: inline; }
form.inline { margin: 0; }
.topbar form { margin: 0; }
.tenant-switch { max-width: 160px; min-height: 36px; padding: 4px 8px; }
.card + .card { margin-top: 0; }
.drawer-page { display: grid; gap: 12px; align-content: start; }
.drawer-page > * { margin: 0; }
.provider-hint { font-size: .85rem; }
.history li { margin-bottom: 4px; }
.empty-state { text-align: center; padding: 40px 8px; }
.bubble audio { max-width: 240px; }

/* ---------------------------------------------------------------- ajustes */
.m0 { margin: 0; }
.between { justify-content: space-between; }
.section-title { margin: 4px 0 0; font-size: 1.2rem; color: var(--petroleo); }
.group-title { margin: 10px 0 0; font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.back { display: inline-block; justify-self: start; }
.setting-links { display: grid; gap: 10px; }
.setting-link, .settings .setting-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; padding: 14px 16px; }
.setting-link > span:nth-child(2), .setting-link > span:first-child:not(.icon) { display: grid; flex: 1; min-width: 0; }
.setting-link .icon { font-size: 1.4rem; width: 32px; text-align: center; }
.setting-link .chev { color: var(--muted); font-size: 1.4rem; }
.setting-link.inactive { opacity: 0.6; }
.form-grid { display: grid; gap: 10px; }
.form-grid label { display: grid; gap: 4px; }
.form-grid label.toggle { display: flex; }
.form-grid h3, .form-grid h4 { margin: 0; color: var(--petroleo); }
.help { margin: -4px 0 0; color: var(--muted); font-size: 0.85rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .two { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0; display: grid; gap: 8px; min-width: 0; }
legend { padding: 0 4px; font-weight: 500; }
.week-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.week-row .day { width: 72px; font-weight: 500; }
.week-row .span { display: inline-flex; gap: 6px; align-items: center; }
.week-row input[type=time] { width: 132px; }
.faq-row { display: grid; gap: 6px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.question { background: var(--bg); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.segmented-radio { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; justify-self: start; }
.segmented-radio label { display: block; cursor: pointer; position: relative; }
.segmented-radio input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; min-height: 0; padding: 0; inset: 0; }
.segmented-radio span { display: block; padding: 8px 12px; background: var(--surface); }
.segmented-radio input:checked + span { background: var(--petroleo); color: #fff; }
.segmented-radio input:focus-visible + span { outline: 2px solid var(--coral); outline-offset: -2px; }
.message-card[data-modo="ai"] .when-fixed { display: none; }
.message-card[data-modo="fixed"] .when-ai, .message-card[data-modo="off"] .when-ai { display: none; }
.field-chip { border: 1px solid var(--line); background: var(--bg); border-radius: 6px; padding: 1px 6px; margin: 2px; font-size: 0.8rem; cursor: pointer; font-family: ui-monospace, monospace; color: var(--petroleo); }
.preview { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--bg); font-size: 0.92rem; }
.flash.error { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.flash.warning { background: var(--warn-bg); }
code { font-family: ui-monospace, monospace; font-size: 0.9em; }
.ai-alert { border: 1px solid var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.ai-alert.retrying { border-color: var(--coral); background: var(--warn-bg); }
.ai-alert p { margin: 0; }
.chat-error { border-color: var(--danger); display: grid; gap: 6px; }
.list { display: grid; gap: 10px; }
.conv-row.card { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; padding: 12px 14px; }
.attendance .who { gap: 4px; }
.attendance.needs-owner { border-left: 4px solid var(--coral); }
.chips { gap: 6px; }
.nowrap { flex-wrap: nowrap; }
.who-owner, .who-paused { background: color-mix(in srgb, var(--coral) 18%, transparent); color: var(--text); }
.who-failed { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.tag-waiting { background: var(--warn-bg); color: var(--text); }
.tag-decision { background: color-mix(in srgb, var(--coral) 25%, transparent); color: var(--text); }
.memory summary { cursor: pointer; font-weight: 500; }
.memory p { margin: 8px 0 0; }
.attendance .who span.chips, .attendance .who span.chips span { white-space: nowrap; overflow: visible; }
.attendance .who span.chips { white-space: normal; display: flex; flex-wrap: wrap; }

/* Telas de conversa: só a lista de mensagens rola; a caixa de texto fica fixa embaixo e
   nunca cobre a última mensagem. */
.content:has(> .chat) { display: flex; flex-direction: column; overflow: hidden; }
.content > .chat { flex: 1; min-height: 0; }
.chat > .messages { overflow-y: auto; min-height: 0; padding: 2px 2px 10px; overscroll-behavior: contain; }
.chat > .card, .chat > .row, .chat > h2, .chat > form:not(.composer) { flex: none; }
.chat > h2 { margin: 0; }
/* Arquivo escolhido no simulador. */
.attach.on { border-color: var(--petroleo); background: color-mix(in srgb, var(--petroleo) 14%, var(--surface)); }
.file-chip { order: -1; flex-basis: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 0.9rem; min-width: 0; }
.file-chip img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.file-chip .nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button { border: 0; background: none; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 6px; }
.status-connected { background: color-mix(in srgb, #2e8b57 18%, transparent); color: var(--text); }
.status-disconnected { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.status-connecting, .status-pending { background: var(--warn-bg); color: var(--text); }
.avisos { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; border-color: var(--coral); }
.order-line { display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.order-line .order-row { margin-bottom: 0; flex: 1; min-width: 0; }
.order-line form { display: flex; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; width: 44px; cursor: pointer; font-size: 1.05rem; color: var(--muted); }
.icon-btn:hover { border-color: var(--danger); color: var(--danger); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
/* Popup de mídias (fotos dos pedidos e das conversas). */
.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(5, 15, 16, 0.94); }
.lightbox[open] { display: grid; grid-template-columns: 56px 1fr 56px; grid-template-rows: auto 1fr; align-items: center; }
.lb-bar { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 10px 12px; color: #fff; }
.lb-count { margin-right: auto; font-size: 0.9rem; opacity: 0.85; }
.lb-close, .lb-open, .lb-nav { background: rgba(255, 255, 255, 0.14); color: #fff; border: 0; border-radius: 999px; width: 44px; height: 44px; font-size: 1.6rem; line-height: 44px; text-align: center; cursor: pointer; text-decoration: none; }
.lb-open { font-size: 1.1rem; }
.lb-nav { justify-self: center; font-size: 2rem; grid-row: 2; }
.lb-prev { grid-column: 1; }
.lb-next { grid-column: 3; }
.lightbox figure { grid-column: 2; grid-row: 2; width: 100%; margin: 0; height: 100%; min-height: 0; display: grid; grid-template-rows: 1fr auto; place-items: center; gap: 8px; padding-bottom: 16px; }
.lb-media { min-height: 0; max-height: 100%; display: grid; place-items: center; }
.lb-media { width: 100%; }
.lb-media img, .lb-media video { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: 8px; }
.lightbox figcaption { color: #e6efef; font-size: 0.9rem; max-width: 640px; text-align: center; padding: 0 8px; }
@media (max-width: 600px) { .lightbox[open] { grid-template-columns: 0 1fr 0; } .lightbox figure { padding: 0 8px 84px; } .lb-nav { position: fixed; bottom: 18px; } .lb-prev { left: 18px; } .lb-next { right: 18px; } }
.thumbs a, .bubble a[data-lightbox] { cursor: zoom-in; }

/* ---------------------------------------------------------------- calendário */
.calendar { display: grid; gap: 4px; }
.cal-head, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head span { text-align: center; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; padding: 2px 0; }
.cal-day { position: relative; min-height: 64px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; font: inherit; text-align: left; cursor: pointer; overflow: hidden; }
.cal-day:hover, .cal-day:focus-visible { border-color: var(--petroleo); outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--petroleo) 25%, transparent); }
.cal-day.out { background: transparent; opacity: 0.45; }
.cal-day.past:not(.today) .cal-num { color: var(--muted); }
.cal-day.today { border-color: var(--petroleo); border-width: 2px; }
.cal-day.today .cal-num { background: var(--petroleo); color: #fff; border-radius: 999px; padding: 0 6px; }
.cal-day.closed { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 6px, var(--bg) 6px, var(--bg) 12px); }
.cal-day.full { border-color: var(--coral); }
.cal-num { font-weight: 600; font-size: 0.9rem; line-height: 1.5; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); flex: none; }
.dot-aberto { background: var(--coral); }
.dot-confirmado { background: var(--petroleo); }
.dot-producao { background: #6b5bd2; }
.dot-pronto { background: #2e8b57; }
.dot-entregue { background: var(--muted); }
.cal-more { font-size: 0.7rem; color: var(--muted); font-weight: 600; }
.cal-prod { font-size: 0.68rem; color: var(--muted); }
.cal-flag { position: absolute; right: 4px; top: 6px; font-size: 0.62rem; color: var(--muted); text-transform: uppercase; }
.cal-day.full .cal-flag { color: #a2541a; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; align-items: center; }
.cal-legend span { display: inline-flex; gap: 5px; align-items: center; }
@media (max-width: 480px) {
  .cal-day { min-height: 52px; padding: 4px; }
  .dot { width: 7px; height: 7px; }
  .cal-flag { display: none; }
  .cal-prod { display: none; }
}
@media (min-width: 900px) { .cal-day { min-height: 92px; } .dot { width: 10px; height: 10px; } }

/* Popup genérico (detalhe do dia). */
.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.modal::backdrop { background: rgba(5, 15, 16, 0.55); }
.modal-close { position: absolute; right: 10px; top: 8px; border: 0; background: none; font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--muted); z-index: 1; }
.modal-body { padding: 18px 16px 16px; overflow-y: auto; max-height: calc(100vh - 48px); }
.day-detail { display: grid; gap: 10px; }
.day-detail header h2 { margin: 0 32px 2px 0; font-size: 1.15rem; color: var(--petroleo); }
.day-detail .order-line { margin-bottom: 0; }
.day-detail .who .muted { white-space: normal; overflow: visible; }

/* Faixa de "sem internet" (telas abertas) */
.offline-bar {
  position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 10px); z-index: 60;
  max-width: 640px; margin: 0 auto; display: flex; gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 14px; background: var(--petroleo); color: #fff;
  font-size: 0.9rem; line-height: 1.4; box-shadow: 0 8px 28px rgba(15, 82, 87, 0.28);
}
.offline-bar .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--coral);
  animation: offline-blink 1.2s ease-in-out infinite; }
.offline-bar.hidden { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .offline-bar { color: #0d1718; } }
@keyframes offline-blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .offline-bar .dot { animation: none; } }

/* ---------------------------------------------------------------- consumo de IA */
.consumo .period-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.consumo .segmented { flex-wrap: wrap; max-width: 100%; }
.consumo .segmented a { padding: 8px 12px; font-size: 0.92rem; }
.custom-period summary { cursor: pointer; color: var(--petroleo); font-size: 0.92rem; padding: 6px 0; }
.custom-period form { margin-top: 6px; }
.custom-period input[type="date"] { min-height: 38px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.custom-period label { display: inline-flex; gap: 6px; align-items: center; font-size: 0.9rem; }
.period-label { margin-top: -6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; box-shadow: var(--shadow); min-width: 0; }
.kpi span { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.kpi b { font-size: 1.45rem; line-height: 1.2; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi em { font-style: normal; font-size: 0.8rem; color: var(--muted); }
.kpi.main { border-color: color-mix(in srgb, var(--petroleo) 45%, var(--line)); }
.kpi.main b { color: var(--petroleo); }
.meter { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--petroleo) 12%, transparent); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--petroleo); }
.meter.near i { background: var(--coral); }
.meter.over i { background: var(--danger); }
.meter-label h3 { margin: 0; }
.bill-lines { margin: 0; display: grid; gap: 4px; }
.bill-lines div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.bill-lines dt { color: var(--muted); }
.bill-lines dd { margin: 0; font-variant-numeric: tabular-nums; }
.bill-lines .sum { border-bottom: 0; font-weight: 700; }
.bill-lines .sum dt { color: var(--text); }
.bill-lines .fore { border-bottom: 0; color: var(--muted); font-size: 0.9rem; }
.chart { position: relative; padding-top: 30px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .base { stroke: var(--line); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .mark { fill: var(--petroleo); }
.chart .bar { outline: none; cursor: default; }
.chart .bar:hover .mark, .chart .bar:focus .mark, .chart .bar.on .mark { fill: var(--petroleo-2); }
.chart .bar:focus-visible .hit { fill: color-mix(in srgb, var(--petroleo) 10%, transparent); }
.chart .axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.75rem; margin-top: 4px; font-variant-numeric: tabular-nums; }
.chart-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 0.8rem; padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 2; }
.table-view summary { cursor: pointer; color: var(--petroleo); font-size: 0.88rem; }
table.mini { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin-top: 6px; }
table.mini th, table.mini td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); }
table.mini th { color: var(--muted); font-weight: 600; font-size: 0.78rem; }
table.mini .num { text-align: right; font-variant-numeric: tabular-nums; }
.hbar { display: grid; gap: 4px; }
.hbar + .hbar { margin-top: 6px; }
.hbar .track { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--petroleo) 10%, transparent); overflow: hidden; }
.hbar .track i { display: block; height: 100%; min-width: 4px; border-radius: 0 4px 4px 0; background: var(--petroleo); }
.top-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.top-list li { padding-left: 2px; }
.top-list li > * { margin-right: 6px; }
.top-list a { color: var(--petroleo); text-decoration: none; font-weight: 600; }
.top-list a:hover { text-decoration: underline; }
.top-list strong { float: right; margin-right: 0; font-variant-numeric: tabular-nums; }
.media-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.media-stats div { display: grid; }
.media-stats b { font-size: 1.3rem; color: var(--petroleo); }
.media-stats span { color: var(--muted); font-size: 0.82rem; }

/* ---------------------------------------------------------------- pedir mais à secretária / retomar */
.ask-more { border-top: 1px dashed var(--line); padding-top: 8px; }
.ask-more summary { cursor: pointer; color: var(--petroleo); font-size: 0.92rem; font-weight: 500; }
.ask-more[open] summary { margin-bottom: 8px; }
.ask-more textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); resize: vertical; }
.ask-more .btn { justify-self: start; margin-top: 6px; }
.conv-actions { display: grid; gap: 8px; }
.conv-actions .ask-more { display: grid; gap: 6px; }
.order-row.pending, .order-line .tag-waiting { border-style: dashed; }

/* ---------------------------------------------------------------- aviso da conversa (fica junto das últimas mensagens) */
.conv-status { position: sticky; bottom: 0; z-index: 2; display: flex; gap: 10px; align-items: flex-start; margin-top: 6px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: 0 -4px 14px rgba(15, 82, 87, 0.08); }
.conv-status .ico { font-size: 1.1rem; line-height: 1.4; }
.conv-status .body { display: grid; gap: 4px; min-width: 0; }
.conv-status .detail { color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.conv-status form { margin-top: 2px; }
.conv-status.lvl-error { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.conv-status.lvl-warn { border-color: var(--coral); background: color-mix(in srgb, var(--coral) 10%, var(--surface)); }
.conv-status.lvl-info { border-style: dashed; box-shadow: none; }
.conv-status.lvl-info strong { font-weight: 500; color: var(--muted); }


/* ---------------------------------------------------------------- falar com a secretária (cartão) */
.talk { display: grid; gap: 8px; border-top: 1px dashed var(--line); padding-top: 10px; }
.talk-title { color: var(--petroleo); font-size: 0.95rem; }
.talk .chips { gap: 6px; }
.chip.suggestion { text-align: left; white-space: normal; line-height: 1.3; padding: 8px 12px; border-color: color-mix(in srgb, var(--petroleo) 40%, var(--line)); }
.chip.suggestion:hover { background: color-mix(in srgb, var(--petroleo) 10%, var(--surface)); }
.talk-form { display: flex; gap: 8px; align-items: flex-end; }
.talk-form textarea { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface); resize: vertical; }
.talk .help { margin: 0; }
.decide-row { gap: 6px; }
fieldset.weekdays { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
fieldset.weekdays legend { padding: 0; margin-bottom: 4px; }
fieldset.weekdays .segmented-radio { display: grid; grid-template-columns: repeat(7, 1fr); justify-self: stretch; }
fieldset.weekdays .segmented-radio span { padding: 8px 0; text-align: center; border-left: 1px solid var(--line); }
fieldset.weekdays .segmented-radio label:first-child span { border-left: 0; }

/* Respostas do pedido (ficha) e o que falta perguntar (cartões) */
fieldset.answers { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
fieldset.answers legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
fieldset.answers label.missing input, fieldset.answers label.missing select { border-color: var(--coral); }
.facts dd.missing { color: var(--coral); font-weight: 600; }

/* ------------------------------------------------------------------ cartão de decisão (v0.2.14) */
.decision { display: grid; gap: 12px; padding: 16px; border-left: 4px solid var(--line); }
.decision.kind-price, .decision.kind-approval { border-left-color: var(--coral); }
.decision.kind-schedule { border-left-color: #2e9e6b; }
.decision.kind-handoff, .decision.kind-safety, .decision.kind-ai_failed { border-left-color: var(--danger); }
.decision > * { margin: 0; }
.decision .dc-head { display: grid; gap: 2px; margin: 0; }
.dc-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dc-when { margin-left: auto; font-size: 0.82rem; }
.dc-name { margin: 4px 0 0; font-size: 1.15rem; line-height: 1.25; }
.dc-sub { margin: 0; font-size: 0.9rem; }
.tag-schedule { background: color-mix(in srgb, #2e9e6b 18%, transparent); color: color-mix(in srgb, #2e9e6b 70%, var(--text)); }
.tag-price, .tag-approval { background: color-mix(in srgb, var(--coral) 22%, transparent); color: color-mix(in srgb, var(--coral) 60%, var(--text)); }

.flow-steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  font-size: 0.78rem; color: var(--muted); }
.flow-steps li { display: grid; gap: 4px; justify-items: start; position: relative; }
.flow-steps .dot { width: 100%; height: 4px; border-radius: 4px; background: var(--line); }
.flow-steps .step-done .dot { background: color-mix(in srgb, var(--petroleo) 55%, var(--line)); }
.flow-steps .step-current { color: var(--text); font-weight: 600; }
.flow-steps .step-current .dot { background: var(--coral); }

.decision .report { font-size: 1rem; line-height: 1.45; }
.decision .question { margin: 0; padding: 8px 12px; border-radius: 10px; font-weight: 600; color: var(--petroleo);
  background: color-mix(in srgb, var(--petroleo) 8%, var(--surface)); }

.dc-facts { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.dc-facts li { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); min-width: 0; }
.dc-facts li.wide { grid-column: 1 / -1; }
.dc-facts .k { font-size: 0.78rem; color: var(--muted); }
.dc-facts .v { font-weight: 600; overflow-wrap: anywhere; }
.dc-facts li.missing { border-color: color-mix(in srgb, var(--coral) 60%, var(--line));
  background: color-mix(in srgb, var(--coral) 10%, var(--surface)); }
.dc-facts li.missing .v { color: color-mix(in srgb, var(--coral) 60%, var(--text)); }
.answers-list summary { cursor: pointer; color: var(--petroleo); font-size: 0.9rem; }
.answers-list[open] summary { margin-bottom: 6px; }

.dc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.kind-schedule .dc-actions .btn { flex: 1 1 140px; min-height: 46px; font-size: 1rem; }
.kind-schedule .dc-actions .btn.primary { background: #2e9e6b; border-color: #2e9e6b; }
.secondary-actions { padding-top: 2px; }

.talk { display: grid; gap: 8px; border-top: 1px dashed var(--line); padding-top: 12px; }
.talk-form { display: grid; gap: 8px; }
.talk-form textarea { width: 100%; min-height: 64px; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; background: var(--surface); resize: vertical; font: inherit; }
.talk-form textarea:focus { outline: 2px solid color-mix(in srgb, var(--petroleo) 45%, transparent); outline-offset: 1px; }
.talk-bar { display: flex; gap: 8px; align-items: center; }
.talk-bar .send { margin-left: auto; }
.mic-status { font-size: 0.85rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.dictate { gap: 6px; }
.btn.dictate.on { background: var(--danger); border-color: var(--danger); color: #fff; animation: mic-pulse 1.2s ease-in-out infinite; }
.btn.dictate.busy { opacity: 0.7; cursor: progress; }
.talk-form.dictating textarea { border-color: var(--danger); }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 45%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { .btn.dictate.on { animation: none; } }
.dc-links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.9rem; border-top: 1px solid var(--line); padding-top: 10px; }
@media (min-width: 900px) {
  .cards { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); align-items: start; }
}

/* Microfone dos campos de conversa (secretária, Testar): o aviso "ouvindo" aparece sobre o campo */
.composer { position: relative; }
.composer .mic-status { position: absolute; left: 12px; bottom: calc(100% + 4px); font-size: 0.82rem;
  background: var(--surface); padding: 2px 8px; border-radius: 8px; pointer-events: none; }
.composer .mic-status:empty { display: none; }
.composer.dictating input[name=text] { border-color: var(--danger); }
.mic.on { background: var(--danger); }

/* ------------------------------------------------------------------ conversa (v0.2.15) */
.tag.st-alert { background: color-mix(in srgb, var(--danger) 16%, transparent); color: color-mix(in srgb, var(--danger) 80%, var(--text)); }
.tag.st-warn, .tag.lvl-warn { background: color-mix(in srgb, var(--coral) 22%, transparent); color: color-mix(in srgb, var(--coral) 60%, var(--text)); }
.tag.st-ok { background: color-mix(in srgb, #2e9e6b 18%, transparent); color: color-mix(in srgb, #2e9e6b 70%, var(--text)); }
.tag.tag-new { background: color-mix(in srgb, #5b6ee1 18%, transparent); color: color-mix(in srgb, #5b6ee1 70%, var(--text)); }
.filters { gap: 6px; margin-bottom: 10px; }
.filters .chip { text-decoration: none; color: inherit; }
.conversation { gap: 10px; }
.contact-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.contact-edit summary { list-style: none; }
.contact-edit summary::-webkit-details-marker { display: none; }
.contact-edit[open] { flex-basis: 100%; display: grid; gap: 10px; }
.contact-edit form { margin-top: 8px; }
.pause-for select { min-height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: inherit; padding: 0 8px; }
.talk-inline textarea { min-height: 42px; }
.conv-side { display: grid; gap: 8px; }
.conv-side summary { cursor: pointer; font-weight: 600; }
.plain-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.plain-list li { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.plain-list li .muted { flex-basis: 100%; }
.audio-preview { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); }
.audio-preview audio { flex: 1; min-width: 200px; }

/* ------------------------------------------------------------------ pedidos: navegação, quadro, incompletos */
.pedidos-nav { margin-bottom: 12px; flex-wrap: wrap; }
.kanban-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 8px; }
.kanban-filters input:not([type=checkbox]), .kanban-filters select { min-height: 38px; border: 1px solid var(--line);
  border-radius: 10px; padding: 0 10px; background: var(--surface); color: inherit; }
.kanban-filters input[name=q] { flex: 1 1 220px; }
.kanban-filters label.small { display: grid; gap: 2px; }
.kanban-filters .toggle { display: flex; align-items: center; gap: 6px; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 10px; overflow-x: auto;
  padding-bottom: 12px; align-items: start; scroll-snap-type: x proximity; }
.kanban-col { background: color-mix(in srgb, var(--petroleo) 5%, var(--bg)); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px; min-height: 120px; scroll-snap-align: start; transition: outline-color .15s; outline: 2px dashed transparent; }
.kanban-col.drop-target { outline-color: var(--petroleo); }
.kanban-col h3 { margin: 2px 4px 8px; font-size: 0.95rem; display: flex; justify-content: space-between; }
.kanban-col .count { color: var(--muted); font-weight: 500; }
.kanban-cards { display: grid; gap: 8px; }
.kanban-card { display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; cursor: grab; box-shadow: var(--shadow); }
.kanban-card.is-incomplete { border-left: 4px solid var(--coral); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card.moving { opacity: 0.6; cursor: progress; }
.kc-title { font-weight: 600; text-decoration: none; color: inherit; overflow-wrap: anywhere; }
.kc-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 0.85rem; }
.kc-move { font-size: 0.82rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: inherit;
  min-height: 30px; }
@media (hover: hover) and (pointer: fine) { .kc-move { opacity: 0.6; } .kanban-card:hover .kc-move { opacity: 1; } }
.incomplete { display: grid; gap: 6px; border-left: 4px solid var(--coral); }
.missing-line { margin: 0; color: color-mix(in srgb, var(--coral) 60%, var(--text)); }

/* ------------------------------------------------------------------ avisos */
.topbar .bell { position: relative; text-decoration: none; font-size: 1.2rem; padding: 6px; margin-left: auto; }
.topbar .bell .badge { position: absolute; top: -2px; right: -6px; }
.notice-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.notice a { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: inherit; text-decoration: none; }
.notice.unread a { border-left: 4px solid var(--coral); }
.notice:not(.unread) a { opacity: 0.8; }
fieldset.multi { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
fieldset.multi legend { padding: 0; margin-bottom: 4px; }
.multi-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 12px; }

/* ------------------------------------------------------------------ QR code do WhatsApp */
.qr-card { display: grid; gap: 10px; justify-items: start; }
.qr-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.qr-box { background: #fff; border-radius: 14px; padding: 12px; border: 1px solid var(--line); min-width: 260px; min-height: 120px;
  display: grid; place-items: center; }
.qr-box img { width: 260px; height: 260px; image-rendering: pixelated; }
.qr-box .muted { color: #555; }
.qr-ok { font-weight: 600; color: color-mix(in srgb, #2e9e6b 75%, var(--text)); }

/* ------------------------------------------------------------------ cartões compactos (v0.2.15) */
.cards { gap: 10px; }
.decision { gap: 8px; padding: 12px 14px; }
.decision .dc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.decision .dc-name { font-size: 1.02rem; }
.decision .dc-when { margin-left: auto; }
.decision .report { margin: 0; line-height: 1.4; }
.decision .report .question { display: inline; padding: 0; background: none; color: var(--petroleo); }
.decision .dc-facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; font-size: 0.9rem; }
.decision .dc-facts .missing { color: color-mix(in srgb, var(--coral) 60%, var(--text)); font-weight: 600; }
.decision .dc-facts .link { padding: 0; }
.decision .answers-list { border-top: 1px dashed var(--line); padding-top: 6px; }
.dc-bottom { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dc-bottom .talk-compact { flex: 1 1 320px; }
.dc-bottom .dc-actions { flex: 0 0 auto; }
.kind-schedule .dc-actions .btn { flex: 0 0 auto; min-height: 36px; font-size: 0.95rem; }
.dc-chat { margin-left: auto; }
.talk-compact { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; position: relative; }
.talk-compact textarea { flex: 1 1 140px; min-height: 38px; height: 38px; resize: none; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font: inherit; overflow: hidden; }
.talk-compact .mic-status { flex-basis: 100%; font-size: 0.8rem; }
.talk-compact .mic-status:empty { display: none; }
.talk-compact.dictating textarea { border-color: var(--danger); }
@media (min-width: 900px) { .cards { grid-template-columns: 1fr; max-width: 980px; } }

/* ------------------------------------------------------------------ conversa em duas colunas e quadro largo */
.conv-tools > summary { list-style: none; width: max-content; }
.conv-tools > summary::-webkit-details-marker { display: none; }
.conv-tools[open] { display: grid; gap: 10px; }
.conv-tools[open] > summary { margin-bottom: 2px; }
@media (min-width: 1100px) {
  .content:has(> .conversation) { max-width: 1240px; }
  .conversation { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    column-gap: 16px; }
  .conversation > .conv-top, .conversation > .contact-head { grid-column: 1 / -1; }
  .conversation > .conv-tools { grid-column: 2; grid-row: 3 / span 3; overflow-y: auto; min-height: 0; align-content: start; }
  .conversation > .conv-tools > summary { display: none; }
  .conversation > .messages { grid-column: 1; grid-row: 3; }
  .conversation > .audio-preview, .conversation > .composer { grid-column: 1; }
  .content:has(> .kanban-page) { max-width: none; }
}
.kanban-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.kanban-filters input[name=q] { flex: 1 1 260px; }
.kanban-filters select { flex: 0 1 220px; }
.kanban-filters .checks { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.9rem; align-items: center; }
.kanban-filters .checks label { display: flex; gap: 6px; align-items: center; }
.kanban-filters .checks input { width: 16px; height: 16px; min-height: 0; }

/* ------------------------------------------------------------------ conversa (v0.2.16) */
.conversation { display: flex; flex-direction: column; gap: 8px; }
.conv-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--line); flex: none; }
.conv-header .back { font-size: 1.6rem; line-height: 1; text-decoration: none; padding: 0 4px; }
.conv-header .who { flex: 1 1 220px; min-width: 0; display: grid; gap: 4px; }
.conv-header h2 { font-size: 1.2rem; overflow-wrap: anywhere; }
.state-switch { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who-answers { font-size: 0.85rem; color: var(--muted); }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 300px; max-width: min(92vw, 360px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.25);
  padding: 6px; }
.menu-pop form { display: grid; }
.menu-title { margin: 8px 10px 4px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.menu-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; text-align: left; border: 0; background: none;
  color: inherit; font: inherit; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
button.menu-item:hover, button.menu-item:focus-visible { background: color-mix(in srgb, var(--petroleo) 10%, var(--surface)); }
.pause-row { cursor: default; }
.pause-row .chip { padding: 4px 10px; }
.dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); width: min(92vw, 440px); padding: 18px; }
.dialog::backdrop { background: rgba(0,0,0,.45); }
.conv-side { display: flex; gap: 8px; flex-wrap: wrap; flex: none; }
.side-block { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: var(--surface); flex: 1 1 220px; }
.side-block > summary { cursor: pointer; font-weight: 600; font-size: 0.92rem; }
.side-block[open] > summary { margin-bottom: 6px; }
.composer-wrap { display: grid; gap: 6px; flex: none; }
.composer-mode { width: max-content; max-width: 100%; }
.composer-mode button { border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer; color: inherit; font: inherit; font-size: 0.88rem; }
.composer-mode button.active { background: var(--petroleo); color: #fff; }
.composer-wrap .composer { padding-top: 0; }
@media (max-width: 1099px) {
  .conversation > .conv-side { order: 2; }
  .conversation > .messages { order: 3; }
  .conversation > .composer-wrap { order: 4; }
  .conv-side .side-block { padding: 6px 10px; }
}
@media (min-width: 1100px) {
  .content:has(> .conversation) { max-width: 1240px; }
  .conversation { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: 16px; row-gap: 8px; }
  .conversation > .conv-header { grid-column: 1 / -1; grid-row: 1; }
  .conversation > .messages { grid-column: 1; grid-row: 2; }
  .conversation > .composer-wrap { grid-column: 1; grid-row: 3; }
  .conversation > .conv-side { grid-column: 2; grid-row: 2 / span 2; flex-direction: column; flex-wrap: nowrap; overflow-y: auto;
    min-height: 0; align-content: start; }
  .conversation > .conv-side .side-block { flex: none; }
}
.tag.pay-paid { background: color-mix(in srgb, #2e9e6b 18%, transparent); color: color-mix(in srgb, #2e9e6b 70%, var(--text)); }
.tag.pay-deposit { background: color-mix(in srgb, #5b6ee1 16%, transparent); color: color-mix(in srgb, #5b6ee1 70%, var(--text)); }
.tag.pay-unpaid { background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); }
/* Agenda, quadro e incompletos com a mesma largura */
.content:has(.pedidos-nav) { max-width: 1400px; }

/* ------------------------------------------------------------------ pesquisa nos ajustes */
.settings-search { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.settings-search input { flex: 1 1 260px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); padding: 0 14px;
  background: var(--surface); color: inherit; font: inherit; }
.settings-search-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.settings-search-form input[name=q] { flex: 1 1 260px; min-height: 40px; border-radius: 10px; border: 1px solid var(--line);
  padding: 0 12px; background: var(--surface); color: inherit; }
.settings-search-form select { min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: inherit; }
.settings-search-form .check { display: flex; gap: 6px; align-items: center; font-size: 0.9rem; }
.search-hit { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; }
.search-hit .hit-body { display: grid; gap: 2px; flex: 1; min-width: 0; }
.field-anchor { scroll-margin-top: 80px; border-radius: 12px; }
.field-anchor:target { outline: 2px solid var(--coral); outline-offset: 6px; animation: flash-target 2s ease-out; }
@keyframes flash-target { from { background: color-mix(in srgb, var(--coral) 18%, transparent); } to { background: transparent; } }
.plain-list a { color: var(--petroleo); text-decoration: none; font-weight: 600; }
.plain-list a:hover { text-decoration: underline; }
@media (max-width: 1099px) { .conv-header .state-switch { flex: 1 1 auto; } }
.kanban-jump { gap: 6px; margin: 4px 0 8px; align-items: center; }
.kanban-jump .chip { text-decoration: none; color: inherit; font-size: 0.85rem; white-space: nowrap; line-height: 1.3; }
.kanban-jump .chip.is-zero { opacity: 0.55; }
.kanban { grid-auto-columns: minmax(230px, 1fr); scroll-behavior: smooth; }
.kanban-col.is-empty { min-width: 0; }
.kanban-col:target { outline-color: var(--coral); }
@media (max-width: 700px) {
  .menu-pop { position: fixed; left: 12px; right: 12px; top: auto; bottom: 76px; max-width: none; min-width: 0;
    max-height: 70vh; overflow-y: auto; }
}
.settings .search-hit { display: flex; }
.settings .settings-search-form { display: flex; }
.settings-search-form .check input, .kanban-filters .checks input { width: 18px; height: 18px; min-height: 0; padding: 0; flex: none; }

/* ---- backup e configuração gerada por IA (v0.2.17) */
.callout { border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; }
.callout ul { margin: 0; padding-left: 18px; display: grid; gap: 2px; }
.callout code { font-size: 0.85em; }
.warn-box { background: var(--warn-bg); }
.error-box { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.error-box strong { color: var(--danger); }
.prompt-box { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem;
  line-height: 1.45; resize: vertical; min-height: 280px; }
.steps { padding-left: 20px; display: grid; gap: 4px; }

/* ---- tela de avisos (v0.2.21) */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.avisos-page { max-width: 860px; margin: 0 auto; display: grid; gap: 14px; }
.avisos-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.avisos-head .unread-count { color: var(--coral); }
.avisos-actions form { margin: 0; }
.btn.ghost { background: transparent; }
.avisos-filtros { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0; }
.avisos-filtros .segmented a { display: inline-flex; align-items: center; gap: 6px; }
.seg-count { background: var(--coral); color: #fff; border-radius: 999px; font-size: 0.75rem; padding: 0 7px; line-height: 1.5; }
.tipo-filtro select { min-width: 220px; }
.aviso-dia { display: grid; gap: 6px; }
.aviso-dia-titulo { margin: 4px 0 0; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.aviso-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.aviso { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: start; padding: 12px 12px 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); position: relative; }
.aviso::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: transparent; }
.aviso.is-new { box-shadow: var(--shadow); }
.aviso.is-new.lvl-urgent::before { background: var(--coral); }
.aviso.is-new.lvl-good::before { background: var(--petroleo); }
.aviso.is-new.lvl-info::before { background: var(--muted); }
.aviso:not(.is-new) { background: transparent; }
.aviso:not(.is-new) .aviso-titulo, .aviso:not(.is-new) .aviso-icone { opacity: 0.7; }
.aviso-icone { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem;
  background: color-mix(in srgb, var(--muted) 12%, transparent); }
.lvl-urgent .aviso-icone { background: color-mix(in srgb, var(--coral) 18%, transparent); }
.lvl-good .aviso-icone { background: color-mix(in srgb, var(--petroleo) 14%, transparent); }
.aviso-corpo { display: grid; gap: 3px; color: inherit; text-decoration: none; min-width: 0; }
.aviso-corpo:hover .aviso-link, .aviso-corpo:focus-visible .aviso-link { text-decoration: underline; }
.aviso-topo { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.aviso-titulo { font-weight: 600; overflow-wrap: anywhere; }
.aviso:not(.is-new) .aviso-titulo { font-weight: 500; }
.aviso-titulo .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); margin-right: 8px; vertical-align: middle; }
.aviso-texto { color: var(--muted); font-size: 0.92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.aviso-link { color: var(--petroleo); font-weight: 600; white-space: nowrap; }
.aviso-botoes { display: flex; gap: 6px; margin: 0; }
.aviso-botoes .icon-btn { width: 36px; height: 36px; font-size: 0.95rem; }
.aviso-botoes button[value="ler"]:hover { border-color: var(--petroleo); color: var(--petroleo); }
.avisos-vazio .big { font-size: 2.2rem; margin: 0 0 6px; }
@media (hover: hover) and (pointer: fine) {
  .aviso-botoes { opacity: 0.35; transition: opacity 0.15s; }
  .aviso:hover .aviso-botoes, .aviso:focus-within .aviso-botoes { opacity: 1; }
}
@media (max-width: 560px) {
  .aviso { grid-template-columns: 34px 1fr 34px; gap: 10px; padding: 12px 10px 12px 12px; }
  .aviso-icone { width: 34px; height: 34px; font-size: 1rem; }
  .aviso-topo { flex-direction: column; gap: 0; }
  .aviso-botoes { flex-direction: column; }
  .aviso-botoes .icon-btn { width: 34px; height: 34px; }
  .tipo-filtro, .tipo-filtro select { width: 100%; }
  .avisos-filtros .segmented { width: 100%; }
  .avisos-filtros .segmented a { flex: 1; justify-content: center; }
}
