/* DropDash — folha unica, mobile-first. Tokens no :root; desktop ganha a barra lateral a partir de 900px. */
:root {
  --bg: #0f1311; --surface: #171c19; --surface-2: #1d2420; --surface-3: #232b26; --border: #262e29; --border-2: #303933;
  --text: #eef2ee; --muted: #9aa59d; --dim: #6a746d;
  --green: #7fe3ac; --green-2: #45a06e; --green-bg: #1d3a2b; --red: #ff8a80; --red-bg: #3a2320; --yellow: #f2c94c; --yellow-bg: #3a3320;
  --purple: #7d72dc; --blue: #8eaeff; --gold: #d3b881;
  --dc-receita: #7d72dc; --dc-lucro: #45a06e;
  --radius: 14px; --radius-s: 10px; --gutter: 16px; --tabbar: 62px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --tip: #0b0e0c; --tabbar-bg: #121715f2; --hero-a: #1f5d3c; --hero-b: #2a9a5c; --hero-border: #2f8a55;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f6f3; --surface: #ffffff; --surface-2: #f3f6f3; --surface-3: #e5ebe6; --border: #dde4de; --border-2: #c9d3cb;
  --text: #121914; --muted: #5a665d; --dim: #8a958c;
  --green: #1f8a4f; --green-2: #2f9e62; --green-bg: #dcf3e5; --red: #c62f23; --red-bg: #fbe3e0; --yellow: #9a6a00; --yellow-bg: #fdf1cc;
  --purple: #6a5fd6; --blue: #3f6fd8; --gold: #9a7b2c;
  --dc-receita: #6a5fd6; --dc-lucro: #2f9e62;
  --tip: #ffffff; --tabbar-bg: #fffffff2; --hero-a: #2a9a5c; --hero-b: #3fbf78; --hero-border: #2f8a55;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 15px; } h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
small, .sub { color: var(--muted); font-size: 12px; }
.sub { display: block; line-height: 1.4; }
.green { color: var(--green); } .red { color: var(--red); } .yellow { color: var(--yellow); } .purple { color: var(--purple); }
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
svg { flex-shrink: 0; }

/* ---------- layout ---------- */
.app { min-height: 100vh; }
.main { padding: 12px var(--gutter) calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); max-width: 1380px; margin: 0 auto; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 0 8px; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); background: linear-gradient(var(--bg) 85%, transparent); }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title .eyebrow { font-size: 10px; letter-spacing: .14em; color: var(--dim); text-transform: uppercase; }
.topbar-title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius-s); border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.icon-button:disabled { opacity: .5; }
.icon-button.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toolbar { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 4px 0 10px; }
.toolbar .period-row { grid-column: 1 / -1; display: flex; gap: 8px; }
.toolbar .period-row .segment { flex: 1; }
.icon-button.on { border-color: var(--green); color: var(--green); }
.store-select { width: 100%; height: 36px; padding: 0 30px 0 12px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa59d' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; appearance: none; -webkit-appearance: none; }
.segment { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 3px; gap: 2px; }
.segment button { flex: 1; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; padding: 0 10px; }
.segment button.on { background: var(--surface-3); color: var(--text); font-weight: 600; }
.period-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.period-label .right { margin-left: auto; color: var(--dim); }

/* ---------- barra inferior (celular) e lateral (desktop) ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--tabbar-bg); backdrop-filter: blur(10px); border-top: 1px solid var(--border); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--dim); font-size: 10px; font-weight: 500; }
.tabbar button.active { color: var(--green); }
.sidebar { display: none; }
.drawer-overlay { display: none; position: fixed; inset: 0; background: #0009; z-index: 40; }
.drawer-overlay.open { display: block; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); z-index: 41; background: var(--surface); border-right: 1px solid var(--border); padding: calc(18px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); transform: translateX(-105%); transition: transform .2s; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.drawer.open { transform: translateX(0); }
.logo { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -.02em; }
.logo-mark { display: inline-flex; width: 32px; height: 32px; border-radius: 9px; background: var(--green-bg); color: var(--green); align-items: center; justify-content: center; }
.workspace { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface-2); }
.workspace .initial, .avatar { display: inline-flex; width: 32px; height: 32px; border-radius: 50%; align-items: center; justify-content: center; background: var(--surface-3); color: var(--green); font-size: 12px; font-weight: 700; flex-shrink: 0; }
.stack { display: flex; flex-direction: column; min-width: 0; }
.stack strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack small { font-size: 11px; }
.nav-caption { font-size: 10px; letter-spacing: .14em; color: var(--dim); margin-top: 4px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 10px; border: 0; border-radius: var(--radius-s); background: transparent; color: var(--muted); font-size: 14px; text-align: left; }
.nav button.active { background: var(--green-bg); color: var(--green); font-weight: 600; }
.nav button .soon { margin-left: auto; font-size: 10px; color: var(--dim); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.fontes { font-size: 11px; line-height: 1.6; color: var(--muted); padding: 10px; border-radius: var(--radius-s); background: var(--surface-2); border: 1px solid var(--border); }
.fontes strong { display: flex; align-items: center; gap: 6px; color: var(--green); font-size: 10px; letter-spacing: .1em; margin-bottom: 4px; }
.profile { display: flex; align-items: center; gap: 10px; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 11px; cursor: pointer; text-decoration: underline dotted; }
.linkish:hover { color: var(--green); }

@media (min-width: 900px) {
  :root { --gutter: 28px; --tabbar: 0px; }
  .tabbar, .drawer, .drawer-overlay { display: none !important; }
  .sidebar { display: flex; flex-direction: column; gap: 14px; position: fixed; top: 0; bottom: 0; left: 0; width: 236px; padding: 20px 16px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
  .main { margin-left: 236px; padding-top: 18px; padding-bottom: 40px; }
  .topbar { position: static; background: none; margin: 0; padding: 0 0 6px; }
  .topbar .icon-button.menu { display: none; }
  .toolbar { display: flex; flex-wrap: wrap; align-items: center; }
  .toolbar .store-select { width: 190px; }
  .toolbar .period-row { grid-column: auto; }
  h1 { font-size: 26px; }
}

/* ---------- cards ---------- */
.dc-grid { display: grid; gap: 10px; margin-bottom: 10px; }
.dc-grid.c5, .dc-grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dc-grid.main { grid-template-columns: 1fr; }
.dc-card { display: flex; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.dc-card.hero { grid-column: 1 / -1; background: linear-gradient(135deg, var(--hero-a), var(--hero-b)); border-color: var(--hero-border); }
.dc-card.hero .dc-ico { background: #ffffff22; color: #fff; }
.dc-card.hero .dc-label, .dc-card.hero .dc-sub { color: #dff7e8; }
.dc-card.hero .dc-value { color: #fff; font-size: 30px; }
.dc-ico { display: inline-flex; width: 34px; height: 34px; border-radius: 10px; align-items: center; justify-content: center; background: var(--surface-3); color: var(--purple); flex-shrink: 0; }
.dc-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.dc-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 5px; }
.dc-info { display: inline-flex; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border-2); font-size: 9px; align-items: center; justify-content: center; color: var(--dim); text-transform: none; }
.dc-value { font-size: clamp(18px, 5.6vw, 24px); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; line-height: 1.15; }
.dc-value.neg { color: var(--red); }
.dc-sub { font-size: 11px; color: var(--muted); line-height: 1.35; }
.dc-trend { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--green-bg); color: var(--green); }
.dc-trend.down { background: var(--red-bg); color: var(--red); }
.dc-trend.flat { background: var(--surface-3); color: var(--muted); }
.dc-panel { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; min-width: 0; }
.dc-panel h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dc-panel .dc-value { font-size: 24px; margin-bottom: 8px; }
.dc-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.dc-list > div span { color: var(--muted); }
.dc-list b { font-variant-numeric: tabular-nums; color: var(--red); }
.dc-list b.ok { color: var(--green); }
.count-badge { font-size: 10px; background: var(--surface-3); color: var(--muted); border-radius: 999px; padding: 2px 7px; font-weight: 600; }
.dc-gauge { display: flex; flex-direction: column; align-items: center; text-align: center; }
.dc-gauge h3 { align-self: flex-start; }
.dc-gauge .big { font-size: 28px; font-weight: 700; margin-top: -30px; }
@media (min-width: 640px) {
  .dc-grid.c5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dc-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dc-card.hero { grid-column: span 1; }
}
@media (min-width: 1100px) { .dc-grid.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } .dc-grid.main { grid-template-columns: 1.4fr 1fr; } }

/* ---------- paineis, listas, tabelas ---------- */
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; overflow: hidden; min-width: 0; }
.panel-heading { display: flex; align-items: flex-start; gap: 10px; padding: 14px 14px 10px; }
.panel-heading .head-text { flex: 1; min-width: 0; }
.panel-heading .caption { margin: 3px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.settings-body { padding: 0 14px 6px; }
.settings-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; }
.settings-row > span:first-child { min-width: 0; flex: 1; }
.settings-row small { display: block; margin-top: 2px; line-height: 1.45; }
.settings-row .money { white-space: nowrap; }
.compact-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.compact-card { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface); }
.compact-card small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.compact-card .money { font-size: 18px; margin-top: 2px; }
@media (min-width: 640px) { .compact-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.two-column { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 1100px) { .two-column { grid-template-columns: 1.3fr 1fr; align-items: start; } .two-column > * { margin-bottom: 0; } .two-column { margin-bottom: 10px; } }
.alert-note { padding: 12px 14px; border: 1px solid var(--border-2); border-left: 3px solid var(--yellow); border-radius: var(--radius-s); background: var(--surface-2); color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-bottom: 10px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.loading::before { content: ""; display: block; width: 26px; height: 26px; margin: 0 auto 10px; border-radius: 50%; border: 3px solid var(--border-2); border-top-color: var(--green); animation: spin .8s linear infinite; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.dt { width: 100%; border-collapse: collapse; font-size: 13px; }
.dt th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); padding: 8px 12px; border-top: 1px solid var(--border); white-space: nowrap; font-weight: 600; }
.dt td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: top; }
.dt th.numeric, .dt td.numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dt td.empty { text-align: center; color: var(--muted); padding: 22px; }
.dt tr.total td { font-weight: 600; background: var(--surface-2); }
.dt td strong { font-weight: 600; }
@media (max-width: 639px) {
  .dt thead { display: none; }
  .dt, .dt tbody, .dt tr, .dt td { display: block; }
  .dt tr { padding: 6px 14px 8px; border-top: 1px solid var(--border); }
  .dt tr.total { background: var(--surface-2); }
  .dt td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .dt td::before { content: attr(data-label); color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; text-align: left; flex-shrink: 0; }
  .dt td.lead { display: block; text-align: left; padding-bottom: 6px; font-size: 14px; }
  .dt td.lead::before { display: none; }
  .dt td.empty { display: block; text-align: center; }
  .dt td.empty::before { display: none; }
  .dt td:empty, .dt td.blank { display: none; }
  .dt td .sub { display: inline; }
  .dt td.lead .sub { display: block; margin-top: 2px; }
}

