:root {
  --ink: #08284c;
  --ink-2: #153a61;
  --teal: #08b8b3;
  --lime: #c8f21a;
  --blue: #2577e8;
  --paper: #ffffff;
  --soft: #f3f7fa;
  --line: #d6e1ea;
  --muted: #5d7086;
  --danger: #c24135;
  --shadow: 0 14px 34px rgba(8, 40, 76, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--soft); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.2rem;
  min-height: 72px;
  padding: 0.75rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.96);
}

.brand { display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; }
.brand-logo { display: block; width: auto; height: 42px; object-fit: contain; }
.header-copy { display: grid; gap: 0.08rem; }
.header-copy span { color: var(--muted); font-size: 0.82rem; }
.back-link { color: var(--ink); font-size: 0.88rem; font-weight: 750; }

.demo-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.demo-nav { padding: 1.5rem 1rem; border-right: 1px solid var(--line); background: var(--paper); }
.nav-label, .eyebrow { margin: 0 0 0.7rem; color: var(--muted); font-size: 0.73rem; font-weight: 800; text-transform: uppercase; }
.nav-button { width: 100%; padding: 0.78rem 0.85rem; border: 0; border-left: 3px solid transparent; color: var(--ink-2); background: transparent; text-align: left; font-weight: 700; }
.nav-button:hover { background: var(--soft); }
.nav-button.is-active { border-left-color: var(--teal); background: #e9fbfa; color: var(--ink); }
.nav-note { margin-top: 2rem; padding: 1rem; border: 1px solid var(--line); border-radius: 6px; background: var(--soft); }
.nav-note p { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }

.demo-main { min-width: 0; padding: clamp(1rem, 3vw, 2.25rem); }
.mobile-picker { display: none; }
.demo-banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.25rem; padding: 0.7rem 0.85rem; border: 1px solid #b9e7e4; border-radius: 6px; color: var(--muted); background: #effcfb; font-size: 0.85rem; }
.demo-banner span { margin-right: 0.45rem; color: #087d79; font-weight: 800; }
.reset-button { flex: 0 0 auto; padding: 0.42rem 0.65rem; border: 1px solid #87cfcb; border-radius: 4px; color: #086966; background: white; font-size: 0.76rem; font-weight: 800; }
.demo-panel { display: none; }
.demo-panel.is-active { display: block; }
.panel-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.25rem; margin-bottom: 1.5rem; }
.panel-heading h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.35rem); letter-spacing: 0; }
.panel-heading p:not(.eyebrow) { max-width: 720px; margin: 0.45rem 0 0; color: var(--muted); line-height: 1.55; }

.primary-button, .secondary-button { min-height: 42px; padding: 0.68rem 1rem; border-radius: 5px; font-weight: 800; }
.primary-button { border: 1px solid var(--ink); color: white; background: var(--ink); }
.primary-button:hover { background: var(--ink-2); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.45; }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: white; }
.wide { width: 100%; }

.toolbar { display: flex; gap: 0.8rem; align-items: end; margin-bottom: 1rem; }
label { display: grid; gap: 0.35rem; color: var(--muted); font-size: 0.78rem; font-weight: 750; }
input, select { min-height: 42px; padding: 0.58rem 0.7rem; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: white; }
input:focus, select:focus { outline: 3px solid rgba(8,184,179,0.18); border-color: var(--teal); }
.search-field { flex: 1; }

