:root {
  --bg: #07070c; --text: #f3f5fa; --muted: #9aa1b4;
  --lime: #b8ff3a; --violet: #7c5cff; --green: #38e08a; --red: #ff5c6c; --amber: #ffce4d;
  --card: rgba(255,255,255,0.04); --border: rgba(255,255,255,0.09); --radius: 16px;
  --side: 248px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: "Inter", system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1,h2,h3,.brand-name { font-family: "Space Grotesk", sans-serif; letter-spacing: -0.02em; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sm { font-size: 0.85rem; }

.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(1000px 600px at 80% -10%, #15152a, var(--bg) 60%); }
.blob { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.4; }
.b1 { width: 480px; height: 480px; background: var(--violet); top: -160px; left: -120px; }
.b2 { width: 420px; height: 420px; background: var(--lime); bottom: -180px; right: -120px; opacity: 0.18; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--lime), var(--violet)); font-size: 1.1rem; flex-shrink: 0; }
.brand-name { font-size: 1.05rem; }

.btn { font-family: "Space Grotesk"; font-weight: 600; font-size: 0.92rem; padding: 11px 18px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; background: linear-gradient(135deg, var(--lime), #d6ff85); color: #0a0a0f; transition: transform 0.15s, box-shadow 0.15s; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(184,255,58,0.25); }
.btn:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }
.btn-sm { padding: 9px 14px; font-size: 0.85rem; border-radius: 10px; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); box-shadow: none; }

input, select, textarea { font-family: inherit; background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: 12px; padding: 12px 13px; color: var(--text); font-size: 1rem; outline: none; transition: border-color 0.2s; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--lime); }
select option { background: #15151f; }

/* senha com olho */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 6px; opacity: 0.7; }
.pw-toggle:hover { opacity: 1; }

/* ===== login ===== */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--border); border-radius: 22px; padding: 32px; display: flex; flex-direction: column; gap: 14px; backdrop-filter: blur(8px); }
.login-card h1 { font-size: 1.5rem; }
.login-card .sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 4px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.login-card .btn { margin-top: 8px; }
.err { color: var(--red); font-size: 0.85rem; min-height: 1em; }