/* ---------- tags, botoes ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.green { background: var(--green-bg); color: var(--green); } .tag.red { background: var(--red-bg); color: var(--red); }
.tag.yellow { background: var(--yellow-bg); color: var(--yellow); } .tag.purple { background: #2a2650; color: #b9b2f5; } .tag.gray { }
.store-avatar { display: inline-flex; width: 26px; height: 26px; border-radius: 7px; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; margin-right: 4px; vertical-align: middle; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-s); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600; }
.button.primary { background: var(--green); border-color: var(--green); color: #0f1f16; }
.button.small { height: 30px; padding: 0 10px; font-size: 12px; }
.button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- grafico ---------- */
.chart-body { padding: 0 14px 14px; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.chart-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.dc-chart-wrap { position: relative; }
.dc-chart-wrap svg { width: 100%; height: 200px; display: block; touch-action: pan-y; }
.dc-bar.receita { fill: var(--dc-receita); } .dc-bar.lucro { fill: var(--dc-lucro); }
.dc-bar.dim { opacity: .35; }
.dc-gridline { stroke: var(--border-2); } .dc-axis { stroke: var(--border-2); } .dc-lbl { fill: var(--dim); } .dc-best { fill: var(--text); } .dc-gauge-bg { stroke: var(--surface-3); }
.dc-tip { position: absolute; top: 0; pointer-events: none; background: var(--tip); border: 1px solid var(--border-2); border-radius: 10px; padding: 8px 10px; font-size: 12px; min-width: 150px; z-index: 5; }
.dc-tip strong { display: block; margin-bottom: 4px; }
.dc-tip div { display: flex; justify-content: space-between; gap: 12px; }
.dc-tip div span { color: var(--muted); }

/* ---------- busca / filtros de tabela ---------- */
.order-toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 12px; align-items: center; }
.search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface-2); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--text); }
.order-toolbar select { height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--surface-2); }
.order-toolbar .count { font-size: 12px; color: var(--muted); }

