/* Bruno OS — interface (mobile primeiro, desktop com barra lateral) */
:root {
  --bg: #111214;
  --petrol: #061f28;
  --petrol-2: #0a3340;
  --lime: #c8f55a;
  --lime-2: #dcfa80;
  --ink: #111214;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .62);
  --faint: rgba(255, 255, 255, .5);
  --line: rgba(255, 255, 255, .1);
  --glass: linear-gradient(135deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  --danger: #ff8a7a;
  --ok: #c8f55a;
  --warn: #ffd27a;
  --r-lg: 24px;
  --r-md: 16px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  /* Tokens de tema (escuro = padrão; claro em [data-theme="light"]) */
  --accent: #c8f55a;
  --text-2: rgba(255, 255, 255, .85);
  --t2c: rgba(255, 255, 255, .55);
  --side-link: rgba(255, 255, 255, .8);
  --hover: rgba(255, 255, 255, .06);
  --line-soft: rgba(255, 255, 255, .06);
  --fill: rgba(255, 255, 255, .06);
  --fill-2: rgba(255, 255, 255, .08);
  --field-line: rgba(255, 255, 255, .14);
  --box-line: rgba(255, 255, 255, .4);
  --switch-off: rgba(255, 255, 255, .2);
  --tabbar-bg: rgba(24, 26, 29, .72);
  --toast-bg: rgba(30, 32, 35, .95);
  --option-bg: #1b1d20;
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 12px 32px -8px rgba(0, 0, 0, .35);
  --chart-in: #c8f55a;
  --chart-out: #6fb7c8;
  --chart-grid: rgba(255, 255, 255, .08);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 15px/1.45 var(--font); overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* Fundo com brilho (mesmo clima do site) */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.glow { position: absolute; border-radius: 50%; animation: float 9s ease-in-out infinite; }
.g1 { width: 440px; height: 440px; left: -180px; top: -150px; background: radial-gradient(closest-side, rgba(200, 245, 90, .13), transparent); }
.g2 { width: 520px; height: 520px; right: -240px; top: 40vh; background: radial-gradient(closest-side, rgba(16, 92, 110, .5), transparent); animation-delay: -5s; }
@keyframes float { 50% { translate: 0 -16px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

#app { position: relative; z-index: 1; min-height: 100dvh; }
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot img { animation: pulse 1.4s ease-in-out infinite; border-radius: 18px; }
@keyframes pulse { 50% { opacity: .4; transform: scale(.94); } }

/* Vidro */
.glass {
  background: var(--glass); border: 1px solid var(--line);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
}
.lime {
  background: linear-gradient(180deg, var(--lime-2), var(--lime)); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 10px 30px -8px rgba(200, 245, 90, .45);
}
.press { transition: transform .15s; }
.press:active { transform: scale(.97); }
.rv { animation: up .6s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes up { 0% { opacity: .01; transform: translateY(14px); } }

/* ---------- Estrutura ---------- */
.shell { min-height: 100dvh; }
.main {
  padding: calc(var(--safe-t) + 18px) calc(var(--safe-r) + 18px) calc(var(--safe-b) + 108px) calc(var(--safe-l) + 18px);
  max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px;
}

/* Tab bar (iPhone) */
.tabbar {
  position: fixed; z-index: 20; left: calc(var(--safe-l) + 14px); right: calc(var(--safe-r) + 14px);
  bottom: calc(var(--safe-b) + 12px); border-radius: 999px; padding: 6px;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--tabbar-bg);
}
.tab {
  flex: 1; min-height: 52px; border-radius: 999px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--side-link); text-decoration: none;
}
.tab svg { width: 21px; height: 21px; }
.tab[aria-current="page"] { background: linear-gradient(180deg, var(--lime-2), var(--lime)); color: var(--ink); }

/* Barra lateral (computador) */
.side { display: none; }
@media (min-width: 900px) {
  .tabbar { display: none; }
  .side {
    display: flex; flex-direction: column; gap: 4px; position: fixed; top: 16px; bottom: 16px; left: 16px; width: 236px;
    border-radius: 28px; padding: 18px 12px; overflow: auto; z-index: 10;
  }
  .side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 700; font-size: 17px; }
  .side .brand img { width: 34px; height: 34px; border-radius: 9px; }
  .side h6 { margin: 14px 12px 4px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
  .side a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; color: var(--side-link); text-decoration: none; font-weight: 500; }
  .side a:hover { background: var(--hover); }
  .side a[aria-current="page"] { background: linear-gradient(180deg, var(--lime-2), var(--lime)); color: var(--ink); }
  .side svg { width: 18px; height: 18px; flex: none; }
  .side .brand { justify-content: space-between; }
  .side .brand > span { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .side-toggle { width: 32px; height: 32px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
  .side-toggle svg { width: 16px; height: 16px; }
  .side, .main { transition: width .2s ease, margin-left .2s ease; }

  /* Conteúdo ocupa toda a largura depois do menu. Leitura confortável:
     telas de lista/formulário até 1120px; Início até 1600px. */
  .main { margin-left: 268px; max-width: none; padding: 32px 40px 48px; }
  #main > * { width: 100%; max-width: 1120px; margin-left: auto; margin-right: auto; }
  #main.wide > * { max-width: 1600px; }
  #main > .form { max-width: 760px; margin-left: max(0px, calc((100% - 1120px) / 2)); }

  /* Menu recolhido: só ícones */
  .shell.mini .side { width: 76px; padding-left: 10px; padding-right: 10px; }
  .shell.mini .main { margin-left: 108px; }
  .shell.mini .side .lbl, .shell.mini .side .brand .lbl { display: none; }
  .shell.mini .side .brand { flex-direction: column; gap: 12px; padding: 4px 0 12px; }
  .shell.mini .side h6 { height: 1px; margin: 10px 8px; background: var(--line); overflow: hidden; color: transparent; }
  .shell.mini .side a { justify-content: center; padding: 10px 0; }
}

/* ---------- Início (layout responsivo) ---------- */
.home-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px 20px; }
.home-top .hello { flex: 1 1 0; min-width: 0; }
@media (max-width: 899px) { .home-top { column-gap: 8px; } .home-top h1 { font-size: 24px; } }
.home-top .msg { flex: 1 1 100%; }
.home-top .actions { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 899px) { .home-top .actions { gap: 6px; } .home-top .icon-btn { width: 40px; height: 40px; } }
.btn-new { min-height: 44px; padding: 0 16px; border-radius: 999px; font-weight: 700; font-size: 14px; display: none; align-items: center; gap: 8px; text-decoration: none; }
.btn-new svg { width: 16px; height: 16px; }
@media (min-width: 900px) { .btn-new { display: inline-flex; } }

.msg { margin: 0; max-width: 780px; border-radius: 18px; padding: 14px 14px 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.msg::before { content: ""; width: 3px; align-self: stretch; border-radius: 3px; background: var(--accent); flex: none; }
/* Versículo / frase: mesma família sans do sistema, sem itálico nem serifa */
.msg blockquote { margin: 0; flex: 1; min-width: 0; font-family: var(--font); font-style: normal; font-size: 16px; line-height: 1.55; font-weight: 450; letter-spacing: -.005em; color: var(--text); text-wrap: pretty; }
.msg figcaption { margin-top: 8px; font-family: var(--font); font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.msg cite { font-style: normal; font-weight: 600; letter-spacing: .01em; }
.msg cite span { font-weight: 400; }
@media (min-width: 900px) { .msg blockquote { font-size: 16.5px; } }
.msg .msg-actions { display: flex; gap: 2px; flex: none; }
.msg .msg-actions button { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.msg .msg-actions button:hover { background: var(--hover); }
.msg .msg-actions svg { width: 17px; height: 17px; }

.home-kpis { display: flex; flex-wrap: wrap; gap: 14px; }
.home-kpis .hero { flex: 1.3 1 320px; min-width: 0; justify-content: space-between; min-height: 150px; }
.home-kpis .kpis { flex: 3 1 480px; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 900px) { .home-kpis .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.home-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.home-row > * { flex: 1 1 320px; min-width: 0; }
.home-row > .grow { flex: 2 1 480px; }
.home-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; align-items: start; }
@media (min-width: 900px) {
  .main.wide { gap: 18px; }
  .home-kpis .hero { padding: 22px 24px; }
  .home-kpis .hero .big { font-size: 40px; }
  .home-kpis .kpi { padding: 16px 18px; gap: 8px; }
  .home-kpis .kpi strong { font-size: 22px; }
}

/* ---------- Gráficos ---------- */
.chart { position: relative; margin-top: 8px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis text { fill: var(--t2c); font-size: 11px; font-family: var(--font); }
.chart .in { fill: var(--chart-in); }
.chart .out { fill: var(--chart-out); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .in { background: var(--chart-in); }
.legend .out { background: var(--chart-out); }
.chart-empty { position: relative; min-height: 168px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 16px; margin-top: 8px;
  border-radius: 16px; border: 1px dashed var(--chart-grid); }
@media (min-width: 900px) { .chart-empty { min-height: 210px; } }
.chart-empty .ico { width: 44px; height: 44px; border-radius: 14px; background: rgba(200, 245, 90, .12); color: var(--accent); display: grid; place-items: center; }
.chart-empty .ico svg { width: 22px; height: 22px; }
.chart-empty strong { font-size: 14.5px; }
.chart-empty span { font-size: 13px; color: var(--muted); max-width: 360px; }
.chart-empty a { font-size: 13.5px; font-weight: 700; text-decoration: none; padding: 6px; }
.cats { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.cats .row1 { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.cats .row1 span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cats .bar > i { background: var(--chart-out); }

/* ---------- Tema claro ---------- */
[data-theme="light"] {
  --bg: #f4f5f2;
  --text: #111214;
  --text-2: #2a2d31;
  --muted: #575c62;
  --faint: #686d73;
  --t2c: #5f646a;
  --line: #e3e5df;
  --line-soft: #eceee9;
  --glass: #ffffff;
  --glass-shadow: 0 1px 2px rgba(17, 18, 20, .04), 0 8px 24px rgba(17, 18, 20, .05);
  --accent: #3d6a00;
  --side-link: #33373b;
  --hover: rgba(17, 18, 20, .05);
  --fill: #f1f2ee;
  --fill-2: #eceee9;
  --field-line: #d6d9d2;
  --box-line: rgba(17, 18, 20, .35);
  --switch-off: #cfd3cb;
  --tabbar-bg: rgba(255, 255, 255, .88);
  --toast-bg: rgba(255, 255, 255, .97);
  --option-bg: #ffffff;
  --danger: #b3261e;
  --warn: #8a5a00;
  --ok: #3d6a00;
  --chart-in: #7fb31a;
  --chart-out: #0a3340;
  --chart-grid: #e6e8e3;
}
[data-theme="light"] .glass { -webkit-backdrop-filter: none; backdrop-filter: none; }
[data-theme="light"] .tabbar.glass, [data-theme="light"] .side.glass { -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
[data-theme="light"] .g1 { background: radial-gradient(closest-side, rgba(200, 245, 90, .28), transparent); }
[data-theme="light"] .g2 { background: radial-gradient(closest-side, rgba(16, 92, 110, .10), transparent); }
[data-theme="light"] .lime { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 10px 24px -10px rgba(100, 140, 20, .35); }
[data-theme="light"] .field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23111214' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); }
[data-theme="light"] .chip.ok { background: #e6f4c6; }
[data-theme="light"] .chip.late { background: #fbe3e0; }
[data-theme="light"] .date.late { background: #fbe3e0; border-color: #f0b8b0; }
[data-theme="light"] .offline-bar { background: #fdf0d5; }
[data-theme="light"] .btn.danger { background: #fbe3e0; border-color: #f0b8b0; }
[data-theme="light"] .note { background: #f1f8e0; }
[data-theme="light"] .chart-empty .ico { background: #eef8d6; }

/* Seletor de aparência (Ajustes) */
.seg-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 5px; border-radius: 16px; background: var(--fill); border: 1px solid var(--line); }
.seg-choice button { min-height: 46px; border-radius: 12px; border: 0; background: transparent; color: var(--side-link); font-weight: 600; cursor: pointer; }
.seg-choice button[aria-checked="true"] { background: linear-gradient(180deg, var(--lime-2), var(--lime)); color: var(--ink); }

/* ---------- Topo de página ---------- */
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.top .kicker { font-size: 13px; color: var(--muted); }
.top h1 { margin: 2px 0 0; font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 999px; display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--glass); color: var(--text);
}
.icon-btn svg { width: 19px; height: 19px; }
.actions { display: flex; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--accent); text-decoration: none; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; }

/* ---------- Início ---------- */
.phrase { margin: 4px 0 0; font-size: 15px; line-height: 1.45; color: var(--text-2); display: flex; gap: 10px; align-items: flex-start; }
.phrase q { quotes: "“" "”"; flex: 1; }
.phrase q::before, .phrase q::after { color: var(--accent); font-weight: 700; }
.phrase button { flex: none; width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.phrase button svg { width: 16px; height: 16px; }

.hero { border-radius: 26px; padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.hero .lbl { font-size: 13px; color: rgba(17, 18, 20, .75); display: flex; justify-content: space-between; }
.hero .big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.hero .row { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: rgba(17, 18, 20, .78); }
.hero strong { color: var(--ink); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--text); }
.kpi > span { font-size: 12px; color: var(--muted); }
.kpi strong { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.kpi.alert strong { color: var(--danger); }

.card { border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.card-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 8px; margin-bottom: 4px; }
.card-h h2 { margin: 0; font-size: 16px; font-weight: 600; }
.card-h a, .card-h span { font-size: 13px; font-weight: 600; text-decoration: none; }
.card-h span { color: var(--muted); font-weight: 500; }
.empty { color: var(--faint); font-size: 14px; padding: 10px 0; }
.empty a { font-weight: 600; }

.task { display: flex; align-items: center; gap: 12px; min-height: 50px; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: var(--text); }
.box { width: 24px; height: 24px; flex: none; border-radius: 8px; border: 1.8px solid var(--box-line); display: grid; place-items: center; }
.box svg { width: 14px; height: 14px; opacity: 0; }
.task.done .box { background: var(--lime); border-color: var(--lime); }
.task.done .box svg { opacity: 1; }
.task.done .t1 { text-decoration: line-through; color: var(--faint); }

.item { display: flex; align-items: center; gap: 12px; min-height: 56px; color: var(--text); text-decoration: none; padding: 4px 0; }
.item + .item { border-top: 1px solid var(--line-soft); }
.item .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.t1 { font-size: 14.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t2 { font-size: 12.5px; color: var(--t2c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val { font-size: 14px; font-weight: 600; white-space: nowrap; }
.val.in { color: var(--accent); }
.val.out { color: var(--text); }
.date {
  width: 44px; height: 44px; flex: none; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--fill-2); border: 1px solid var(--line);
}
.date b { font-size: 15px; line-height: 1; }
.date i { font-style: normal; font-size: 9.5px; font-weight: 600; letter-spacing: .04em; }
.date.today { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.date.late { background: rgba(255, 138, 122, .18); border-color: rgba(255, 138, 122, .5); color: var(--danger); }
.chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--fill-2); color: var(--muted); }
.chip.late { background: rgba(255, 138, 122, .16); color: var(--danger); }
.chip.ok { background: rgba(200, 245, 90, .14); color: var(--accent); }

.bar { height: 8px; border-radius: 99px; background: var(--fill-2); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--lime), var(--lime-2)); }

/* ---------- Listas e módulos ---------- */
.seg { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 2px 18px; }
.seg::-webkit-scrollbar { display: none; }
.seg a { flex: none; padding: 9px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--side-link); border: 1px solid var(--line); background: var(--glass); min-height: 40px; display: inline-flex; align-items: center; }
.seg a[aria-current="page"] { background: var(--lime); color: var(--ink); border-color: var(--lime); }
@media (min-width: 900px) { .seg { margin: 0; padding: 2px 0; } }

.search { position: relative; }
.search input { width: 100%; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--fill); padding: 0 14px 0 40px; font-size: 16px; }
.search svg { position: absolute; left: 13px; top: 14px; width: 18px; height: 18px; color: var(--faint); }

.fab {
  position: fixed; z-index: 21; right: calc(var(--safe-r) + 20px); bottom: calc(var(--safe-b) + 92px);
  width: 56px; height: 56px; border-radius: 999px; display: grid; place-items: center; border: 0; cursor: pointer; text-decoration: none;
}
.fab svg { width: 24px; height: 24px; }
@media (min-width: 900px) { .fab { bottom: 32px; right: 32px; } }

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-grid a { border-radius: 20px; padding: 16px; min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.menu-grid svg { width: 24px; height: 24px; color: var(--accent); }
.menu-grid small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.group-title { margin: 8px 2px 0; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
@media (min-width: 600px) { .menu-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Formulários ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 50px; border-radius: 14px; border: 1px solid var(--field-line);
  background: var(--fill); padding: 12px 14px; font-size: 16px; /* 16px evita zoom no iPhone */
  outline: none; -webkit-appearance: none; appearance: none;
}
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23ffffff99' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px; }
.field select option { background: var(--option-bg); }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(200, 245, 90, .18); }
.field.err input, .field.err select { border-color: var(--danger); }
.field .hint { font-size: 12px; color: var(--faint); }
.switch { display: flex; align-items: center; justify-content: space-between; min-height: 50px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--field-line); background: var(--fill); }
.switch input { width: 46px; height: 28px; min-height: 0; padding: 0; border-radius: 99px; background: var(--switch-off); position: relative; cursor: pointer; border: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .2s; }
.switch input:checked { background: var(--lime); }
.switch input:checked::after { left: 21px; }
.btn { min-height: 52px; border-radius: 16px; border: 0; padding: 0 20px; font-weight: 700; font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.ghost { background: var(--fill-2); border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: rgba(255, 138, 122, .12); border: 1px solid rgba(255, 138, 122, .4); color: var(--danger); }
.btn[disabled] { opacity: .6; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.note { font-size: 13px; color: var(--muted); border-left: 3px solid var(--lime); padding: 8px 12px; background: rgba(200, 245, 90, .06); border-radius: 0 12px 12px 0; }
.err-msg { color: var(--danger); font-size: 14px; min-height: 20px; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.sim { width: 100%; border-collapse: collapse; font-size: 13px; }
.sim th, .sim td { padding: 8px 4px; text-align: right; border-bottom: 1px solid var(--line-soft); }
.sim th:first-child, .sim td:first-child { text-align: left; }
.sim th { color: var(--muted); font-weight: 600; }

/* ---------- Login ---------- */
.auth { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--safe-t) + 24px) 22px calc(var(--safe-b) + 24px); max-width: 440px; margin: 0 auto; gap: 22px; }
.auth .logo { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 20px 50px -12px rgba(200, 245, 90, .25); }
.auth h1 { margin: 0; font-size: 30px; letter-spacing: -.02em; }
.auth p { margin: 0; color: var(--muted); }
.secret { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 18px; letter-spacing: .06em; padding: 14px; border-radius: 14px; background: var(--fill); border: 1px dashed var(--field-line); text-align: center; user-select: all; -webkit-user-select: all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 16px; }
.codes span { padding: 10px; border-radius: 10px; background: var(--fill); text-align: center; }
.otp { letter-spacing: .4em; text-align: center; font-size: 24px !important; font-weight: 700; }

/* Toast */
#toast {
  position: fixed; z-index: 50; left: 50%; top: calc(var(--safe-t) + 12px); transform: translate(-50%, -140%);
  max-width: min(92vw, 420px); padding: 12px 16px; border-radius: 16px; background: var(--toast-bg); border: 1px solid var(--line); box-shadow: 0 12px 32px -8px rgba(0, 0, 0, .3);
  font-size: 14px; transition: transform .3s cubic-bezier(.2, .7, .2, 1); display: flex; gap: 12px; align-items: center;
}
#toast.show { transform: translate(-50%, 0); }
#toast button { background: var(--lime); color: var(--ink); border: 0; border-radius: 10px; padding: 8px 12px; font-weight: 700; cursor: pointer; }

.hide-values .money { filter: blur(7px); }
.offline-bar { font-size: 13px; text-align: center; padding: 8px; border-radius: 12px; background: rgba(255, 210, 122, .12); color: var(--warn); }
.card p.t2, p.t2 { white-space: normal; }
.msg .msg-body { flex: 1; min-width: 0; }
.cats .bar { display: block; }
/* Força a frase do dia para a linha de baixo do cabeçalho (o max-width dela atrapalhava a quebra) */
.home-top::after { content: ""; flex-basis: 100%; order: 1; height: 0; }
.home-top .msg { order: 2; }

/* ---------- Conta (perfil no cabeçalho) ---------- */
.avatar { --sz: 36px; width: var(--sz); height: var(--sz); flex: none; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--fill-2); box-shadow: 0 0 0 1.5px var(--line), 0 0 0 3px transparent; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.initials { background: linear-gradient(180deg, var(--lime-2), var(--lime)); color: var(--ink); font-weight: 700; font-size: calc(var(--sz) * .38); letter-spacing: .02em; }
.avatar.lg { --sz: 48px; }
.avatar.xl { --sz: 104px; }
.account { position: relative; display: flex; }
.account-btn { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--text); cursor: pointer; text-align: left; }
.account-btn:hover, .account-btn[aria-expanded="true"] { background: var(--hover); border-color: var(--line); }
.account-btn:focus-visible, .account-menu [role=menuitem]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.account-btn .avatar { box-shadow: 0 0 0 1.5px var(--line), 0 0 0 3px var(--bg), 0 0 0 4.5px var(--accent); --sz: 36px; margin: 4px; }
.who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.who .nm { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.who .rl { font-size: 12px; color: var(--muted); }
.who .em { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.account-btn .chev { display: grid; place-items: center; color: var(--muted); transition: transform .2s; }
.account-btn .chev svg { width: 16px; height: 16px; }
.account-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.account-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: 280px; border-radius: 20px; padding: 8px;
  display: flex; flex-direction: column; background: var(--option-bg); animation: pop .18s cubic-bezier(.2, .7, .2, 1); }
@keyframes pop { 0% { opacity: 0; transform: translateY(-6px) scale(.98); } }
.account-head { display: flex; gap: 12px; align-items: center; padding: 8px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.account-head .who .nm { max-width: 190px; }
.account-menu [role=menuitem] { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 10px; border-radius: 12px; border: 0; background: none;
  color: var(--text); font-size: 14.5px; font-weight: 500; text-decoration: none; cursor: pointer; text-align: left; width: 100%; }
.account-menu [role=menuitem]:hover { background: var(--hover); }
.account-menu [role=menuitem] svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.account-menu .danger, .account-menu .danger svg { color: var(--danger); }
.account-menu hr { border: 0; height: 1px; background: var(--line-soft); margin: 4px 6px; }
@media (max-width: 899px) {
  /* Celular: só o avatar no cabeçalho; nome e função aparecem ao tocar */
  .account-btn { padding: 0; gap: 0; }
  .account-btn .who, .account-btn .chev { display: none; }
  .account-btn:hover, .account-btn[aria-expanded="true"] { background: transparent; border-color: transparent; }
  .account-btn .avatar { --sz: 34px; margin: 3px; }
  .account-menu { position: fixed; top: calc(var(--safe-t) + 70px); right: calc(var(--safe-r) + 14px); width: min(300px, calc(100vw - 28px)); }
}

/* Diálogos (editar informações / alterar foto) */
dialog.sheet { width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border-radius: 26px; padding: 18px; color: var(--text); background: var(--option-bg); }
dialog.sheet::backdrop { background: rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sheet-h h2 { margin: 0; font-size: 18px; }
.sheet-h .icon-btn { width: 36px; height: 36px; font-size: 14px; color: var(--muted); }
.field input:disabled { opacity: .65; }
.crop { position: relative; width: min(280px, 100%); aspect-ratio: 1; margin: 0 auto; border-radius: 50%; overflow: hidden; background: var(--fill); touch-action: none; }
.crop canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.crop canvas:active { cursor: grabbing; }
.crop-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--accent); pointer-events: none; }
.crop-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14px; }
.crop-empty svg { width: 28px; height: 28px; color: var(--accent); }
.crop-zoom input[type=range] { min-height: 0; padding: 0; height: 28px; background: transparent; border: 0; accent-color: var(--lime); -webkit-appearance: auto; appearance: auto; }
.btn-row label.btn { flex: 1; }

/* Meu perfil */
.profile-card { align-items: center; text-align: center; gap: 10px; padding: 26px 18px; }
.profile-card .who { align-items: center; }
.profile-card .who .nm { font-size: 22px; font-weight: 700; max-width: none; }
.profile-card .who .rl { font-size: 14px; }
.profile-card .who .em { font-size: 13px; }
.profile-photo { position: relative; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }
.profile-photo .avatar { box-shadow: 0 0 0 2px var(--line), 0 0 0 5px var(--bg), 0 0 0 7px var(--accent); }
.profile-photo .cam { position: absolute; right: 0; bottom: 2px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(180deg, var(--lime-2), var(--lime)); color: var(--ink); box-shadow: 0 0 0 3px var(--bg); }
.profile-photo .cam svg { width: 17px; height: 17px; }
.profile-card .btn-row { width: 100%; max-width: 460px; margin-top: 8px; }
.profile-card .btn { font-size: 14.5px; min-height: 46px; }
@media (max-width: 520px) { .profile-card .btn-row { flex-direction: column; } }

/* Celular: mais respiro entre blocos e nas bordas */
@media (max-width: 899px) {
  .main { padding-left: calc(var(--safe-l) + 20px); padding-right: calc(var(--safe-r) + 20px); padding-top: calc(var(--safe-t) + 22px); gap: 18px; }
  .seg { margin: 0 -20px; padding: 2px 20px; }
  .home-top { row-gap: 18px; }
  .home-top .kicker { margin-bottom: 4px; }
  .home-kpis, .home-row, .home-3 { gap: 16px; }
  .kpis { gap: 12px; }
  .hero { padding: 20px 22px; gap: 8px; }
  .kpi { padding: 16px 18px; gap: 6px; }
  .card { padding: 18px 20px; gap: 4px; }
  .card-h { margin-bottom: 8px; }
  .msg { padding: 16px 16px 16px 18px; gap: 14px; }
  .chart-empty { margin-top: 12px; }
}

.area-switch{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin:0 0 12px;color:var(--muted);font-size:12px}
.area-switch .seg-choice{grid-template-columns:repeat(2,minmax(0,1fr));width:min(100%,420px)}
.area-switch .seg-choice button{min-height:38px;font-size:12px}
[hidden]{display:none!important}
.filters{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin:14px 0}
.compact-kpis{grid-template-columns:repeat(3,minmax(0,1fr));margin:12px 0}
.recv-row{width:100%;background:transparent;border:0;text-align:left;cursor:pointer}
.balance-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:12px 0}
.month-pick{max-width:280px;margin:12px 0}
.forecast-group{margin-top:16px}.forecast-group h3{margin:10px 0 4px;font-size:15px}
.history-row{display:grid;grid-template-columns:1fr auto;gap:4px 12px;padding:10px 0;border-top:1px solid var(--line-soft)}
.history-row small{grid-column:1/-1;color:var(--muted);white-space:pre-wrap;overflow-wrap:anywhere}
.import-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;border-top:1px solid var(--line-soft);padding:12px 0}
.import-row>span:first-child{flex:1 1 250px;display:flex;flex-direction:column;gap:4px}.import-row small{color:var(--muted);line-height:1.45}
.balance-nudge{display:flex;flex-direction:column;gap:6px;text-decoration:none;color:var(--text)}
.review-note{display:block;text-decoration:none}
@media(max-width:700px){.area-switch{align-items:stretch;flex-direction:column}.area-switch .seg-choice{width:100%}.filters{grid-template-columns:repeat(2,minmax(0,1fr))}.compact-kpis,.balance-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.recv-row{align-items:flex-start}.recv-row .val{display:flex;flex-direction:column;align-items:flex-end;gap:4px}}
