:root {
  color-scheme: light;
  --bg: #fffdf8;
  --surface: #f5f1e9;
  --surface-strong: #ede7da;
  --fg: #191816;
  --muted: #6f6c65;
  --faint: #9a968c;
  --border: rgba(25, 24, 22, 0.14);
  --border-strong: rgba(25, 24, 22, 0.26);
  --accent: #9f2721;
  --accent-deep: #741b17;
  --accent-hover: oklch(0.52 0.17 30);
  --accent-press: oklch(0.41 0.14 30);
  --on-accent: #fffdf8;
  --olive: #596047;
  --olive-deep: #3f4a2e;
  --olive-bg: oklch(0.935 0.02 108);
  --danger-ink: oklch(0.36 0.15 28);
  --danger-bg: oklch(0.945 0.02 30);
  --warn-ink: oklch(0.46 0.1 72);
  --warn-bg: oklch(0.945 0.03 72);
  --neutral-bg: oklch(0.96 0.008 87);
  --success-bg: var(--olive-bg);
  --shadow-sm: 0 1px 2px rgba(25, 24, 22, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(25, 24, 22, 0.22);
  --topbar-bg: rgba(255, 253, 248, 0.88);
  --radius: 8px;
  --radius-lg: 12px;
  --font-display: "Manrope", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: oklch(0.168 0.009 78);
  --surface: oklch(0.212 0.011 78);
  --surface-strong: oklch(0.252 0.013 78);
  --fg: oklch(0.93 0.009 78);
  --muted: oklch(0.715 0.012 78);
  --faint: oklch(0.585 0.012 78);
  --border: rgba(255, 253, 248, 0.14);
  --border-strong: rgba(255, 253, 248, 0.27);
  --accent: oklch(0.645 0.15 30);
  --accent-deep: oklch(0.585 0.14 30);
  --accent-hover: oklch(0.6 0.14 30);
  --accent-press: oklch(0.55 0.14 30);
  --on-accent: oklch(0.2 0.02 78);
  --olive: oklch(0.68 0.085 108);
  --olive-deep: oklch(0.745 0.09 108);
  --olive-bg: oklch(0.29 0.03 108);
  --danger-ink: oklch(0.735 0.12 28);
  --danger-bg: oklch(0.29 0.045 30);
  --warn-ink: oklch(0.78 0.1 72);
  --warn-bg: oklch(0.3 0.045 72);
  --neutral-bg: oklch(0.28 0.01 80);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.62);
  --topbar-bg: rgba(22, 20, 18, 0.86);
}

* {
  box-sizing: border-box;
}
html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  cursor: pointer;
}
svg {
  display: block;
}
img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
}

/* ---------- App shell ---------- */

.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.content {
  padding: 28px 32px 56px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Sidebar ---------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 20px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  display: block;
  flex: none;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.brand-mark svg {
  width: 19px;
  height: 19px;
}
.brand-word {
  display: grid;
  line-height: 1;
}
.brand-word b {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-word span {
  margin-top: 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--muted);
  text-transform: uppercase;
}
.nav {
  display: grid;
  gap: 3px;
  margin-top: 8px;
}
.nav-label {
  padding: 0 10px;
  margin: 10px 0 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.16s, color 0.16s;
}
.nav-link svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.nav-link:hover {
  background: var(--surface);
  color: var(--fg);
}
.nav-link.active {
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  position: relative;
}
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-link .nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
}
.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: grid;
  gap: 10px;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius);
}
.user-card:hover {
  background: var(--surface);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  flex: none;
}
.user-card .u-name {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
}
.user-card .u-role {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.2;
}
.logout-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.logout-link svg {
  width: 17px;
  height: 17px;
}
.logout-link:hover {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 68px;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
}
.topbar .page-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.topbar .page-crumb {
  font-size: 12px;
  color: var(--faint);
  margin-top: 1px;
}
.topbar-spacer {
  flex: 1;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}