/* ---------- dialogo, toast, login ---------- */
dialog { border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: #0009; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.dialog-body { padding: 8px 16px; font-size: 13px; color: var(--muted); }
.dialog-body p { margin: 0 0 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 16px; }
.dc-form label, .dc-login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.dc-form input, .dc-login-card input, .dialog-body input { background: var(--bg); border: 1px solid var(--border-2); border-radius: var(--radius-s); color: var(--text); padding: 10px 12px; font-size: 15px; outline: none; width: 100%; }
.dc-form input:focus, .dc-login-card input:focus { border-color: var(--green); }
.dc-login-erro { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 6px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; transition: .2s; background: var(--tip); border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 14px; font-size: 13px; max-width: calc(100vw - 32px); z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dc-login { min-height: 100vh; display: grid; place-items: center; padding: calc(24px + env(safe-area-inset-top)) 24px 24px; }
.dc-login-card { width: min(360px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px 24px; display: flex; flex-direction: column; gap: 6px; }
.dc-login-card .logo { font-size: 22px; }
.dc-login-card .caption { color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.dc-login-card .button.primary { margin-top: 14px; height: 42px; }
.page-footer { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--dim); padding: 14px 0 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- notificacoes / instalar ---- */
.alert-note.install { border-left-color: var(--green); color: var(--text); }
.alert-note.install svg { vertical-align: -2px; }
.push-box .button { display: inline-flex; }

/* ---- periodo livre ---- */
.preset-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dc-form input[type=date] { min-height: 40px; }
