/* Estudo de Gate Outbound — tema claro (fundo branco), mesmo visual do Estudo Inbound */
:root {
  --paper: #f6f7fb; --card: #ffffff; --card-2: #fbfbfd;
  --line: #e6e8ef; --line-2: #d6dae4;
  --text: #161b26; --muted: #5d6677; --muted-2: #8a93a4;
  --orange: #ee4d2d; --orange-2: #ff6a45; --orange-soft: #fff0eb;
  --blue: #2f6fe4; --blue-soft: #eaf1ff;
  --green: #12a46c; --green-soft: #e6f7ef; --red: #e0443a; --red-soft: #fdecea; --yellow: #e59a00; --yellow-soft: #fff5de;
  --shadow: 0 1px 2px rgba(22, 27, 38, .04), 0 8px 24px rgba(22, 27, 38, .06);
  --radius: 20px; --gutter: clamp(16px, 3.4vw, 40px); --wrap: 1480px;
  --font-display: 'Space Grotesk', 'DM Sans', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--paper); font: 14px/1.5 var(--font-body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }

/* fundo: brilho laranja suave + grade pontilhada */
.bg { position: fixed; inset: 0; z-index: -2; background:
  radial-gradient(900px 520px at 88% -4%, rgba(238, 77, 45, .14), transparent 62%),
  radial-gradient(700px 480px at -6% 104%, rgba(47, 111, 228, .08), transparent 60%),
  radial-gradient(rgba(22, 27, 38, .06) 1px, transparent 1px) 0 0 / 22px 22px,
  var(--paper); }

/* sacolas e moedas subindo */
.rain { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.rain span { position: absolute; bottom: -40px; display: grid; place-items: center; opacity: 0; animation: rise linear infinite; }
.rain .bag { color: var(--orange-2); filter: drop-shadow(0 6px 10px rgba(238, 77, 45, .2)); }
.rain .coin { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe08a, #ffb21e 55%, #e88a00); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6), 0 4px 10px rgba(232, 138, 0, .25); }
@keyframes rise { 0% { transform: translate(0, 0) rotate(-8deg); opacity: 0; } 12% { opacity: .32; } 50% { transform: translate(18px, -55vh) rotate(8deg); } 88% { opacity: .28; } 100% { transform: translate(-12px, -112vh) rotate(-6deg); opacity: 0; } }

/* topo */
.top { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px); background: rgba(255, 255, 255, .78); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 18px; max-width: var(--wrap); margin: 0 auto; padding: 12px var(--gutter); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--orange-2), var(--orange)); box-shadow: 0 8px 20px rgba(238, 77, 45, .3); font: 700 13px var(--font-display); }
.brand b { display: block; font: 700 16px/1 var(--font-display); } .brand b i { color: var(--orange); font-style: normal; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .2em; }
.tabs { display: flex; gap: 4px; padding: 4px; margin-left: 12px; border: 1px solid var(--line); border-radius: 999px; background: #f0f2f7; }
.tabs button { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-weight: 600; cursor: pointer; transition: background .2s, color .2s; }
.tabs button svg { width: 16px; height: 16px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: #fff; background: var(--orange); box-shadow: 0 6px 14px rgba(238, 77, 45, .3); }
.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.live { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--green); background: var(--green-soft); border: 1px solid rgba(18, 164, 108, .3); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(18, 164, 108, .5); animation: pulse 1.8s infinite; }
.live.snap { color: #a76f00; background: var(--yellow-soft); border-color: rgba(229, 154, 0, .35); } .live.snap i { background: var(--yellow); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(18, 164, 108, 0); } 100% { box-shadow: 0 0 0 0 rgba(18, 164, 108, 0); } }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); text-decoration: none; font-weight: 600; cursor: pointer; transition: border-color .2s, background .2s; }
.btn:hover { border-color: rgba(238, 77, 45, .5); background: var(--orange-soft); }
.btn.primary { color: #fff; border-color: transparent; background: var(--orange); box-shadow: 0 10px 24px rgba(238, 77, 45, .28); }
.btn svg { width: 16px; height: 16px; }

/* hero */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; padding: 38px 0 24px; }
.kicker { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); font-size: 11px; font-weight: 700; letter-spacing: .14em; }
.kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.hero h1 { margin: 16px 0 10px; font: 700 clamp(34px, 5vw, 64px)/1.02 var(--font-display); letter-spacing: -.035em; }
.hero h1 em { font-style: normal; color: var(--orange); }
.hero p { max-width: 640px; margin: 0; color: var(--muted); font-size: 15px; }
.hero-chips { position: relative; display: flex; gap: 12px; }
.chip { display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); box-shadow: var(--shadow); animation: float 6s ease-in-out infinite; }
.chip:nth-child(2) { animation-delay: -2s; }
.chip-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--orange-2), var(--orange)); box-shadow: 0 6px 16px rgba(238, 77, 45, .3); }
.chip-ico svg { width: 18px; height: 18px; }
.chip small { display: block; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .16em; }
.chip b { display: block; font: 700 16px/1.15 var(--font-display); }
@keyframes float { 50% { transform: translateY(-7px); } }