.search-box input {
  width: 220px;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
}
.search-box input::placeholder {
  color: var(--faint);
}
.search-box input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: background 0.16s, color 0.16s;
}
.icon-btn svg {
  width: 19px;
  height: 19px;
}
.icon-btn:hover {
  background: var(--surface);
  color: var(--fg);
}
.icon-btn .dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  border: 1.5px solid var(--bg);
}
.unit-select {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
}
.unit-select svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.unit-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Dropdown (notificações) */
.popover {
  position: absolute;
  top: 48px;
  right: 0;
  width: 320px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: none;
  z-index: 60;
}
.popover.open {
  display: block;
}
.popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 10px;
}
.popover-head strong {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
}
.notif-item:hover {
  background: var(--surface);
}
.notif-item .notif-ico {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--neutral-bg);
  color: var(--muted);
  display: grid;
  place-items: center;
  flex: none;
}
.notif-item .notif-ico svg {
  width: 15px;
  height: 15px;
}
.notif-item.warn .notif-ico {
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.notif-item p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
}
.notif-item p b {
  font-weight: 600;
}
.notif-item time {
  color: var(--faint);
  font-size: 11px;
}

/* ---------- Botões ---------- */

.btn {
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s, border-color 0.16s, transform 0.1s;
}
.btn svg {
  width: 16px;
  height: 16px;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-primary:active {
  background: var(--accent-press);
}
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-ghost:hover {
  background: var(--surface);
}
.btn-soft {
  background: var(--surface);
  color: var(--fg);
}
.btn-soft:hover {
  background: var(--surface-strong);
}
.btn-danger-ghost {
  background: transparent;
  color: var(--danger-ink);
  border-color: var(--border-strong);
}
.btn-danger-ghost:hover {
  background: var(--danger-bg);
}
.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12.5px;
}
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  border-bottom: 1px solid currentColor;
}
.link-btn svg {
  width: 14px;
  height: 14px;
}
.link-btn:hover {
  color: var(--accent);
}
.link-btn.accent {
  color: var(--accent);
}
.link-btn.accent:hover {
  color: var(--accent-deep);
}

