:root {
  --bg: #f6f3f7;
  --surface: #ffffff;
  --surface-soft: #faf8fb;
  --ink: #241b27;
  --muted: #746b78;
  --line: #e7dfe9;
  --green-950: #25172c;
  --green-900: #301c39;
  --green-800: #482553;
  --green-700: #5d326b;
  --green-600: #744682;
  --green-100: #eaddec;
  --green-50: #f6eef7;
  --blue: #4174c4;
  --blue-soft: #eaf1fd;
  --coral: #df6b58;
  --coral-soft: #fcece9;
  --amber: #b87c18;
  --amber-soft: #fff3da;
  --red: #bd4e4e;
  --red-soft: #fbe9e9;
  --shadow: 0 12px 30px rgba(50, 28, 58, .08);
  --radius: 18px;
  --radius-sm: 11px;
  --sidebar: 256px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, input, select, textarea { outline-color: var(--green-600); }
svg { width: 1.25em; height: 1.25em; fill: currentColor; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #f8f1f9;
  background:
    radial-gradient(circle at 15% 2%, rgba(216, 172, 82, .19), transparent 32%),
    linear-gradient(180deg, #35213d 0%, #211628 100%);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 26px; font-size: 20px; letter-spacing: -.4px; }
.brand strong { font-weight: 800; }
.brand small { display: block; max-width: 160px; margin-top: 2px; color: #ddc37e; font-size: 8px; line-height: 1.3; font-weight: 600; letter-spacing: .45px; text-transform: uppercase; }
.brand-mark { width: 49px; height: 49px; flex: 0 0 49px; display: grid; place-items: center; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; }

.main-nav { display: flex; flex: 1; flex-direction: column; gap: 5px; }
.nav-item { position: relative; width: 100%; border: 0; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #d8cbdc; background: transparent; text-align: left; font-weight: 600; transition: .18s ease; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(216, 172, 82, .17); box-shadow: inset 3px 0 #d8ac52; }
.nav-icon { display: grid; place-items: center; width: 20px; height: 20px; flex: 0 0 20px; }
.nav-icon svg { width: 19px; height: 19px; }
.nav-badge { margin-left: auto; min-width: 22px; padding: 2px 6px; border-radius: 20px; color: #f3eaf5; background: rgba(255,255,255,.12); text-align: center; font-size: 11px; }
.nav-badge.accent { color: #fff0ed; background: rgba(223,107,88,.35); }
.nav-badge.loyalty { color: #fff5cf; background: rgba(210,164,62,.28); }
.nav-badge.chronic { color: #dff6eb; background: rgba(87,184,139,.25); }

.sidebar-footer { padding: 17px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sync-status { display: flex; align-items: center; gap: 10px; }
.sync-status > span { width: 9px; height: 9px; border-radius: 50%; background: #55c992; box-shadow: 0 0 0 4px rgba(85,201,146,.12); }
.sync-status strong, .sync-status small { display: block; }
.sync-status strong { font-size: 12px; color: #f1e6f2; }
.sync-status small { font-size: 10px; color: #baa9c0; }
.text-button { margin-top: 10px; padding: 4px 0; border: 0; color: #c9b8ce; background: transparent; font-size: 11px; }
.text-button:hover { color: #fff; }

.main-content { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; top: 0; z-index: 20; height: 78px; display: flex; align-items: center; justify-content: space-between; padding: 0 34px; border-bottom: 1px solid rgba(226,217,229,.82); background: rgba(251,249,251,.93); backdrop-filter: blur(16px); }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar h1 { margin: 0; font-size: 19px; letter-spacing: -.2px; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.date-chip { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.menu-button { display: none !important; }

.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 18px 34px -2px; padding: 10px 14px; border: 1px solid #e9d7aa; border-radius: 10px; color: #765413; background: #fff8e8; font-size: 11px; }
.demo-banner strong { margin-right: 9px; }
.demo-banner button { border: 0; color: #987027; background: transparent; font-size: 19px; line-height: 1; }

.view { display: none; padding: 30px 34px 48px; animation: viewIn .22s ease; }
.view.active { display: block; }
@keyframes viewIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.hero-row, .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 23px; }
.heading-actions { display: flex; gap: 8px; }
.hero-row h2, .section-heading h2 { margin: 3px 0 0; font-size: 25px; line-height: 1.2; letter-spacing: -.65px; }
.section-heading p:last-child { max-width: 580px; margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.eyebrow { margin: 0; color: var(--green-600); font-size: 10px; font-weight: 800; letter-spacing: 1.4px; }

.button { min-height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; font-weight: 700; font-size: 12px; transition: .18s ease; }
.button svg { width: 16px; height: 16px; }
.button.primary { color: #fff; background: var(--green-700); box-shadow: 0 6px 14px rgba(93,50,107,.2); }
.button.primary:hover { background: var(--green-800); transform: translateY(-1px); }
.button.secondary { color: var(--green-800); border-color: #ddd0e1; background: #fff; }
.button.secondary:hover { border-color: var(--green-600); background: var(--green-50); }
.button.danger { color: var(--red); border-color: #efcaca; background: #fff; }
.button.full { width: 100%; }
.button.compact { min-height: 34px; padding: 7px 12px; }
.icon-button { width: 34px; height: 34px; border: 0; display: inline-grid; place-items: center; border-radius: 9px; color: var(--muted); background: transparent; font-size: 22px; }
.icon-button:hover { color: var(--ink); background: #f1ebf2; }
.link-button { padding: 2px 0; border: 0; color: var(--green-700); background: transparent; font-size: 11px; font-weight: 700; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-card { min-height: 150px; padding: 18px; border: 1px solid #e8e0e9; border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 20px rgba(65,38,72,.04); }
.metric-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.metric-icon { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; }
.metric-icon.green { color: var(--green-700); background: var(--green-100); }
.metric-icon.coral { color: var(--coral); background: var(--coral-soft); }
.metric-icon.blue { color: var(--blue); background: var(--blue-soft); }
.metric-icon.white { color: #fff; background: rgba(255,255,255,.14); }
.metric-note { padding: 3px 7px; border-radius: 10px; color: var(--muted); background: var(--surface-soft); font-size: 9px; font-weight: 700; }
.metric-note.positive { color: var(--green-700); background: var(--green-50); }
.metric-note.light { color: #eadcec; background: rgba(255,255,255,.1); }
.metric-card p { margin: 0 0 3px; color: var(--muted); font-size: 11px; }
.metric-card strong { display: block; margin-bottom: 3px; font-size: 24px; line-height: 1.2; letter-spacing: -.5px; }
.metric-card small { color: #9b929e; font-size: 10px; }
.metric-card.featured { color: #fff; border-color: transparent; background: linear-gradient(135deg, #684078, #35203f); box-shadow: 0 12px 25px rgba(60,31,70,.2); }
.metric-card.featured p, .metric-card.featured small { color: #e4d7e7; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .9fr); gap: 18px; margin-bottom: 18px; }
.dashboard-grid.lower { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { border: 1px solid #e7dfe9; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 19px 20px 0; }
.panel-header h3 { margin: 0; font-size: 14px; letter-spacing: -.15px; }
.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.panel-total { padding: 5px 9px; border-radius: 8px; color: var(--green-800); background: var(--green-50); font-size: 11px; font-weight: 800; }

.sales-panel { min-height: 318px; }
.bar-chart { height: 235px; display: flex; align-items: stretch; gap: 10px; padding: 21px 20px 18px; }
.chart-col { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; }
.chart-value { color: var(--muted); font-size: 8px; white-space: nowrap; }
.chart-bar-track { width: min(35px, 80%); height: 150px; display: flex; align-items: flex-end; border-radius: 7px; background: #f0ebf1; overflow: hidden; }
.chart-bar { width: 100%; min-height: 3px; border-radius: 7px; background: linear-gradient(180deg, #a678b1, #5d326b); transition: height .5s ease; }
.chart-col.today .chart-bar { background: linear-gradient(180deg, #df826f, #d35e4b); }
.chart-label { color: var(--muted); font-size: 9px; text-transform: capitalize; }
.chart-col.today .chart-label { color: var(--ink); font-weight: 800; }

.priority-list { padding: 13px 19px 17px; }
.priority-item { display: flex; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid #edf2ef; }
.priority-item:last-child { border-bottom: 0; }
.priority-dot { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 10px; color: var(--green-700); background: var(--green-50); font-weight: 800; font-size: 11px; }
.priority-dot.danger { color: var(--red); background: var(--red-soft); }
.priority-dot.warn { color: var(--amber); background: var(--amber-soft); }
.priority-item div { min-width: 0; flex: 1; }
.priority-item strong, .priority-item small { display: block; }
.priority-item strong { font-size: 11px; }
.priority-item small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.priority-item button { border: 0; color: var(--green-700); background: transparent; font-weight: 800; font-size: 15px; }

.compact-list { padding: 10px 20px 16px; }
.compact-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #edf2ef; }
.compact-row:last-child { border-bottom: 0; }
.compact-row strong, .compact-row small { display: block; }
.compact-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.compact-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.stock-meter { width: 90px; }
.stock-meter span { display: block; margin-bottom: 4px; color: var(--red); text-align: right; font-size: 9px; font-weight: 700; }
.stock-meter div { height: 5px; border-radius: 5px; background: #edf1ef; overflow: hidden; }
.stock-meter i { display: block; height: 100%; border-radius: 5px; background: var(--coral); }

.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.summary-item { padding: 15px 18px; border-right: 1px solid var(--line); }
.summary-item:last-child { border-right: 0; }
.summary-item small, .summary-item strong { display: block; }
.summary-item small { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .6px; }
.summary-item strong { margin-top: 3px; font-size: 17px; }
.summary-item strong.danger { color: var(--red); }

.table-panel { overflow: hidden; }
.table-toolbar { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.search-field { min-width: 270px; max-width: 430px; flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid #dbe5e0; border-radius: 9px; background: var(--surface-soft); }
.search-field:focus-within { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(116,70,130,.11); }
.search-field svg { width: 16px; height: 16px; color: #8b9a93; }
.search-field input { min-width: 0; width: 100%; border: 0; color: var(--ink); background: transparent; font-size: 11px; }
.search-field input::placeholder { color: #9caaa3; }
.filter-group { display: flex; gap: 6px; }
.filter-chip { padding: 7px 10px; border: 1px solid #dce5e1; border-radius: 8px; color: var(--muted); background: #fff; font-size: 10px; font-weight: 600; }
.filter-chip.active { color: var(--green-800); border-color: #bbd8cb; background: var(--green-50); }
.toolbar-fields { display: flex; gap: 8px; }
.select-control { min-height: 35px; padding: 7px 31px 7px 10px; border: 1px solid #dbe5e0; border-radius: 8px; color: var(--ink); background: #fff; font-size: 10px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 15px; color: #7d8d85; background: #f8faf9; text-align: left; font-size: 8px; font-weight: 800; letter-spacing: .55px; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px 15px; border-top: 1px solid #edf1ef; color: #34473f; font-size: 10px; vertical-align: middle; }
tbody tr:hover { background: #fbfcfb; }
.product-cell { min-width: 220px; display: flex; align-items: center; gap: 10px; }
.product-avatar { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; color: var(--green-800); background: var(--green-50); font-size: 10px; font-weight: 800; }
.product-cell strong, .product-cell small { display: block; }
.product-cell strong { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 10px; }
.product-cell small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.stacked strong, .stacked small { display: block; }
.stacked strong { color: var(--ink); font-size: 10px; }
.stacked small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.qty-cell strong { display: block; font-size: 12px; }
.qty-cell small { color: var(--muted); font-size: 8px; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border-radius: 20px; font-size: 8px; font-weight: 800; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.ok, .status.purchased { color: var(--green-700); background: var(--green-50); }
.status.low, .status.pending { color: var(--amber); background: var(--amber-soft); }
.status.out, .status.expired { color: var(--red); background: var(--red-soft); }
.status.expiring, .status.approved { color: var(--blue); background: var(--blue-soft); }
.status.dismissed { color: #77827d; background: #eff2f0; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-action { width: 28px; height: 28px; border: 0; display: grid; place-items: center; border-radius: 7px; color: #75867e; background: transparent; font-size: 13px; }
.row-action:hover { color: var(--green-800); background: var(--green-50); }
.row-action.delete:hover { color: var(--red); background: var(--red-soft); }
.value-income { color: var(--green-700); font-weight: 800; }
.value-expense { color: var(--red); font-weight: 800; }
.origin-chip { padding: 3px 6px; border-radius: 6px; color: var(--muted); background: #eef2f0; font-size: 8px; font-weight: 700; }

.empty-state { padding: 46px 20px; color: var(--muted); text-align: center; }
.empty-state > span { width: 46px; height: 46px; display: grid; place-items: center; margin: auto; border-radius: 15px; color: var(--green-700); background: var(--green-50); font-weight: 800; }
.empty-state h3 { margin: 12px 0 4px; color: var(--ink); font-size: 13px; }
.empty-state p { margin: 0; font-size: 10px; }

.demand-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.demand-cards { padding: 4px 17px 13px; }
.demand-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; padding: 15px 2px; border-bottom: 1px solid var(--line); }
.demand-card:last-child { border-bottom: 0; }
.demand-title { display: flex; align-items: center; gap: 10px; }
.demand-title h3 { margin: 0; font-size: 12px; }
.demand-title p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.demand-meta { display: flex; flex-wrap: wrap; gap: 11px; margin: 9px 0 0 44px; color: var(--muted); font-size: 9px; }
.demand-meta b { color: #455950; }
.demand-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: var(--coral); background: var(--coral-soft); font-weight: 800; }
.demand-actions { display: flex; align-items: center; gap: 6px; }
.demand-actions select { max-width: 110px; }
.ranking-panel { overflow: hidden; }
.ranking-list { padding: 11px 20px 18px; }
.ranking-row { display: grid; grid-template-columns: 25px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.ranking-row:last-child { border-bottom: 0; }
.ranking-position { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; color: var(--green-800); background: var(--green-50); font-size: 9px; font-weight: 800; }
.ranking-row strong, .ranking-row small { display: block; }
.ranking-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.ranking-row small { color: var(--muted); font-size: 8px; }
.ranking-count { color: var(--coral); font-size: 11px; font-weight: 800; }

.info-callout { display: flex; align-items: center; gap: 12px; margin-bottom: 17px; padding: 13px 16px; border: 1px solid #cfe4da; border-radius: 12px; background: var(--green-50); }
.info-callout > span { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--green-700); font-weight: 800; }
.info-callout strong { font-size: 10px; }
.info-callout p { margin: 2px 0 0; color: #587068; font-size: 9px; }
.priority-badge { display: inline-block; min-width: 52px; padding: 4px 7px; border-radius: 7px; text-align: center; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.priority-badge.critical { color: var(--red); background: var(--red-soft); }
.priority-badge.high { color: var(--amber); background: var(--amber-soft); }
.priority-badge.normal { color: var(--blue); background: var(--blue-soft); }

.privacy-callout { display: grid; grid-template-columns: 30px minmax(0,1fr) auto; align-items: center; gap: 12px; margin-bottom: 17px; padding: 13px 15px; border: 1px solid #d7dfef; border-radius: 12px; color: #3e567b; background: #f2f6fd; }
.privacy-callout > span:first-child { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: #5579b3; font-weight: 800; }
.privacy-callout strong { font-size: 10px; }
.privacy-callout p { margin: 2px 0 0; color: #657899; font-size: 9px; }
.privacy-chip { padding: 4px 8px; border-radius: 20px; color: #496a9d; background: #e1eafa; font-size: 8px; font-weight: 800; }
.loyalty-layout { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 18px; align-items: start; margin-bottom: 18px; }
.secure-label { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 20px; color: #55709b; background: #edf3fc; font-size: 8px; font-weight: 800; white-space: nowrap; }
.secure-label::before { content: "●"; font-size: 6px; }
.customer-cell { min-width: 180px; display: flex; align-items: center; gap: 10px; }
.customer-avatar { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 50%; color: #8a661d; background: #fff3d7; font-size: 10px; font-weight: 800; }
.customer-cell strong, .customer-cell small { display: block; }
.customer-cell strong { color: var(--ink); font-size: 10px; }
.customer-cell small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.points-balance { display: inline-flex; align-items: baseline; gap: 4px; color: var(--green-800); }
.points-balance strong { font-size: 16px; }
.points-balance small { font-size: 8px; font-weight: 700; }
.rewards-panel { overflow: hidden; }
.rewards-list { padding: 10px 19px 6px; }
.reward-row { display: grid; grid-template-columns: 35px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.reward-row:last-child { border-bottom: 0; }
.reward-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #8b671d; background: #fff3d7; font-size: 14px; }
.reward-row strong, .reward-row small { display: block; }
.reward-row strong { font-size: 10px; }
.reward-row small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.reward-cost { padding: 4px 7px; border-radius: 7px; color: var(--green-800); background: var(--green-50); font-size: 9px; font-weight: 800; white-space: nowrap; }
.reset-rule { margin: 8px 16px 16px; padding: 11px; border-radius: 10px; color: #72581f; background: #fff7e5; }
.reset-rule strong { font-size: 9px; }
.reset-rule p { margin: 3px 0 0; font-size: 8px; }
.points-history-panel { overflow: hidden; }
.movement { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; font-size: 9px; }
.movement.earn { color: var(--green-700); }
.movement.redeem { color: var(--coral); }
.point-change { font-weight: 800; }
.point-change.positive { color: var(--green-700); }
.point-change.negative { color: var(--coral); }
.points-preview { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 13px; border: 1px solid #cfe1d8; border-radius: 10px; background: var(--green-50); }
.points-preview strong, .points-preview small { display: block; }
.points-preview strong { font-size: 10px; }
.points-preview small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.points-preview b { color: var(--green-800); font-size: 18px; }
.points-preview.warning { border-color: #ead7aa; color: #735719; background: #fff8e7; }
.points-preview.warning b { color: #a06f13; }
.consent-box { display: flex; align-items: flex-start; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #f9fbfa; }
.consent-box input { width: 16px; min-height: 16px; margin-top: 1px; }
.consent-box span { color: #52655d; font-size: 9px; line-height: 1.45; }
.privacy-warning { padding: 10px 12px; border-radius: 9px; color: #7b5b20; background: #fff6e1; font-size: 9px; }

.health-privacy-callout { display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; gap: 12px; margin-bottom: 17px; padding: 13px 15px; border: 1px solid #edcfd2; border-radius: 12px; color: #754950; background: #fff4f5; }
.health-privacy-callout > span:first-child { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: #cb6976; }
.health-privacy-callout strong { font-size: 10px; }
.health-privacy-callout p { margin: 2px 0 0; color: #89666c; font-size: 9px; }
.chronic-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; padding: 12px 14px; }
.chronic-layout { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 18px; align-items: start; margin-bottom: 18px; }
.chronic-patients-panel, .chronic-due-panel { overflow: hidden; }
.chronic-patient-list { padding: 7px 19px 16px; }
.chronic-card { padding: 15px 0; border-bottom: 1px solid var(--line); }
.chronic-card:last-child { border-bottom: 0; }
.chronic-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.chronic-identity { min-width: 0; display: flex; align-items: center; gap: 10px; }
.chronic-avatar { width: 39px; height: 39px; flex: 0 0 39px; display: grid; place-items: center; border-radius: 13px; color: #a54e5b; background: #fbe6e9; font-size: 10px; font-weight: 800; }
.chronic-identity h3 { margin: 0; font-size: 12px; }
.chronic-identity p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.chronic-head-actions { display: flex; align-items: center; gap: 6px; }
.chronic-head-actions .select-control { max-width: 130px; }
.chronic-medications { margin: 12px 0 0 49px; border: 1px solid #e5ece8; border-radius: 11px; background: #fafcfb; overflow: hidden; }
.chronic-med-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid #e8eeeb; }
.chronic-med-row:last-child { border-bottom: 0; }
.chronic-med-row strong, .chronic-med-row small { display: block; }
.chronic-med-row strong { font-size: 10px; }
.chronic-med-row small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.next-purchase { text-align: right; }
.next-purchase strong { color: var(--green-800); }
.next-purchase.due strong { color: var(--amber); }
.next-purchase.overdue strong { color: var(--red); }
.due-label { display: inline-flex; margin-top: 3px; padding: 3px 6px; border-radius: 7px; color: var(--muted); background: #eef2f0; font-size: 8px; font-weight: 800; }
.due-label.due { color: var(--amber); background: var(--amber-soft); }
.due-label.overdue { color: var(--red); background: var(--red-soft); }
.chronic-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 11px 0 0 49px; }
.chronic-card-footer small { color: var(--muted); font-size: 8px; }
.whatsapp-button { min-height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 0; border-radius: 8px; color: #fff; background: #238b58; font-size: 9px; font-weight: 800; }
.whatsapp-button:hover { background: #197448; }
.whatsapp-button svg { width: 14px; height: 14px; }
.whatsapp-button[disabled] { cursor: default; color: #83928b; background: #e8eeeb; }
.due-count { min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 9px; color: var(--red); background: var(--red-soft); font-size: 10px; font-weight: 800; }
.chronic-due-list { padding: 10px 18px 17px; }
.chronic-due-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.chronic-due-item:last-child { border-bottom: 0; }
.chronic-due-item > div:first-child { display: flex; justify-content: space-between; gap: 10px; }
.chronic-due-item strong, .chronic-due-item small { display: block; }
.chronic-due-item strong { font-size: 10px; }
.chronic-due-item small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.chronic-due-item .whatsapp-button { width: 100%; justify-content: center; margin-top: 9px; }
.chronic-status { display: inline-flex; padding: 4px 7px; border-radius: 20px; font-size: 8px; font-weight: 800; white-space: nowrap; }
.chronic-status.not_contacted { color: #6b7771; background: #edf1ef; }
.chronic-status.whatsapp_sent { color: #17734b; background: #e1f3e9; }
.chronic-status.order_separated { color: var(--blue); background: var(--blue-soft); }
.chronic-status.delivered { color: #785cb3; background: #eee9fa; }
.medication-preview { padding: 11px 12px; border: 1px solid #e0e8e4; border-radius: 10px; background: #fafcfb; }
.medication-preview strong, .medication-preview small { display: block; }
.medication-preview strong { font-size: 10px; }
.medication-preview small { margin-top: 3px; color: var(--muted); font-size: 8px; }

.report-controls { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding: 11px 14px; }
.report-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 9px; background: #eef3f0; }
.report-tabs button { padding: 7px 12px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; }
.report-tabs button.active { color: var(--green-800); background: #fff; box-shadow: 0 2px 8px rgba(25,64,50,.08); }
.report-controls label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.report-controls input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 10px; }
.report-sheet { min-height: 600px; padding: 27px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.report-brand { display: flex; align-items: center; justify-content: space-between; padding-bottom: 20px; border-bottom: 2px solid var(--green-800); }
.report-brand h3 { margin: 0; font-size: 18px; }
.report-brand p { margin: 2px 0 0; color: var(--muted); font-size: 9px; }
.report-brand span { color: var(--muted); text-align: right; font-size: 9px; }
.report-title { margin: 24px 0 16px; }
.report-title h2 { margin: 0; font-size: 22px; }
.report-title p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.report-kpis { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 22px; }
.report-kpi { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; }
.report-kpi small, .report-kpi strong { display: block; }
.report-kpi small { color: var(--muted); font-size: 8px; text-transform: uppercase; }
.report-kpi strong { margin-top: 4px; font-size: 17px; }
.report-section { margin-top: 22px; }
.report-section h3 { margin: 0 0 9px; font-size: 12px; }
.report-section table th, .report-section table td { padding: 9px 11px; }
.report-note { margin-top: 22px; padding: 12px; border-radius: 10px; color: #526b60; background: var(--green-50); font-size: 9px; }
.report-footer { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--line); color: #91a098; text-align: center; font-size: 8px; }

.import-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; margin-bottom: 18px; }
.import-card { padding: 21px; }
.large-icon { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; }
.large-icon.green { color: var(--green-700); background: var(--green-50); }
.large-icon.blue { color: var(--blue); background: var(--blue-soft); }
.import-card h3 { margin: 15px 0 5px; font-size: 14px; }
.import-card p { min-height: 38px; margin: 0 0 16px; color: var(--muted); font-size: 10px; }
.upload-panel { margin-bottom: 18px; padding: 20px; }
.upload-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.upload-head h3 { margin: 0; font-size: 14px; }
.upload-head p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.drop-zone { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1.5px dashed #b9cdc4; border-radius: 14px; background: #f9fbfa; text-align: center; transition: .18s ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--green-600); background: var(--green-50); }
.drop-zone > span { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 11px; border-radius: 13px; color: var(--green-700); background: var(--green-100); }
.drop-zone strong { font-size: 11px; }
.drop-zone small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.import-preview { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.preview-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; background: #f8faf9; }
.preview-head strong, .preview-head span { display: block; }
.preview-head strong { font-size: 10px; }
.preview-head span { color: var(--muted); font-size: 8px; }
.preview-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-top: 1px solid var(--line); }
.preview-actions p { margin: 0; color: var(--muted); font-size: 9px; }
.import-history-panel { overflow: hidden; }
.history-list { padding: 10px 20px 17px; }
.history-row { display: grid; grid-template-columns: 35px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.history-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--green-700); background: var(--green-50); font-weight: 800; }
.history-row strong, .history-row small { display: block; }
.history-row strong { font-size: 10px; }
.history-row small { color: var(--muted); font-size: 8px; }
.history-row > span:last-child { color: var(--muted); font-size: 9px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(12,31,24,.55); backdrop-filter: blur(4px); }
.modal { width: min(610px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border-radius: 18px; background: #fff; box-shadow: 0 25px 80px rgba(5,25,17,.26); animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal > header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.modal h2 { margin: 3px 0 0; font-size: 19px; }
.modal-form { padding: 19px 22px 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #566961; font-size: 9px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; }
.field input, .field select, .field textarea { width: 100%; min-height: 39px; padding: 9px 11px; border: 1px solid #d9e3de; border-radius: 9px; color: var(--ink); background: #fbfcfb; font-size: 11px; }
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(116,70,130,.11); background: #fff; }
.field-hint { color: #8b9b93; font-size: 8px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 19px; padding-top: 16px; border-top: 1px solid var(--line); }
.type-switch { display: grid; grid-template-columns: repeat(2,1fr); gap: 7px; }
.type-switch label { cursor: pointer; }
.type-switch input { position: absolute; opacity: 0; pointer-events: none; }
.type-option { display: flex; align-items: center; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 10px; font-weight: 700; }
.type-switch input:checked + .type-option { color: var(--green-800); border-color: #9ec7b5; background: var(--green-50); }
.quick-options { padding: 12px 18px 20px; }
.quick-options button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 4px; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: transparent; text-align: left; }
.quick-options button:last-child { border-bottom: 0; }
.quick-options button:hover { padding-left: 8px; }
.quick-options button div { flex: 1; }
.quick-options strong, .quick-options small { display: block; }
.quick-options strong { font-size: 11px; }
.quick-options small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.quick-options b { color: var(--green-700); font-size: 20px; }
.quick-icon { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; font-size: 10px; font-weight: 800; }
.quick-icon.blue { color: var(--blue); background: var(--blue-soft); }
.quick-icon.coral { color: var(--coral); background: var(--coral-soft); }
.quick-icon.green { color: var(--green-700); background: var(--green-50); }
.quick-icon.loyalty { color: #8b671d; background: #fff3d7; }
.quick-icon.chronic { color: #a54e5b; background: #fbe6e9; }

.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 270px; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid #ded0e2; border-radius: 11px; color: #4e3158; background: #fdf9fe; box-shadow: 0 15px 35px rgba(54,29,63,.16); font-size: 10px; animation: toastIn .2s ease; }
.toast.error { color: #833d3d; border-color: #efcccc; background: #fff9f9; }
.toast span { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--green-700); font-weight: 800; }
.toast.error span { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateX(10px); } }

.mobile-overlay { display: none; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: minmax(0, 1.35fr) minmax(270px, .8fr); }
  .demand-layout { grid-template-columns: minmax(0, 1fr) 270px; }
  .loyalty-layout { grid-template-columns: minmax(0, 1fr) 285px; }
  .chronic-layout { grid-template-columns: minmax(0,1fr) 300px; }
}

@media (max-width: 920px) {
  :root { --sidebar: 0px; }
  .sidebar { width: 256px; transform: translateX(-100%); transition: transform .23s ease; }
  .sidebar.open { transform: none; }
  .mobile-overlay { position: fixed; inset: 0; z-index: 29; display: block; pointer-events: none; background: rgba(35,21,40,.38); opacity: 0; transition: .2s; }
  .mobile-overlay.open { pointer-events: auto; opacity: 1; }
  .menu-button { display: inline-grid !important; }
  .topbar { padding: 0 22px; }
  .view { padding: 26px 22px 40px; }
  .demo-banner { margin-left: 22px; margin-right: 22px; }
  .dashboard-grid, .dashboard-grid.lower { grid-template-columns: 1fr; }
  .demand-layout { grid-template-columns: 1fr; }
  .loyalty-layout { grid-template-columns: 1fr; }
  .chronic-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .topbar { height: 67px; padding: 0 14px; }
  .topbar h1 { font-size: 16px; }
  .topbar p, .date-chip { display: none; }
  .topbar-actions .button { width: 34px; padding: 0; font-size: 0; }
  .topbar-actions .button span { font-size: 17px; }
  .view { padding: 22px 14px 34px; }
  .demo-banner { margin: 12px 14px 0; }
  .demo-banner span { display: none; }
  .hero-row, .section-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
  .heading-actions { width: 100%; flex-direction: column; }
  .heading-actions .button { width: 100%; }
  .hero-row h2, .section-heading h2 { font-size: 21px; }
  .hero-row .button, .section-heading .button { width: 100%; }
  .metric-grid, .metric-grid.three { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 138px; padding: 14px; }
  .metric-card strong { font-size: 19px; }
  .summary-strip { grid-template-columns: repeat(2,1fr); }
  .summary-item:nth-child(2) { border-right: 0; }
  .summary-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .search-field { min-width: 0; max-width: none; }
  .filter-group, .toolbar-fields { overflow-x: auto; }
  .filter-chip { flex: 0 0 auto; }
  .table-wrap table { min-width: 720px; }
  .demand-card { grid-template-columns: 1fr; }
  .privacy-callout { grid-template-columns: 30px minmax(0,1fr); }
  .health-privacy-callout { grid-template-columns: 32px minmax(0,1fr); }
  .privacy-chip { display: none; }
  .chronic-toolbar { align-items: stretch; flex-direction: column; }
  .chronic-card-head { flex-direction: column; }
  .chronic-head-actions { width: 100%; }
  .chronic-head-actions .select-control { max-width: none; flex: 1; }
  .chronic-medications, .chronic-card-footer { margin-left: 0; }
  .chronic-med-row { grid-template-columns: minmax(0,1fr) auto; }
  .chronic-med-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .demand-actions { margin-left: 44px; }
  .import-grid { grid-template-columns: 1fr; }
  .report-controls { align-items: stretch; flex-direction: column; }
  .report-kpis { grid-template-columns: repeat(2,1fr); }
  .report-sheet { padding: 18px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .type-switch { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .demo-banner, .section-heading, .report-controls, .toast-region { display: none !important; }
  .main-content { margin: 0; }
  .view { display: none !important; padding: 0; }
  #view-relatorios { display: block !important; }
  .report-sheet { border: 0; box-shadow: none; padding: 0; }
  .report-footer { position: fixed; bottom: 0; left: 0; right: 0; }
}
