/* Painel administrativo */
body { background: #f4ebe1; }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(700px 500px at 0% 0%, var(--latte), transparent 60%), radial-gradient(600px 400px at 100% 100%, rgba(138, 92, 69, 0.35), transparent 60%), var(--cream); }
.login__card { width: min(400px, 100%); background: var(--paper); border-radius: 28px; padding: 32px 26px; box-shadow: var(--shadow); display: grid; gap: 14px; text-align: center; }
.login__card .field { text-align: left; }
.login__logo { margin: -74px auto 0; border-radius: 50%; box-shadow: 0 0 0 6px var(--paper), var(--shadow); }
.login h1 { margin: 0 0 6px; font-size: 2.6rem; color: var(--choc); line-height: 1; }
.login__demo { background: var(--sand); padding: 8px 12px; border-radius: 12px; }

/* Shell */
.app { display: grid; min-height: 100dvh; }
@media (min-width: 960px) { .app { grid-template-columns: 248px 1fr; } }
.side { display: none; }
@media (min-width: 960px) {
  .side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100dvh; overflow-y: auto; padding: 20px 14px; background: var(--espresso); color: var(--latte); }
}
.side__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px 8px 12px; }
.side__brand img { border-radius: 50%; box-shadow: 0 0 0 2px var(--latte); }
.side__brand span { display: grid; line-height: 1; }
.side__brand b { font-family: var(--f-display); text-transform: uppercase; letter-spacing: 0.05em; color: var(--paper); font-weight: 600; }
.side__brand small { font-family: var(--f-script); font-size: 1.15rem; color: var(--caramel); }
.side__nav { display: grid; gap: 2px; }
.side__nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-decoration: none; font-weight: 700; color: var(--latte); transition: background 0.2s, color 0.2s; }
.side__nav a:hover { background: rgba(255, 255, 255, 0.06); color: var(--paper); }
.side__nav a[aria-current='page'] { background: var(--paper); color: var(--espresso); }
.side__nav .pill { margin-left: auto; }
.side__foot { margin-top: auto; display: grid; gap: 10px; }
.mode { font-size: 0.75rem; font-weight: 800; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); text-align: center; }
.mode--demo { color: var(--honey); } .mode--live { color: #9fd18b; }
.pill { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--berry); color: #fff; font-size: 0.75rem; display: inline-grid; place-items: center; }

.main { min-width: 0; padding: 0 16px 100px; }
@media (min-width: 960px) { .main { padding: 0 32px 48px; } }
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0 12px; background: linear-gradient(#f4ebe1 75%, rgba(244, 235, 225, 0)); }
.bar__date { margin: 0; font-size: 0.82rem; color: var(--ink-soft); font-weight: 700; text-transform: capitalize; }
.bar__title { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: clamp(1.5rem, 4vw, 2rem); color: var(--choc); line-height: 1.1; }
.bar__actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 480px) { #newOrderBtn span { display: none; } #newOrderBtn { padding: 0; width: 42px; } }
.view { display: grid; gap: 18px; animation: fadein 0.35s var(--ease); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

.tabbar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--espresso); padding: 6px 4px max(6px, env(safe-area-inset-bottom)); }
.tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; color: var(--latte); text-decoration: none; font-size: 0.7rem; font-weight: 700; background: none; border: 0; border-radius: 12px; }
.tabbar a[aria-current='page'] { color: var(--paper); background: rgba(255, 255, 255, 0.1); }
.tabbar svg { width: 22px; height: 22px; }
@media (min-width: 960px) { .tabbar { display: none; } }

