/* LocaFesta — design system */
:root {
  --primary: #6d28d9;
  --primary-600: color-mix(in srgb, var(--primary) 88%, #000);
  --primary-50: color-mix(in srgb, var(--primary) 7%, #fff);
  --primary-100: color-mix(in srgb, var(--primary) 14%, #fff);
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e6e8ef;
  --border-strong: #d4d7e2;
  --text: #171a2b;
  --text-2: #4a5068;
  --muted: #7c8299;
  --green: #16a34a; --green-50: #ecfdf3;
  --red: #dc2626; --red-50: #fef2f2;
  --amber: #d97706; --amber-50: #fffbeb;
  --blue: #2563eb; --blue-50: #eff6ff;
  --cyan: #0891b2; --cyan-50: #ecfeff;
  --pink: #db2777; --pink-50: #fdf2f8;
  --gray-50: #f3f4f7;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 45, .06);
  --shadow: 0 1px 3px rgba(20, 24, 45, .06), 0 6px 20px rgba(20, 24, 45, .05);
  --shadow-lg: 0 20px 50px rgba(20, 24, 45, .18);
  --sidebar: 252px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14.5px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; line-height: 1.45; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 750; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.strong { font-weight: 700; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.sm { gap: 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); }

/* ---------- layout */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #12142a; color: #c9cce0; display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--primary), #ec4899); display: grid; place-items: center; font-size: 20px; flex: none; overflow: hidden; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand b { font-size: 16px; display: block; letter-spacing: -.01em; }
.brand small { color: #8f93b3; font-size: 11.5px; display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #b4b8d2; font-weight: 550; font-size: 14px; transition: .15s; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 40%, transparent); }
.nav .ico { width: 22px; text-align: center; font-size: 16px; }
.nav .badge-count { margin-left: auto; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }
.sidebar-foot { margin-top: auto; padding: 14px 6px 0; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; }
.user-chip:hover { background: rgba(255,255,255,.06); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-100); color: var(--primary); display: grid; place-items: center; font-weight: 700; flex: none; font-size: 13px; }
.sidebar .avatar { background: rgba(255,255,255,.12); color: #fff; }
.user-chip b { color: #fff; font-size: 13px; display: block; }
.user-chip small { font-size: 11.5px; color: #8f93b3; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--border); }
.topbar .title { flex: 1; min-width: 0; }
.topbar .title small { color: var(--muted); display: block; font-size: 12.5px; }
.btn.menu-btn { display: none; }
.view { padding: 8px 28px 40px; max-width: 1440px; width: 100%; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .grow h1 { font-size: 22px; }

/* ---------- surface */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { flex: 1; }
.card-body { padding: 16px 18px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 4px 0 10px; }

/* ---------- stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.stats.dash { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stats.dash > .stat:first-child { grid-column: span 2; }
.stats.dash > .stat:first-child .val { font-size: 30px; }
@media (max-width: 1350px) { .stats.dash { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; cursor: default; transition: .15s; }
.stat[data-href] { cursor: pointer; }
.stat[data-href]:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.stat .lbl { color: var(--text-2); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 15px; background: var(--primary-50); flex: none; }
.stat .val { font-size: 24px; font-weight: 780; letter-spacing: -.02em; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat.hl { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #ec4899)); color: #fff; border: 0; }
.stat.hl .lbl, .stat.hl .sub { color: rgba(255,255,255,.85); }
.stat.hl .ic { background: rgba(255,255,255,.18); }
.ic.green { background: var(--green-50); } .ic.red { background: var(--red-50); } .ic.amber { background: var(--amber-50); } .ic.blue { background: var(--blue-50); } .ic.cyan { background: var(--cyan-50); } .ic.pink { background: var(--pink-50); }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 650; font-size: 14px; cursor: pointer; white-space: nowrap; transition: .12s; text-decoration: none; }
.btn:hover { background: var(--surface-2); border-color: #c3c7d6; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn.primary:hover { background: var(--primary-600); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn.wa:hover { background: #1fb457; }
.btn.danger { color: var(--red); border-color: #f3c4c4; }
.btn.danger:hover { background: var(--red-50); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.xs { height: 27px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 32px; }
.btn.block { width: 100%; }
.btn-group { display: inline-flex; background: var(--gray-50); border-radius: 11px; padding: 3px; gap: 2px; border: 1px solid var(--border); }
.btn-group button { border: 0; background: transparent; padding: 6px 13px; border-radius: 8px; font-weight: 650; font-size: 13px; color: var(--text-2); cursor: pointer; }
.btn-group button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- forms */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .label { font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.input, .field input, .field select, .field textarea { width: 100%; height: 40px; border: 1px solid var(--border-strong); border-radius: 10px; padding: 0 12px; background: #fff; outline: none; transition: .12s; font-size: 14.5px; }
.field textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c6 { grid-column: span 6; } .c4 { grid-column: span 4; } .c3 { grid-column: span 3; } .c9 { grid-column: span 9; } .c2 { grid-column: span 2; } .c5 { grid-column: span 5; } .c7 { grid-column: span 7; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 550; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.search { position: relative; }
.search input { padding-left: 36px; }
.search::before { content: "🔍"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .55; }
.input-money { position: relative; }
.input-money::before { content: "R$"; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; font-weight: 600; }
.input-money input { padding-left: 34px; }

/* ---------- chips & badges */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border-strong); background: #fff; border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }
.chip .n { opacity: .65; margin-left: 4px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--gray-50); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.b-gray { background: #f1f2f6; color: #5b6178; }
.b-amber { background: var(--amber-50); color: #b45309; }
.b-blue { background: var(--blue-50); color: #1d4ed8; }
.b-violet { background: var(--primary-50); color: var(--primary); }
.b-cyan { background: var(--cyan-50); color: #0e7490; }
.b-green { background: var(--green-50); color: #15803d; }
.b-red { background: var(--red-50); color: #b91c1c; }
.b-pink { background: var(--pink-50); color: #be185d; }
.b-dark { background: #e9eaf0; color: #30344a; }

/* ---------- tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- list items */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.li:last-child { border-bottom: 0; }
.li.click { cursor: pointer; }
.li.click:hover { background: var(--surface-2); }
.li .when { width: 54px; text-align: center; flex: none; }
.li .when b { display: block; font-size: 15px; }
.li .when small { color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 700; }
.thumb { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--gray-50); flex: none; display: grid; place-items: center; font-size: 20px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .em { font-size: 38px; margin-bottom: 8px; }
.empty b { color: var(--text-2); display: block; margin-bottom: 4px; font-size: 15px; }

/* ---------- product cards */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: .15s; }
.pcard:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.pcard .ph { aspect-ratio: 4/3; background: var(--gray-50); position: relative; display: grid; place-items: center; font-size: 44px; }
.pcard .ph img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.pcard .ph .badge { position: absolute; top: 10px; left: 10px; }
.pcard .bd { padding: 13px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pcard .price { font-weight: 780; font-size: 17px; }
.pcard.off { opacity: .55; }
.meter { height: 6px; background: var(--gray-50); border-radius: 99px; overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; }

/* ---------- picker (novo pedido) */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.pick .nm { font-size: 13.5px; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.pick { border: 1.5px solid var(--border); border-radius: 12px; padding: 10px; display: flex; gap: 10px; align-items: center; background: #fff; transition: .12s; }
.pick.sel { border-color: var(--primary); background: var(--primary-50); }
.pick.indisp { opacity: .5; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: #fff; }
.qty button { width: 30px; height: 30px; border: 0; background: transparent; cursor: pointer; font-size: 16px; font-weight: 700; color: var(--primary); }
.qty button:disabled { color: #c5c8d6; cursor: default; }
.qty span { min-width: 24px; text-align: center; font-weight: 700; }
.summary { position: sticky; top: 84px; }
.sum-line { display: flex; justify-content: space-between; padding: 6px 0; color: var(--text-2); }
.sum-line.total { border-top: 1px dashed var(--border-strong); margin-top: 6px; padding-top: 12px; font-size: 20px; color: var(--text); font-weight: 800; }

/* ---------- autocomplete */
.ac { position: relative; }
.ac-list { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 290px; overflow: auto; }
.ac-item { padding: 10px 13px; cursor: pointer; border-bottom: 1px solid var(--border); }
.ac-item:hover, .ac-item.hi { background: var(--primary-50); }
.ac-item:last-child { border-bottom: 0; }

/* ---------- status stepper */
.stepper { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.stepper .st { flex: 1; min-width: 92px; text-align: center; font-size: 11.5px; font-weight: 650; color: var(--muted); position: relative; padding-top: 18px; }
.stepper .st::before { content: ""; position: absolute; top: 4px; left: 0; right: 0; height: 6px; border-radius: 99px; background: var(--gray-50); }
.stepper .st.done::before { background: var(--primary); }
.stepper .st.cur { color: var(--primary); }
.stepper .st.cur::before { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }

/* ---------- calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal .dow { padding: 8px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); text-align: center; background: var(--surface-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal .day { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; background: #fff; min-width: 0; }
.cal .day:hover { background: var(--surface-2); }
.cal .day.out { background: #fafbfd; }
.cal .day.out .dn { color: #b9bdcc; }
.cal .day .dn { font-size: 12.5px; font-weight: 700; color: var(--text-2); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal .day.today .dn { background: var(--primary); color: #fff; }
.ev { font-size: 11.5px; font-weight: 600; padding: 2px 6px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; border-left: 3px solid currentColor; }
.ev.more { background: transparent; border: 0; color: var(--muted); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.week .wd { background: #fff; border: 1px solid var(--border); border-radius: 12px; min-height: 240px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.week .wd.today { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.week .wd h4 { font-size: 12px; text-transform: uppercase; color: var(--muted); }
.week .wd h4 b { display: block; font-size: 20px; color: var(--text); }
.evc { border-radius: 9px; padding: 7px 9px; font-size: 12px; cursor: pointer; border-left: 3px solid currentColor; }
.evc b { display: block; color: var(--text); font-size: 12.5px; }
.evc span { color: var(--text-2); }

/* ---------- delivery cards */
.dcard { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.dcard .time { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.addr { display: flex; gap: 8px; align-items: flex-start; color: var(--text-2); }

/* ---------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 650; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 14px; }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs button .n { background: var(--gray-50); border-radius: 99px; padding: 1px 7px; font-size: 11.5px; margin-left: 5px; color: var(--text-2); }

/* ---------- modal */
.overlay { position: fixed; inset: 0; background: rgba(15, 17, 35, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; animation: fade .15s; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 640px; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; display: flex; flex-direction: column; max-height: none; }
.modal.lg { max-width: 920px; } .modal.sm { max-width: 440px; } .modal.xl { max-width: 1100px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }

/* ---------- toast */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #171a2b; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; max-width: 380px; animation: pop .2s; display: flex; gap: 10px; align-items: center; }
.toast.err { background: #b91c1c; }
.toast.ok { background: #15803d; }

/* ---------- charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart-box { width: 100%; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--muted); }
.chart .bar { fill: var(--primary); transition: .15s; }
.chart .bar:hover { opacity: .8; }
.chart .grid line { stroke: var(--border); }
.hbars { display: flex; flex-direction: column; gap: 11px; }
.hbar .top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px; }
.hbar .trk { height: 9px; border-radius: 99px; background: var(--gray-50); overflow: hidden; }
.hbar .trk i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-tip { position: fixed; z-index: 300; background: #171a2b; color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 8px; pointer-events: none; font-weight: 600; white-space: nowrap; }

/* ---------- misc */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.alert { padding: 12px 14px; border-radius: 12px; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.alert.warn { background: var(--amber-50); color: #92400e; }
.alert.info { background: var(--blue-50); color: #1e40af; }
.alert.danger { background: var(--red-50); color: #991b1b; }
.alert.success { background: var(--green-50); color: #166534; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.gallery .gi { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--gray-50); border: 1px solid var(--border); display: grid; place-items: center; text-align: center; font-size: 12px; padding: 4px; }
.gallery .gi img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.gallery .gi .x { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border: 0; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; z-index: 2; }
.upload { border: 2px dashed var(--border-strong); border-radius: 12px; display: grid; place-items: center; aspect-ratio: 1; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 12.5px; text-align: center; padding: 6px; }
.upload:hover { border-color: var(--primary); color: var(--primary); }
.photo-input { width: 100%; aspect-ratio: 4/3; border-radius: 12px; border: 2px dashed var(--border-strong); display: grid; place-items: center; cursor: pointer; overflow: hidden; background: var(--surface-2); color: var(--muted); font-weight: 600; position: relative; }
.photo-input img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 240px; padding: 6px; z-index: 50; }
.dropdown-menu button, .dropdown-menu a { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 11px; border-radius: 8px; cursor: pointer; font-weight: 550; color: var(--text); font-size: 14px; }
.dropdown-menu button:hover, .dropdown-menu a:hover { background: var(--surface-2); }
.fab { display: none; }
.bottom-nav { display: none; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--primary-100); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; margin: 50px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.color-dot { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.color-dot.on { box-shadow: 0 0 0 2px var(--text); }

/* ---------- login */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: radial-gradient(1200px 600px at -10% -10%, #8b5cf6 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #ec4899 0, transparent 55%), #1a1240; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero h1 { font-size: 40px; line-height: 1.1; letter-spacing: -.03em; max-width: 520px; }
.auth-hero p { color: rgba(255,255,255,.8); font-size: 16px; max-width: 480px; margin-top: 16px; }
.auth-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 520px; margin-top: 36px; }
.auth-feats div { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: 14px; font-size: 13.5px; font-weight: 600; }
.auth-feats div span { font-size: 20px; display: block; margin-bottom: 4px; }
.balloons { position: absolute; right: 40px; top: 40px; font-size: 64px; opacity: .9; animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-14px) rotate(4deg); } }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { font-size: 24px; margin-bottom: 6px; }

/* ---------- print */
.doc { background: #fff; color: #111; font-size: 13.5px; line-height: 1.55; }
.doc h1 { font-size: 20px; text-align: center; margin: 14px 0 4px; }
.doc .doc-head { display: flex; gap: 16px; align-items: center; border-bottom: 2px solid #111; padding-bottom: 12px; }
.doc .doc-head img { width: 64px; height: 64px; object-fit: contain; }
.doc table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.doc th, .doc td { border: 1px solid #bbb; padding: 6px 8px; text-align: left; font-size: 13px; }
.doc th { background: #f2f2f2; }
.doc .clausulas { white-space: pre-wrap; margin-top: 8px; }
.doc .assin { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 46px; text-align: center; }
.doc .assin div { border-top: 1px solid #111; padding-top: 6px; font-size: 12.5px; }
.doc .assin img { max-height: 70px; margin: 0 auto -8px; }
.doc-wrap { background: #e9eaf0; padding: 24px; border-radius: 12px; }
.doc-page { background: #fff; max-width: 800px; margin: 0 auto; padding: 44px 52px; box-shadow: var(--shadow); }
#print-area { display: none; }
@media print {
  body { background: #fff; }
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block !important; }
  #print-area .doc-page { box-shadow: none; padding: 0; max-width: none; }
  .no-print { display: none !important; }
  @page { margin: 16mm; }
}

/* ---------- responsive */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 14px; }
  .topbar .hide-m { display: none; }
  .view { padding: 4px 14px 110px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .stats, .stats.dash { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 13px; }
  .stat .val { font-size: 19px; }
  .stat .lbl { font-size: 12px; }
  .stat .ic { width: 26px; height: 26px; font-size: 13px; }
  .form-grid > * { grid-column: span 12 !important; }
  .form-grid > .m6 { grid-column: span 6 !important; }
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcard .bd { padding: 10px; }
  .pcard .price { font-size: 15px; }
  .picker { grid-template-columns: 1fr; }
  .summary { position: static; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal, .modal.lg, .modal.sm, .modal.xl { max-width: none; border-radius: 20px 20px 0 0; max-height: 94vh; overflow-y: auto; }
  .modal-foot { border-radius: 0; position: sticky; bottom: 0; }
  .modal-head { position: sticky; top: 0; background: #fff; z-index: 2; border-radius: 20px 20px 0 0; }
  .page-head { margin-bottom: 14px; }
  .page-head .grow h1 { font-size: 20px; }
  .page-head > .btn:not(.keep) { flex: 1 1 auto; }
  .page-head > :not(.btn):not(.btn-group):not(.dropdown) { flex: 1 1 100%; }
  .page-head .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .page-head .row input.input { flex: 1; width: auto !important; min-width: 0; }
  .li.wrap-m { flex-wrap: wrap; }
  .li.wrap-m > .grow { flex-basis: calc(100% - 60px); }
  .cal .day { min-height: 64px; padding: 3px; }
  .cal .ev { font-size: 0; padding: 0; height: 6px; border-radius: 3px; border: 0; }
  .cal .ev.more { font-size: 10px; height: auto; }
  .week { grid-template-columns: 1fr; }
  .week .wd { min-height: 0; }
  .kv { grid-template-columns: 110px 1fr; }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff; border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 650; color: var(--muted); padding: 4px 0; border: 0; background: transparent; cursor: pointer; }
  .bottom-nav .ico { font-size: 19px; line-height: 1.2; filter: grayscale(1); opacity: .7; }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a.active .ico { filter: none; opacity: 1; }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; background: var(--primary); color: #fff; font-size: 28px; border: 0; box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 45%, transparent); z-index: 31; cursor: pointer; }
  .toasts { left: 14px; right: 14px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 24px; min-height: auto; }
  .auth-hero h1 { font-size: 28px; }
  .auth-feats { display: none; }
  .balloons { font-size: 40px; right: 20px; top: 20px; }
  .doc-page { padding: 22px 18px; }
  .doc-wrap { padding: 8px; }
  /* tabelas viram cartões no celular */
  table.table.resp thead { display: none; }
  table.table.resp, table.table.resp tbody, table.table.resp tr, table.table.resp td { display: block; width: 100%; }
  table.table.resp tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  table.table.resp td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.table.resp td::before { content: attr(data-l); color: var(--muted); font-size: 12.5px; font-weight: 600; text-align: left; }
  table.table.resp td.main-cell { font-size: 15px; font-weight: 700; text-align: left; justify-content: flex-start; }
  table.table.resp td.main-cell::before { display: none; }
  table.table.resp td.num { text-align: right; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat .val { font-size: 17px; }
}
.doc .chart { height: auto; }