/* ---------- Eyebrow / títulos ---------- */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow.neutral {
  color: var(--muted);
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-head h1 {
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.page-head .page-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 62ch;
}
.page-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

/* ---------- Cards ---------- */

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.card-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- KPIs ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  padding: 18px 20px;
  display: grid;
  gap: 12px;
}
.kpi .kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.kpi-ico {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  display: grid;
  place-items: center;
}
.kpi-ico svg {
  width: 15px;
  height: 15px;
}
.kpi-value {
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}
.kpi-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 12px;
}
.delta svg {
  width: 12px;
  height: 12px;
}
.delta.up {
  color: var(--olive-deep);
}
.delta.down {
  color: var(--danger-ink);
}
.delta.down svg {
  transform: rotate(180deg);
}
.delta.warn {
  color: var(--warn-ink);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.badge.solid::before {
  background: currentColor;
}
.badge.neutral {
  background: var(--neutral-bg);
  color: var(--fg);
}
.badge.success {
  background: var(--olive-bg);
  color: var(--olive-deep);
}
.badge.warn {
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.badge.danger {
  background: var(--danger-bg);
  color: var(--danger-ink);
}
.badge.solid {
  background: var(--fg);
  color: var(--bg);
}

/* ---------- Tabelas ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}
.tbl th {
  text-align: left;
  padding: 12px 18px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
.tbl td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}
.tbl tr:last-child td {
  border-bottom: 0;
}
.tbl tbody tr {
  transition: background 0.14s;
}
.tbl tbody tr:hover {
  background: var(--surface);
}
.tbl .cell-primary {
  display: flex;
  align-items: center;
  gap: 11px;
}
.tbl .cell-name {
  font-weight: 600;
  line-height: 1.25;
}
.tbl .cell-sub {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.25;
}
.tbl .num {
  font-variant-numeric: tabular-nums;
}
.tbl .strong {
  font-weight: 600;
}
.row-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--fg);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 600;
  flex: none;
}
.row-avatar.accent {
  background: var(--danger-bg);
  color: var(--danger-ink);
}

/* ---------- Formulários ---------- */

.field {
  display: grid;
  gap: 6px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg);
}
.field .hint {
  font-size: 11.5px;
  color: var(--faint);
}
.input,
.select,
textarea.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13.5px;
}
.input::placeholder {
  color: var(--faint);
}
.input:focus,
.select:focus,
textarea.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
.input.invalid {
  border-color: var(--danger-ink);
}
.input.invalid:focus {
  outline-color: var(--danger-ink);
}
.field .field-error {
  display: none;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--danger-ink);
}
.field.has-error .field-error {
  display: block;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .full {
  grid-column: 1 / -1;
}

/* Pills de filtro */
.pill-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pill {
  min-height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.pill:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}
.pill.active {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  font-weight: 600;
}
.pill .pill-count {
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0.7;
}

/* ---------- Gráficos ---------- */

.chart-grid {
  display: grid;
  grid-template-columns: 1.9fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.chart {
  width: 100%;
  display: block;
}
.chart-legend {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
}
.legend-row .lg-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
}
.legend-row .lg-val {
  margin-left: auto;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.legend-row .lg-pct {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
}
.chart-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: 8px;
  padding: 3px;
}
.chart-tabs button {
  border: 0;
  background: transparent;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.chart-tabs button:hover {
  color: var(--fg);
}
.chart-tabs button.active {
  background: var(--bg);
  color: var(--fg);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ---------- Barras de estoque ---------- */

.stock-bar {
  width: 110px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}
.stock-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--olive);
}
.stock-bar i.crit {
  background: var(--accent);
}
.stock-bar i.warn {
  background: oklch(0.72 0.11 72);
}
.stock-cell {
  display: grid;
  gap: 6px;
  justify-items: start;
}

/* ---------- Progresso ---------- */

.progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}
.progress i[style*="--goal"] {
  background: color-mix(in oklch, var(--success-ink) var(--goal, 0%), var(--danger-ink));
}

/* ---------- Modal / Drawer ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(25, 24, 22, 0.44);
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.backdrop.open {
  display: flex;
}
.backdrop.right {
  justify-content: flex-end;
  padding: 0;
}
.modal {
  width: 100%;
  max-width: 520px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 0;
}
.modal-head h3 {
  font-size: 17px;
  font-weight: 600;
}
.modal-head .sub {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 3px;
}
.modal-body {
  padding: 20px 24px 24px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 24px;
}
.drawer {
  width: min(460px, 100vw);
  height: 100vh;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}
.drawer-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 2;
}
.drawer-head h3 {
  font-size: 17px;
  font-weight: 600;
}
.drawer-body {
  padding: 20px 24px 40px;
  display: grid;
  gap: 22px;
}

/* Lista de itens do pedido */
.order-items {
  display: grid;
  gap: 10px;
}
.order-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.order-item .oi-name {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.25;
}
.order-item .oi-sub {
  color: var(--muted);
  font-size: 11.5px;
}
.order-item .oi-amount {
  margin-left: auto;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.order-totals {
  display: grid;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.order-totals .ot-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.order-totals .ot-row.total {
  color: var(--fg);
  font-weight: 600;
  font-size: 15px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 2px;
}
.order-totals .ot-row.total span {
  font-variant-numeric: tabular-nums;
}
.kv-list {
  display: grid;
  gap: 10px;
}
.kv-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  font-size: 13px;
}
.kv-row dt {
  color: var(--muted);
}
.kv-row dd {
  margin: 0;
  font-weight: 500;
}

/* ---------- Banner de demonstração ---------- */

.demo-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
}
.demo-banner svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
  flex: none;
}
.demo-banner .close-demo {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--faint);
  padding: 4px;
  display: grid;
  place-items: center;
  border-radius: 6px;
}
.demo-banner .close-demo:hover {
  background: var(--surface-strong);
  color: var(--fg);
}
.demo-banner .close-demo svg {
  width: 14px;
  height: 14px;
}

