:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1d2330;
  --muted: #667085;
  --border: #dfe3ea;
  --primary: #1f6feb;
  --primary-dark: #1557c0;
  --danger: #c62828;
  --ok: #1b873f;
  --warn-bg: #fff4e5;
  --wa-bg: #e7fbd8;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }
.hidden { display: none !important; }
.muted, .hint { color: var(--muted); }
.hint { font-size: .85rem; margin: .25rem 0 .75rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

.topbar {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem;
  padding: .9rem 1.5rem; background: #111827; color: #fff;
}
.status-pills { display: flex; gap: .5rem; flex-wrap: wrap; }
.pill { padding: .25rem .7rem; border-radius: 999px; font-size: .8rem; background: #374151; }
.pill.ok { background: var(--ok); }
.pill.bad { background: var(--danger); }

.tabs { display: flex; gap: .25rem; padding: .5rem 1.5rem 0; background: #fff; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs button {
  background: none; color: var(--muted); border: 0; border-bottom: 3px solid transparent;
  border-radius: 0; padding: .7rem 1rem; font-weight: 600; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }

main { padding: 1.25rem 1.5rem; max-width: 1300px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem; margin-bottom: 1rem; }
.card.warn { background: var(--warn-bg); border-color: #f5c27a; }
.narrow { max-width: 560px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.grid-2.tight { gap: .75rem; grid-template-columns: 1fr 1fr; }
.row-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.row-between h2 { margin: 0; }
.row-end { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.spaced { margin-top: 1.5rem; }
.row-start { display: flex; gap: .5rem; flex-wrap: wrap; }
.notice {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
  background: var(--warn-bg); border: 1px solid #f5c27a; border-radius: 8px; padding: .6rem .8rem; margin-bottom: .9rem; font-size: .875rem;
}
.notice.ok { background: #e8f5ec; border-color: #9fd3b0; }
.hint.ok { color: var(--ok); }
.hint.error { color: var(--danger); }

label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .75rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .65rem; font: inherit; font-weight: 400;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
label.check input, fieldset input { width: auto; margin: 0; display: inline-block; }
.filters input, .filters select { width: auto; margin: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
fieldset { border: 1px solid var(--border); border-radius: 6px; margin: 0 0 1rem; padding: .5rem .9rem; }
fieldset label { display: inline-flex; align-items: center; gap: .35rem; margin: .25rem 1rem .25rem 0; font-weight: 500; }

button {
  font: inherit; font-weight: 600; font-size: .875rem; cursor: pointer;
  padding: .55rem 1rem; border-radius: 6px; border: 1px solid var(--primary); background: var(--primary); color: #fff;
}
button:hover { background: var(--primary-dark); }
button:disabled { opacity: .6; cursor: progress; }
button.ghost { background: #fff; color: var(--text); border-color: var(--border); }
button.ghost:hover { background: var(--bg); }
button.danger { background: var(--danger); border-color: var(--danger); }
button.small { padding: .3rem .6rem; font-size: .8rem; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; }
.product { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.product.inactive .media img, .product.inactive .body { opacity: .5; }
.product .media img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--bg); display: block; }
.product .body { padding: .6rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.product .title { font-size: .85rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product .price { color: var(--ok); font-weight: 700; }
.product .old { color: var(--muted); text-decoration: line-through; font-size: .8rem; margin-left: .3rem; font-weight: 400; }
.product .meta { font-size: .75rem; color: var(--muted); }
.product .actions { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: auto; }
.tag { font-size: .7rem; padding: .1rem .45rem; border-radius: 4px; background: #eef2ff; color: #3730a3; align-self: flex-start; }

.product-grid > p { grid-column: 1 / -1; }

/* Barra de filtros */
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-bottom: .75rem; }
.toolbar > input { flex: 1 1 220px; margin: 0; }
.field-inline { display: flex; flex-direction: column; gap: .2rem; margin: 0; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.field-inline select { margin: 0; min-width: 120px; text-transform: none; letter-spacing: 0; color: var(--text); font-size: .875rem; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.chip {
  background: #fff; color: var(--muted); border: 1px solid var(--border); border-radius: 999px;
  padding: .3rem .85rem; font-size: .8rem; font-weight: 600;
}
.chip:hover { background: var(--bg); }
.chip[aria-pressed="true"] { background: #111827; border-color: #111827; color: #fff; }

/* Barra de seleção: fica grudada no topo enquanto rola a lista */
.select-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; flex-wrap: wrap; gap: .6rem;
  padding: .55rem .75rem; margin: 0 -.25rem .9rem; border-radius: 10px;
  background: var(--bg); border: 1px dashed var(--border); transition: background .15s, border-color .15s;
}
.select-bar.active { background: #111827; border: 1px solid #111827; color: #fff; }
.select-bar.active .select-page { color: #fff; }
.select-page { margin: 0; font-size: .85rem; font-weight: 600; }
.select-page input { width: 18px; height: 18px; accent-color: var(--primary); }
.sel-count { font-weight: 700; font-size: .85rem; }
.sel-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.sel-actions[hidden] { display: none; }
.select-bar.active button.ghost { background: transparent; color: #fff; border-color: #4b5563; }
.select-bar.active button.ghost:hover { background: #1f2937; }
#btn-delete-filter { margin-left: auto; }
#btn-delete-filter[hidden] { display: none; }
button.danger-outline { background: #fff; color: var(--danger); border-color: #f1b5b5; }
button.danger-outline:hover { background: #fdecec; }
button.link { background: none; border: 0; color: #93c5fd; text-decoration: underline; padding-inline: .3rem; }
button.link:hover { background: none; color: #fff; }

/* Cartão do produto: seleção e selos */
.product { position: relative; transition: box-shadow .15s, border-color .15s; }
.product.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.product .media { position: relative; }
.pick-wrap {
  position: absolute; top: .45rem; left: .45rem; z-index: 2; margin: 0;
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  background: rgb(255 255 255 / .92); box-shadow: 0 1px 3px rgb(0 0 0 / .25); cursor: pointer;
}
.pick-wrap input { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--primary); }
.badges { position: absolute; top: .45rem; right: .45rem; display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.badge { font-size: .7rem; font-weight: 700; padding: .15rem .45rem; border-radius: 5px; color: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .2); }
.badge.off { background: #e11d48; }
.badge.sent { background: var(--ok); }
.badge.paused { background: #6b7280; }
.tags { display: flex; gap: .3rem; flex-wrap: wrap; }
.tag.soft { background: #f3f4f6; color: var(--muted); }
.pager .gap { align-self: center; color: var(--muted); padding: 0 .2rem; }

/* Botão Enviar (verde WhatsApp) */
:root { --send: #16a34a; --send-dark: #15803d; }
button.send { background: var(--send); border-color: var(--send); color: #fff; }
button.send:hover { background: var(--send-dark); }
.select-bar button.send { padding-inline: 1rem; font-size: .85rem; }
.sel-actions .sep { width: 1px; align-self: stretch; background: #4b5563; margin: 0 .15rem; }

/* Janela de confirmação */
dialog.confirm { width: min(440px, 92vw); border-radius: 16px; box-shadow: 0 24px 60px rgb(0 0 0 / .3); }
dialog.confirm[open] { animation: pop .16s ease-out; }
dialog.confirm::backdrop { background: rgb(17 24 39 / .55); backdrop-filter: blur(2px); }
@keyframes pop { from { transform: translateY(8px) scale(.97); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.confirm[open] { animation: none; } }
.confirm-body { padding: 1.5rem 1.5rem 1.25rem; text-align: center; }
.confirm-icon {
  width: 52px; height: 52px; margin: 0 auto .85rem; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.35rem; font-weight: 800;
  background: #e0ebff; color: var(--primary);
}
dialog[data-tone="danger"] .confirm-icon { background: #fde8e8; color: var(--danger); }
dialog[data-tone="send"] .confirm-icon { background: #dcfce7; color: var(--send); }
.confirm-body h2 { font-size: 1.15rem; margin: 0 0 .4rem; }
#confirm-msg { margin: 0 0 1rem; color: var(--muted); font-size: .92rem; line-height: 1.45; overflow-wrap: anywhere; }
#confirm-msg:empty { display: none; }
#confirm-extra { text-align: left; }
#confirm-extra:empty { display: none; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1.1rem; }
.confirm-actions button { padding: .7rem 1rem; font-size: .92rem; border-radius: 10px; }
.type-confirm { font-size: .82rem; color: var(--muted); }
.type-confirm input { text-align: center; letter-spacing: .15em; font-weight: 700; text-transform: uppercase; }

.send-summary { background: var(--bg); border-radius: 10px; padding: .75rem .9rem; display: flex; flex-direction: column; gap: .55rem; font-size: .85rem; }
.summary-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin: 0; font-weight: 400; }
.summary-row strong { text-align: right; overflow-wrap: anywhere; }
.gap-field input { width: 90px; margin: 0; text-align: center; }
.warn-line { margin: 0; color: #9a5b00; font-size: .8rem; }
.summary-row.top { align-items: flex-start; }
.dest-list { list-style: none; margin: 0; padding: 0; text-align: right; font-weight: 600; max-height: 120px; overflow: auto; }
.dest-list li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

/* Telegram */
.tg-bot { display: flex; align-items: center; gap: .75rem; padding: .75rem; border-radius: 10px; background: #e8f4fd; border: 1px solid #b6dcf7; margin-bottom: 1rem; }
.tg-avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #229ed9; font-size: 1.3rem; }
.badge-ok { margin-left: auto; background: var(--ok); color: #fff; font-size: .72rem; font-weight: 700; padding: .2rem .55rem; border-radius: 99px; }
.warn-text { color: #9a5b00; }
.hint:empty { display: none; }
.howto { margin-top: 1rem; border: 1px solid var(--border); border-radius: 8px; padding: .6rem .8rem; font-size: .875rem; }
.howto summary { cursor: pointer; font-weight: 600; }
.howto ol { margin: .6rem 0 .3rem; padding-left: 1.2rem; line-height: 1.6; }
.howto code, .tg-steps code { background: var(--bg); padding: .05rem .3rem; border-radius: 4px; }
.tg-steps { font-size: .85rem; background: var(--bg); border-radius: 10px; padding: .7rem .9rem; margin-bottom: .9rem; }
.tg-steps p { margin: 0 0 .4rem; }
.tg-steps ul { margin: 0 0 .4rem; padding-left: 1.1rem; line-height: 1.55; }
.tg-steps.dim { opacity: .55; }
.inline-form { display: flex; gap: .5rem; margin-bottom: .9rem; }
.inline-form input { margin: 0; }
.tg-list { display: flex; flex-direction: column; gap: .45rem; }
.tg-list .empty { margin: .25rem 0; font-size: .875rem; }
.tg-chat { display: flex; align-items: center; gap: .5rem; border: 1px solid var(--border); border-radius: 10px; padding: .45rem .55rem; }
.tg-chat.on { border-color: #9fd3b0; background: #f4fbf6; }
.tg-chat-main { display: flex; align-items: center; gap: .6rem; flex: 1; min-width: 0; margin: 0; cursor: pointer; font-weight: 400; }
.tg-chat-main input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--ok); }
.tg-chat-icon { font-size: 1.15rem; }
.tg-chat-text { display: flex; flex-direction: column; min-width: 0; }
.tg-chat-text strong, .tg-chat-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .85rem; }
.tg-chat-text span { font-size: .75rem; }
.tg-chat-actions { display: flex; gap: .3rem; flex: none; }

/* Agendamento */
.agenda { max-width: 820px; }
.agenda-head { display: flex; flex-direction: column; gap: 1rem; }
.switch { display: flex; align-items: center; gap: .75rem; margin: 0; cursor: pointer; font-weight: 400; }
.switch > span:last-child { display: flex; flex-direction: column; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { position: relative; flex: none; width: 46px; height: 26px; border-radius: 99px; background: #cbd2dc; transition: background .15s; }
.switch-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--send); }
.switch input:checked + .switch-ui::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch.tiny .switch-ui { width: 36px; height: 20px; }
.switch.tiny .switch-ui::after { width: 14px; height: 14px; }
.switch.tiny input:checked + .switch-ui::after { transform: translateX(16px); }

.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.mode { margin: 0; cursor: pointer; font-weight: 400; }
.mode input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode-card { display: flex; flex-direction: column; gap: .25rem; height: 100%; padding: .85rem .95rem; border: 2px solid var(--border); border-radius: 12px; transition: border-color .15s, background .15s; }
.mode-card .muted { font-size: .8rem; line-height: 1.4; }
.mode-icon { font-size: 1.3rem; }
.mode input:checked + .mode-card { border-color: var(--primary); background: #f0f6ff; }
.mode input:focus-visible + .mode-card { outline: 2px solid var(--primary); outline-offset: 2px; }

.day-total { font-weight: 700; color: var(--send); font-size: .9rem; }

.timeline { position: relative; height: 34px; margin: .5rem 0 1.4rem; background: repeating-linear-gradient(90deg, var(--bg) 0 calc(100% / 24 - 1px), var(--border) calc(100% / 24 - 1px) calc(100% / 24)); border-radius: 8px; border: 1px solid var(--border); }
.tl-hour { position: absolute; bottom: -1.2rem; transform: translateX(-50%); font-size: .68rem; color: var(--muted); }
.tl-hour:first-child { transform: none; }
.tl-hour:last-child { transform: translateX(-100%); }
.tl-block { position: absolute; top: 5px; bottom: 5px; min-width: 4px; border-radius: 5px; background: var(--send); opacity: .85; }
.tl-block.clash { background: #f59e0b; }

.slot-list { display: flex; flex-direction: column; gap: .55rem; margin-bottom: 1rem; }
.slot-list .empty { margin: 0; font-size: .875rem; }
.slot { display: flex; align-items: flex-start; gap: .75rem; padding: .7rem .8rem; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.slot.off { background: var(--bg); }
.slot.off .slot-main { opacity: .55; }
.slot.clash { border-color: #f5c27a; }
.slot .switch { margin-top: 1.35rem; }
.slot-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .5rem; }
.slot-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
.slot-fields label { margin: 0; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.slot-fields input { margin-top: .2rem; font-size: .95rem; color: var(--text); }
.gap-input { display: flex; margin-top: .2rem; }
.gap-input input { margin: 0; border-radius: 6px 0 0 6px; min-width: 0; font-size: .95rem; color: var(--text); text-transform: none; }
.gap-input select { margin: 0; width: auto; border-left: 0; border-radius: 0 6px 6px 0; background: var(--bg); font-size: .85rem; color: var(--text); text-transform: none; letter-spacing: 0; padding-inline: .45rem; }
.unit-input { position: relative; display: block; }

/* Arte do Story */
dialog.story-dlg { width: min(900px, 96vw); border-radius: 16px; }
dialog.story-dlg::backdrop { background: rgb(17 24 39 / .6); }
.story-body { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 1.5rem; padding: 1.25rem; max-height: 92vh; overflow: auto; }
.story-preview { position: relative; aspect-ratio: 9 / 16; border-radius: 14px; overflow: hidden; background: #1f2937; box-shadow: 0 10px 30px rgb(0 0 0 / .25); }
.story-preview img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .2s; }
.story-preview img.loading { opacity: .35; }
.story-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: .9rem; }
.story-loading[hidden] { display: none; }
.story-side { display: flex; flex-direction: column; gap: .9rem; min-width: 0; }
.story-side h2 { margin: 0; }
#story-product { margin: -.5rem 0 0; font-size: .85rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
.story-themes { margin: 0; }
.theme-list { display: flex; flex-wrap: wrap; gap: .5rem; padding-top: .25rem; }
.theme { display: flex; align-items: center; gap: .5rem; background: #fff; color: var(--text); border: 2px solid var(--border); border-radius: 10px; padding: .35rem .7rem .35rem .4rem; }
.theme:hover { background: var(--bg); }
.theme[aria-pressed="true"] { border-color: var(--primary); background: #f0f6ff; }
.theme-swatch { width: 26px; height: 40px; border-radius: 6px; display: grid; place-items: end center; padding-bottom: 6px; }
.theme-swatch span { width: 14px; height: 5px; border-radius: 3px; }
.button-link {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; align-self: flex-start;
  padding: .6rem 1.1rem; border-radius: 8px; background: var(--primary); color: #fff; font-weight: 600; font-size: .9rem; text-decoration: none;
}
.button-link:hover { background: var(--primary-dark); }
.button-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.story-howto { background: var(--bg); border-radius: 12px; padding: .8rem .9rem; font-size: .85rem; }
.story-howto ol { margin: .4rem 0 .5rem; padding-left: 1.2rem; line-height: 1.55; }
.story-howto .hint { margin: .6rem 0 0; }
.copy-row { display: flex; gap: .4rem; }
.copy-row input { margin: 0; font-size: .8rem; }
@media (max-width: 700px) {
  .story-body { grid-template-columns: 1fr; }
  .story-preview { max-width: 300px; width: 100%; margin: 0 auto; }
}

/* Importação de CSV */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: .2rem; text-align: center;
  padding: 1.1rem .75rem; border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; font-weight: 400;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: #f0f6ff; }
.dropzone:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.dropzone strong { font-size: .9rem; }
.dropzone .muted { font-size: .78rem; }
.drop-icon { font-size: 1.5rem; }
.csv-files { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; max-height: 220px; overflow: auto; }
.csv-files:empty { display: none; }
/* Nome em cima, resultado embaixo: o nome do arquivo nunca fica espremido */
.csv-file {
  display: grid; grid-template-columns: 1.2rem minmax(0, 1fr) auto; column-gap: .45rem; row-gap: .05rem;
  align-items: center; padding: .4rem .5rem; border-radius: 8px; background: var(--bg); font-size: .8rem;
}
.csv-icon { grid-row: 1 / span 2; text-align: center; font-weight: 700; color: var(--muted); }
.csv-name { grid-column: 2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.csv-info { grid-column: 2; color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.csv-file > button { grid-column: 3; grid-row: 1 / span 2; }
.csv-file.ok { background: #e8f5ec; }
.csv-file.ok .csv-icon { color: var(--ok); }
.csv-file.erro { background: #fdecec; }
.csv-file.erro .csv-icon, .csv-file.erro .csv-info { color: var(--danger); }
.csv-file.importando { background: #eef4ff; }
.csv-file .small { padding: .1rem .4rem; }
.unit-input span { position: absolute; right: .65rem; top: 50%; transform: translateY(-40%); font-size: .8rem; text-transform: none; letter-spacing: 0; pointer-events: none; }
.unit-input input { padding-right: 2.6rem; }
.slot-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; font-size: .78rem; }
.slot-status { color: var(--ok); }
.slot-status.bad { color: #9a5b00; }
.slot > button { margin-top: 1.25rem; }

.days { display: flex; gap: .25rem; }
.day { width: 32px; height: 32px; padding: 0; border-radius: 50%; font-size: .78rem; background: #fff; color: var(--muted); border: 1px solid var(--border); }
.day:hover { background: var(--bg); }
.day[aria-pressed="true"] { background: #111827; color: #fff; border-color: #111827; }
.days.small .day { width: 26px; height: 26px; font-size: .7rem; }

.slot-add { display: flex; flex-direction: column; gap: .7rem; padding: .85rem; border: 2px dashed var(--border); border-radius: 12px; }
.slot-add > button { align-self: flex-start; }

@media (max-width: 640px) {
  .mode-pick { grid-template-columns: 1fr; }
  .slot { flex-wrap: wrap; }
  .slot .switch, .slot > button { margin-top: 0; }
  .slot-main { order: 3; flex-basis: 100%; }
  .slot > button { margin-left: auto; }
}

/* Painel de progresso do envio em lote */
.batch-panel {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 50; width: min(340px, calc(100vw - 2rem));
  background: #111827; color: #fff; border-radius: 14px; padding: .9rem 1rem; box-shadow: 0 12px 32px rgb(0 0 0 / .35);
}
.batch-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.batch-head button.ghost { background: transparent; color: #fca5a5; border-color: #4b5563; }
.batch-head button[hidden] { display: none; }
.batch-bar { height: 6px; background: #374151; border-radius: 99px; margin: .7rem 0 .5rem; overflow: hidden; }
.batch-bar span { display: block; height: 100%; width: 0; background: var(--send); border-radius: inherit; transition: width .4s; }
.batch-text { margin: 0; font-size: .8rem; color: #d1d5db; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-panel.done .batch-bar span { background: #60a5fa; }
.pager { display: flex; gap: .4rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }

.group-list { display: flex; flex-direction: column; gap: .4rem; max-height: 480px; overflow: auto; }
.group-list label { display: flex; align-items: center; gap: .55rem; margin: 0; font-weight: 500; padding: .35rem; border-radius: 6px; }
.group-list label:hover { background: var(--bg); }
.group-list input { width: auto; margin: 0; }

.qr img { width: 280px; max-width: 100%; height: auto; aspect-ratio: 1; display: block; margin: .5rem 0; }
.pairing { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: .5rem; }
.pairing-code { font: 700 1.8rem ui-monospace, Consolas, monospace; letter-spacing: .15em; margin: .75rem 0 0; }
.pairing-code:empty { display: none; }

.pill-btn { border: 0; color: #fff; font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; padding: .25rem .7rem; }
.pill-btn:hover { background: #4b5563; }

/* App instalado no iPhone: respeita o entalhe e a barra de início */
.topbar { padding-top: max(.9rem, env(safe-area-inset-top)); padding-left: max(1.5rem, env(safe-area-inset-left)); padding-right: max(1.5rem, env(safe-area-inset-right)); }
main { padding-bottom: max(1.25rem, env(safe-area-inset-bottom)); }
.batch-panel { bottom: max(1.25rem, env(safe-area-inset-bottom)); }
.toast { bottom: max(1.25rem, env(safe-area-inset-bottom)); }
/* Sem destaque azul ao tocar e sem seleção acidental de texto nos botões */
button, .chip, .day, .theme { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }

/* Tela de login */
.login-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; background: linear-gradient(160deg, #1e1b4b, #7c3aed); }
.login-box { width: min(360px, 100%); background: #fff; border-radius: 20px; padding: 2rem 1.5rem 1.5rem; text-align: center; box-shadow: 0 24px 60px rgb(0 0 0 / .3); }
.login-box h1 { font-size: 1.4rem; margin: .75rem 0 .25rem; color: var(--text); }
.login-box > p { margin: 0 0 1.25rem; }
.login-box form { text-align: left; }
.login-box button { width: 100%; padding: .8rem; font-size: 1rem; border-radius: 10px; }
.login-box input { font-size: 16px; padding: .75rem; }
.login-logo { border-radius: 18px; display: block; margin: 0 auto; }

/* Celular */
@media (max-width: 640px) {
  .topbar { padding: max(.7rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) .7rem max(1rem, env(safe-area-inset-left)); }
  .tabs { padding: .25rem .5rem 0; }
  .tabs button { padding: .65rem .7rem; }
  main { padding: .75rem; }
  .card { padding: .9rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .toolbar > input { flex-basis: 100%; }
  .field-inline { flex: 1 1 45%; }
  .field-inline select { min-width: 0; }
  #btn-delete-filter { margin-left: 0; }
  .sel-actions { width: 100%; }
  input, select, textarea { font-size: 16px; } /* evita zoom automático no iPhone */
  button { padding: .65rem 1rem; }
  button.small { padding: .45rem .6rem; }
}

.wa-bubble {
  background: var(--wa-bg); border-radius: 8px; padding: .8rem 1rem; white-space: pre-wrap; word-break: break-word;
  font-size: .9rem; line-height: 1.45; min-height: 3rem;
}

dialog { border: 0; border-radius: 12px; padding: 0; width: min(560px, 95vw); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog-body { padding: 1.25rem; max-height: 90vh; overflow: auto; }

.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); max-width: 90vw;
  background: #111827; color: #fff; padding: .7rem 1.1rem; border-radius: 8px; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); }
