:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #eef4ef;
  --ink: #17211b;
  --muted: #66736b;
  --line: #dce5de;
  --brand: #1f7a4d;
  --brand-2: #0d5c8f;
  --warn: #b86710;
  --danger: #b33838;
  --ok: #26704a;
  --shadow: 0 12px 28px rgba(23, 33, 27, .08);
  color-scheme: light;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #101713;
  --surface: #17211b;
  --surface-2: #223027;
  --ink: #edf5ef;
  --muted: #a8b7ae;
  --line: #2d3b32;
  --brand: #45a875;
  --brand-2: #62a8d6;
  --shadow: 0 16px 34px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
small { display: block; color: var(--muted); margin-top: 3px; }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: #17211b; color: #f7fbf8; padding: 24px 18px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.14); }
.brand-mark { width: 42px; height: 42px; border-radius: 8px; display: grid; place-items: center; background: #e6f4ea; color: #1f7a4d; font-weight: 800; }
.brand h1 { margin: 0; font-size: 1.05rem; }
.brand p { margin: 3px 0 0; color: #b9c8bf; font-size: .82rem; }
.nav { display: grid; gap: 8px; }
.nav a { color: #dcebe1; border-radius: 8px; padding: 11px 12px; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-note { margin-top: auto; padding: 14px; border-radius: 8px; background: rgba(255,255,255,.08); color: #d4e1d8; font-size: .86rem; line-height: 1.4; }

.main { padding: 26px; display: grid; gap: 22px; align-content: start; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.topbar h2 { margin: 0; font-size: clamp(1.45rem, 2.5vw, 2rem); }
.topbar p { margin: 5px 0 0; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn { min-height: 40px; border-radius: 8px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; box-shadow: 0 3px 10px rgba(23,33,27,.04); white-space: nowrap; }
.btn.primary { color: #fff; background: var(--brand); border-color: var(--brand); }
.btn.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); cursor: pointer; }
.form-actions, .row-actions, .variation-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form-actions .btn.primary { flex: 1 1 220px; }
.row-actions { min-width: 126px; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.metric, .panel, .auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.metric { min-height: 108px; padding: 16px; display: grid; gap: 8px; }
.metric span { color: var(--muted); font-size: .86rem; }
.metric strong { font-size: 1.45rem; line-height: 1.1; }

.panel { overflow: hidden; }
.panel-header { padding: 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-header h3 { margin: 0; font-size: 1rem; }
.panel-body { padding: 16px; color: var(--muted); }
.form { padding: 16px; display: grid; gap: 12px; }
.form label { display: grid; gap: 6px; color: var(--muted); font-size: .83rem; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 10px; outline: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(13,92,143,.13); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 10px; }
.split, .sales-grid, .chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.chart-grid canvas { width: 100%; min-height: 260px; padding: 16px; }

.filters { display: flex; gap: 10px; align-items: center; }
.filters.wide { padding: 16px; display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); }
.filters.compact { display: flex; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; }
td { font-size: .92rem; }
.inline-form { display: grid; grid-template-columns: 1.1fr .8fr 70px 1fr auto; gap: 7px; min-width: 620px; }
.tag { display: inline-flex; min-height: 26px; align-items: center; margin: 2px; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .78rem; font-weight: 650; }
.empty { padding: 24px; color: var(--muted); text-align: center; }

.variation-box { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.variation-toolbar { justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.variation-toolbar strong { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; }
.sale-picker { display: grid; grid-template-columns: 1fr 1fr 88px 110px auto; gap: 10px; }
.cart-total { display: flex; justify-content: flex-end; gap: 12px; align-items: center; font-size: 1.1rem; }
.cart-total span { color: var(--muted); }
.cart-total strong { color: var(--brand); }

.alert-list { padding: 12px 16px 16px; display: grid; gap: 10px; }
.alert-item { padding: 12px; border-radius: 8px; border: 1px solid var(--line); display: grid; gap: 4px; }
.alert-item span { color: var(--muted); font-size: .86rem; }
.alert-item.warning { background: rgba(184,103,16,.1); }
.alert-item.danger { background: rgba(179,56,56,.1); }

.toast { padding: 12px 14px; border-radius: 8px; background: #17211b; color: #fff; box-shadow: var(--shadow); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }
.toast.floating { position: fixed; right: 18px; bottom: 18px; z-index: 999; max-width: 320px; opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }
.toast.floating.show { opacity: 1; transform: translateY(0); }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: linear-gradient(120deg, rgba(31,122,77,.12), transparent 34%), var(--bg); }
.auth-card { width: min(440px, 100%); padding: 24px; }
.auth-card h1 { margin: 8px 0 6px; }
.auth-card p { color: var(--muted); margin-top: 0; }
.auth-brand { font-weight: 800; color: var(--brand); }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; color: var(--brand-2); }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 4px; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.btn.demo {
  width: 100%;
  min-height: 46px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(120deg, var(--brand-2), var(--brand));
  border: none;
  box-shadow: 0 10px 22px rgba(13, 92, 143, .28);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn.demo:hover { transform: translateY(-1px); box-shadow: 0 14px 26px rgba(13, 92, 143, .34); }

.demo-banner {
  background: var(--warn);
  color: #fff;
  text-align: center;
  padding: 9px 14px;
  font-size: .86rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.notice { margin-top: 14px; padding: 12px; border-radius: 8px; background: var(--surface-2); color: var(--muted); overflow-wrap: anywhere; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 10; padding: 12px; }
  .brand { padding-bottom: 10px; }
  .nav { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .nav a { text-align: center; padding: 9px 6px; font-size: .86rem; }
  .sidebar-note { display: none; }
  .split, .sales-grid, .chart-grid { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}

@media (max-width: 680px) {
  .main { padding: 16px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .actions, .filters { align-items: stretch; flex-direction: column; }
  .grid-2, .grid-4, .filters.wide, .sale-picker { grid-template-columns: 1fr; }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* MENU HAMBURGUER (somente mobile, nao interfere no layout de desktop) */

.menu-toggle {
    display: none;
}

@media (max-width: 1100px) {

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 15px;
        left: 15px;
        width: 48px;
        height: 48px;
        z-index: 1001;

        border: none;
        border-radius: 8px;

        background: var(--brand);
        color: #fff;

        font-size: 24px;
        cursor: pointer;

        box-shadow: var(--shadow);
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100vh;
        z-index: 1000;
        padding: 24px 18px;
        transform: translateX(-100%);
        transition: transform .3s ease;
        overflow-y: auto;
    }

    .nav { grid-template-columns: 1fr; }
    .nav a { text-align: left; padding: 11px 12px; font-size: 1rem; }
    .sidebar-note { display: block; }

    body.menu-open .sidebar {
        transform: translateX(0);
    }

    .main { padding-top: 78px; }
}