:root {
  --blue: #041B54;
  --yellow: #FBAB0B;
  --bg: #F5F6F8;
  --border: #D9DDE5;
  --text: #1B2430;
  --muted: #687482;
  --edit: #38BDF8;
  --danger: #DC2626;
  --whats: #25D366;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
body.dark { background: #101318; color: #f2f5f8; }
a { color: inherit; text-decoration: none; }
.app { min-height: 100vh; display: grid; grid-template-columns: 286px minmax(0, 1fr); }
.app.login-shell { grid-template-columns: 1fr; }
.app.login-shell .main { min-height: 100vh; display: grid; align-content: center; justify-items: center; max-width: none; }
.app.login-shell .topbar { width: min(420px, 100%); }
.app.login-shell form.card { width: min(420px, 100%); }
.sidebar { background: var(--blue); color: white; padding: 22px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 26px; }
.brand img { width: 54px; height: 54px; object-fit: contain; }
.brand strong { display: block; font-size: 18px; }
.brand span { color: #dbe4ef; font-size: 13px; }
.nav { display: grid; gap: 8px; align-content: start; }
.nav a, .nav button { border: 0; width: 100%; text-align: left; border-radius: 10px; padding: 12px 14px; background: transparent; color: white; font-weight: 700; cursor: pointer; }
.nav a.active, .nav a:hover, .nav button:hover { background: rgba(255,255,255,.12); }
.main { padding: 28px; max-width: 1680px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.title h1 { margin: 0; color: var(--blue); font-size: 30px; }
body.dark .title h1 { color: #fff; }
.title p { margin: 6px 0 0; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard { display: grid; grid-template-columns: minmax(420px, 1.2fr) minmax(360px, .8fr); gap: 18px; align-items: start; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 15px; }
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.stat strong { display: block; margin-top: 8px; color: var(--blue); font-size: 26px; }
.card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 18px; box-shadow: 0 10px 26px rgba(4,27,84,.06); min-width: 0; }
body.dark .card { background: #181D24; border-color: #2B3340; }
.notice { margin: 0 0 16px; border-radius: 12px; padding: 13px 16px; font-weight: 900; border: 1px solid transparent; }
.notice.success { background: #DCFCE7; color: #14532D; border-color: #86EFAC; }
.notice.error { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }
.action-card { min-height: 150px; color: white; border: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; transition: transform .14s ease, box-shadow .14s ease; }
.action-card:hover, button:hover { transform: translateY(-1px); }
.action-card strong { font-size: 25px; }
.product-card { color: white; min-height: 126px; display: grid; align-content: center; gap: 8px; cursor: pointer; transition: transform .14s ease, filter .14s ease; }
.product-card:hover { transform: scale(1.015); filter: brightness(1.06); }
.seller-card { color: white; min-height: 118px; cursor: pointer; border: 0; }
.btn { border: 0; border-radius: 10px; padding: 13px 18px; font-weight: 800; cursor: pointer; background: var(--blue); color: white; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; }
.btn.secondary { background: var(--yellow); color: var(--blue); }
.btn.edit { background: var(--edit); color: #062033; }
.btn.danger { background: var(--danger); color: white; }
.btn.black { background: #111827; color: white; }
.btn.whats { background: var(--whats); color: white; }
.btn.ghost { background: white; color: var(--blue); border: 1px solid var(--border); }
body.dark .btn.ghost { background: #202631; color: #fff; border-color: #374151; }
.bottom-actions { position: sticky; bottom: 0; background: rgba(245,246,248,.94); padding: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; backdrop-filter: blur(8px); z-index: 5; }
body.dark .bottom-actions { background: rgba(16,19,24,.94); }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 12px 13px; font: inherit; background: white; color: var(--text); }
body.dark input, body.dark select, body.dark textarea { background: #111827; color: #fff; border-color: #374151; }
textarea { min-height: 90px; resize: vertical; }
label { display: grid; gap: 7px; font-weight: 800; font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); margin: 8px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip input { display: none; }
.chip span { display: inline-flex; min-height: 38px; align-items: center; border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; background: white; cursor: pointer; font-weight: 800; }
body.dark .chip span { background: #111827; border-color: #374151; }
.chip input:checked + span { background: var(--yellow); color: var(--blue); border-color: var(--yellow); }
.measure-presets { display: grid; gap: 10px; }
.measure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.measure-card input { display: none; }
.measure-card span { min-height: 74px; display: grid; align-content: center; gap: 5px; border: 2px solid var(--border); border-radius: 12px; padding: 12px; background: white; cursor: pointer; transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease; }
.measure-card b { color: var(--blue); font-size: 18px; }
.measure-card small { color: var(--muted); font-weight: 800; }
.measure-card:hover span { transform: translateY(-1px); border-color: #94A3B8; }
.measure-card input:checked + span { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(251,171,11,.18); }
body.dark .measure-card span { background: #111827; border-color: #374151; }
body.dark .measure-card b { color: #fff; }
.quantity-approx { margin-top: 10px; border: 1px solid #BFDBFE; background: #EFF6FF; border-radius: 12px; padding: 12px; display: grid; gap: 4px; }
.quantity-approx span { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.quantity-approx strong { color: var(--blue); font-size: 19px; }
.quantity-approx small { color: var(--muted); font-weight: 700; }
body.dark .quantity-approx { background: #111827; border-color: #334155; }
.payment-preview { border: 1px solid var(--border); background: #F8FAFC; border-radius: 14px; padding: 15px; display: grid; gap: 6px; }
.payment-preview span { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.payment-preview strong { color: var(--blue); font-size: 26px; }
.payment-preview p { margin: 0; color: var(--text); font-weight: 800; line-height: 1.4; }
body.dark .payment-preview { background: #111827; border-color: #374151; }
body.dark .payment-preview strong, body.dark .payment-preview p { color: #fff; }
.size-grid-block { display: grid; gap: 8px; }
.size-grid { display: grid; grid-template-columns: repeat(8, minmax(70px, 1fr)); gap: 10px; }
.size-box { min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: #F8FAFC; padding: 9px; gap: 6px; text-align: center; }
.size-box span { color: var(--blue); font-weight: 900; font-size: 14px; }
.size-box input { min-height: 38px; padding: 8px; text-align: center; font-weight: 900; }
body.dark .size-box { background: #111827; border-color: #374151; }
body.dark .size-box span { color: #fff; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.color-card input { display: none; }
.color-card span { display: grid; gap: 8px; justify-items: center; border: 2px solid var(--border); border-radius: 12px; padding: 10px; background: white; cursor: pointer; transition: transform .14s ease, border-color .14s ease; }
.color-card img { width: 74px; height: 74px; object-fit: cover; border-radius: 10px; }
.color-card b { color: var(--blue); font-size: 18px; }
.color-card input:checked + span { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(251,171,11,.18); transform: translateY(-1px); }
body.dark .color-card span { background: #111827; border-color: #374151; }
.progress { margin: 0 0 18px; }
.progress-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 800; }
.bar { height: 8px; border-radius: 999px; background: #E5E7EB; overflow: hidden; margin-top: 8px; }
.bar span { display: block; height: 100%; background: var(--blue); }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 12px; max-height: 560px; background: white; }
.table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; min-width: 760px; }
body.dark .table { background: #181D24; }
.table th { position: sticky; top: 0; z-index: 1; background: #EEF2F7; color: var(--blue); }
.table th, .table td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; vertical-align: middle; }
.table td:last-child { white-space: nowrap; }
.badge { display: inline-flex; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800; background: #E5E7EB; color: var(--blue); }
.badge.on { background: #DCFCE7; color: #166534; }
.badge.off { background: #FEE2E2; color: #991B1B; }
.doc-page { width: 794px; min-height: 1123px; margin: 0 auto; background: var(--bg); color: var(--text); overflow: hidden; }
.doc-header { height: 202px; background: var(--blue); display: grid; grid-template-columns: 210px 1fr 300px; gap: 18px; align-items: center; padding: 34px 44px; }
.doc-header img { width: 148px; height: 128px; object-fit: contain; }
.doc-header h1 { margin: 0 0 10px; color: white; font-size: 30px; }
.doc-header p { color: #dbe4ef; margin: 4px 0; font-size: 18px; }
.doc-header .doc-cnpj { font-size: 19px; font-weight: 800; }
.doc-header .doc-contact { font-size: 16px; line-height: 1.35; max-width: 390px; }
.doc-side-meta { display: grid; gap: 8px; }
.doc-date { color: #dbe4ef; font-size: 13px; font-weight: 900; text-align: center; }
.doc-badge { background: var(--yellow); color: var(--blue); border-radius: 16px; padding: 22px 24px; }
.doc-badge strong { display: block; font-size: 30px; }
.doc-content { padding: 34px 40px 28px; display: grid; gap: 18px; }
.doc-card { background: white; border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px; }
.doc-validity { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 12px 18px; text-align: center; color: #B87400; font-size: 15px; font-weight: 900; text-transform: uppercase; }
.doc-client-card { padding-block: 16px; }
.doc-items-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.doc-items-grid.single { grid-template-columns: 1fr; }
.doc-item { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-top: 0; }
.doc-item-title { background: #eef2f7; color: var(--blue); font-size: 18px; font-weight: 900; padding: 12px 14px; }
.doc-row { display: grid; grid-template-columns: minmax(110px, .7fr) minmax(0, 1fr); gap: 10px; padding: 7px 12px; border-bottom: 1px solid #e7ebf0; min-height: 34px; align-items: center; }
.doc-row b { color: var(--muted); font-size: 13px; }
.doc-row span { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; border: 1px solid var(--border); }
.doc-price { background: #eef2f7; color: var(--blue); font-weight: 900; }
.doc-values-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: stretch; }
.doc-summary-stack { display: grid; gap: 14px; }
.doc-summary-box, .doc-total { background: white; color: var(--blue); border: 1px solid var(--border); border-radius: 14px; padding: 14px 18px; }
.doc-summary-box span, .doc-total span { display: block; font-size: 12px; font-weight: 900; }
.doc-summary-box strong { display: block; margin-top: 8px; font-size: 18px; }
.doc-total strong { display: block; margin-top: 8px; font-size: 21px; }
.doc-payment-detail { background: #F8FAFC; border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; color: var(--text); font-weight: 800; line-height: 1.55; font-size: 15px; }
.doc-terms { color: #9A3E3E; font-size: 15px; line-height: 1.45; }
.signature { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; }
.signature div { padding-top: 42px; border-top: 1px solid #6B7280; font-weight: 800; font-size: 12px; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .main { padding: 16px; }
  .cols-2, .cols-3, .cols-4, .dashboard, .stat-grid, .form-grid, .doc-items-grid, .doc-values-layout { grid-template-columns: 1fr; }
  .form-grid .wide, .form-grid .full { grid-column: auto; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .doc-page { width: 100%; min-height: auto; }
  .doc-header { grid-template-columns: 1fr; height: auto; }
  .size-grid { grid-template-columns: repeat(4, minmax(64px, 1fr)); }
}
@media print {
  body { background: white; }
  .sidebar, .topbar, .no-print { display: none !important; }
  .app { display: block; }
  .main { padding: 0; max-width: none; }
  .doc-page { width: 210mm; min-height: 297mm; margin: 0; }
}
.admin-workspace { display: grid; gap: 16px; }
.admin-section { border: 1px solid var(--border); border-radius: 14px; background: white; box-shadow: 0 10px 26px rgba(4,27,84,.05); overflow: hidden; }
.admin-section > summary { list-style: none; cursor: pointer; padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; font-weight: 900; color: var(--blue); background: #fff; }
.admin-section > summary::-webkit-details-marker { display: none; }
.admin-section > summary::after { content: "Abrir"; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.admin-section[open] > summary { border-bottom: 1px solid var(--border); background: #F8FAFC; }
.admin-section[open] > summary::after { content: "Fechar"; }
.admin-body { padding: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(180px, 1fr)); gap: 14px; align-items: end; }
.form-grid .wide { grid-column: span 2; }
.form-grid .full { grid-column: 1 / -1; }
.compact-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.compact-actions .btn { min-height: 36px; padding: 8px 10px; font-size: 12px; }
.product-summary h3 { margin-top: 0; }
.summary-product-name { color: var(--blue); font-size: 22px; font-weight: 900; margin-bottom: 14px; }
.summary-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.summary-row { display: grid; grid-template-columns: minmax(150px, .75fr) minmax(180px, 1fr); gap: 14px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.summary-row:last-child { border-bottom: 0; }
.summary-row span { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.summary-row strong { color: var(--text); font-size: 14px; }
.summary-total { margin-top: 14px; background: var(--yellow); color: var(--blue); border-radius: 12px; padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.summary-total span { font-size: 12px; font-weight: 900; text-transform: uppercase; }
.summary-total strong { font-size: 22px; }
body.dark .admin-section, body.dark .stat { background: #181D24; border-color: #2B3340; }
body.dark .admin-section > summary { background: #181D24; color: #fff; }
body.dark .admin-section[open] > summary { background: #202631; }
body.dark .table-wrap { background: #181D24; border-color: #2B3340; }
body.dark .table th { background: #202631; color: #fff; }
body.dark .summary-row strong { color: #fff; }
