/* =====================================================================
   Giro — Sistema de Gestão  ·  folha de estilo
   Estética: painel operacional quente e confiável (mercado / frios)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700;12..96,800&family=Archivo:wght@400;500;600;700&display=swap');

:root {
  /* paleta */
  --bg: #f4efe6;
  --bg-2: #efe8db;
  --surface: #fffdf9;
  --surface-2: #faf5ec;
  --ink: #211c17;
  --ink-soft: #5d544a;
  --muted: #8d8275;
  --line: #e7ddcd;
  --line-2: #efe7d9;

  --brand: #b23a2e;      /* páprica / brick */
  --brand-deep: #8d2a21;
  --brand-tint: #f6e5e1;
  --amber: #c8893a;      /* latão */
  --amber-tint: #f7ead4;
  --green: #2f7d5b;      /* dinheiro entrando / fresco */
  --green-tint: #e2efe7;
  --danger: #c0392b;
  --danger-tint: #f7e3df;
  --warn: #cf9a32;
  --warn-tint: #f8eecf;

  --shadow-sm: 0 1px 2px rgba(45, 33, 22, .05), 0 1px 3px rgba(45, 33, 22, .06);
  --shadow-md: 0 4px 14px rgba(60, 42, 26, .08), 0 2px 6px rgba(60, 42, 26, .06);
  --shadow-lg: 0 18px 48px rgba(50, 35, 20, .14);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --sidebar-w: 248px;

  --sans: 'Archivo', system-ui, sans-serif;
  --display: 'Bricolage Grotesque', 'Archivo', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  /* textura sutil de papel */
  background-image:
    radial-gradient(circle at 18% 12%, rgba(178, 58, 46, .04), transparent 42%),
    radial-gradient(circle at 88% 8%, rgba(200, 137, 58, .05), transparent 38%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.025'/%3E%3C/svg%3E");
  background-attachment: fixed;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; letter-spacing: -.015em; line-height: 1.12; }