/* ---------- Listas de alerta ---------- */

.alert-list {
  display: grid;
  gap: 2px;
}
.alert-item {
  display: flex;
  gap: 11px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.alert-item:last-child {
  border-bottom: 0;
}
.alert-item .al-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: none;
}
.alert-item .al-ico svg {
  width: 14px;
  height: 14px;
}
.alert-item.warn .al-ico {
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.alert-item.danger .al-ico {
  background: var(--danger-bg);
  color: var(--danger-ink);
}
.alert-item .al-copy p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
}
.alert-item .al-copy .al-act {
  color: var(--accent);
  font-weight: 600;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.alert-item .al-copy .al-act svg {
  width: 11px;
  height: 11px;
}
.alert-item .al-copy time {
  color: var(--faint);
  font-size: 11px;
}

/* ---------- Listas de resumo ---------- */

.mini-list {
  display: grid;
}
.mini-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--border);
}
.mini-item:last-child {
  border-bottom: 0;
}
.mini-item .mi-name {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
}
.mini-item .mi-sub {
  color: var(--muted);
  font-size: 11.5px;
}
.mini-item .mi-right {
  margin-left: auto;
  text-align: right;
}
.mini-item .mi-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
}
.mini-item .mi-meta {
  color: var(--muted);
  font-size: 11px;
}

/* ---------- Layouts ---------- */

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.grid-dash-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ---------- Toast ---------- */

.toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 120;
  display: grid;
  gap: 10px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--fg);
  color: var(--bg);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
}
.toast svg {
  width: 16px;
  height: 16px;
  color: var(--accent-hover);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Vazio / estados ---------- */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-state svg {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  color: var(--faint);
}
.empty-state p {
  margin: 0 0 4px;
  font-weight: 600;
  color: var(--fg);
}
.empty-state span {
  font-size: 12.5px;
}

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login-aside {
  display: none;
}
.login-aside .aside-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.login-aside h2 {
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 500;
  max-width: 17ch;
}
.login-aside h2 em {
  font-style: normal;
  color: var(--accent);
}
.login-aside p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
  max-width: 44ch;
}
.swatch-strip {
  display: flex;
  gap: 8px;
  margin-top: 34px;
}
.swatch-strip i {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
}
.swatch-strip .sw-red {
  background: #9f2721;
}
.swatch-strip .sw-deep {
  background: #741b17;
}
.swatch-strip .sw-olive {
  background: #596047;
}
.swatch-strip .sw-sand {
  background: #f5f1e9;
}
.aside-fact {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.06em;
}
.aside-fact b {
  color: var(--fg);
  font-size: 13px;
  letter-spacing: 0;
}
.login-main {
  display: grid;
  place-items: center;
  padding: 40px;
}
.login-card {
  width: 100%;
  max-width: 400px;
}
.login-card .brand {
  padding: 0 0 26px;
}
.login-card h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.login-card .login-sub {
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 26px;
}
.login-form {
  display: grid;
  gap: 16px;
}
.login-form .form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  cursor: pointer;
}
.check input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}
.demo-hint {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--muted);
}
.demo-hint svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
  flex: none;
  margin-top: 1px;
}
.demo-hint code {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--fg);
  background: var(--surface);
  padding: 0 5px;
  border-radius: 4px;
}
.login-foot {
  margin-top: 34px;
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.04em;
}
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 60;
}
.theme-toggle:focus-visible {
  outline: none;
}
.theme-toggle svg {
  position: absolute;
  inset: 0;
  margin: auto;
}
.theme-toggle .ico-moon {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .ico-sun {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .ico-moon {
  display: block;
}

/* ---------- Lojas ---------- */

.store-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.store-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  padding: 24px;
  display: grid;
  gap: 18px;
}
.store-card .store-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.store-card h3 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.store-card .store-addr {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 3px;
}
.store-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.store-metric {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.store-metric .sm-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.store-metric .sm-val {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 5px;
  font-variant-numeric: tabular-nums;
}
.store-contacts {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.store-contacts a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
}
.store-contacts a svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}
.store-contacts a:hover {
  color: var(--accent);
}

/* ---------- Comparativo de lojas ---------- */

.bars-v {
  display: grid;
  grid-template-columns: 48px repeat(6, 1fr);
  gap: 8px 12px;
  align-items: end;
}
.bars-v .bv-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  align-self: end;
  padding-bottom: 4px;
}
.bv-col {
  display: grid;
  gap: 6px;
}
.bv-col .bv-head {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}
.bv-bar {
  height: 140px;
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--surface-strong);
}
.bv-bar i {
  width: 100%;
  background: var(--olive);
  border-radius: 6px 6px 0 0;
  min-height: 3px;
}
.bv-bar.mga i {
  background: var(--accent);
}
.bv-val {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ---------- Configurações ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: 224px 1fr;
  gap: 28px;
  align-items: start;
}
.settings-nav {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 2px;
}
.sn-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
}
.sn-link svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.sn-link:hover {
  background: var(--surface);
  color: var(--fg);
}
.sn-link.active {
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
}
.settings-stack {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.settings-stack > .card {
  scroll-margin-top: 128px;
}

.profile-photo {
  display: flex;
  align-items: center;
  gap: 16px;
}
.avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  flex: none;
}
.photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  padding: 0;
  flex: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 1px 3px rgba(25, 24, 22, 0.28);
  transition: transform 0.18s ease;
}
.switch:not([aria-checked="true"]):hover {
  background: oklch(0.8 0.01 82);
  border-color: var(--border-strong);
}
.switch[aria-checked="true"] {
  background: var(--olive);
  border-color: var(--olive);
}
.switch[aria-checked="true"]:hover {
  background: var(--olive-deep);
  border-color: var(--olive-deep);
}
.switch[aria-checked="true"]::after {
  transform: translateX(18px);
}
.switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hint {
  font-size: 11.5px;
  color: var(--faint);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:first-child {
  padding-top: 0;
}
.toggle-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.toggle-ico {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  display: grid;
  place-items: center;
  flex: none;
}
.toggle-ico svg {
  width: 18px;
  height: 18px;
}
.toggle-body {
  flex: 1;
  min-width: 0;
}
.toggle-body b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
}
.toggle-body p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.qr-demo {
  width: 148px;
  height: 148px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--fg);
  background: var(--bg);
}
.qr-demo svg {
  width: 116px;
  height: 116px;
}
.code-line {
  display: flex;
  align-items: center;
  gap: 10px;
}
.code-box {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  padding: 10px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.session-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.session-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.sess-meta {
  flex: 1;
  min-width: 0;
}
.sess-meta b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
}
.sess-meta span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.theme-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.theme-pill {
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.theme-pill svg {
  width: 16px;
  height: 16px;
}
.theme-pill:hover {
  border-color: var(--border-strong);
  color: var(--fg);
}
.theme-pill.active {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}
.theme-pill.active svg {
  color: var(--bg);
}

/* ---------- Funcionários (admin) ---------- */

html:not([data-admin="1"]) [data-role="admin"] {
  display: none;
}
.emp-table {
  margin-top: 4px;
}
.emp-self {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}
.emp-actions {
  display: flex;
  justify-content: flex-end;
}
.emp-block {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.emp-block:first-child {
  padding-top: 0;
}
.emp-block:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}
.emp-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.emp-block-head b {
  font-size: 13.5px;
  font-weight: 600;
}
.emp-block-head .btn.active {
  background: var(--surface-strong);
}
.emp-pwd-block {
  margin-top: 14px;
}
.field-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.emp-danger {
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 14px;
}
.emp-danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.emp-danger-row:last-child {
  border-bottom: 0;
}
.emp-danger-row b {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}
.emp-danger-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.emp-danger-row .btn {
  flex: none;
}
.btn-danger {
  background: var(--danger-ink);
  border-color: var(--danger-ink);
  color: var(--bg);
}
.btn-danger:hover {
  background: oklch(0.31 0.14 26);
  border-color: oklch(0.31 0.14 26);
  color: var(--bg);
}
[data-theme="dark"] .btn-danger:hover {
  background: oklch(0.8 0.1 28);
  border-color: oklch(0.8 0.1 28);
  color: var(--bg);
}
.emp-confirm.armed {
  background: var(--danger-ink);
  border-color: var(--danger-ink);
  color: var(--bg);
}
.emp-self-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.emp-self-note svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
  color: var(--fg);
}
.emp-self-note[hidden] {
  display: none;
}
@media (max-width: 480px) {
  .emp-danger-row {
    flex-direction: column;
    align-items: stretch;
  }
  .emp-danger-row .btn {
    align-self: flex-end;
  }
}