.summary-strip, .kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 6px; background: white; box-shadow: var(--shadow); }
.summary-item, .kpi { padding: 1rem; border-right: 1px solid var(--line); }
.summary-item:last-child, .kpi:last-child { border-right: 0; }
.summary-item span, .kpi span { display: block; color: var(--muted); font-size: 0.78rem; }
.summary-item strong, .kpi strong { display: block; margin-top: 0.25rem; font-size: 1.45rem; }
.kpi small { color: #11845d; font-weight: 700; }

.table-wrap { overflow-x: auto; margin-top: 1rem; border: 1px solid var(--line); border-radius: 6px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 0.82rem 0.9rem; border-bottom: 1px solid var(--line); text-align: left; font-size: 0.86rem; }
th { color: var(--muted); background: #f8fafc; font-size: 0.74rem; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.table-select { min-height: 34px; padding: 0.35rem 0.5rem; }
.priority { display: inline-block; padding: 0.2rem 0.45rem; border-radius: 4px; font-size: 0.74rem; font-weight: 800; background: #e8eff6; }
.priority.urgente { color: #99271e; background: #ffebe8; }
.priority.alta { color: #855100; background: #fff4d6; }

.period-control { min-width: 180px; }
.kpi-grid { margin-bottom: 1rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1rem; }
.chart-section, .ranking-section, .activity-log, .waiting-list, .cart-panel { padding: 1rem; border: 1px solid var(--line); border-radius: 6px; background: white; box-shadow: var(--shadow); }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.section-title h2 { margin: 0; font-size: 1rem; }
.section-title span { color: var(--muted); font-size: 0.75rem; }
.bar-chart { display: flex; align-items: end; gap: clamp(0.5rem, 2vw, 1.15rem); min-height: 260px; padding: 2rem 0.5rem 0.2rem; }
.bar-column { display: grid; grid-template-rows: 1fr auto; align-items: end; justify-items: center; gap: 0.5rem; flex: 1; height: 220px; }
.bar { width: min(48px, 78%); min-height: 8px; border-radius: 4px 4px 0 0; background: var(--teal); transition: height 240ms ease; }
.bar-column span { color: var(--muted); font-size: 0.72rem; }
.ranking-row { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.7rem; padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.ranking-row:last-child { border-bottom: 0; }
.ranking-row span { color: var(--muted); font-size: 0.78rem; }
.ranking-meter { grid-column: 1 / -1; height: 5px; overflow: hidden; background: #edf2f6; border-radius: 4px; }
.ranking-meter i { display: block; height: 100%; background: var(--blue); }

.automation-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr); gap: 1rem; }
.automation-list { border: 1px solid var(--line); border-radius: 6px; background: white; box-shadow: var(--shadow); }
.automation-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0 0.85rem; padding: 1rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.automation-row:last-child { border-bottom: 0; }
.automation-row input { position: absolute; opacity: 0; pointer-events: none; }
.automation-row > span:last-child { grid-column: 2; display: grid; gap: 0.25rem; }
.automation-row small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.switch { grid-row: 1; width: 42px; height: 24px; padding: 3px; border-radius: 12px; background: #b9c5cf; }
.switch::after { display: block; width: 18px; height: 18px; border-radius: 50%; content: ""; background: white; transition: transform 160ms ease; }
.automation-row input:checked + .switch { background: var(--teal); }
.automation-row input:checked + .switch::after { transform: translateX(18px); }
.log-entry { padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.log-entry:last-child { border-bottom: 0; }
.log-entry strong { display: block; font-size: 0.85rem; }
.log-entry span { color: var(--muted); font-size: 0.75rem; }
.empty-state { color: var(--muted); font-size: 0.85rem; line-height: 1.5; }

.queue-layout { display: grid; grid-template-columns: minmax(240px, 0.8fr) minmax(260px, 1fr) minmax(280px, 1.2fr); gap: 1rem; }
.now-serving { display: grid; place-items: center; min-height: 270px; padding: 1.5rem; color: white; background: var(--ink); border-radius: 6px; box-shadow: var(--shadow); text-align: center; }
.now-serving span { color: #b9d2ea; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.now-serving strong { font-size: clamp(3.4rem, 8vw, 5.8rem); }
.now-serving small { font-size: 1rem; }
.queue-control { align-self: start; padding: 1rem; border: 1px solid var(--line); border-radius: 6px; background: white; box-shadow: var(--shadow); }
.queue-metrics { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 1rem; }
.queue-metrics div { padding: 0.75rem; border-right: 1px solid var(--line); }
.queue-metrics div:last-child { border-right: 0; }
.queue-metrics span { display: block; color: var(--muted); font-size: 0.75rem; }
.queue-metrics strong { display: block; margin-top: 0.25rem; font-size: 1.45rem; }
.waiting-list ol { margin: 0.8rem 0 0; padding: 0; list-style: none; }
.waiting-list li { display: flex; justify-content: space-between; padding: 0.8rem 0; border-bottom: 1px solid var(--line); font-weight: 800; }
.waiting-list li span { color: var(--muted); font-size: 0.78rem; font-weight: 500; }

.catalog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 1rem; }
.catalog-products { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem; }
.product-tile { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: white; box-shadow: var(--shadow); }
.product-swatch { height: 90px; background: linear-gradient(135deg, #dff7f6, #f2f8fd); }
.product-swatch.blue { background: linear-gradient(135deg, #e7effc, #d8eaff); }
.product-swatch.lime { background: linear-gradient(135deg, #effad1, #f8fce9); }
.product-body { padding: 0.85rem; }
.product-body h3 { margin: 0; font-size: 0.95rem; }
.product-meta { display: flex; justify-content: space-between; margin: 0.35rem 0 0.8rem; color: var(--muted); font-size: 0.75rem; }
.product-body button { width: 100%; min-height: 38px; border: 1px solid var(--ink); border-radius: 5px; color: var(--ink); background: white; font-weight: 800; }
.product-body button:hover { color: white; background: var(--ink); }
.cart-total { min-width: 120px; text-align: right; }
.cart-total span { display: block; color: var(--muted); font-size: 0.75rem; }
.cart-total strong { font-size: 1.55rem; }
.cart-panel { align-self: start; position: sticky; top: 92px; }
.cart-row { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 0.8rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.cart-row span { color: var(--muted); font-size: 0.75rem; }
.cart-row button { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 4px; background: white; }
.cart-controls { display: flex; align-items: center; gap: 0.4rem; }
.cart-panel .wide { margin-top: 1rem; }
.order-confirmation { text-align: center; }
.order-confirmation > span { display: block; color: #11845d; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.order-confirmation > strong { display: block; margin: 0.55rem 0; font-size: 2rem; }
.order-confirmation p { margin: 0; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }

dialog { width: min(520px, calc(100% - 2rem)); padding: 0; border: 0; border-radius: 7px; box-shadow: 0 24px 70px rgba(8,40,76,0.25); }
dialog::backdrop { background: rgba(8,40,76,0.5); }
dialog form { display: grid; gap: 1rem; padding: 1.25rem; }
.dialog-heading, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; }
.dialog-heading h2 { margin: 0; }
.close-button { border: 0; color: var(--muted); background: transparent; font-size: 1.7rem; }
.dialog-actions { justify-content: flex-end; }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; max-width: min(380px, calc(100% - 2rem)); padding: 0.8rem 1rem; border-radius: 5px; color: white; background: var(--ink); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: 180ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .demo-layout { grid-template-columns: 1fr; }
  .demo-nav { display: none; }
  .mobile-picker { display: grid; margin-bottom: 1rem; }
  .dashboard-grid, .automation-layout, .catalog-layout { grid-template-columns: 1fr; }
  .queue-layout { grid-template-columns: 1fr 1fr; }
  .waiting-list { grid-column: 1 / -1; }
  .cart-panel { position: static; }
}

@media (max-width: 680px) {
  .app-header { grid-template-columns: auto minmax(0, 1fr); gap: 0.75rem; padding: 0.65rem 0.8rem; }
  .brand-logo { max-width: 105px; height: 34px; }
  .header-copy { min-width: 0; }
  .header-copy strong { font-size: 0.86rem; line-height: 1.2; }
  .header-copy span, .back-link { display: none; }
  .demo-main { padding: 1rem; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .demo-banner { align-items: stretch; flex-direction: column; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .summary-strip, .kpi-grid { grid-template-columns: 1fr 1fr; }
  .summary-item:nth-child(2), .kpi:nth-child(2) { border-right: 0; }
  .summary-item:nth-child(-n+2), .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .queue-layout { grid-template-columns: 1fr; }
  .waiting-list { grid-column: auto; }
  .catalog-products { grid-template-columns: 1fr 1fr; }
  .bar-chart { gap: 0.3rem; }
}

@media (max-width: 430px) {
  .catalog-products { grid-template-columns: 1fr; }
  .summary-strip, .kpi-grid { grid-template-columns: 1fr; }
  .summary-item, .kpi { border-right: 0; border-bottom: 1px solid var(--line); }
  .summary-item:last-child, .kpi:last-child { border-bottom: 0; }
}