/* Painéis */
.panel { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); min-width: 0; }
@media (min-width: 720px) { .panel { padding: 22px; } }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel__head h2 { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: 1.15rem; color: var(--choc); }
.panel__head p { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.cols { display: grid; gap: 18px; }
@media (min-width: 1100px) { .cols--2 { grid-template-columns: 1.6fr 1fr; } .cols--even { grid-template-columns: 1fr 1fr; } }
.greet { font-family: var(--f-script); font-size: 2.2rem; color: var(--choc); margin: 0; line-height: 1; }

/* KPIs */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); display: grid; gap: 4px; position: relative; overflow: hidden; }
.kpi__label { font-size: 0.8rem; font-weight: 800; color: var(--ink-soft); display: flex; gap: 6px; align-items: center; }
.kpi__label svg { width: 16px; height: 16px; color: var(--cocoa); }
.kpi__value { font-family: var(--f-display); font-weight: 600; font-size: clamp(1.35rem, 3.4vw, 1.85rem); color: var(--choc); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi__sub { font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.kpi--dark { background: var(--choc); } .kpi--dark .kpi__value { color: var(--paper); } .kpi--dark .kpi__label, .kpi--dark .kpi__label svg { color: var(--latte); } .kpi--dark .kpi__sub { color: var(--caramel); }
.up { color: var(--leaf) !important; } .down { color: #b44d42 !important; }

/* Gráficos */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--f-body); font-size: 11px; fill: var(--ink-soft); }
.chart .grid line { stroke: var(--line); }
.chart rect.bar { transition: opacity 0.2s; }
.chart g.col:hover rect { opacity: 0.8; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.8rem; font-weight: 700; color: var(--ink-soft); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: grid; grid-template-columns: 130px 1fr; gap: 16px; align-items: center; }
.donut-wrap ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 0.9rem; }
.donut-wrap li { display: flex; align-items: center; gap: 8px; } .donut-wrap li b { margin-left: auto; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chart-tip { position: fixed; z-index: 90; pointer-events: none; background: var(--espresso); color: var(--paper); padding: 8px 10px; border-radius: 10px; font-size: 0.8rem; box-shadow: var(--shadow); white-space: nowrap; }

/* Listas de pedidos */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar .input, .toolbar .select { min-height: 40px; width: auto; flex: 1 1 180px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips .chip { flex: none; }
.chip .n { background: rgba(255, 255, 255, 0.25); border-radius: 99px; padding: 0 6px; font-size: 0.72rem; }
.chip[aria-pressed='false'] .n { background: rgba(91, 53, 34, 0.1); }

.board { display: grid; gap: 14px; grid-auto-flow: column; grid-auto-columns: minmax(270px, 86vw); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 10px; }
@media (min-width: 960px) { .board { grid-auto-columns: minmax(272px, 1fr); } }
.col { background: rgba(255, 250, 244, 0.6); border-radius: var(--radius); padding: 10px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; min-height: 160px; border: 1.5px dashed transparent; transition: border-color 0.2s, background 0.2s; }
.col.drop { border-color: var(--caramel); background: rgba(227, 199, 167, 0.35); }
.col__head { display: flex; align-items: center; gap: 8px; font-family: var(--f-display); font-weight: 600; color: var(--choc); padding: 4px 6px; }
.col__head .n { margin-left: auto; font-size: 0.8rem; color: var(--ink-soft); }
.col__empty { color: var(--muted); font-size: 0.85rem; text-align: center; padding: 16px 8px; }

.ocard { background: var(--surface); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-sm); display: grid; gap: 8px; border-left: 4px solid var(--st, var(--latte)); cursor: grab; }
.ocard:active { cursor: grabbing; }
.ocard.dragging { opacity: 0.5; }
.ocard.fresh { animation: fresh 1.6s var(--ease) 2; }
@keyframes fresh { 50% { box-shadow: 0 0 0 4px var(--berry-soft); } }
.ocard__top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.ocard__code { font-family: var(--f-display); font-weight: 600; color: var(--choc); letter-spacing: 0.04em; }
.ocard__time { font-size: 0.75rem; color: var(--muted); font-weight: 700; margin-left: auto; }
.ocard__who { font-weight: 800; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ocard ul { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; color: var(--ink-soft); }
.ocard__notes { font-size: 0.82rem; background: var(--sand); border-radius: 8px; padding: 6px 8px; color: var(--choc); }
.ocard__foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.ocard__foot .btn { margin-left: auto; }
.ocard { min-width: 0; }
.ocard__total { font-weight: 800; color: var(--choc); margin-right: auto; font-variant-numeric: tabular-nums; }
.ch { font-size: 0.68rem; font-weight: 800; padding: 2px 7px; border-radius: 99px; background: var(--sand); color: var(--cocoa); text-transform: uppercase; letter-spacing: 0.04em; }
.ch--whatsapp, .ch--grupo { background: #dcf1e2; color: #22783f; }
.ch--web { background: var(--berry-soft); color: #9a3f35; }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.t { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 560px; }
.t th { text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 800; padding: 8px 10px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t tfoot td { font-weight: 800; border-top: 1.5px solid var(--line); }
.prod-cell { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.prod-cell img { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.mbar-cell { position: relative; min-width: 90px; }
.mbar-cell span { position: absolute; left: 0; top: 50%; height: 8px; transform: translateY(-50%); border-radius: 99px; background: var(--latte); }

.marg { font-weight: 800; padding: 2px 8px; border-radius: 99px; font-size: 0.8rem; }
.marg--good { background: #e2efd9; color: #48652f; } .marg--ok { background: #f6e7c8; color: #8a6116; } .marg--bad { background: var(--berry-soft); color: #9a3f35; }

/* Produtos */
.pgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.pcard { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.pcard.off { opacity: 0.6; }
.pcard__img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; background: var(--sand); }
.pcard__body { padding: 14px; display: grid; gap: 8px; }
.pcard__body h3 { margin: 0; font-family: var(--f-display); font-weight: 600; color: var(--choc); font-size: 1.05rem; display: flex; gap: 6px; align-items: center; }
.pcard__nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; text-align: center; background: var(--paper); border-radius: 12px; padding: 8px 4px; }
.pcard__nums small { display: block; font-size: 0.68rem; color: var(--muted); font-weight: 800; text-transform: uppercase; }
.pcard__nums b { font-variant-numeric: tabular-nums; color: var(--choc); }
.pcard__actions { display: flex; gap: 6px; align-items: center; }
.pcard__actions .btn { flex: 1; }
.star { color: var(--latte); } .star.on { color: var(--honey); } .star.on svg { fill: var(--honey); }

/* Switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; font-size: 0.92rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 42px; height: 24px; border-radius: 99px; background: var(--latte); position: relative; transition: background 0.2s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); box-shadow: var(--shadow-sm); }
.switch input:checked + i { background: var(--leaf); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 3px solid var(--berry); outline-offset: 2px; }

/* Forms no modal */
.form { display: grid; gap: 14px; }
.form .row { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form .row .field, .form .row .input { min-width: 0; }
.form .row3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 480px) { .form .row3 { grid-template-columns: 1fr 1fr; } }
.form__actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
/* Janela que passa da altura da tela rola por dentro (a do pedido, a do cupom e a da campanha passam no celular). */
.modal { max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal--wide { width: min(720px, calc(100vw - 32px)); }
.modal__x { float: right; margin: -10px -10px 0 0; }
.preview-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: var(--sand); border-radius: 14px; padding: 12px; text-align: center; }
.preview-box small { display: block; font-size: 0.72rem; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; }
.preview-box b { font-family: var(--f-display); font-size: 1.2rem; color: var(--choc); font-weight: 600; }
.img-pick { display: grid; grid-template-columns: 88px 1fr; gap: 12px; align-items: center; }
.img-pick img { width: 88px; height: 88px; border-radius: 14px; object-fit: cover; background: var(--sand); }
.mline { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }

/* Produção */
.prod-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.prod-item { background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow-sm); display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; }
.prod-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 14px; }
.prod-item h3 { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: 1rem; color: var(--choc); }
.prod-item small { color: var(--ink-soft); font-size: 0.8rem; }
.prod-item .qty { font-family: var(--f-display); font-size: 2rem; font-weight: 600; color: var(--choc); }
.prod-item details { grid-column: 1 / -1; font-size: 0.85rem; color: var(--ink-soft); }
.prod-item summary { cursor: pointer; font-weight: 700; color: var(--cocoa); }

/* Novidades */
.nlist { display: grid; gap: 10px; }
.nitem { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px; border-radius: 14px; background: var(--paper); }
.nitem img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--sand); }
.nitem h3 { margin: 0; font-size: 1rem; font-family: var(--f-display); font-weight: 600; color: var(--choc); }
.nitem p { margin: 2px 0 6px; font-size: 0.88rem; color: var(--ink-soft); }
.nitem__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.nitem__meta .icon-btn { width: 32px; height: 32px; }
.nitem__meta .actions { margin-left: auto; display: flex; gap: 2px; }

/* Simulador WhatsApp */
.phone-sim { width: 100%; max-width: 380px; margin: 0 auto; border-radius: 32px; background: #1b1310; padding: 10px; box-shadow: var(--shadow); }
.phone-sim__screen { border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; height: 560px; background: #efe5d8; }
.phone-sim__head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--choc); color: var(--paper); }
.phone-sim__head img { border-radius: 50%; }
.phone-sim__head b { display: block; font-size: 0.92rem; } .phone-sim__head small { font-size: 0.72rem; color: var(--latte); }
.phone-sim__head select { margin-left: auto; background: rgba(255, 255, 255, 0.12); border: 0; color: var(--paper); border-radius: 8px; font-size: 0.75rem; padding: 4px; }
.phone-sim__head select option { color: var(--ink); }
.msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px;
  background-image: radial-gradient(rgba(91, 53, 34, 0.07) 1px, transparent 1px); background-size: 16px 16px; }
.msg { max-width: 85%; padding: 7px 10px 8px; border-radius: 12px; font-size: 0.86rem; line-height: 1.38; white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06); animation: pop 0.2s var(--ease); }
.msg--in { align-self: flex-start; background: #fff; border-top-left-radius: 4px; }
.msg--out { align-self: flex-end; background: #dcf1d0; border-top-right-radius: 4px; }
.msg--sys { align-self: center; background: rgba(255, 255, 255, 0.7); font-size: 0.75rem; color: var(--ink-soft); }
.msg b { font-weight: 800; } .msg em { font-style: italic; }
.composer { display: flex; gap: 6px; padding: 8px; background: #f6efe6; }
.composer input { flex: 1; border: 0; border-radius: 99px; padding: 10px 14px; background: #fff; min-width: 0; }
.composer button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--choc); color: #fff; display: grid; place-items: center; cursor: pointer; }
.quick { display: flex; gap: 6px; overflow-x: auto; padding: 0 8px 8px; background: #f6efe6; scrollbar-width: none; }
.quick button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 10px; font-size: 0.75rem; font-weight: 700; cursor: pointer; }

.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 0.92rem; color: var(--ink-soft); }
.steps-list code, .codeline { background: var(--sand); padding: 2px 6px; border-radius: 6px; font-size: 0.85em; color: var(--choc); word-break: break-all; }
.status-line { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.92rem; }
.status-line .dot { width: 9px; height: 9px; }
.empty { text-align: center; color: var(--ink-soft); padding: 28px 12px; }
.empty .script { font-size: 1.8rem; color: var(--choc); display: block; }

/* Menu "mais" */
.more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.more-grid a, .more-grid button { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface); text-decoration: none; font-weight: 800; color: var(--choc); border: 0; cursor: pointer; box-shadow: var(--shadow-sm); }

@media print {
  .side, .tabbar, .bar__actions, .no-print { display: none !important; }
  body { background: #fff; }
  .app { display: block; }
  .main { padding: 0; }
  .panel, .prod-item { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
/* Tamanho natural (6 px por módulo): reduzir o QR com pixelated deixa os módulos desiguais e a câmera não lê. */
.bot-qr { display: block; width: auto; max-width: 100%; height: auto; margin: 12px auto 4px; padding: 10px; background: #fff; border-radius: 14px; image-rendering: pixelated; }
.bot-code { margin: 14px 0 6px; text-align: center; font-family: var(--f-display); font-size: 2.2rem; font-weight: 600; letter-spacing: 0.12em; color: var(--choc); }
.camp { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.camp:last-child { border-bottom: 0; }
.camp__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.camp__head h3 { margin: 0; font-family: var(--f-display); font-size: 1.05rem; color: var(--choc); }
.camp .hint, .camp__nums { margin: 0; }
.camp__nums { font-size: 0.9rem; color: var(--ink-soft); }
.camp__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.camp__list { margin: 8px 0 0; padding-left: 18px; max-height: 220px; overflow: auto; font-size: 0.88rem; }
.camp__list small { color: var(--ink-soft); }
.progress { height: 8px; border-radius: 99px; background: var(--sand); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--leaf); border-radius: inherit; transition: width 0.4s; }
.aud summary { cursor: pointer; font-weight: 800; color: var(--choc); }
.aud__list { display: grid; gap: 4px; max-height: 220px; overflow: auto; margin-top: 8px; font-size: 0.9rem; }
.aud__list small { color: var(--ink-soft); }
.preview-msg { max-width: none; }