/* ===== app shell — drawer ===== */
.app { min-height: 100dvh; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(2px); z-index: 30; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.app.menu-open .overlay { opacity: 1; pointer-events: auto; }

.sidebar { position: fixed; top: 0; left: 0; height: 100dvh; width: var(--side); z-index: 40; border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; background: #0c0c15; transform: translateX(-100%); transition: transform 0.25s ease; }
.app.menu-open .sidebar { transform: none; }
.side-brand { padding: 4px 8px; }
.menu { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.menu-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: var(--muted); font-weight: 500; cursor: pointer; font-size: 0.98rem; border: none; background: none; font-family: inherit; text-align: left; width: 100%; transition: background 0.15s, color 0.15s; }
.menu-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.menu-item.active { background: linear-gradient(135deg, rgba(184,255,58,0.16), rgba(124,92,255,0.16)); color: var(--text); }
.mi-ic { font-size: 1.05rem; width: 22px; text-align: center; }
.side-foot { border-top: 1px solid var(--border); padding-top: 10px; }
.logout:hover { color: var(--red); }

.main { min-height: 100dvh; display: flex; flex-direction: column; transition: margin-left 0.25s ease; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(8,8,14,0.85); backdrop-filter: blur(12px); z-index: 20; padding-top: max(14px, env(safe-area-inset-top)); }
.topbar h2 { font-size: 1.2rem; flex: 1; }
.hamburger { background: none; border: 1px solid var(--border); color: var(--text); width: 40px; height: 40px; border-radius: 11px; font-size: 1.2rem; cursor: pointer; flex-shrink: 0; }
.hamburger:hover { border-color: var(--lime); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill { font-size: 0.78rem; color: var(--muted); background: var(--card); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.content { padding: 18px; width: 100%; flex: 1; }

/* desktop: drawer empurra o conteúdo quando aberto */
@media (min-width: 860px) {
  .app.menu-open .main { margin-left: var(--side); }
  .app.menu-open .overlay { opacity: 0; pointer-events: none; }
  .topbar { padding-left: 24px; padding-right: 24px; }
  .content { padding: 24px 28px 48px; }
}

/* ===== generic ===== */
.row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); }
.inline-field select { width: auto; padding: 9px 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.spacer { flex: 1; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.kpi .v { font-family: "Space Grotesk"; font-size: 1.55rem; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.kpi .v.up { color: var(--red); } .kpi .v.down { color: var(--green); }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.panel h3 { font-size: 1.05rem; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; }
.cat-wrap { max-width: 480px; margin: 0 auto; }

/* ===== lista compacta (dashboard) ===== */
.list-compact { display: flex; flex-direction: column; }
.lc-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.lc-row:last-child { border-bottom: none; }
.lc-cat { font-size: 1.1rem; }
.lc-name { flex: 1; font-weight: 500; min-width: 0; }
.lc-date { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.lc-val { font-family: "Space Grotesk"; font-weight: 600; white-space: nowrap; }

/* ===== filtros ===== */
.filter-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.filter-grid .field { margin-bottom: 0; }
.filter-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.segmented { display: inline-flex; background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; }
.segmented.full { display: flex; width: 100%; margin-bottom: 14px; }
.segmented.full .seg { flex: 1; }
.seg { background: none; border: none; color: var(--muted); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 0.85rem; font-weight: 600; }
.seg.active { background: linear-gradient(135deg, rgba(184,255,58,0.2), rgba(124,92,255,0.2)); color: var(--text); }

.totais-bar { display: flex; gap: 16px; flex-wrap: wrap; padding: 12px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 14px; font-size: 0.9rem; }
.totais-bar b { font-family: "Space Grotesk"; }

/* ===== cards de comprovante ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; display: flex; flex-direction: column; gap: 9px; }
.card.cancelado { opacity: 0.55; }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-name { font-weight: 600; font-size: 1rem; }
.card-meta { color: var(--muted); font-size: 0.8rem; display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 3px; }
.card-val { font-family: "Space Grotesk"; font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.card-desc { font-size: 0.88rem; color: var(--muted); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { width: 54px; height: 54px; border-radius: 10px; border: 1px solid var(--border); object-fit: cover; cursor: pointer; background: rgba(0,0,0,0.3); display: grid; place-items: center; font-size: 1.4rem; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 10px; }
.chip { font-size: 0.7rem; padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.chip.pendente { background: rgba(255,206,77,0.15); color: var(--amber); }
.chip.conferido { background: rgba(56,224,138,0.15); color: var(--green); }
.chip.cancelado { background: rgba(255,92,108,0.15); color: var(--red); }
.iconbtn { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 9px; padding: 6px 11px; cursor: pointer; font-size: 0.8rem; font-family: inherit; }
.iconbtn:hover { color: var(--text); border-color: var(--lime); }
.iconbtn.danger:hover { color: var(--red); border-color: var(--red); }

/* ===== visão em lista ===== */
.cards.lista { display: flex; flex-direction: column; gap: 8px; }
.cards.lista .card { flex-direction: row; align-items: center; flex-wrap: wrap; padding: 12px 14px; gap: 12px; }
.cards.lista .card-top { flex: 1; min-width: 200px; }
.cards.lista .card-desc, .cards.lista .thumbs { display: none; }
.cards.lista .card-actions { border-top: none; padding-top: 0; width: auto; }
.cards.lista .card-meta-extra { display: none; }

/* ===== categorias / usuários / logs ===== */
.cat-list, .user-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.cat-row, .user-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; flex-wrap: wrap; }
.cat-row .cn { flex: 1; } .user-row .un { flex: 1; font-weight: 500; }
.cat-add { display: flex; gap: 8px; align-items: center; }
.emoji-in { width: 54px; text-align: center; flex-shrink: 0; }
.cat-add input:not(.emoji-in) { flex: 1; }
.logs { display: flex; flex-direction: column; max-height: 72vh; overflow: auto; }
.log-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.log-row .lt { color: var(--muted); } .log-row .lu { color: var(--lime); font-weight: 600; }
.badge { background: rgba(124,92,255,0.18); color: #c5b8ff; padding: 1px 8px; border-radius: 999px; font-size: 0.72rem; }

.anexos-edit { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ae { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 5px 8px; font-size: 0.8rem; }
.ae button { background: none; border: none; color: var(--red); cursor: pointer; font-size: 0.9rem; }

/* ===== modal ===== */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal-back { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.modal-card { position: relative; background: #0d0d16; border: 1px solid var(--border); border-radius: 18px; max-width: 96vw; max-height: 92dvh; width: 760px; display: flex; flex-direction: column; overflow: hidden; }
.modal-card.sm-card { width: 440px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; }
.modal-body { padding: 16px; overflow: auto; display: grid; place-items: center; }
.modal-body.block { display: block; }
.modal-body img { max-width: 100%; max-height: 74dvh; border-radius: 10px; }
.modal-body iframe { width: 100%; height: 74dvh; border: none; border-radius: 10px; background: #fff; }
.periodo-box { margin-bottom: 8px; }
.export-formats { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.export-formats .btn { width: 100%; justify-content: flex-start; padding: 14px 16px; gap: 10px; }
.export-formats .btn small { color: inherit; opacity: 0.7; font-weight: 400; margin-left: auto; }

/* ===== toast ===== */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #15151f; border: 1px solid var(--border); padding: 12px 20px; border-radius: 999px; font-size: 0.9rem; z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,0.4); max-width: 90vw; text-align: center; }
.toast.ok { border-color: var(--green); } .toast.bad { border-color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }

/* ===== mobile ===== */
@media (max-width: 600px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar h2 { font-size: 1.1rem; }
  .cards { grid-template-columns: 1fr; }
  .filter-actions { gap: 8px; }
  .filter-actions .segmented { width: 100%; }
  .filter-actions .segmented .seg { flex: 1; }
  .filter-actions .spacer { display: none; }
  .openExport, #openExport, #filLimpar { flex: 1; }
  .log-row { grid-template-columns: 1fr; gap: 2px; }
  .modal-card.sm-card { width: 100%; }
}