.tnum { font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
::selection { background: var(--brand); color: #fff; }

/* ===================== LAYOUT SHELL ===================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
  background: linear-gradient(168deg, #241d17 0%, #2c241c 60%, #322820 100%);
  color: #efe6d8;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid #16110c;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 auto;
  background: linear-gradient(150deg, var(--brand) 0%, var(--amber) 130%);
  display: grid; place-items: center; box-shadow: 0 4px 14px rgba(178, 58, 46, .4);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 22px; color: #fff; letter-spacing: -.02em; line-height: 1; }
.brand-sub { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #b6a892; margin-top: 3px; }

.nav-group-label { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #9a8d78; padding: 16px 12px 7px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 10px; color: #d8cdba;
  font-weight: 500; font-size: 14.5px; text-align: left; position: relative;
  transition: background .16s, color .16s;
}
.nav-item svg { width: 19px; height: 19px; flex: 0 0 auto; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .055); color: #fff; }
.nav-item.active { background: rgba(178, 58, 46, .18); color: #fff; }
.nav-item.active::before { content: ''; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav-badge { margin-left: auto; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; min-width: 19px; height: 19px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }
.company-card { display: flex; align-items: center; gap: 11px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.company-ava { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(140deg, var(--amber), var(--brand)); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 14px; color: #fff; flex: 0 0 auto; }
.company-meta b { display: block; font-size: 13.5px; color: #fff; font-weight: 600; }
.company-meta span { font-size: 11.5px; color: #b6a892; }

/* --- Main --- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 30px; background: rgba(250, 245, 236, .82);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 21px; }
.topbar .crumb { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.search {
  margin-left: auto; display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px;
  padding: 8px 13px; min-width: 230px; color: var(--muted);
}
.search input { border: none; outline: none; background: none; font-family: inherit; font-size: 14px; width: 100%; color: var(--ink); }
.search svg { width: 17px; height: 17px; flex: 0 0 auto; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; position: relative; transition: border-color .15s, transform .1s; }
.icon-btn:hover { border-color: var(--brand); transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(140deg, var(--green), #234d3a); color: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 15px; }

.view { padding: 26px 30px 60px; max-width: 1320px; width: 100%; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.view-head .lead { color: var(--ink-soft); font-size: 14.5px; max-width: 560px; margin-top: 6px; }
.eyebrow { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--brand); font-weight: 700; margin-bottom: 8px; }
.view-head h2 { font-size: 27px; }

/* ===================== COMPONENTES ===================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 16px; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }

.grid { display: grid; gap: 18px; }
.kpi-grid { grid-template-columns: repeat(4, 1fr); }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.span-2 { grid-column: span 2; }

/* KPI */
.kpi { position: relative; overflow: hidden; padding: 18px 18px 16px; }
.kpi .k-top { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.kpi .k-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.kpi .k-ic svg { width: 18px; height: 18px; }
.kpi .k-label { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.kpi .k-val { font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: -.02em; line-height: 1; }
.kpi .k-foot { display: flex; align-items: center; gap: 8px; margin-top: 11px; font-size: 12.5px; color: var(--muted); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 12.5px; padding: 2px 7px; border-radius: 7px; }
.delta.up { color: var(--green); background: var(--green-tint); }
.delta.down { color: var(--danger); background: var(--danger-tint); }
.delta svg { width: 12px; height: 12px; }
.k-ic.red { background: var(--brand-tint); color: var(--brand); }
.k-ic.green { background: var(--green-tint); color: var(--green); }
.k-ic.amber { background: var(--amber-tint); color: var(--amber); }
.k-ic.ink { background: var(--bg-2); color: var(--ink); }

/* tabela */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 11px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 18px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .strong { font-weight: 600; }
.tbl .right { text-align: right; }
.cell-main { display: flex; align-items: center; gap: 11px; }
.cell-ava { width: 32px; height: 32px; border-radius: 9px; background: var(--bg-2); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--ink-soft); flex: 0 0 auto; font-family: var(--display); }

/* pills / tags */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.ok { color: var(--green); background: var(--green-tint); }
.pill.warn { color: var(--warn); background: var(--warn-tint); }
.pill.bad { color: var(--danger); background: var(--danger-tint); }
.pill.neutral { color: var(--ink-soft); background: var(--bg-2); }
.pill.brand { color: var(--brand); background: var(--brand-tint); }
.tag { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 7px; background: var(--bg-2); color: var(--ink-soft); }

/* progresso de estoque */
.stock-bar { width: 92px; height: 7px; border-radius: 5px; background: var(--line); overflow: hidden; }
.stock-bar i { display: block; height: 100%; border-radius: 5px; }

/* alertas */
.alert-feed { display: flex; flex-direction: column; }
.alert-row { display: flex; gap: 14px; padding: 15px 20px; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.alert-row:last-child { border-bottom: none; }
.alert-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; }
.alert-ic svg { width: 19px; height: 19px; }
.alert-row.critico .alert-ic { background: var(--danger-tint); color: var(--danger); }
.alert-row.alerta .alert-ic { background: var(--warn-tint); color: var(--warn); }
.alert-row.info .alert-ic { background: var(--green-tint); color: var(--green); }
.alert-body { min-width: 0; flex: 1; }
.alert-body b { font-size: 14.5px; display: block; }
.alert-body p { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.alert-act { font-size: 12.5px; font-weight: 700; color: var(--brand); margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
.alert-act svg { width: 13px; height: 13px; }
.alert-side { margin-left: auto; }

/* legenda chart */
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-soft); }
.legend i { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.legend i.dash { width: 14px; height: 0; border-top: 2px dashed var(--green); border-radius: 0; }

/* charts */
.chart { width: 100%; display: block; }
.chart-area { height: 230px; }
.chart-axis { font-size: 10.5px; fill: var(--muted); font-family: var(--sans); }
.dot-brand { fill: var(--surface); stroke: var(--brand); stroke-width: 2; }
.spark { width: 110px; height: 34px; }
.donut-cap { font-size: 10px; fill: var(--muted); font-family: var(--sans); letter-spacing: .03em; }
.donut-val { font-size: 17px; fill: var(--ink); font-family: var(--display); font-weight: 700; }
.ring-txt { font-size: 15px; fill: var(--ink); font-family: var(--display); font-weight: 700; }

/* barras horizontais */
.barsh { display: flex; flex-direction: column; gap: 13px; }
.barsh-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 12px; }
.barsh-label { font-size: 13px; color: var(--ink-soft); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barsh-track { height: 9px; background: var(--line); border-radius: 6px; overflow: hidden; }
.barsh-fill { display: block; height: 100%; border-radius: 6px; transition: width .9s cubic-bezier(.22,1,.36,1); }
.barsh-val { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 56px; text-align: right; }

/* donut layout */
.donut-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 11px; flex: 1; min-width: 180px; }
.dl-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.dl-row i { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.dl-row b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* vendedor card */
.seller { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); }
.seller:last-child { border-bottom: none; }
.seller-ava { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(140deg, var(--amber-tint), var(--brand-tint)); color: var(--brand-deep); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 15px; flex: 0 0 auto; }
.seller-main { min-width: 0; flex: 1; }
.seller-main b { font-size: 14.5px; }
.seller-main span { font-size: 12.5px; color: var(--muted); display: block; }
.seller-num { text-align: right; }
.seller-num b { font-family: var(--display); font-size: 16px; }

/* botões */
.btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; padding: 9px 16px; border-radius: 11px; transition: transform .1s, box-shadow .15s, background .15s; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(178, 58, 46, .28); }
.btn-primary:hover { background: var(--brand-deep); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* segmento / filtros */
.segment { display: inline-flex; background: var(--bg-2); border-radius: 11px; padding: 3px; gap: 2px; }
.segment button { padding: 6px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.segment button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 30px 0 16px; }
.section-title h3 { font-size: 18px; }
.muted { color: var(--muted); }
.mini-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* hero banner (financeiro/relatórios) */
.hero {
  border-radius: var(--r-lg); padding: 26px 28px; color: #f3e9da; position: relative; overflow: hidden;
  background: linear-gradient(150deg, #2a221a 0%, #3a2c20 100%);
  border: 1px solid #1c1610;
}
.hero::after { content: ''; position: absolute; right: -40px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgba(200, 137, 58, .28), transparent 65%); }
.hero h3 { color: #fff; font-size: 15px; font-weight: 600; opacity: .8; position: relative; }
.hero .big { font-family: var(--display); font-weight: 800; font-size: 40px; margin: 6px 0 2px; letter-spacing: -.02em; position: relative; }
.hero .hero-grid { display: flex; gap: 34px; flex-wrap: wrap; margin-top: 20px; position: relative; }
.hero-grid div span { display: block; font-size: 12px; opacity: .7; }
.hero-grid div b { font-family: var(--display); font-size: 19px; }

/* lista simples chave/valor */
.kv { display: flex; flex-direction: column; }
.kv-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.kv-row:last-child { border-bottom: none; }
.kv-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.kv-row.total { border-top: 2px solid var(--line); border-bottom: none; margin-top: 4px; padding-top: 14px; }
.kv-row.total b, .kv-row.total span { font-size: 16px; font-weight: 700; }

/* status banner topo dashboard */
.daystrip { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, var(--brand-tint), var(--amber-tint)); border: 1px solid #ecd9cf; border-radius: var(--r-md); padding: 14px 20px; margin-bottom: 20px; }
.daystrip .ds-ic { width: 40px; height: 40px; border-radius: 11px; background: #fff; display: grid; place-items: center; color: var(--brand); flex: 0 0 auto; }
.daystrip .ds-ic svg { width: 21px; height: 21px; }
.daystrip b { font-family: var(--display); font-size: 15.5px; }
.daystrip p { font-size: 13px; color: var(--ink-soft); }

/* mobile bottom nav (escondida no desktop) */
.botnav { display: none; }
.menu-btn { display: none; }
.backdrop { display: none; }

/* entrada animada */
.stagger > * { opacity: 0; transform: translateY(10px); animation: rise .5s cubic-bezier(.22,1,.36,1) forwards; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; }
.stagger > *:nth-child(5) { animation-delay: .22s; }
.stagger > *:nth-child(6) { animation-delay: .27s; }
.stagger > *:nth-child(7) { animation-delay: .32s; }
.stagger > *:nth-child(8) { animation-delay: .37s; }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .stagger > * { animation: none; opacity: 1; transform: none; } .barsh-fill { transition: none; } }

/* ===================== RESPONSIVO ===================== */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .cols-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  :root { --sidebar-w: 0px; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60; width: 264px; height: 100vh;
    transform: translateX(-100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
  }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(30, 22, 14, .42); z-index: 50; }
  .menu-btn { display: grid; }
  .topbar { padding: 12px 16px; }
  .search { display: none; }
  .view { padding: 18px 16px 96px; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .botnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: rgba(255, 253, 249, .94); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .botnav button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--muted); padding: 4px 8px; border-radius: 9px; flex: 1; max-width: 84px; }
  .botnav button svg { width: 21px; height: 21px; }
  .botnav button.active { color: var(--brand); }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid { gap: 14px; }
  .kpi .k-val { font-size: 24px; }
  .view-head h2 { font-size: 22px; }
  .hero .big { font-size: 32px; }
  .topbar h1 { font-size: 18px; }
}
