@font-face { font-family: Roboto; src: url("/brand/fonts/Roboto-400.ttf") format("truetype"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: Roboto; src: url("/brand/fonts/Roboto-500.ttf") format("truetype"); font-style: normal; font-weight: 500; font-display: swap; }
@font-face { font-family: Roboto; src: url("/brand/fonts/Roboto-700.ttf") format("truetype"); font-style: normal; font-weight: 700; font-display: swap; }
@font-face { font-family: Roboto; src: url("/brand/fonts/Roboto-900.ttf") format("truetype"); font-style: normal; font-weight: 900; font-display: swap; }

:root {
  --ink: #1d1d1b;
  --muted: #706f6f;
  --line: #d6d5d5;
  --paper: #f7f3ea;
  --surface: #ffffff;
  --brand-red: #ff0000;
  --brand-red-dark: #b01016;
  --brand-gold: #ffbc01;
  --brand-gold-soft: #ffe193;
  --brand-navy: #001c34;
  --brand-black: #0c0d0e;
  --success: #176337;
  --warning: #8b5d00;
  --danger: #b01016;
  --module: var(--brand-red);
  --module-dark: var(--brand-red-dark);
  --radius: 20px;
  font-family: Roboto, "Segoe UI", Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: var(--paper); }
html.modal-open, body.modal-open { overflow: hidden; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 24px 24px, rgba(255,188,1,.14) 0 3px, transparent 4px) 0 0 / 48px 48px,
    linear-gradient(145deg, var(--brand-black) 0 48%, var(--brand-red-dark) 48% 68%, var(--brand-red) 68% 83%, var(--brand-gold) 83% 100%);
}
.login-card { width: min(470px, 100%); background: white; border-top: 6px solid var(--brand-red); border-radius: 22px; padding: 38px; box-shadow: 0 28px 80px rgba(0,0,0,.34); }
.login-brand, .drawer-brand { display: flex; align-items: center; gap: 14px; }
.brand-orbit { width: 66px; height: 66px; flex: 0 0 auto; border: 3px solid currentColor; border-radius: 50%; display: grid; place-items: center; color: var(--brand-red); }
.brand-orbit.small { width: 54px; height: 54px; color: white; }
.brand-crab { width: 48px; height: 25px; display: block; background: currentColor; -webkit-mask: url("/brand/caranguejo-outline.svg") center / contain no-repeat; mask: url("/brand/caranguejo-outline.svg") center / contain no-repeat; }
.brand-orbit.small .brand-crab { width: 40px; height: 20px; }
.wordmark { font-weight: 600; letter-spacing: .08em; font-size: 1.25rem; color: var(--ink); }
.wordmark span { color: var(--brand-red); font-weight: 400; }
.wordmark.compact { color: white; font-size: 1.05rem; }
.wordmark.compact span { color: rgba(255,255,255,.76); }
.login-brand small, .drawer-brand small { display: block; color: var(--muted); font-size: .67rem; letter-spacing: .14em; margin-top: 5px; }
.drawer-brand small { color: rgba(255,255,255,.7); }
.section-label { display: inline-block; margin-top: 24px; color: var(--brand-red-dark); font-size: .67rem; font-weight: 800; letter-spacing: .12em; }
.login-card h1 { font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.02; margin: 20px 0 12px; font-weight: 500; }
.login-card > p { color: var(--muted); line-height: 1.55; }
.stack { display: grid; gap: 17px; margin-top: 28px; }
label { min-width: 0; display: grid; gap: 7px; color: var(--muted); font-weight: 700; font-size: .78rem; letter-spacing: .02em; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); padding: 12px 13px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--module); box-shadow: 0 0 0 3px color-mix(in srgb, var(--module) 16%, transparent); }
button { border: 0; border-radius: 8px; padding: 10px 15px; font-weight: 800; }
.primary { color: white; background: var(--module); }
.primary:hover { filter: brightness(.94); }
.primary.wide { width: 100%; min-height: 48px; letter-spacing: .08em; }
.secondary { color: white; background: var(--module-dark); }
.ghost { background: transparent; border: 1px solid var(--line); color: inherit; }
.form-error { color: var(--danger) !important; font-weight: 700; margin: 0; }
.access-hint { font-size: .76rem; border-top: 1px solid var(--line); margin: 24px 0 0 !important; padding-top: 18px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 272px minmax(0, 1fr); }
.app-shell[data-section="abc"], .app-shell[data-section="catalog"] { --module: var(--brand-gold); --module-dark: #755d18; }
.app-shell[data-section="clients"], .app-shell[data-section="orders"] { --module: var(--brand-red); --module-dark: var(--brand-red-dark); }
.app-shell[data-section="visits"], .app-shell[data-section="commissions"] { --module: var(--brand-navy); --module-dark: var(--brand-black); }
.app-shell[data-section="reports"] { --module: var(--brand-black); --module-dark: #000000; }

.sidebar { position: sticky; top: 0; z-index: 30; height: 100vh; overflow-y: auto; color: white; padding: 28px 18px; display: flex; flex-direction: column; gap: 22px; background:
  radial-gradient(circle at 18px 18px, rgba(255,188,1,.12) 0 4px, transparent 5px) 0 0 / 54px 54px,
  linear-gradient(155deg, var(--brand-black) 0%, var(--ink) 72%, var(--brand-red-dark) 100%); }
.drawer-account { padding: 15px 10px; border-top: 1px solid rgba(255,255,255,.18); border-bottom: 1px solid rgba(255,255,255,.18); display: grid; gap: 4px; }
.drawer-account small { color: rgba(255,255,255,.68); }
.sidebar nav { display: grid; gap: 4px; }
.nav-button { width: 100%; text-align: left; color: rgba(255,255,255,.84); background: transparent; padding: 12px 13px; border-radius: 999px; font-weight: 600; display: flex; gap: 12px; align-items: center; }
.nav-button .nav-icon { width: 28px; text-align: center; font-size: 1.15rem; }
.nav-button:hover, .nav-button.active { color: var(--brand-red-dark); background: white; }
.side-foot { margin-top: auto; display: grid; gap: 14px; color: rgba(255,255,255,.66); line-height: 1.4; letter-spacing: .05em; }
.side-foot .ghost { color: white; border-color: rgba(255,255,255,.35); }
.drawer-backdrop { display: none; }

.workspace { min-width: 0; padding: 0 34px 56px; }
.topbar { min-height: 112px; margin: 0 -34px 24px; padding: 22px 34px; display: flex; align-items: center; gap: 18px; color: white; background: var(--brand-black); box-shadow: 0 2px 7px rgba(0,0,0,.13); }
.topbar-heading { min-width: 0; }
.eyebrow { color: rgba(255,255,255,.7); font-size: .67rem; font-weight: 800; letter-spacing: .14em; margin: 0 0 5px; }
.topbar h1 { font-size: clamp(1.55rem, 3vw, 2.25rem); margin: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-icon { display: none; color: white; background: transparent; font-size: 1.8rem; padding: 6px; }
.topbar-actions { margin-left: auto; display: none; gap: 16px; font-size: 2rem; }
.topbar-actions button { padding: 5px 7px; color: white; background: transparent; font-size: 1.8rem; font-weight: 400; }
.mobile-home-brand { display: none; }
.profile { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.profile div:last-child { display: grid; }
.profile small { color: rgba(255,255,255,.72); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: white; color: var(--module-dark); font-weight: 900; }

.filters { margin: 0 0 24px; display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)) auto; gap: 12px; padding: 16px; border: 1px solid var(--line); background: var(--surface); align-items: end; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.filters > *, .content > *, .home-launcher > *, .cards > * { min-width: 0; }
.content { min-width: 0; display: grid; gap: 20px; }
.notice { padding: 13px 15px; border-left: 4px solid var(--brand-gold); background: #fff8df; color: #5a4400; font-size: .85rem; }

.home-launcher { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.launcher-tile { min-width: 0; min-height: 104px; overflow: hidden; color: white; border-radius: 8px; padding: 17px; display: flex; align-items: center; gap: 14px; text-align: left; box-shadow: 0 4px 10px rgba(0,0,0,.13); }
.launcher-tile span:first-child { font-size: 1.7rem; }
.launcher-tile strong { min-width: 0; font-size: 1.05rem; line-height: 1.15; overflow-wrap: anywhere; letter-spacing: .02em; }
.launcher-tile.clients { background: var(--brand-red); }
.launcher-tile.orders { background: var(--brand-navy); }
.launcher-tile.abc { color: var(--ink); background: linear-gradient(135deg, var(--brand-gold-soft), var(--brand-gold)); }
.launcher-tile.reports { background: var(--brand-black); }
.launcher-tile.visits { background: var(--brand-red-dark); }
.launcher-tile.catalog { color: var(--ink); background: linear-gradient(135deg, var(--brand-gold), #eab835); }
.home-message { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.message-card { border-radius: 24px; padding: 22px; background: white; border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.message-card h2 { color: var(--brand-red-dark); font-size: 1.55rem; font-weight: 400; margin: 0 0 16px; }
.message-card p { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.45; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.team-card { display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: start; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fbfcfb; }
.team-avatar { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--brand-red); font-weight: 800; }
.team-card small { color: var(--brand-red-dark); font-size: .62rem; font-weight: 900; letter-spacing: .08em; }
.team-card h3 { margin: 4px 0; font-size: .95rem; }
.team-card p { margin: 0; color: var(--muted); font-size: .75rem; }
.team-sellers { grid-column: 1 / -1; display: grid; gap: 7px; padding-top: 10px; border-top: 1px solid var(--line); }
.team-sellers span { display: flex; align-items: center; gap: 8px; font-size: .76rem; }
.team-sellers b { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-gold-soft); color: var(--ink); font-size: .62rem; }
.team-sellers em { color: var(--muted); font-size: .76rem; }

.cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 10px rgba(0,0,0,.055); }
.card { padding: 18px; }
.card span { display: block; color: var(--muted); text-transform: uppercase; font-size: .64rem; font-weight: 850; letter-spacing: .08em; }
.card strong { display: block; margin-top: 9px; font-size: 1.55rem; font-weight: 500; }
.card small { color: var(--muted); }
.panel { padding: 20px; overflow: hidden; }
.panel-header { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 16px; }
.panel-header h2 { margin: 0; color: color-mix(in srgb, var(--module-dark) 80%, #333); font-size: 1.2rem; font-weight: 600; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: .82rem; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.two-cols { display: grid; grid-template-columns: 1.3fr .7fr; gap: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #edf0f1; font-size: .8rem; vertical-align: top; }
th { color: var(--muted); font-size: .65rem; text-transform: uppercase; letter-spacing: .07em; }
td strong { display: block; }
td small { color: var(--muted); }
.status { display: inline-block; padding: 4px 8px; border-radius: 999px; font-size: .66rem; font-weight: 850; text-transform: uppercase; }
.status.enviado, .status.aprovado, .status.paga { color: var(--success); background: #e8f5ed; }
.status.pendente_aprovacao, .status.pendente, .status.programada { color: var(--warning); background: #fff3dc; }
.status.cancelado, .status.rejeitado { color: var(--danger); background: #fdebea; }
.status.rascunho { color: #59625a; background: #ecefec; }
span.abc { font-weight: 900; width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 50%; }
span.abc.A { color: #8b0000; background: #ffdddd; }
span.abc.B { color: #5a4400; background: #fff0b8; }
span.abc.C { color: var(--brand-navy); background: #e7ebef; }
.bar-list { display: grid; gap: 15px; }
.bar-row { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr auto; align-items: center; gap: 12px; font-size: .8rem; }
.bar-track { height: 9px; background: #edf0f1; border-radius: 9px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--module); border-radius: inherit; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mini { padding: 7px 10px; border-radius: 6px; border: 1px solid var(--line); background: white; color: var(--ink); font-size: .7rem; }
.mini.danger { color: var(--danger); }
.empty { padding: 46px 24px; text-align: center; color: var(--muted); }
.empty::before { content: "⌕"; display: block; margin-bottom: 12px; color: #bbb; font-size: 3.5rem; }

.mobile-list { display: none; }
.mobile-row { display: grid; grid-template-columns: 56px minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 17px 4px; border-bottom: 1px solid var(--line); }
.row-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--module) 22%, white); color: var(--module-dark); font-size: 1.3rem; }
.mobile-row strong { display: block; font-weight: 600; }
.mobile-row small { display: block; margin-top: 4px; color: var(--muted); }
.row-more { color: var(--muted); font-size: 1.5rem; }

dialog { width: min(760px, calc(100% - 32px)); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(18,43,45,.65); backdrop-filter: blur(3px); }
#client-dialog { max-height: calc(100dvh - 24px); overflow-x: hidden; overflow-y: auto; }
.modal-form { padding: 24px; display: grid; gap: 18px; }
.modal-form header, .modal-form footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-form h2 { margin: 6px 0 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-wide { grid-column: 1 / -1; }
.cnpj-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.cnpj-search button { min-height: 45px; white-space: nowrap; }
.form-status { margin: -4px 0 2px; color: var(--muted); font-size: .82rem; }
.form-status.success { color: #1a6b35; }
.form-status.error { color: var(--brand-red-dark); }
.icon-button { background: transparent; font-size: 1.6rem; color: var(--muted); }

.flow-dialog { position: fixed; inset: 0; width: min(980px, calc(100% - 24px)); max-width: none; max-height: 92dvh; margin: auto; border-radius: 10px; overflow: hidden; }
.order-flow { min-height: min(860px, 92dvh); max-height: 92dvh; display: grid; grid-template-rows: auto auto minmax(0,1fr); overflow: hidden; background: white; }
.flow-header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; padding: 18px 22px; color: white; background: linear-gradient(120deg, var(--brand-red-dark), var(--brand-red)); }
.flow-header h2 { margin: 0; font-size: 1.65rem; font-weight: 500; }
.flow-header small { display: block; color: rgba(255,255,255,.65); margin-top: 3px; }
.flow-close, .flow-save { color: white; background: transparent; }
.flow-close { font-size: 2rem; padding: 0 6px; font-weight: 300; }
.flow-save { letter-spacing: .03em; }
.flow-tabs { display: flex; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; background: white; border-bottom: 1px solid var(--line); }
.flow-tabs::-webkit-scrollbar { display: none; }
.flow-tabs button { flex: 1 0 auto; border-radius: 0; color: var(--muted); background: transparent; padding: 15px 24px; border-bottom: 4px solid transparent; }
.flow-tabs button.active { color: var(--brand-red-dark); border-bottom-color: var(--brand-red); }
.flow-body { min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; padding: 22px 22px max(22px, env(safe-area-inset-bottom)); scroll-padding-bottom: max(22px, env(safe-area-inset-bottom)); background: #f7f5f1; }
.order-pane { display: none; }
.order-pane.active { display: block; }
.ion-card { padding: 24px; border-radius: 24px; background: white; border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.ion-card + .ion-card { margin-top: 18px; }
.ion-card h3 { color: var(--brand-red-dark); margin: 0 0 22px; font-size: 1.25rem; font-weight: 500; }
.order-head-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.order-table-card { padding: 17px; display: grid; gap: 16px; border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: 0 7px 25px rgba(20,36,59,.04); }
.order-stage-title { display: flex; align-items: center; gap: 10px; }
.order-stage-title > span { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; color: white; background: var(--brand-red); font-size: 12px; font-weight: 900; }
.order-stage-title > div { min-width: 0; flex: 1; display: grid; gap: 2px; }
.order-stage-title strong { color: var(--brand-navy); font-size: 14px; }
.order-stage-title small { color: var(--muted); font-size: 10px; }
.order-stage-title em { padding: 5px 8px; border-radius: 999px; color: #8b5d00; background: #fff2d5; font-size: 9px; font-style: normal; font-weight: 900; }
.order-search-field { min-height: 48px; padding: 0 13px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.order-search-field > span { width: 19px; color: #8796a6; font-size: 1.1rem; }
.order-search-field input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.order-search-field input::placeholder { color: #95a1af; }
.product-catalog, .order-items { display: grid; }
.product-catalog { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.product-row { min-height: 66px; padding: 12px 4px; position: relative; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: white; }
.product-photo-button { padding: 0; flex: 0 0 auto; border: 0; border-radius: 9px; background: transparent; cursor: zoom-in; }
.product-row > .product-photo-button { position: relative; z-index: 1; }
.product-photo-button:disabled { cursor: default; }
.product-photo-button:focus-visible { outline: 3px solid var(--brand-red); outline-offset: 3px; }
.product-row-action { min-width: 0; min-height: 66px; padding: 0 4px 0 74px; position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.product-photo-frame { width: 58px; height: 70px; flex: 0 0 58px; display: grid; place-items: center; overflow: hidden; border: 1px solid #e8edf0; border-radius: 9px; background: white; }
.product-photo-frame img { display: block; max-width: 50px; max-height: 64px; width: auto; height: auto; object-fit: contain; }
.product-photo-frame > span { color: #9aaab5; font-size: 9px; text-align: center; }
.product-catalog .product-row:last-child, .order-items .product-row:last-child { border-bottom: 0; }
.product-row-action > span { min-width: 0; display: grid; gap: 4px; }
.product-row-action strong { overflow: hidden; color: var(--brand-navy); font-size: 12px; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.product-row-action small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.product-row-action b { flex: 0 0 auto; color: var(--brand-red-dark); font-size: 11px; }
.product-catalog .catalog-selected { background: #fff3f3; }
.item-row { padding: 18px 8px; border-bottom: 1px solid var(--line); background: white; }
.item-row-head { display: flex; justify-content: space-between; gap: 14px; }
.item-row h4 { margin: 0; font-weight: 500; }
.item-meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: .82rem; }
.item-controls { display: flex; align-items: center; gap: 6px; }
.item-controls button { width: 34px; height: 34px; padding: 0; border-radius: 50%; background: #eef1f2; color: var(--ink); }
.item-controls button.remove { color: var(--danger); }
.order-sticky-total { position: sticky; bottom: -22px; display: flex; justify-content: space-between; margin: 18px -22px -22px; padding: 16px 22px; background: white; border-top: 1px solid var(--line); }
.order-sticky-total span { display: grid; gap: 3px; color: var(--muted); }
.order-sticky-total strong { color: var(--ink); }
.totals-card { display: grid; gap: 0; }
.total-line { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 14px 8px; color: var(--muted); }
.total-line:nth-child(odd) { background: #fafafa; }
.total-line strong { color: var(--ink); font-weight: 500; }
.total-line.grand { margin-top: 8px; padding-block: 18px; border-top: 2px solid var(--brand-red); font-size: 1.08rem; }
.total-line .markup { color: var(--brand-navy); }
.total-line .discount { color: var(--success); }
.mix-list { display: grid; gap: 2px; }
.mix-row { display: flex; justify-content: space-between; gap: 14px; padding: 15px 10px; border-bottom: 1px solid var(--line); }
.alert-list { display: grid; }
.alert-row { display: grid; grid-template-columns: 52px 1fr; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.alert-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: #fff0b8; color: var(--brand-navy); font-weight: 900; }
.alert-row.error .alert-icon { color: var(--brand-red-dark); background: #fde8e5; }
.alert-row strong { display: block; margin-bottom: 5px; }
.alert-row p { margin: 0; color: var(--muted); line-height: 1.45; }
.item-editor { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(20,37,36,.72); }
.item-editor[hidden] { display: none; }
.item-editor-card { box-sizing: border-box; width: min(620px, 100%); max-height: calc(100dvh - 24px); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; overflow: hidden; padding: 24px; border-radius: 24px; background: white; box-shadow: 0 24px 70px rgba(0,0,0,.38); }
.item-editor-card header { display: flex; justify-content: space-between; gap: 12px; }
.item-editor-card header small { color: var(--brand-red-dark); font-weight: 900; letter-spacing: .08em; }
.item-editor-card h3 { margin: 5px 0; }
.item-editor-card header p { margin: 0; color: var(--muted); }
.item-editor-product { display: grid; grid-template-columns: 110px 1fr; gap: 18px; align-items: center; margin: 22px 0; padding: 16px; border-radius: 18px; background: #f5f7f5; }
.item-editor-product > div:first-child { width: 110px; height: 110px; display: grid; place-items: center; overflow: hidden; border-radius: 14px; background: white; }
.item-editor-product img { width: 100%; height: 100%; object-fit: contain; }
.item-editor-product span, .item-editor-product small { display: block; color: var(--muted); }
.item-editor-product strong { display: block; margin: 5px 0; font-size: 1.35rem; }
.item-editor-fields { min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.editor-subtotal { display: grid; align-items: center; min-height: 45px; font-size: 1.3rem; color: var(--brand-red-dark); }
.item-editor-card footer { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; margin-top: 22px; }
.ghost.danger { color: var(--danger); }

.product-lightbox-backdrop { padding: 16px; position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(5,24,46,.72); overscroll-behavior: contain; }
.product-lightbox-backdrop[hidden] { display: none; }
.product-lightbox { width: min(100%,620px); height: min(86dvh,780px); max-height: calc(100dvh - 32px); padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; border-radius: 18px; background: white; box-shadow: 0 24px 70px rgba(0,0,0,.3); }
.product-lightbox header { flex: 0 0 auto; display: flex; align-items: start; justify-content: space-between; gap: 16px; color: var(--brand-navy); }
.product-lightbox header strong { padding-top: 7px; font-size: 16px; line-height: 1.35; }
.product-lightbox header button { width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid #d7e2ea; border-radius: 9px; color: var(--brand-navy); background: white; font-size: 25px; }
.product-lightbox-photo { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; background: white; }
.product-lightbox-photo img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.product-lightbox-back { min-height: 42px; flex: 0 0 auto; border: 1px solid #cddbe4; border-radius: 9px; color: var(--brand-navy); background: white; font-weight: 700; }

.mobile-row-button { width: 100%; border: 0; border-radius: 0; text-align: left; background: transparent; }
.detail-dialog { width: min(780px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: hidden; }
.order-detail { box-sizing: border-box; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; max-height: calc(100dvh - 24px); padding: 24px; overflow: hidden; }
.order-detail > header, .order-detail > footer { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.order-detail h2 { margin: 7px 0 4px; }
.order-detail header p { margin: 0; color: var(--muted); }
.detail-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 22px 0; }
.detail-summary div { padding: 14px; border-radius: 14px; background: #f3f6f5; }
.detail-summary span, .detail-summary strong { display: block; }
.detail-summary span { color: var(--muted); font-size: .7rem; text-transform: uppercase; }
.detail-summary strong { margin-top: 5px; }
.detail-items { display: grid; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.detail-item { display: grid; grid-template-columns: 58px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.detail-thumb { width: 58px; height: 58px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; background: #f3f5f3; font-size: .7rem; }
.detail-thumb img { width: 100%; height: 100%; object-fit: contain; }
.detail-item h3, .detail-item p { margin: 0; }
.detail-item h3 { font-size: .9rem; }
.detail-item p { margin-top: 4px; color: var(--muted); font-size: .75rem; }
.order-detail > footer { position: relative; z-index: 1; min-height: 48px; align-items: center; justify-content: flex-end; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); background: white; }
.catalog-notice { border-left-color: var(--brand-gold); }

.toast { position: fixed; z-index: 80; right: 22px; bottom: 22px; max-width: 420px; padding: 13px 16px; color: white; background: #263234; border-radius: 8px; box-shadow: 0 10px 32px rgba(0,0,0,.25); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.loading { min-height: 300px; display: grid; place-items: center; color: var(--muted); }

@media (max-width: 1180px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(78vw, 350px); padding: 0; gap: 0; overflow-y: auto; color: #202124; background: white; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 16px 0 40px rgba(0,0,0,.3); }
  .app-shell.drawer-open .sidebar { transform: translateX(0); }
  .drawer-backdrop { position: fixed; inset: 0; z-index: 25; display: block; visibility: hidden; opacity: 0; background: rgba(0,0,0,.55); border-radius: 0; transition: .2s; }
  .app-shell.drawer-open .drawer-backdrop { visibility: visible; opacity: 1; }
  .workspace { padding: 0 0 42px; }
  .drawer-brand { min-height: 118px; padding: 24px 22px 14px; color: white; background: radial-gradient(circle at 18px 18px, rgba(255,188,1,.15) 0 4px, transparent 5px) 0 0 / 54px 54px, linear-gradient(145deg, var(--brand-black), var(--brand-red-dark)); }
  .drawer-account { padding: 12px 22px 22px; color: white; background: radial-gradient(circle at 18px 18px, rgba(255,188,1,.15) 0 4px, transparent 5px) 0 -14px / 54px 54px, linear-gradient(145deg, var(--brand-black), var(--brand-red-dark)); border: 0; }
  .drawer-account strong { overflow: hidden; font-size: 1rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
  .drawer-account small { color: rgba(255,255,255,.66); font-size: .78rem; font-weight: 400; }
  .sidebar nav { padding: 16px 0; gap: 0; }
  .nav-button { width: calc(100% - 12px); min-height: 58px; padding: 0 22px 0 24px; gap: 18px; border-radius: 0 999px 999px 0; color: #202124; font-size: 1rem; font-weight: 450; }
  .nav-button .nav-icon { width: 30px; color: #7b7d80; font-size: 1.35rem; }
  .nav-button:hover, .nav-button.active { color: var(--brand-red-dark); background: #fff0f0; }
  .nav-button.active .nav-icon { color: var(--brand-red); }
  .side-foot { margin-top: 0; padding: 20px 22px; gap: 14px; color: #74777a; border-top: 1px solid #e0e0e0; background: white; }
  .side-foot .ghost { color: #202124; border-color: #d8dadd; }
  .topbar { position: sticky; top: 0; z-index: 20; min-height: 96px; margin: 0; padding: 16px 18px; font-weight: 400; }
  .topbar-icon { display: block; }
  .topbar-actions { display: flex; }
  .profile { display: none; }
  .filters { grid-template-columns: 1fr 1fr; margin: 0; padding: 14px 18px; border-width: 0 0 1px; box-shadow: none; }
  .filters .secondary { grid-column: 1 / -1; }
  .content { padding: 12px; gap: 16px; }
  .home-launcher { grid-template-columns: 1fr 1fr; gap: 10px; }
  .launcher-tile { min-height: 70px; padding: 13px 15px; border-radius: 5px; gap: 12px; }
  .launcher-tile span:first-child { font-size: 1.55rem; }
  .launcher-tile strong { font-size: 1rem; font-weight: 500; letter-spacing: .015em; }
  .home-message, .cards, .two-cols { grid-template-columns: 1fr; }
  .panel { border-radius: 0; margin-inline: -18px; border-left: 0; border-right: 0; box-shadow: none; }
  .desktop-only { display: none !important; }
  .mobile-list { display: block; }
  .flow-dialog { position: fixed; inset: 0; width: 100dvw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; overflow: hidden; }
  .order-flow { min-height: 0; height: 100%; max-height: 100%; }
  .item-editor { position: fixed; padding: 12px; }
  .flow-body { padding: 16px 16px max(16px, env(safe-area-inset-bottom)); scroll-padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .order-sticky-total { bottom: -16px; margin: 18px -16px -16px; padding: 16px; }
  .app-shell[data-section="overview"] .topbar { min-height: 250px; align-items: flex-start; background: linear-gradient(160deg, var(--brand-red) 0 10%, var(--brand-black) 10% 82%, var(--brand-gold) 82% 86%, white 86%); }
  .app-shell[data-section="overview"] .mobile-home-brand { position: absolute; inset: 82px 58px 40px; display: grid; place-items: center; gap: 8px; color: white; }
  .mobile-brand-orbit { width: 76px; height: 76px; display: grid; place-items: center; border: 2px solid rgba(255,255,255,.92); border-radius: 50%; }
  .mobile-brand-orbit img { display: block; width: 56px; height: auto; }
  .mobile-home-brand small { font-size: .72rem; font-weight: 400; letter-spacing: .16em; }
  .app-shell[data-section="overview"] .filters { display: none; }
  .app-shell[data-section="overview"] .eyebrow { display: none; }
}

@media (max-width: 560px) {
  .login-shell { padding: 0; background: var(--brand-black); }
  .login-card { min-height: 100vh; border-radius: 0; padding: 48px 24px 30px; }
  .topbar h1 { font-size: 1.75rem; }
  .eyebrow { display: none; }
  .topbar-actions span:first-child { display: none; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters label:nth-child(n+3) { grid-column: span 2; }
  .cards, .two-cols, .form-grid, .order-head-grid { grid-template-columns: 1fr; }
  .cnpj-search { grid-template-columns: 1fr; }
  .cnpj-search button { width: 100%; }
  .home-launcher { gap: 10px; }
  .launcher-tile { min-height: 68px; padding: 12px; }
  .launcher-tile strong { font-size: .95rem; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .flow-header { padding: 15px 12px; gap: 10px; }
  .flow-header h2 { font-size: 1.35rem; }
  .flow-tabs button { padding: 14px 12px; font-size: .72rem; }
  .ion-card { padding: 20px 16px; border-radius: 20px; }
  .order-table-card { padding: 14px 12px; border-radius: 16px; }
  .product-row-action { gap: 8px; }
  .product-row-action b { max-width: 78px; text-align: right; }
  .item-editor-card { max-height: calc(100dvh - 16px); padding: 19px 15px; border-radius: 20px; }
  .item-editor-fields, .detail-summary { grid-template-columns: 1fr; }
  .item-editor-card footer { grid-template-columns: 1fr 1fr; }
  .item-editor-card footer span { display: none; }
  .detail-item { grid-template-columns: 50px 1fr; }
  .detail-item > strong { grid-column: 2; }
}

@media (max-height: 600px) {
  .detail-dialog { max-height: calc(100dvh - 12px); }
  .order-detail { height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); padding: 12px 16px; }
  .order-detail h2 { margin: 3px 0; font-size: 1.05rem; }
  .order-detail header p { font-size: .72rem; line-height: 1.2; }
  .detail-summary { gap: 6px; margin: 8px 0; }
  .detail-summary div { padding: 7px 10px; border-radius: 9px; }
  .detail-summary span { font-size: .58rem; }
  .detail-summary strong { margin-top: 2px; font-size: .82rem; }
  .detail-item { padding: 7px 0; }
  .detail-thumb { width: 44px; height: 44px; }
  .detail-item h3 { font-size: .78rem; }
  .detail-item p { margin-top: 2px; font-size: .66rem; }
  .order-detail > footer { min-height: 39px; margin-top: 6px; padding-top: 6px; }
  .order-detail > footer button { padding: 7px 12px; }
}

@media (max-height: 360px) {
  .order-detail { grid-template-rows: auto minmax(0, 1fr) auto; padding: 8px 16px; }
  .order-detail .section-label,
  .order-detail header p,
  .detail-summary { display: none; }
  .order-detail h2 { margin: 0; font-size: .92rem; }
  .detail-item { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .detail-item h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .detail-item > strong { grid-column: auto; }
  .order-detail > footer { min-height: 35px; margin-top: 2px; padding-top: 2px; }
  .order-detail > footer button { padding: 4px 10px; }
}