/* filtros */
.filters { position: relative; z-index: 5; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 14px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.period { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.period .presets { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: #f0f2f7; }
.period .presets button { padding: 6px 11px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.period .presets button.on { color: #fff; background: var(--orange); }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field span { color: var(--muted-2); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.field input, .field select { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); outline: none; transition: border-color .2s; }
.field input:focus, .field select:focus { border-color: var(--orange); }
.field select option { background: var(--card); }
.field.has-value input, .field.has-value select { border-color: rgba(238, 77, 45, .6); background: var(--orange-soft); }
.selects { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; align-items: end; }
.clear { height: 34px; }

/* cards de indicadores */
.kpis { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { position: relative; overflow: hidden; padding: 14px 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: var(--shadow); transition: transform .25s, border-color .25s; animation: pop .5s both; animation-delay: calc(var(--i) * 40ms); }
.kpis.eta { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi { cursor: pointer; }
.kpi::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c, var(--orange)); }
.kpi:hover { transform: translateY(-3px); border-color: rgba(238, 77, 45, .4); }
.kpi.on { border-color: var(--orange); background: var(--orange-soft); }
.kpi small { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.kpi b { display: block; margin-top: 4px; font: 700 26px/1.05 var(--font-display); letter-spacing: -.02em; }
.kpi .sub { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.kpi .pair { display: flex; gap: 14px; margin-top: 6px; }
.kpi .pair div { display: flex; flex-direction: column; }
.kpi .pair em { color: var(--muted-2); font-size: 10px; font-style: normal; font-weight: 700; letter-spacing: .12em; }
.kpi .pair b { margin: 0; font-size: 21px; }
@keyframes pop { from { opacity: 0; transform: translateY(12px); } }

/* grade de painéis */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.panel { position: relative; min-width: 0; padding: 16px 16px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); animation: pop .5s both; }
.panel h3 { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font: 600 14px var(--font-display); letter-spacing: -.01em; }
.panel h3 .ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--orange); background: var(--orange-soft); }
.panel h3 .ico svg { width: 15px; height: 15px; }
.panel h3 small { margin-left: auto; color: var(--muted-2); font-family: var(--font-body); font-size: 11px; font-weight: 600; }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; } .s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s12 { grid-column: span 12; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: -4px 0 8px; color: var(--muted); font-size: 11px; }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 3px; vertical-align: -1px; }

/* gráficos SVG */
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font: 600 10px var(--font-body); }
.chart .val { fill: var(--text); font-size: 10px; }
.chart .grid-line { stroke: var(--line); }
.chart .dot { fill: var(--card); stroke-width: 2; }

/* barras horizontais */
.hbars { display: grid; gap: 9px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr; align-items: center; gap: 10px; }
.hbar > span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.hbar .fill { display: flex; align-items: center; justify-content: flex-end; min-width: 22px; height: 18px; padding: 0 6px; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 700; background: linear-gradient(90deg, #ff9a80, var(--orange)); transform-origin: left; animation: grow .7s cubic-bezier(.2, .8, .2, 1) both; }
.hbar .fill.blue { background: linear-gradient(90deg, #8db2f5, var(--blue)); }
.hbar .track { display: grid; gap: 3px; }
.hbar .fill.muted { color: var(--muted); background: #e6e8ef; }
.hbar .fill.zero { min-width: 0; padding: 0; background: none; color: var(--muted-2); justify-content: flex-start; }
.hbar .fill.green { background: linear-gradient(90deg, #7fd3b1, var(--green)); }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes rise-bar { from { transform: scaleY(0); } }

/* tabelas */
.tbl-wrap { overflow: auto; max-height: 440px; margin: 0 -4px; border-radius: 12px; }
.tbl-wrap.tall { max-height: 560px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; z-index: 1; padding: 8px 8px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-align: right; text-transform: uppercase; background: #f3f4f8; white-space: nowrap; }
td { padding: 7px 8px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
tbody tr:hover td { background: #fafbfd; }
tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); background: #f6f7fb; }
td.rank { width: 26px; color: var(--muted-2); }
td.wrap-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.pill.ok { color: var(--green); background: var(--green-soft); } .pill.run { color: var(--blue); background: var(--blue-soft); } .pill.wait { color: #a76f00; background: var(--yellow-soft); } .pill.bad { color: var(--red); background: var(--red-soft); }
.pill.nok, .pill.delay { color: var(--red); background: var(--red-soft); } .pill.ontime { color: var(--green); background: var(--green-soft); }
.bad { color: var(--red); font-weight: 700; } .good { color: var(--green); }
.meter { position: relative; display: inline-block; width: 46px; height: 5px; margin-left: 6px; vertical-align: middle; border-radius: 3px; background: #eceef4; }
.meter i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--orange); }

/* blocos de resumo */
.clocks { display: grid; gap: 10px; }
.clock { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(135deg, var(--blue-soft), #fff); }
.clock:first-child { background: linear-gradient(135deg, var(--orange-soft), #fff); }
.clock .ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: #fff; box-shadow: var(--shadow); }
.clock .ico svg { width: 20px; height: 20px; }
.clock small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.clock b { font: 700 26px/1.1 var(--font-display); letter-spacing: -.01em; }

/* heatmap */
.heat td.h { min-width: 40px; text-align: center; font-weight: 700; border-radius: 6px; }
.heat td { border-top: 2px solid #fff; }

/* regionais lado a lado */
.reg-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.reg-tabs button { padding: 5px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--card); color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.reg-tabs button.on { color: #fff; border-color: var(--orange); background: var(--orange); }

/* estados */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 14px; border: 1px solid rgba(229, 154, 0, .35); border-radius: 14px; color: #8a5c00; background: var(--yellow-soft); font-size: 13px; }
.banner code { padding: 1px 6px; border-radius: 6px; background: rgba(229, 154, 0, .14); color: #6b4700; }
.loading { display: grid; place-items: center; gap: 14px; min-height: 52vh; text-align: center; color: var(--muted); }
.loading img { width: 150px; animation: float 3s ease-in-out infinite; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.busy main { opacity: .6; transition: opacity .2s; pointer-events: none; }
.empty { padding: 26px; color: var(--muted); text-align: center; }
.tip { position: fixed; z-index: 50; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; box-shadow: var(--shadow); font-size: 12px; pointer-events: none; white-space: nowrap; }
footer { padding: 20px 0 40px; color: var(--muted-2); font-size: 12px; text-align: center; }

@media (max-width: 1180px) {
  .kpis, .kpis.eta { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .s3, .s4, .s5 { grid-column: span 6; } .s6, .s7, .s8 { grid-column: span 12; }
  .hero-chips { display: none; } .hero { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .top-in { flex-wrap: wrap; gap: 10px; } .tabs { order: 3; width: 100%; margin: 0; } .tabs button { flex: 1; justify-content: center; padding: 8px 6px; font-size: 12px; }
  .top-right .btn span { display: none; }
  .kpis, .kpis.eta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .s3, .s4, .s5, .s6 { grid-column: span 12; }
  .selects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* programação e atendimento por dia */
.chart.prog text { paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.chart.prog text.val { font-size: 10.5px; font-weight: 700; }
.prog-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
