/* ==========================================================================
   Integra SYS Industrial — Design System v2 (Integra Code · Glass Premium)
   Mobile-first · 100% responsivo
   ========================================================================== */
:root {
  --blue: #2E7CF6; --blue-600: #1D4ED8; --blue-700: #1E40AF; --blue-50: #EFF6FF;
  --purple: #7C3FE4; --teal: #10D9A3; --pink: #AB0E86; --navy: #0B1533; --navy-2: #13204A;
  --text: #0F172A; --text-2: #334155; --muted: #64748B; --line: #E6ECF5; --line-2: #EEF2F8;
  --bg: #F3F6FC; --card: #FFFFFF; --glass: rgba(255,255,255,.78);
  --ok: #059669; --ok-bg: #ECFDF5; --warn: #D97706; --warn-bg: #FFFBEB; --err: #DC2626; --err-bg: #FEF2F2;
  --r-sm: 8px; --r: 12px; --r-lg: 18px; --r-xl: 24px;
  --sh-1: 0 1px 2px rgba(16,24,40,.05); --sh-2: 0 4px 16px -2px rgba(16,24,40,.08), 0 2px 4px -2px rgba(16,24,40,.04);
  --sh-3: 0 20px 48px -12px rgba(16,24,40,.22); --ring: 0 0 0 4px rgba(46,124,246,.16);
  --grad-brand: linear-gradient(135deg, #2E7CF6 0%, #7C3FE4 55%, #10D9A3 120%);
  --grad-pedidos: linear-gradient(135deg, #C0158F 0%, #7C3FE4 100%);
  --grad-erp: linear-gradient(135deg, #1D4ED8 0%, #0891B2 100%);
  --side-w: 272px; --head-h: 64px; --gap: 1rem;
  --font: "Plus Jakarta Sans", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (min-width: 1280px) { :root { --gap: 1.25rem; } }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--text); font-size: 14px; line-height: 1.5; background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img { max-width: 100%; }
a { color: var(--blue-600); }
h1, h2, h3, h4 { letter-spacing: -.015em; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
::selection { background: rgba(46,124,246,.18); }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------- Fundo ---------- */
.app-body::before { content: ""; position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(1200px 600px at 110% -10%, rgba(124,63,228,.10), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, rgba(16,217,163,.10), transparent 60%),
              linear-gradient(180deg, #F6F8FD 0%, #EEF3FB 100%); }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login-page { min-height: 100vh; min-height: 100dvh; display: grid; background: #0B1533; }
.login-wrap { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }
.login-hero { position: relative; overflow: hidden; color: #fff; padding: 2rem 1.5rem; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
  background: radial-gradient(800px 400px at 0% 0%, rgba(46,124,246,.55), transparent 60%), radial-gradient(700px 500px at 100% 100%, rgba(171,14,134,.45), transparent 60%), #0B1533; }
.login-hero::after { content: ""; position: absolute; inset: 0; background: url('/static/img/bg-wave-dots.png') center/cover; opacity: .10; mix-blend-mode: screen; pointer-events: none; }
.login-hero > * { position: relative; z-index: 1; }
.login-hero .brand { display: flex; align-items: center; gap: .75rem; }
.login-hero .brand img { height: 44px; background: #fff; border-radius: 12px; padding: 4px 8px; }
.login-hero h1 { font-size: clamp(1.7rem, 4vw, 2.8rem); line-height: 1.1; margin: 0 0 .75rem; font-weight: 800; }
.login-hero h1 span { background: linear-gradient(90deg, #7DD3FC, #C4B5FD, #6EE7B7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero p { color: #C7D2FE; max-width: 520px; margin: 0; }
.login-feats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; max-width: 560px; }
.login-feats div { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 14px; padding: .75rem .9rem; font-size: .82rem; color: #E0E7FF; display: flex; gap: .55rem; align-items: center; backdrop-filter: blur(6px); }
.login-feats i { color: #6EE7B7; }
.login-client { display: inline-flex; align-items: center; gap: .6rem; background: #fff; color: var(--navy); border-radius: 999px; padding: .4rem .9rem .4rem .45rem; font-weight: 700; font-size: .8rem; width: max-content; }
.login-client img { height: 30px; }
.login-panel { background: #fff; display: grid; place-items: center; padding: 2rem 1.25rem; }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { margin: 0; font-size: 1.6rem; color: var(--navy); }
.login-sub { color: var(--muted); margin: .35rem 0 1.5rem; }
.login-form { display: grid; gap: 1rem; }
.login-error { background: var(--err-bg); color: var(--err); border: 1px solid #FECACA; padding: .7rem .9rem; border-radius: var(--r); margin-bottom: 1rem; font-weight: 600; }
.login-foot { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 1.5rem; }
.pwd-wrap { position: relative; } .pwd-wrap .input { padding-right: 2.75rem; }
.pwd-wrap button { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: .5rem; }
@media (min-width: 960px) { .login-wrap { grid-template-columns: 1.15fr 1fr; } .login-hero { padding: 3rem; } .login-panel { padding: 3rem; } }
@media (max-width: 959px) { .login-feats { display: none; } }

/* ==========================================================================
   SHELL
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.app-sidebar { width: var(--side-w); position: fixed; inset: 0 auto 0 0; z-index: 60; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0B1533 0%, #101D45 100%); color: #CBD5E1; transition: transform .28s cubic-bezier(.4,0,.2,1); box-shadow: 8px 0 32px rgba(11,21,51,.18); }
.sidebar-head { padding: 1rem 1.1rem; display: flex; align-items: center; gap: .7rem; border-bottom: 1px solid rgba(255,255,255,.07); min-height: var(--head-h); }
.sidebar-brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: #fff; flex: 1; min-width: 0; }
.sidebar-brand .logo { width: 38px; height: 38px; border-radius: 11px; background: #fff; display: grid; place-items: center; padding: 3px; flex-shrink: 0; }
.sidebar-brand .logo img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand b { display: block; font-size: 1rem; line-height: 1.1; font-weight: 800; }
.sidebar-brand small { display: block; font-size: .65rem; letter-spacing: .14em; text-transform: uppercase; color: #93C5FD; font-weight: 700; }
.sidebar-close { display: none; border: 0; background: rgba(255,255,255,.08); color: #fff; width: 34px; height: 34px; border-radius: 10px; cursor: pointer; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: .5rem .75rem 1rem; scrollbar-width: thin; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }
.nav-front { margin: 1.05rem .4rem .4rem; display: flex; align-items: center; gap: .5rem; font-size: .64rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #64748B; }
.nav-front .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.nav-front.pedidos { color: #F0ABFC; } .nav-front.erp { color: #93C5FD; } .nav-front.fiscal { color: #6EE7B7; }
.nav-front.estoque { color: #FCD34D; } .nav-front.relatorios { color: #A78BFA; } .nav-front.sistema { color: #94A3B8; }
.nav-front .nav-toggle-icon { transition: transform .2s ease; }
.nav-front.collapsed .nav-toggle-icon { transform: rotate(-90deg); }
.nav-front.expanded .nav-toggle-icon { transform: rotate(0deg); }
.nav-front[onclick] { cursor: pointer; user-select: none; }
.nav-front[onclick]:hover { color: #E2E8F0; }
.nav-item { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-radius: 10px; color: #CBD5E1; text-decoration: none; font-weight: 600; font-size: .86rem; margin: 2px 0; position: relative; transition: background .15s, color .15s; }
.nav-item i { width: 18px; text-align: center; color: #7C8DB5; font-size: .95rem; transition: color .15s; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; } .nav-item:hover i { color: #fff; }
.nav-item.active { background: linear-gradient(90deg, rgba(46,124,246,.35), rgba(124,63,228,.18)); color: #fff; box-shadow: inset 0 0 0 1px rgba(147,197,253,.18); }
.nav-item.active i { color: #93C5FD; }
.nav-item.active::before { content: ""; position: absolute; left: -.75rem; top: 20%; bottom: 20%; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad-brand); }
.nav-badge { margin-left: auto; background: #EF4444; color: #fff; font-size: .66rem; border-radius: 999px; padding: .05rem .45rem; font-weight: 800; }
.sidebar-foot { padding: .85rem; border-top: 1px solid rgba(255,255,255,.07); display: grid; gap: .6rem; }
.sidebar-client { display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; background: rgba(255,255,255,.96); border-radius: 12px; }
.sidebar-client img { height: 30px; width: auto; }
.sidebar-client b { display: block; font-size: .8rem; color: var(--navy); } .sidebar-client small { color: var(--muted); font-size: .7rem; }
.sidebar-logout { border: 0; background: rgba(239,68,68,.12); color: #FCA5A5; text-align: left; padding: .55rem .75rem; font: inherit; font-weight: 700; cursor: pointer; border-radius: 10px; display: flex; gap: .5rem; align-items: center; }
.sidebar-logout:hover { background: rgba(239,68,68,.22); color: #fff; }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(11,21,51,.5); backdrop-filter: blur(2px); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .25s; }

.app-content { flex: 1; margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; }
.global-header { position: sticky; top: 0; z-index: 40; height: var(--head-h); display: flex; align-items: center; gap: .85rem; padding: 0 1.5rem;
  background: rgba(255,255,255,.82); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px); border-bottom: 1px solid var(--line); }
.sidebar-toggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 40px; height: 40px; cursor: pointer; color: var(--text-2); flex-shrink: 0; }
.header-title { min-width: 0; flex: 1; }
.header-title h1 { margin: 0; font-size: 1.12rem; color: var(--navy); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-title p { margin: 0; color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-search-wrap { position: relative; width: min(340px, 30vw); }
.global-search-wrap i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; }
.global-search-wrap input { width: 100%; height: 40px; padding: 0 3.2rem 0 2.3rem; border: 1px solid var(--line); border-radius: 11px; background: #F8FAFD; font: inherit; }
.global-search-wrap input:focus { outline: 0; box-shadow: var(--ring); border-color: var(--blue); background: #fff; }
.global-search-wrap kbd { position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); font: 600 .65rem var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: .1rem .35rem; background: #fff; }
.header-actions { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.global-user { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem .25rem .25rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.global-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad-brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .78rem; flex-shrink: 0; }
.global-user-info span { display: block; font-weight: 700; font-size: .8rem; line-height: 1.1; } .global-user-info small { color: var(--muted); font-size: .7rem; text-transform: capitalize; }
.app-main { padding: 1.5rem; flex: 1; width: 100%; max-width: 1680px; margin: 0 auto; }
.loading-screen { display: grid; place-items: center; min-height: 50vh; font-size: 1.8rem; color: var(--blue); }

/* Mobile bottom nav */
.bottom-nav { display: none; }
@media (max-width: 1080px) {
  .app-sidebar { transform: translateX(-104%); }
  body.sidebar-open .app-sidebar { transform: none; } body.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }
  body.sidebar-open { overflow: hidden; }
  .sidebar-close { display: inline-grid; place-items: center; }
  .app-content { margin-left: 0; } .sidebar-toggle { display: inline-grid; place-items: center; }
  .global-search-wrap { display: none; } .global-user-info { display: none; } .global-user { padding: .15rem; }
  .app-main { padding: 1rem 1rem calc(5.5rem + env(safe-area-inset-bottom)); }
  .global-header { padding: 0 1rem; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: rgba(255,255,255,.96); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: .35rem .25rem calc(.35rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 24px rgba(16,24,40,.06); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: .15rem; text-decoration: none; color: var(--muted); font-size: .64rem; font-weight: 700; padding: .3rem 0; border-radius: 10px; }
  .bottom-nav a i { font-size: 1.1rem; }
  .bottom-nav a.active { color: var(--blue-600); }
  .bottom-nav a.fab i { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--grad-pedidos); color: #fff; margin-top: -1.1rem; box-shadow: 0 8px 20px rgba(171,14,134,.35); }
  .hide-mobile { display: none !important; }
}
@media (max-width: 520px) { .app-main { padding-left: .75rem; padding-right: .75rem; } .header-title p { display: none; } }

/* ==========================================================================
   COMPONENTES
   ========================================================================== */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-2); min-width: 0; }
.card-pad { padding: 1.1rem 1.25rem; }
@media (max-width: 520px) { .card-pad { padding: .9rem 1rem; } }
.card-title { font-size: .95rem; font-weight: 800; color: var(--navy); margin: 0; display: flex; align-items: center; gap: .55rem; }
.card-title i { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 9px; background: var(--blue-50); color: var(--blue-600); font-size: .82rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-foot { padding: .8rem 1.25rem; border-top: 1px solid var(--line-2); display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }
.section-gap > * + * { margin-top: var(--gap); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: var(--gap); }
.page-head h2 { margin: 0; font-size: 1.35rem; font-weight: 800; color: var(--navy); }
.page-head p { margin: .15rem 0 0; color: var(--muted); }

/* Grids */
.grid { display: grid; gap: var(--gap); }
.grid-kpi { display: grid; gap: var(--gap); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .grid-kpi { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); } }
.two-col, .split, .three-col { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .split { grid-template-columns: repeat(2, minmax(0, 1fr)); } .three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .two-col { grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); } }
.form-grid { display: grid; gap: .85rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.form-grid .span-2 { grid-column: span 2; } .form-grid .span-all { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span-2 { grid-column: 1 / -1; } .form-grid.one { grid-template-columns: 1fr; } }

/* KPI */
.kpi { padding: 1rem 1.1rem; display: flex; gap: .85rem; align-items: flex-start; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; position: relative; overflow: hidden; }
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-3); }
.kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1rem; flex-shrink: 0; }
.kpi-label { font-size: .7rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 1.4rem; font-weight: 800; color: var(--navy); letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; word-break: break-word; }
.kpi-sub { font-size: .74rem; color: var(--muted); }
@media (max-width: 520px) { .kpi { flex-direction: column; gap: .5rem; padding: .85rem; } .kpi-icon { width: 36px; height: 36px; border-radius: 10px; } .kpi-value { font-size: 1.12rem; } }
.t-blue { background: #EFF6FF; color: #2563EB; } .t-green { background: #ECFDF5; color: #059669; } .t-purple { background: #F5F3FF; color: #7C3AED; }
.t-orange { background: #FFF7ED; color: #EA580C; } .t-red { background: #FEF2F2; color: #DC2626; } .t-cyan { background: #ECFEFF; color: #0891B2; }
.t-pink { background: #FDF2F8; color: #BE185D; } .t-gray { background: #F1F5F9; color: #475569; } .t-amber { background: #FFFBEB; color: #B45309; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; height: 40px; padding: 0 1rem; border-radius: 11px; border: 1px solid transparent; font: inherit; font-weight: 700; font-size: .84rem; cursor: pointer; text-decoration: none; transition: all .15s; white-space: nowrap; user-select: none; }
.btn:focus-visible { outline: 0; box-shadow: var(--ring); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 .75rem; font-size: .78rem; border-radius: 9px; }
.btn-lg { height: 48px; padding: 0 1.4rem; font-size: .95rem; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(180deg, #2F6FF0, #1D4ED8); color: #fff; box-shadow: 0 6px 16px -4px rgba(29,78,216,.45), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-brand { background: var(--grad-pedidos); color: #fff; box-shadow: 0 8px 20px -6px rgba(171,14,134,.5); } .btn-brand:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn-success { background: linear-gradient(180deg, #10B981, #059669); color: #fff; box-shadow: 0 6px 16px -6px rgba(5,150,105,.5); }
.btn-danger { background: linear-gradient(180deg, #EF4444, #DC2626); color: #fff; }
.btn-ghost { background: #fff; color: var(--text-2); border-color: var(--line); box-shadow: var(--sh-1); } .btn-ghost:hover { background: #F8FAFD; border-color: #D5DEEB; }
.btn-soft { background: var(--blue-50); color: var(--blue-600); } .btn-soft:hover { background: #DBEAFE; }
.btn-icon { width: 40px; padding: 0; } .btn-sm.btn-icon { width: 32px; }
.btn-group { display: inline-flex; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fff; }
.btn-group .btn { border-radius: 0; border: 0; box-shadow: none; height: 36px; } .btn-group .btn + .btn { border-left: 1px solid var(--line); } .btn-group .btn.active { background: var(--blue-50); color: var(--blue-600); }

/* Inputs */
.input, .select, textarea.input { width: 100%; height: 40px; padding: 0 .8rem; border: 1px solid #D5DEEB; border-radius: 10px; font: inherit; font-size: .88rem; background: #fff; color: var(--text); transition: border .15s, box-shadow .15s; }
textarea.input { height: auto; padding: .6rem .8rem; resize: vertical; }
.input:focus, .select:focus { outline: 0; border-color: var(--blue); box-shadow: var(--ring); }
.select { appearance: none; padding-right: 2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .7rem center; }
.input-sm { height: 34px; font-size: .82rem; }
.field { display: grid; gap: .3rem; min-width: 0; } .field > span { font-size: .72rem; font-weight: 700; color: #475569; letter-spacing: .01em; }
.check { display: inline-flex; align-items: center; gap: .45rem; font-size: .84rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue-600); }
.input-icon { position: relative; } .input-icon i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; } .input-icon .input { padding-left: 2.2rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.toolbar > .grow { flex: 1 1 220px; min-width: 0; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--line-2); align-items: center; }
.filters > * { flex: 1 1 160px; min-width: 0; } .filters > .grow { flex: 2 1 240px; } .filters > .auto { flex: 0 0 auto; }
@media (max-width: 520px) { .filters { padding: .75rem 1rem; } .filters > * { flex: 1 1 100%; } }

/* Tabelas → cards no mobile */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; }
.tbl th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; padding: .7rem .9rem; border-bottom: 1px solid var(--line); background: #FAFBFE; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl td { padding: .7rem .9rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; } .tbl tbody tr:hover { background: #F8FAFF; }
.tbl tr.clickable { cursor: pointer; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .actions { white-space: nowrap; text-align: right; }
@media (max-width: 760px) {
  table.tbl.responsive thead { display: none; }
  table.tbl.responsive, .tbl.responsive tbody, .tbl.responsive tr, .tbl.responsive td { display: block; width: 100%; }
  .tbl.responsive tr { padding: .75rem 1rem; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .75rem; }
  .tbl.responsive td { padding: 0; border: 0; text-align: left !important; min-width: 0; }
  .tbl.responsive td[data-l]::before { content: attr(data-l); display: block; font-size: .64rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; }
  .tbl.responsive td.full, .tbl.responsive td.main { grid-column: 1 / -1; }
  .tbl.responsive td.main { font-size: .92rem; }
  .tbl.responsive td.actions { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-start; }
  .tbl.responsive td:empty { display: none; }
}
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8em; }
.muted { color: var(--muted); } .small { font-size: .76rem; } .strong { font-weight: 800; } .ok { color: var(--ok); } .err { color: var(--err); } .warn { color: var(--warn); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: block; }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .7rem; font-weight: 800; white-space: nowrap; background: var(--bb, #F1F5F9); color: var(--bc, #334155); line-height: 1.4; }
.badge.outline { background: #fff; border: 1px solid var(--line); }
.dot-sm { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* Chips / tabs */
.chip-bar { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; max-width: 100%; }
.chip-bar::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; height: 34px; padding: 0 .85rem; font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; color: var(--text-2); white-space: nowrap; flex-shrink: 0; transition: all .15s; }
.chip b { background: #F1F5F9; border-radius: 999px; padding: 0 .45rem; font-size: .68rem; }
.chip:hover { border-color: #C7D2E3; }
.chip.active { border-color: var(--cc, var(--blue)); color: var(--cc, var(--blue-600)); background: color-mix(in srgb, var(--cc, #2E7CF6) 9%, white); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cc, #2E7CF6) 12%, transparent); }
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--line); padding: 0 .75rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: .9rem .9rem; border: 0; background: none; font: inherit; font-weight: 700; font-size: .85rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: .45rem; align-items: center; margin-bottom: -1px; }
.tab:hover { color: var(--text-2); } .tab.active { color: var(--blue-600); border-color: var(--blue-600); }
.tab .badge { font-size: .64rem; padding: .05rem .45rem; }
.seg { display: inline-flex; background: #EEF2F8; padding: 3px; border-radius: 12px; gap: 2px; }
.seg button { border: 0; background: none; font: inherit; font-weight: 700; font-size: .8rem; color: var(--muted); padding: .45rem .85rem; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.seg button.active { background: #fff; color: var(--navy); box-shadow: var(--sh-1); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty i { font-size: 2.2rem; color: #CBD5E1; display: block; margin-bottom: .6rem; }
.empty b { display: block; color: var(--text-2); font-size: .95rem; margin-bottom: .2rem; }
.stat-line { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); font-size: .85rem; } .stat-line:last-child { border: 0; }
.stat-line > :last-child { text-align: right; }
.bar { height: 8px; border-radius: 999px; background: #EEF2F8; overflow: hidden; } .bar > span { display: block; height: 100%; border-radius: inherit; background: var(--grad-brand); }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; padding: .75rem 1.25rem; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1.1rem; border-radius: var(--r); border: 1px solid; font-size: .85rem; }
.alert i { margin-top: .15rem; } .alert-warn { background: var(--warn-bg); border-color: #FDE68A; color: #92400E; } .alert-info { background: var(--blue-50); border-color: #BFDBFE; color: #1E3A8A; } .alert-ok { background: var(--ok-bg); border-color: #A7F3D0; color: #065F46; } .alert-err { background: var(--err-bg); border-color: #FECACA; color: #991B1B; }

/* Hero das frentes */
.hero-fronts { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .hero-fronts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.front-card { padding: 1.35rem 1.4rem; border-radius: var(--r-xl); color: #fff; position: relative; overflow: hidden; text-decoration: none; display: block; box-shadow: var(--sh-3); transition: transform .2s; isolation: isolate; }
.front-card:hover { transform: translateY(-3px); }
.front-card .tag { font-size: .66rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.front-card h3 { margin: .2rem 0 .2rem; font-size: 1.2rem; font-weight: 800; }
.front-card p { margin: 0; opacity: .85; font-size: .82rem; }
.front-card .fc-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-top: 1.1rem; }
.front-card .fc-row div { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.18); border-radius: 14px; padding: .65rem .75rem; min-width: 0; }
.front-card .fc-row b { display: block; font-size: 1.2rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.front-card .fc-row span { font-size: .66rem; opacity: .9; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.front-pedidos { background: var(--grad-pedidos); } .front-erp { background: var(--grad-erp); }
.front-card::before { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.12); z-index: -1; }
.front-card::after { content: ""; position: absolute; right: 40px; bottom: -80px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.07); z-index: -1; }
@media (max-width: 520px) { .front-card .fc-row b { font-size: .95rem; } .front-card .fc-row { gap: .4rem; } .front-card .fc-row div { padding: .5rem; } }

/* Quick actions */
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.quick a, .quick button { display: flex; flex-direction: column; gap: .45rem; align-items: flex-start; padding: .85rem; border-radius: 14px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--text-2); font: inherit; font-weight: 700; font-size: .8rem; cursor: pointer; transition: all .15s; text-align: left; }
.quick a:hover, .quick button:hover { border-color: #BFD3F7; box-shadow: var(--sh-2); transform: translateY(-1px); }
.quick i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; font-size: .9rem; }

/* Workflow */
.flow { display: flex; align-items: flex-start; overflow-x: auto; padding: .35rem 0 .25rem; scrollbar-width: none; }
.flow::-webkit-scrollbar { display: none; }
.flow-step { display: flex; flex-direction: column; align-items: center; gap: .3rem; min-width: 92px; flex: 1; position: relative; font-size: .7rem; font-weight: 700; color: #94A3B8; text-align: center; }
.flow-step .dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #F1F5F9; color: #94A3B8; border: 2px solid #E2E8F0; z-index: 1; transition: all .2s; }
.flow-step.done .dot { background: var(--sc); color: #fff; border-color: var(--sc); } .flow-step.done { color: var(--text-2); }
.flow-step.current .dot { box-shadow: 0 0 0 5px color-mix(in srgb, var(--sc) 22%, transparent); transform: scale(1.06); }
.flow-step:not(:last-child)::after { content: ""; position: absolute; top: 18px; left: calc(50% + 22px); right: calc(-50% + 22px); height: 2px; background: #E2E8F0; }
.flow-step.done:not(:last-child)::after { background: var(--sc); }
.fase-tag { font-size: .58rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }

/* ==========================================================================
   NOVO PEDIDO (grade Aquarela) — responsivo
   ========================================================================== */
.pedido-layout { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1280px) { .pedido-layout { grid-template-columns: minmax(0, 1fr) 340px; } .resumo-pedido { position: sticky; top: calc(var(--head-h) + 1rem); } }
.stepper { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; margin-bottom: var(--gap); }
.stepper::-webkit-scrollbar { display: none; }
.stepper button { flex: 1 0 auto; display: flex; align-items: center; gap: .55rem; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: .6rem .9rem; font: inherit; font-weight: 700; font-size: .82rem; color: var(--muted); cursor: pointer; }
.stepper button b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #EEF2F8; font-size: .72rem; }
.stepper button.active { border-color: #E9A6DA; color: var(--pink); background: #FDF2F8; } .stepper button.active b { background: var(--pink); color: #fff; }
.stepper button.done b { background: var(--ok); color: #fff; }
.grade-toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; padding: .75rem 0; position: sticky; top: var(--head-h); z-index: 20; background: linear-gradient(180deg, #F3F6FC 80%, rgba(243,246,252,0)); }
.grade-toolbar .input-icon { flex: 1 1 200px; }
.sec-nav { display: flex; gap: .4rem; overflow-x: auto; padding: .1rem 0 .6rem; scrollbar-width: none; }
.sec-nav::-webkit-scrollbar { display: none; }
.sec-pill { border: 1px solid var(--line); background: #fff; border-radius: 999px; height: 32px; padding: 0 .8rem; font: inherit; font-size: .74rem; font-weight: 700; cursor: pointer; white-space: nowrap; color: var(--text-2); flex-shrink: 0; }
.sec-pill.has { border-color: #E9A6DA; color: var(--pink); background: #FDF2F8; }
.grade-sec { margin-bottom: .85rem; overflow: hidden; }
.grade-sec-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; cursor: pointer; gap: .75rem; user-select: none; }
.grade-sec-head h3 { margin: 0; font-size: .88rem; color: var(--navy); display: flex; align-items: center; gap: .55rem; min-width: 0; }
.grade-sec-head h3 span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grade-sec-head .chev { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: #F1F5F9; color: var(--muted); font-size: .7rem; flex-shrink: 0; transition: transform .2s; }
.grade-sec.open .grade-sec-head .chev { transform: rotate(90deg); background: #FDF2F8; color: var(--pink); }
.grade-sec-head .gs-tot { font-size: .82rem; font-weight: 800; color: var(--pink); white-space: nowrap; }
.grade-sec.open .grade-sec-head { border-bottom: 1px solid var(--line-2); background: linear-gradient(90deg, #FDF2F8, #F5F3FF 60%, #fff); }
.grade-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grade { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .8rem; }
.grade th { background: #FAFBFE; padding: .5rem .35rem; font-size: .66rem; color: #475569; border-bottom: 1px solid var(--line); text-align: center; line-height: 1.25; min-width: 86px; font-weight: 800; }
.grade th small { display: block; font-weight: 600; color: #94A3B8; font-size: .6rem; } .grade th .gp { display: block; color: var(--blue-600); font-size: .72rem; margin-top: 2px; }
.grade th .gp-in, .grade th .colq { display: block; width: 100%; max-width: 76px; min-width: 56px; margin: 3px auto 0; height: 22px; padding: 0 .25rem; border: 1px solid #DCE3EE; border-radius: 6px; text-align: center; font: inherit; font-size: .7rem; font-weight: 700; background: #fff; color: #475569; }
.grade th .gp-in { color: var(--blue-600); border-style: dashed; } .grade th .gp-in.alt { border-color: #F59E0B; background: #FFFBEB; color: #B45309; } .grade th .gp-in:focus, .grade th .colq:focus { outline: 0; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(171,14,134,.15); }
.grade th .colq::placeholder { color: #94A3B8; }
.grade th.cor-h, .grade td.cor { position: sticky; left: 0; z-index: 2; background: #fff; text-align: left; min-width: 150px; box-shadow: 1px 0 0 var(--line-2); }
.grade th.cor-h { background: #FAFBFE; padding-left: 1rem; }
.grade td { border-bottom: 1px solid var(--line-2); padding: .25rem .3rem; text-align: center; }
.grade td.cor { font-weight: 700; white-space: nowrap; padding-left: 1rem; font-size: .78rem; }
.grade td.cor small { color: var(--muted); font-weight: 800; margin-right: .35rem; font-size: .66rem; }
.grade td.cor small.cor-tipo { display: block; margin: 1px 0 0; font-weight: 600; font-size: .6rem; }
.grade input.q { width: 100%; max-width: 76px; height: 34px; padding: 0 .3rem; border: 1px solid #DCE3EE; border-radius: 9px; text-align: center; font: inherit; font-weight: 800; font-size: .86rem; background: #fff; }
.grade input.q:focus { outline: 0; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(171,14,134,.15); }
.grade input.q.filled { background: #FDF2F8; border-color: #F0ABFC; color: #86198F; }
.grade .stk { display: block; font-size: .58rem; color: #94A3B8; margin-top: 2px; white-space: nowrap; } .grade .stk.low { color: var(--err); font-weight: 800; }
.grade td.na { background: repeating-linear-gradient(45deg, #FAFBFD, #FAFBFD 5px, #F3F5F9 5px, #F3F5F9 10px); }
/* Mobile: cada cor vira um card com as variações */
.grade-cards { display: none; }
@media (max-width: 760px) {
  .grade-scroll { display: none; } .grade-cards { display: grid; gap: .5rem; padding: .75rem; }
  .gc { border: 1px solid var(--line); border-radius: 14px; padding: .7rem .75rem; background: #fff; }
  .gc.has { border-color: #F0ABFC; background: #FFFBFE; }
  .gc-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: .84rem; margin-bottom: .5rem; gap: .5rem; }
  .gc-head small { color: var(--muted); font-weight: 800; font-size: .68rem; }
  .gc-vars { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .45rem; }
  .gc-var { display: grid; gap: .2rem; font-size: .64rem; color: var(--muted); font-weight: 700; }
  .gc-var input.q { width: 100%; max-width: none; height: 42px; font-size: 1rem; border: 1px solid #DCE3EE; border-radius: 10px; text-align: center; font-weight: 800; }
  .gc-var input.q.filled { background: #FDF2F8; border-color: #F0ABFC; color: #86198F; }
  .gc-var .stk { font-size: .6rem; } .gc-var .stk.low { color: var(--err); }
}
/* Barra fixa de total no mobile */
.pedido-mbar { display: none; }
@media (max-width: 1279px) {
  .pedido-mbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 46; background: #0B1533; color: #fff; padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom)); align-items: center; gap: .75rem; box-shadow: 0 -10px 30px rgba(11,21,51,.25); }
  .pedido-mbar .tot { flex: 1; min-width: 0; } .pedido-mbar .tot small { display: block; color: #93C5FD; font-size: .68rem; font-weight: 700; } .pedido-mbar .tot b { font-size: 1.15rem; }
  body.has-mbar .bottom-nav { display: none; } body.has-mbar .app-main { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
  .resumo-pedido .resumo-actions { display: none; }
}
.totais .grand { font-size: 1.4rem; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.cliente-pick { display: grid; gap: .5rem; position: relative; }
.ac-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-3); max-height: 280px; overflow: auto; margin-top: 4px; }
.ac-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .65rem .85rem; font: inherit; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.ac-list button:hover { background: #F8FAFF; } .ac-list small { display: block; color: var(--muted); }

/* Kanban produção */
.kanban { display: grid; gap: var(--gap); grid-template-columns: repeat(4, minmax(260px, 1fr)); overflow-x: auto; padding-bottom: .5rem; scroll-snap-type: x mandatory; }
.kanban > .card { scroll-snap-align: start; }
@media (max-width: 1080px) { .kanban { grid-template-columns: repeat(4, 84vw); } }
.k-col-head { border-top: 4px solid var(--kc); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.k-card { border: 1px solid var(--line); border-radius: 14px; padding: .8rem; cursor: grab; background: #fff; transition: all .15s; user-select: none; }
.k-card:hover { border-color: #C7D2E3; box-shadow: var(--sh-2); }
.k-card:active { cursor: grabbing; }
.k-card.is-dragging { opacity: 0.45; transform: scale(0.97); box-shadow: var(--sh-3); }
.k-card.pinned {
  border-color: #f59e0b;
  border-left: 5px solid #f59e0b;
  background: linear-gradient(135deg, #fffcf5 0%, #ffffff 100%);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}
.btn-pin {
  padding: 3px 6px;
  border-radius: 8px;
  transition: transform .15s, background .15s;
  cursor: pointer;
  color: #94a3b8;
}
.btn-pin:hover {
  background: rgba(245, 158, 11, 0.15);
  transform: scale(1.15);
  color: #d97706;
}
.btn-pin.pinned {
  color: #d97706;
}
.k-col-cards.drag-over {
  background: rgba(37, 99, 235, 0.06);
  outline: 2px dashed #3b82f6;
  outline-offset: -3px;
  border-radius: 12px;
}

/* Modal / drawer */
.modal-back { position: fixed; inset: 0; background: rgba(11,21,51,.5); backdrop-filter: blur(3px); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 1rem; animation: fade .15s; }
.modal { width: 100%; max-width: 560px; max-height: calc(100dvh - 2rem); display: flex; flex-direction: column; background: #fff; border-radius: 20px; box-shadow: var(--sh-3); animation: pop .2s cubic-bezier(.2,.9,.3,1.2); }
.modal.lg { max-width: 920px; } .modal.xl { max-width: 1200px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line-2); flex-shrink: 0; }
.modal-head h3 { margin: 0; font-size: 1.02rem; color: var(--navy); font-weight: 800; }
.modal-body { padding: 1.25rem; overflow: auto; flex: 1; } .modal-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; flex-shrink: 0; }
@media (max-width: 640px) {
  .modal-back { padding: 0; align-items: flex-end; }
  .modal, .modal.lg, .modal.xl { max-width: none; max-height: 94dvh; border-radius: 22px 22px 0 0; animation: sheet .25s cubic-bezier(.2,.9,.3,1); }
  .modal-foot { padding-bottom: calc(.9rem + env(safe-area-inset-bottom)); } .modal-foot .btn { flex: 1; }
}
.toast-root { position: fixed; right: 1rem; bottom: 1rem; z-index: 95; display: grid; gap: .5rem; max-width: calc(100vw - 2rem); }
@media (max-width: 1080px) { .toast-root { left: 1rem; bottom: calc(5.5rem + env(safe-area-inset-bottom)); } }
.toast { background: var(--navy); color: #fff; padding: .8rem 1rem; border-radius: 14px; box-shadow: var(--sh-3); font-weight: 600; max-width: 440px; display: flex; gap: .6rem; align-items: flex-start; animation: slide .2s; }
.toast.ok { background: #065F46; } .toast.err { background: #991B1B; }
@keyframes fade { from { opacity: 0 } } @keyframes slide { from { transform: translateY(10px); opacity: 0 } }
@keyframes pop { from { transform: scale(.96); opacity: 0 } } @keyframes sheet { from { transform: translateY(100%) } }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: flex; gap: .75rem; padding: .55rem 0; font-size: .82rem; position: relative; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 1.3rem; bottom: -.4rem; width: 2px; background: var(--line); }
.timeline .tl-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: .3rem; flex-shrink: 0; box-shadow: 0 0 0 3px #fff; z-index: 1; }
.dropzone { border: 2px dashed #C7D2E3; border-radius: 16px; padding: 1.75rem 1rem; text-align: center; color: var(--muted); cursor: pointer; transition: all .15s; background: #FAFBFE; }
.dropzone:hover, .dropzone.drag { border-color: var(--blue); background: var(--blue-50); color: var(--blue-600); }
.dropzone i { font-size: 2rem; display: block; margin-bottom: .5rem; }
.company-tabs { display: flex; gap: .5rem; overflow-x: auto; scrollbar-width: none; } .company-tabs::-webkit-scrollbar { display: none; }
.company-tab { flex: 0 0 auto; min-width: 200px; border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: .75rem .9rem; cursor: pointer; text-align: left; font: inherit; transition: all .15s; }
.company-tab.active { border-color: var(--ec); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ec) 15%, transparent); }
.company-tab b { display: flex; align-items: center; gap: .45rem; font-size: .88rem; } .company-tab small { color: var(--muted); display: block; font-size: .72rem; margin-top: .2rem; }
.company-tab .mini { display: flex; gap: .75rem; margin-top: .5rem; font-size: .72rem; color: var(--text-2); font-weight: 700; }
.kbd-hint { font-size: .72rem; color: var(--muted); }
pre.code { margin: 0; font-size: .76rem; overflow: auto; background: #0B1533; color: #C7D2FE; padding: 1rem; border-radius: 12px; line-height: 1.55; }

/* ==========================================================================
   IMPRESSÃO — pedidos, etiquetas, DANFE
   ========================================================================== */
#print-root { display: none; }
@media print {
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; height: auto !important; overflow: visible !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; position: static; width: auto; }
  #print-root * { zoom: 1 !important; transform: none !important; }
  .app-body::before { display: none; }
  #print-root .labels { box-shadow: none; }
  #print-root .label { border: none !important; }
  #print-root .labels-rolo { display: block; }
  #print-root .labels-rolo .label { page-break-after: always; break-after: page; margin: 0; }
  #print-root .labels-rolo .label:last-child { page-break-after: auto; break-after: auto; }
  #print-root .labels-folha .label:nth-child(24n) { break-after: page; }
  #print-root .labels-folha .label:nth-child(24n+1), #print-root .labels-folha .label:nth-child(24n+2), #print-root .labels-folha .label:nth-child(24n+3) { break-before: auto; }
  #print-root .doc { box-shadow: none !important; padding: 0 !important; margin: 0 !important; max-width: none !important; width: 100% !important; }
  #print-root .doc.danfe { width: 100% !important; max-width: 100% !important; min-height: 283mm; }
  #print-root .doc.danfe table { page-break-inside: auto; break-inside: auto; }
  #print-root .doc.danfe tr { page-break-inside: avoid; break-inside: avoid; }
}
.doc { font-family: Arial, Helvetica, sans-serif; color: #000; font-size: 10.5px; background: #fff; }
.doc h1 { font-size: 15px; margin: 0; }
.doc h2 { font-size: 9.5px; margin: 5px 0 2px; text-transform: uppercase; border-bottom: 1px solid #000; padding-bottom: 1px; font-weight: 800; }
.doc table { width: 100%; border-collapse: collapse; }
.doc th, .doc td { border: 0.75px solid #555; padding: 2.5px 4px; font-size: 9.5px; text-align: left; }
.doc th { background: #EEE; }
.doc .r { text-align: right; } .doc .c { text-align: center; }
.doc .hdr { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 1.5px solid #000; padding-bottom: 5px; margin-bottom: 5px; }
.doc .hdr img { height: 40px; } .doc .kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px 10px; } .doc .kv div span { display: block; font-size: 7.5px; text-transform: uppercase; color: #444; }
.doc .box { border: 0.75px solid #000; padding: 2.5px 4px; } .doc .lbl { font-size: 6.8px; text-transform: uppercase; display: block; color: #333; line-height: 1; margin-bottom: 1px; }
.doc .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 24px; } .doc .sign div { border-top: 1px solid #000; text-align: center; padding-top: 3px; }
.doc .check-box { width: 12px; height: 12px; border: 1px solid #000; display: inline-block; }
.doc-page { page-break-after: always; } .doc-page:last-child { page-break-after: auto; }

/* DANFE ultra-compacto — cabe perfeitamente em 1 folha A4 com traços ultra-finos */
.doc.danfe { font-family: Arial, Helvetica, sans-serif; color: #000; font-size: 10px; font-weight: 700; line-height: 1.15; background: #fff; width: 100%; box-sizing: border-box; }
.doc.danfe h2 { font-size: 6px; font-weight: 800; letter-spacing: .04em; margin: 2px 0 1px; text-transform: uppercase; border-bottom: 0.25px solid #999; padding: 0.5px 0; line-height: 1; }
.doc.danfe .box { border: 0.25px solid #999; padding: 1.5px 3px; box-sizing: border-box; }
.doc.danfe .lbl { font-size: 5.2px; text-transform: uppercase; display: block; color: #333; line-height: 1; margin-bottom: 1px; font-weight: 600; }
.doc.danfe table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.doc.danfe th { border: 0.25px solid #999; padding: 1px 2px; font-size: 6.2px; font-weight: 700; background: #eee; line-height: 1; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc.danfe td { border: 0.25px solid #999; padding: 0.6px 2px; font-weight: 700; font-size: 9px; line-height: 1.05; }
.doc.danfe [style*="display:grid"], .doc.danfe h2 + .box, .doc.danfe h2 + table { margin-top: -1px; }
.doc.danfe [style*="display:grid"] > .box:not(:first-child) { margin-left: -1px; }
.doc.danfe .danfe-prod tbody tr:nth-child(even) td { background: #F1F5FA; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc.danfe .danfe-prod th, .doc.danfe .danfe-prod tbody td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc.danfe.danfe-espacada .box { padding: 5px 7px; }
.doc.danfe.danfe-espacada h2 { margin: 8px 0 3px; }
.doc.danfe.danfe-espacada .lbl { margin-bottom: 2.5px; }
.doc.danfe.danfe-espacada .danfe-prod td { padding-top: 2.5px !important; padding-bottom: 2.5px !important; }

/* Etiquetas */
.labels { display: grid; gap: 0; justify-content: start; }
.label { box-sizing: border-box; border: 1px dashed #BBB; padding: 1.5mm 2.5mm; overflow: hidden; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; display: flex; flex-direction: column; justify-content: space-between; font-family: Arial, sans-serif; color: #000; background: #fff; page-break-inside: avoid; }
.label .l-top { display: flex; justify-content: space-between; gap: 2mm; align-items: flex-start; }
.label .l-brand { font-weight: 800; font-size: 7pt; letter-spacing: .05em; }
.label .l-sku { font-weight: 800; font-size: 11pt; line-height: 1; }
.label .l-desc { font-size: 7pt; line-height: 1.15; margin-top: .5mm; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.label .l-sku, .label .l-cor { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label .l-top > div:first-child { min-width: 0; overflow: hidden; }
.label .l-cor { font-weight: 800; font-size: 9pt; }
.label .l-meta { font-size: 6.5pt; display: flex; justify-content: space-between; gap: 2mm; }
.label .l-bc { flex: 1 1 auto; min-height: 0; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.label svg { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }
.label.sz-100x50 { width: 100mm; height: 50mm; } .label.sz-60x40 { width: 60mm; height: 40mm; } .label.sz-50x30 { width: 50mm; height: 30mm; }
.label.sz-100x150 { width: 100mm; height: 150mm; } .label.sz-a4-3x8 { width: 70mm; height: 37mm; border-color: transparent; }
.label.vol { font-size: 10pt; } .label.vol .v-big { font-size: 30pt; font-weight: 800; text-align: center; line-height: 1; } .label.vol .v-dest { font-size: 11pt; font-weight: 800; }

/* Visualização de DANFE e impressões (sem margens vazias gigantes) */
.print-preview { background: #525659; padding: 1rem 0.5rem; border-radius: 8px; overflow: auto; flex: 1; min-height: 0; text-align: center; overscroll-behavior: contain; }
.pv-sheet-holder { display: inline-block; text-align: left; margin: 0 auto; vertical-align: top; transform-origin: top center; transition: zoom .12s cubic-bezier(0.2, 0, 0, 1); }
.print-preview .doc, .print-preview .labels { background: #fff; margin: 0 auto; box-shadow: 0 4px 20px rgba(0,0,0,.3); }
.print-preview .doc, .print-preview .ap, .print-preview .ap-det { width: 210mm; max-width: none; box-sizing: border-box; }
.print-preview .doc { padding: 3mm 4mm; }

/* ---------- v2.1 complementos ---------- */
.tbl tr.row-hl td { background: #FFFBEB; }
.dre-tbl td, .dre-tbl th { white-space: nowrap; padding: .5rem .7rem; font-size: .8rem; }
.dre-tbl td:first-child, .dre-tbl th:first-child { position: sticky; left: 0; background: inherit; z-index: 1; }
.dre-tbl tbody tr { background: #fff; }
nav.tabs.card { padding: 0 .5rem; overflow-x: auto; }
nav.tabs a.tab { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.company-tab .dot-sm { display: inline-block; }
button.card.kpi { width: 100%; }
@media (max-width: 760px) { .tbl.responsive tfoot { display: block; } .tbl.responsive tfoot tr { display: flex; justify-content: space-between; } .tbl.responsive tfoot td[colspan] { display: none; } }

/* Etiqueta modelo Aquarela (34 × 70 mm, cantos arredondados, 3 por linha em rolo de 110 mm) */
.labels-aq { display: block; padding: 0; }
.labels-aq .aq-row { display: flex; gap: 3mm; padding: 2mm 3mm; width: 110mm; box-sizing: border-box; }
.label.aq { width: 34mm; height: 70mm; flex: none; border: .35mm solid #000; border-radius: 3mm; padding: 2mm 1.5mm 2mm; align-items: center; justify-content: flex-start; text-align: center; gap: .5mm; }
.label.aq .aq-logo { width: 27mm; height: 22mm; object-fit: contain; filter: grayscale(1) contrast(1.6) brightness(.35); }
.label.aq .aq-cod { font: 800 15pt/1 Arial, sans-serif; margin: .3mm 0 .8mm; }
.label.aq .aq-txt { font: 400 6.4pt/1.2 Arial, sans-serif; }
.label.aq .aq-bc { margin-top: 2.5mm; width: 27mm; height: 14mm; flex: none; }
@media print {
  #print-root .labels-aq .aq-row { height: 74mm; break-after: page; page-break-after: always; }
  #print-root .labels-aq .aq-row:last-child { break-after: auto; page-break-after: auto; }
  #print-root .labels-aq .label.aq { border: .35mm solid #000 !important; }
}

/* ---------- Central de relatórios ---------- */
.rel-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--gap); align-items: start; }
.rel-menu { padding: .6rem; position: sticky; top: calc(var(--head-h) + 1rem); max-height: calc(100vh - var(--head-h) - 2rem); overflow: auto; }
.rel-area { margin-bottom: .6rem; }
.rel-area-t { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .5rem; }
.rel-area-t .kpi-icon { width: 26px; height: 26px; font-size: .75rem; border-radius: 8px; }
.rel-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .55rem .7rem; border-radius: 10px; cursor: pointer; font: inherit; color: var(--text); }
.rel-item b { display: block; font-size: .88rem; } .rel-item span { display: block; font-size: .74rem; color: var(--muted); }
.rel-item:hover { background: var(--line-2); } .rel-item.active { background: var(--blue-50); box-shadow: inset 3px 0 0 var(--purple); }
.rel-main { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.rel-bar { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.rel-periodos { display: flex; gap: .25rem; flex-wrap: wrap; }
.rel-doc { display: flex; flex-direction: column; gap: var(--gap); }
.rel-hero { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.4rem 1.6rem; border-radius: var(--r-xl); color: #fff; background: var(--grad-pedidos); box-shadow: var(--sh-3); }
.rel-hero h2 { margin: .2rem 0; font-size: 1.6rem; } .rel-hero p { margin: 0; opacity: .85; }
.rel-kicker { font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.rel-logo { height: 54px; filter: brightness(0) invert(1); opacity: .9; }
.rel-graficos { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--gap); }
.rel-ia { padding: 1.2rem 1.4rem; border: 1px solid #E9D5FF; background: linear-gradient(135deg, #FBF7FF 0%, #F4F8FF 100%); }
.rel-ia-cta { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; } .rel-ia-cta h3 { margin: 0 0 .2rem; }
.rel-ia-form { display: flex; gap: .5rem; flex: 1 1 420px; } .rel-ia-form .input { flex: 1; }
.rel-ia-head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.rel-manchete { font-size: 1.3rem; margin: .8rem 0 .3rem; line-height: 1.3; }
.rel-resumo { margin: 0 0 1rem; color: var(--text-2); line-height: 1.55; }
.rel-ia-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.rel-ia-col { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: .8rem 1rem; }
.rel-ia-col h4 { margin: 0 0 .4rem; font-size: .9rem; } .rel-ia-col ul { margin: 0; padding-left: 1.1rem; } .rel-ia-col li { margin: .3rem 0; font-size: .88rem; line-height: 1.45; }
.rel-print .rel-hero { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rel-print .grid-kpi { grid-template-columns: repeat(4, 1fr); } .rel-print .card { box-shadow: none; break-inside: avoid; }
@media (max-width: 960px) { .rel-layout { grid-template-columns: 1fr; } .rel-menu { position: static; max-height: none; } .rel-ia-form { flex-direction: column; } }

/* ---------- Assistente IA ---------- */
#ia-fab { position: fixed; right: 20px; bottom: 20px; z-index: 900; width: 58px; height: 58px; border-radius: 50%; border: 0; color: #fff; font-size: 1.3rem; cursor: pointer; background: var(--grad-pedidos); box-shadow: 0 12px 28px -6px rgba(124,63,228,.6); transition: transform .15s; }
#ia-fab:hover { transform: scale(1.06); }
body.has-mbar #ia-fab { bottom: 84px; }
#ia-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 950; background: var(--card); border-left: 1px solid var(--line); box-shadow: var(--sh-3); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .22s ease; }
#ia-panel.open { transform: none; }
.ia-head { display: flex; align-items: center; gap: .3rem; padding: .9rem 1rem; color: #fff; background: var(--grad-pedidos); }
.ia-head > div { flex: 1; } .ia-head b { display: block; } .ia-head span { font-size: .75rem; opacity: .85; } .ia-head .btn { color: #fff; background: rgba(255,255,255,.16); border-color: transparent; box-shadow: none; } .ia-head .btn:hover { background: rgba(255,255,255,.28); }
.ia-msgs { flex: 1; overflow: auto; padding: 1rem; display: flex; flex-direction: column; gap: .7rem; background: var(--bg); }
.ia-msg { max-width: 92%; padding: .65rem .9rem; border-radius: 14px; font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; }
.ia-msg p { margin: .2rem 0; } .ia-msg ul { margin: .3rem 0; padding-left: 1.1rem; } .ia-msg h4 { margin: .4rem 0 .2rem; }
.ia-msg .table-wrap { margin: .4rem 0; overflow-x: auto; max-width: 100%; } .ia-msg .tbl { font-size: .78rem; width: auto; min-width: 100%; } .ia-msg .tbl th, .ia-msg .tbl td { overflow-wrap: normal; word-break: normal; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; padding: .3rem .5rem; } .ia-msg.bot:has(.table-wrap) { max-width: 100%; width: 100%; } .ia-msg code { background: rgba(0,0,0,.06); padding: 0 .3rem; border-radius: 4px; }
.ia-msg.user { align-self: flex-end; background: var(--purple); color: #fff; border-bottom-right-radius: 4px; }
.ia-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ia-passos { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; } .ia-passos span { font-size: .68rem; color: var(--muted); background: var(--line-2); border-radius: 999px; padding: .1rem .5rem; }
.ia-acao { align-self: stretch; background: #FFFBEB; border: 1px solid #FCD34D; border-radius: 14px; padding: .8rem 1rem; font-size: .88rem; }
.ia-acao.ok { background: var(--ok-bg); border-color: #6EE7B7; } .ia-acao.erro { background: var(--err-bg); border-color: #FCA5A5; } .ia-acao.cancelada { opacity: .6; }
.ia-acao-h { font-weight: 800; color: var(--warn); } .ia-acao p { margin: .3rem 0 .5rem; }
.ia-acao pre { max-height: 160px; overflow: auto; font-size: .72rem; background: #fff; padding: .5rem; border-radius: 8px; }
.ia-hello { text-align: center; color: var(--text-2); padding: 1.5rem .5rem; } .ia-hello i { font-size: 2rem; color: var(--purple); display: block; margin-bottom: .5rem; }
.ia-sug { display: flex; flex-wrap: wrap; gap: .35rem; padding: .6rem 1rem; border-top: 1px solid var(--line); }
.ia-sug .chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .3rem .7rem; font: inherit; font-size: .76rem; cursor: pointer; }
.ia-sug .chip:hover { border-color: var(--purple); color: var(--purple); }
.ia-input { display: flex; gap: .5rem; padding: .8rem 1rem; border-top: 1px solid var(--line); background: var(--card); }
.ia-input textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; font: inherit; max-height: 140px; }
.ia-typing { display: flex; gap: 4px; } .ia-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: iaPulse 1s infinite ease-in-out; }
.ia-typing span:nth-child(2) { animation-delay: .15s; } .ia-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes iaPulse { 0%, 100% { opacity: .25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@media print { #ia-fab, #ia-panel { display: none !important; } }

/* ---------- Usuários e acessos ---------- */
.perfis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--gap); padding: 1rem; }
.perm-chips { display: flex; flex-wrap: wrap; gap: .3rem; } .perm-chips .badge { font-size: .7rem; }
.perm-tbl th.c, .perm-tbl td.c { text-align: center; } .perm-tbl input[type=radio] { width: 18px; height: 18px; accent-color: var(--purple); cursor: pointer; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .75rem; font-weight: 800; color: #fff; background: var(--grad-brand); flex: none; }
/* v7 — correções visuais relatórios / IA */
#ia-panel .ia-head .btn, #ia-panel .ia-head .btn-ghost { color: #fff !important; background: rgba(255,255,255,.16) !important; border: 0 !important; box-shadow: none !important; width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; }
#ia-panel .ia-head .btn:hover { background: rgba(255,255,255,.3) !important; }
.rel-doc .grid-kpi { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.rel-doc .kpi { align-items: center; }
.rel-doc .kpi-value { font-size: clamp(1.05rem, 1.6vw, 1.4rem); white-space: nowrap; word-break: normal; overflow: hidden; text-overflow: ellipsis; }
.rel-doc .kpi-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 1280px) { body.ia-open .app-main-wrap, body.ia-open main, body.ia-open #app-main { margin-right: 0; } body.ia-open { padding-right: 440px; } }
/* Impressão do relatório (layout dedicado) */
.rp { font-family: Arial, Helvetica, sans-serif; color: #0F172A; font-size: 10pt; }
.rp-hero { display: flex; justify-content: space-between; align-items: center; padding: 6mm 7mm; border-radius: 4mm; color: #fff; background: linear-gradient(135deg, #C0158F 0%, #7C3FE4 100%); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rp-hero h1 { margin: 1mm 0; font-size: 18pt; } .rp-hero p { margin: 0; font-size: 9pt; opacity: .9; } .rp-hero small { font-size: 8pt; letter-spacing: .08em; text-transform: uppercase; opacity: .85; font-weight: 700; }
.rp-hero img { height: 14mm; filter: brightness(0) invert(1); }
.rp-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; margin: 4mm 0; }
.rp-kpi { border: .3mm solid #E2E8F0; border-left: 1.2mm solid var(--c); border-radius: 2mm; padding: 2.5mm 3mm; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rp-kpi span { display: block; font-size: 7.5pt; text-transform: uppercase; color: #64748B; font-weight: 700; letter-spacing: .04em; }
.rp-kpi b { display: block; font-size: 14pt; white-space: nowrap; margin-top: .5mm; } .rp-kpi em { font-style: normal; font-size: 7.5pt; color: #64748B; }
.rp-ia { border: .3mm solid #E9D5FF; background: #FBF7FF; border-radius: 3mm; padding: 4mm 5mm; margin: 4mm 0; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rp-ia h2 { font-size: 13pt; margin: 0 0 2mm; } .rp-ia p { margin: 0 0 2mm; line-height: 1.45; }
.rp-ia-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; } .rp-ia-grid h3 { font-size: 9pt; margin: 0 0 1mm; } .rp-ia-grid ul { margin: 0; padding-left: 4mm; font-size: 8.5pt; } .rp-ia-grid li { margin: .8mm 0; }
.rp-graf { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4mm; margin: 4mm 0; } .rp-graf.um { grid-template-columns: 1fr; }
.rp-graf figure { margin: 0; border: .3mm solid #E2E8F0; border-radius: 2mm; padding: 3mm; break-inside: avoid; } .rp-graf figcaption { font-weight: 700; font-size: 9pt; margin-bottom: 2mm; } .rp-graf img { width: 100%; }
.rp table { width: 100%; border-collapse: collapse; font-size: 8pt; } .rp th { background: #F1F5F9; text-align: left; padding: 1.5mm 2mm; border-bottom: .3mm solid #CBD5E1; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rp td { padding: 1.2mm 2mm; border-bottom: .2mm solid #E2E8F0; } .rp td.n, .rp th.n { text-align: right; white-space: nowrap; } .rp tr { break-inside: avoid; }
.rp h2.sec { font-size: 11pt; margin: 5mm 0 2mm; }
.cep-st { display: block; font-size: .72rem; margin-top: .2rem; } .cep-st.ok { color: var(--ok); } .cep-st.err { color: var(--err); } .cep-st.muted { color: var(--muted); }
/* botões de rolagem */
#scroll-btns { position: fixed; right: 29px; bottom: 92px; z-index: 899; display: flex; flex-direction: column; gap: .4rem; transition: opacity .2s; }
#scroll-btns button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink, #333); box-shadow: var(--sh-2, 0 4px 12px rgba(0,0,0,.15)); cursor: pointer; display: grid; place-items: center; }
#scroll-btns button:hover { background: var(--purple); color: #fff; }
#scroll-btns button.off { opacity: 0; pointer-events: none; }
body.has-mbar #scroll-btns { bottom: 156px; }
body.ia-open #scroll-btns { display: none; }
body:not(:has(#ia-fab)) #scroll-btns { bottom: 20px; }
@media print { #scroll-btns { display: none !important; } }
/* rolagem horizontal das barras de chips (status) */
.chip-scroll { position: relative; display: flex; align-items: center; gap: .3rem; min-width: 0; flex: 1 1 auto; max-width: 100%; }
.chip-scroll .chip-bar { flex: 1 1 auto; min-width: 0; scroll-behavior: smooth; }
.chip-scroll .cs-btn { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.chip-scroll .cs-btn:hover { background: var(--purple); color: #fff; }
.chip-scroll .cs-btn.off { visibility: hidden; }
.chip-scroll.no-ovf .cs-btn { display: none; }
/* ações de status do pedido */
.st-acoes { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.st-grp { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.st-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #888); font-weight: 700; margin-right: .2rem; }
.st-sep { width: 1px; height: 24px; background: var(--line); margin: 0 .3rem; }
/* botão da IA não cobre conteúdo: menor, discreto e com espaço reservado no fim da página */
#app-main { padding-bottom: 96px !important; }
#ia-fab { width: 46px; height: 46px; font-size: 1.05rem; right: 16px; bottom: 16px; opacity: .85; }
#ia-fab:hover { opacity: 1; }
#scroll-btns { right: 19px; bottom: 72px; }
#scroll-btns button { width: 36px; height: 36px; opacity: .85; }
body.has-mbar #scroll-btns { bottom: 136px; }
.pager { padding-right: 70px; }
.nav-toggle-all { display: flex; align-items: center; gap: .5rem; width: calc(100% - 1rem); margin: .2rem .5rem .4rem; padding: .4rem .75rem; border: 1px dashed rgba(255,255,255,.18); border-radius: 10px; background: transparent; color: rgba(255,255,255,.65); font: inherit; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; cursor: pointer; }
.nav-toggle-all:hover { background: rgba(255,255,255,.08); color: #fff; }
.tbl tr.row-atual td { background: rgba(59,130,246,.08); }
/* janelas maiores e modo tela cheia */
.modal.lg { max-width: min(1280px, 96vw); max-height: 94dvh; }
.modal.xl { max-width: min(1600px, 97vw); max-height: 95dvh; }
.modal.full { max-width: none !important; width: calc(100vw - 1rem); height: calc(100dvh - 1rem); max-height: none; border-radius: 14px; }
.modal-back:has(.modal.full) { padding: .5rem; }
/* modais de visualização de impressão e DANFE: tela maximizada verticalmente sem margens excessivas */
.modal-back:has(.modal-preview),
.modal-back:has(.modal:has(.print-preview)) {
  padding: .5rem;
}
.modal.modal-preview,
.modal:has(.print-preview) {
  width: calc(100vw - 1rem);
  max-width: min(1400px, 98vw);
  height: calc(100dvh - 1rem);
  max-height: calc(100dvh - 1rem);
  border-radius: 14px;
}
.modal.modal-preview .modal-head,
.modal:has(.print-preview) .modal-head {
  padding: .5rem 1rem;
}
.modal.modal-preview .modal-head h3,
.modal:has(.print-preview) .modal-head h3 {
  font-size: .95rem;
}
.modal.modal-preview .modal-foot,
.modal:has(.print-preview) .modal-foot {
  padding: .35rem .75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
.pv-foot-bar { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: .6rem; flex-wrap: wrap; }
.pv-zoom-bar { display: inline-flex; align-items: center; gap: 2px; background: var(--card, #fff); border: 1px solid var(--line, #CBD5E1); border-radius: 9px; padding: 2px 4px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.pv-zoom-bar button.btn { height: 28px; padding: 0 7px; font-size: .78rem; font-weight: 600; border-radius: 6px; border: 0; color: var(--text-2, #475569); background: transparent; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; transition: all .12s; box-shadow: none; }
.pv-zoom-bar button.btn:hover { background: #F1F5F9; color: var(--text, #1E293B); }
.pv-zoom-bar button.btn:active { background: #E2E8F0; }
.pv-zoom-bar .pv-zoom-val { min-width: 48px; text-align: center; justify-content: center; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--blue-600, #2563EB); }
.pv-zoom-bar .pv-zoom-sep { display: inline-block; width: 1px; height: 16px; background: var(--line, #CBD5E1); margin: 0 2px; }
.pv-zoom-bar button.btn.active { background: var(--blue-50, #EFF6FF); color: var(--blue-600, #2563EB); font-weight: 700; }
.pv-foot-actions { display: inline-flex; align-items: center; gap: .5rem; margin-left: auto; }
.modal.modal-preview .modal-body,
.modal:has(.print-preview) .modal-body {
  padding: .35rem .5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.modal.modal-preview .print-preview,
.modal:has(.print-preview) .print-preview {
  height: 100%;
  max-height: none;
  flex: 1;
  padding: .75rem .5rem;
  border-radius: 8px;
  background: #525659;
}
/* com janela aberta, esconde botões flutuantes (IA e rolagem) para não cobrir o rodapé */
body:has(#modal-root .modal-back) #ia-fab, body:has(#modal-root .modal-back) #scroll-btns { display: none !important; }
/* histórico por SKU na grade do novo pedido */
.grade td { position: relative; }
.g-hist { position: absolute; top: 1px; right: 1px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #94A3B8; font-size: .6rem; cursor: pointer; opacity: .45; display: grid; place-items: center; }
.grade td:hover .g-hist, .gc-var:hover .g-hist { opacity: 1; }
.g-hist:hover { background: var(--purple); color: #fff; }
.gc-var { position: relative; }
/* valor unitário editável na grade */
.grade input.pu, .gc-var input.pu { display: block; width: 100%; max-width: 76px; margin: 3px auto 0; height: 22px; padding: 0 .25rem; border: 1px dashed #DCE3EE; border-radius: 6px; text-align: center; font: inherit; font-size: .68rem; font-weight: 700; color: #475569; background: #F8FAFC; }
.gc-var input.pu { max-width: none; height: 28px; font-size: .8rem; }
.grade input.pu:focus, .gc-var input.pu:focus { outline: 0; border-style: solid; border-color: var(--purple); background: #fff; }
.grade input.pu.alt, .gc-var input.pu.alt { border-style: solid; border-color: #F59E0B; background: #FFFBEB; color: #B45309; }
.pu-ro { display: block; font-size: .62rem; color: #64748B; margin-top: 2px; }
/* busca de transportadora no pedido */
.tp-busca { position: relative; }
.tp-res { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; max-height: 320px; overflow: auto; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-3); }
.tp-res button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: .55rem .8rem; border: 0; border-bottom: 1px solid var(--line-2); background: transparent; text-align: left; cursor: pointer; font: inherit; }
.tp-res button:hover { background: #F5F3FF; }
/* emissão de cobrança */
.cob-met { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .5rem; }
.cob-op { position: relative; display: flex; flex-direction: column; gap: .2rem; padding: .8rem; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; }
.cob-op input { position: absolute; opacity: 0; } .cob-op i { font-size: 1.2rem; color: var(--purple); }
.cob-op:has(input:checked) { border-color: var(--purple); background: #F5F3FF; }

/* Filtros específicos da tela de Pedidos */
.pedidos-filters {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--line-2);
  background: #FCFDFF;
}
.pedidos-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: center;
}
.pedidos-filters-row.dates-row {
  gap: .75rem;
}
.pedidos-filters-sum {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: .65rem;
}
.filter-period-box, .filter-date-group {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: #fff;
  border: 1px solid #D5DEEB;
  border-radius: 10px;
  padding: 4px 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
  flex-wrap: wrap;
}
.filter-period-box .lbl, .filter-date-group .lbl {
  font-size: .76rem;
  font-weight: 700;
  color: #1E293B;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  white-space: nowrap;
  user-select: none;
}
.filter-period-box .sep, .filter-date-group .sep {
  font-size: .75rem;
  color: var(--muted);
  user-select: none;
}
.filter-period-box input[type="date"], .filter-date-group input[type="date"] {
  border: 1px solid #E2E8F0 !important;
  border-radius: 6px !important;
  height: 32px !important;
  font-size: .82rem !important;
  color: var(--text) !important;
  background: #F8FAFD !important;
  padding: 0 8px !important;
  width: 142px !important;
  min-width: 135px !important;
  box-sizing: border-box !important;
  font-family: inherit !important;
}
.filter-period-box input[type="date"]:hover, .filter-date-group input[type="date"]:hover {
  background: #F1F5F9 !important;
}
.filter-period-box input[type="date"]:focus, .filter-date-group input[type="date"]:focus {
  outline: none !important;
  border-color: var(--blue-600) !important;
  background: #fff !important;
  box-shadow: 0 0 0 2px rgba(46, 124, 246, 0.15) !important;
}
.sortable-th {
  transition: background .12s, color .12s;
}
.sortable-th:hover {
  background: #EEF3FA !important;
}
.sortable-th:hover i {
  opacity: .75 !important;
}
@media (max-width: 900px) {
  .pedidos-filters-sum {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }
}
@media (max-width: 640px) {
  .pedidos-filters {
    padding: .75rem .85rem;
  }
  .pedidos-filters-row .input-icon,
  .pedidos-filters-row .select {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }
  .filter-period-box, .filter-date-group {
    width: 100%;
    flex-wrap: wrap;
    padding: 6px 8px;
    gap: .35rem;
  }
  .filter-period-box .lbl, .filter-date-group .lbl {
    width: 100%;
    margin-bottom: 2px;
  }
  .filter-period-box input[type="date"], .filter-date-group input[type="date"] {
    flex: 1 1 calc(50% - 15px);
    width: auto !important;
    min-width: 120px !important;
  }
}

/* identificação da categoria + medida em cada célula da grade (novo pedido) */
.grade .g-tag { display: block; max-width: 110px; margin: 2px auto 0; text-align: center; font-size: .56rem; font-weight: 700; line-height: 1.15; color: var(--muted); white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
/* editor de pedido: categoria Outros (itens personalizados) */
.out-linha { padding: .6rem 0; border-bottom: 1px dashed var(--line, #e5e7eb); }
.out-linha:last-child { border-bottom: 0; }
.out-vars { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1rem; }
.out-var { display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)); gap: .55rem .6rem; align-items: center; position: relative; padding-right: 1.6rem; }
.out-var [data-vdel] { position: absolute; right: 0; top: 0; }

/* DANFE: títulos menores, conteúdo maior/negrito; rodapé (dados adicionais + recibo) colado no fim da página */
.doc.danfe .lbl, .doc.danfe th, .doc.danfe h2 { font-weight: 600; }
.doc.danfe { display: flex; flex-direction: column; min-height: 287mm; }
.doc.danfe .danfe-rodape { margin-top: auto; }
/* DANFE produtos: títulos quebram em vez de cortar; números não invadem a célula vizinha */
.doc.danfe table th { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.doc.danfe table td { white-space: nowrap; overflow: hidden; font-size: 7.5px; padding-left: 1px !important; padding-right: 1px !important; }
.doc.danfe table th { padding-left: 1px !important; padding-right: 1px !important; }
/* Lista de Pedidos compacta (no celular continua em cartões) */
@media (min-width: 761px) {
  .tbl tr.ped-row td { padding-top: .22rem; padding-bottom: .22rem; }
  .tbl tr.ped-row td.main { font-size: .74rem; line-height: 1.15; }
  .tbl tr.ped-row td.main .small { font-size: .66rem; }
}