.access-card {
  max-width: 520px;
  margin: 48px auto 0;
  padding: 44px 32px;
  text-align: center;
}
html[data-admin="1"] .access-card {
  display: none;
}
.access-card .access-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--danger-ink);
}
.access-card h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}
.access-card p {
  max-width: 42ch;
  margin: 0 auto 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- Badges de status (cores semânticas) ---------- */

:root {
  --success-ink: oklch(0.34 0.09 152);
  --success-bg: oklch(0.94 0.05 152);
  --info-ink: #2569b5;
  --info-bg: color-mix(in oklch, #2569b5 14%, transparent);
  --rec-ink: #1a4d96;
  --rec-bg: color-mix(in oklch, #1a4d96 14%, transparent);
}
:root[data-theme="dark"] {
  --success-ink: oklch(0.78 0.1 152);
  --success-bg: oklch(0.3 0.04 152);
  --info-ink: oklch(0.76 0.1 250);
  --info-bg: color-mix(in oklch, #2569b5 26%, transparent);
  --rec-ink: oklch(0.72 0.1 255);
  --rec-bg: color-mix(in oklch, #1a4d96 28%, transparent);
}

.badge.success {
  background: var(--success-bg);
  color: var(--success-ink);
}
.badge.info {
  background: var(--info-bg);
  color: var(--info-ink);
}
.badge.rec {
  background: var(--rec-bg);
  color: var(--rec-ink);
}

/* ---------- Dropdown customizado ---------- */

.dd {
  position: relative;
  display: inline-block;
  min-width: 160px;
}
.dd.w100 {
  display: block;
  width: 100%;
}
.dd .select-dd {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.dd-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 16px 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  min-height: 40px;
}
.dd-btn:hover {
  border-color: var(--accent);
}
.dd-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}
.dd.open .dd-btn {
  border-color: var(--accent);
}
.dd-val {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dd-arrow {
  width: 16px;
  height: 16px;
  color: var(--muted);
  flex: none;
  transition: transform 0.15s;
}
.dd.open .dd-arrow {
  transform: rotate(180deg);
  color: var(--accent-deep);
}
.dd-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 90;
  display: none;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
}
.dd.open .dd-panel {
  display: block;
}
.dd:hover .dd-btn {
  border-color: var(--accent);
}
.dd:hover .dd-arrow {
  transform: rotate(180deg);
  color: var(--accent-deep);
}
.dd:hover .dd-panel {
  display: block;
}
.dd-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13.5px;
  text-align: left;
}
.dd-opt:hover {
  background: var(--surface-strong);
}
.dd-opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.dd-opt.sel {
  color: var(--accent-deep);
  font-weight: 600;
}
.dd-opt.sel .dd-check {
  opacity: 1;
}
.dd-check {
  opacity: 0;
  width: 16px;
  height: 16px;
  color: currentColor;
  flex: none;
}
.dd.tb .dd-btn {
  padding: 8px 16px 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border-color: var(--border);
}

/* ---------- Relatório ---------- */

.rep-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.rep-stat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 14px 16px;
}
.rep-stat .rs-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.rep-stat .rs-val {
  display: block;
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.rep-note {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--muted);
}
.rep-note svg {
  width: 15px;
  height: 15px;
  flex: none;
}
.range-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.range-row .field {
  flex: 1;
}
.range-row .field .hint {
  margin-top: 2px;
}
@media (max-width: 520px) {
  .rep-grid {
    grid-template-columns: 1fr;
  }
  .range-row {
    flex-direction: column;
    gap: 12px;
  }
  .range-row .field {
    flex: none;
  }
}

/* ---------- Calendário customizado ---------- */

.date-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  cursor: pointer;
  text-align: left;
}
.date-field .df-val {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.date-field .df-ico {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}
.date-field:hover {
  border-color: var(--accent);
}
.date-field:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.cal {
  position: fixed;
  z-index: 130;
  display: none;
  width: min(304px, calc(100vw - 24px));
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.cal.open {
  display: block;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.cal-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.cal-nav {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cal-nav svg {
  width: 17px;
  height: 17px;
}
.cal-nav:hover {
  background: var(--surface);
  color: var(--fg);
}
.cal-nav:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-top: 10px;
}
.cal-dow {
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cal-day {
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.cal-day:hover {
  background: var(--surface);
}
.cal-day:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.cal-day.out {
  color: var(--faint);
}
.cal-day.today {
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 600;
}
.cal-day.sel {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.cal-day.sel:hover {
  background: var(--accent-hover);
}
.cal-day:disabled {
  color: var(--faint);
  background: transparent;
  border-color: transparent;
  cursor: default;
  opacity: 0.55;
}
.cal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.cal-link {
  padding: 8px 10px;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-deep);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.cal-link:hover {
  background: var(--surface);
}
.cal-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.cal-link.cal-clear {
  color: var(--muted);
}

/* ---------- Responsivo ---------- */

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .chart-grid,
  .grid-dash-bottom {
    grid-template-columns: 1fr;
  }
  .grid-3col,
  .store-grid,
  .grid-2col {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .settings-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .login-aside {
    padding: 40px;
  }
}
@media (max-width: 860px) {
  .app {
    display: block;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 272px;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 100;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: none;
  }
  .nav-link.active::before {
    left: -16px;
  }
  .topbar {
    padding: 0 20px;
  }
  .content {
    padding: 22px 18px 48px;
  }
  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .login-wrap {
    grid-template-columns: 1fr;
  }
  .login-aside {
    display: none;
  }
  .login-main {
    padding: 32px 20px;
  }
  .topbar .search-box {
    display: none;
  }
  .topbar .page-title {
    font-size: 15px;
  }
  .menu-btn {
    display: grid;
  }
  .cal-day {
    height: 44px;
  }
  .cal-nav {
    width: 40px;
    height: 40px;
  }
}
@media (min-width: 861px) {
  .menu-btn {
    display: none;
  }
}
@media (max-width: 520px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .page-head h1 {
    font-size: 23px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .full {
    grid-column: auto;
  }
  .unit-select span {
    display: none;
  }
  .topbar .dd.tb {
    max-width: 132px;
  }
  .settings-actions {
    flex-direction: column-reverse;
  }
  .settings-actions .btn {
    width: 100%;
  }
  .login-main {
    padding: 48px 20px;
  }
  .login-foot {
    flex-direction: column;
    gap: 4px;
  }
}
