:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #6b7a8c;
  --line: #e3e7ec;
  --brand: #14283c;
  --brand-2: #1e3a56;
  --accent: #f0a41e;
  --accent-ink: #3a2a00;
  --ok: #1e9e5a;
  --warn: #d98a00;
  --bad: #d34545;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 30, 46, .08);
}
* { box-sizing: border-box; margin: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(140deg, var(--brand), var(--brand-2) 60%, #2c5078); padding: 16px; }
.login-card { background: var(--card); border-radius: 16px; padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.login-card h1 { font-size: 24px; margin-bottom: 2px; }
.login-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.brand-badge { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--brand); font-size: 20px; margin-bottom: 8px; }
.brand-badge .dot { background: var(--accent); border-radius: 8px; padding: 4px 8px; font-size: 18px; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 224px; background: var(--brand); color: #cfdae6; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 30; transition: transform .2s; }
.sidebar .logo { padding: 20px 18px 14px; font-weight: 700; color: #fff; font-size: 17px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .logo .dot { background: var(--accent); border-radius: 8px; padding: 3px 7px; }
.sidebar nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: inherit; text-decoration: none; margin-bottom: 2px; font-size: 14px; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); }
.sidebar nav a.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.sidebar .foot { padding: 12px 16px; font-size: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar .foot button { background: none; border: 1px solid rgba(255,255,255,.25); color: #cfdae6; border-radius: 8px; padding: 6px 12px; width: 100%; margin-top: 8px; }
.main { flex: 1; margin-left: 224px; padding: 24px 28px 60px; max-width: 1280px; }
.topbar { display: none; }

/* ---------- componentes ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: none; border-radius: 9px; padding: 9px 16px; font-weight: 600; font-size: 14px; background: var(--brand); color: #fff; }
.btn:hover { background: var(--brand-2); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); font-weight: 500; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.danger { background: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .lbl { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
.stat .val { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .val.ok { color: var(--ok); } .stat .val.warn { color: var(--warn); } .stat .val.bad { color: var(--bad); } .stat .val.accent { color: var(--accent); }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.panel h3 { font-size: 15px; margin-bottom: 12px; color: var(--brand); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7f9fb; }
.table-wrap { overflow-x: auto; }

.tag { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.tag.disponivel, .tag.ok, .tag.encerrado, .tag.receita, .tag.bom { background: #e2f5ea; color: var(--ok); }
.tag.alugado, .tag.ativo { background: #e7effa; color: #2b62b5; }
.tag.manutencao, .tag.warn, .tag.atencao { background: #fdf1dc; color: var(--warn); }
.tag.inativo, .tag.cancelado { background: #eceff2; color: var(--muted); }
.tag.atrasado, .tag.bad, .tag.despesa, .tag.bloqueado { background: #fbe5e5; color: var(--bad); }

.search { padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; width: 250px; max-width: 100%; background: var(--card); }

.alert-list { display: flex; flex-direction: column; gap: 7px; }
.alert-item { display: flex; align-items: center; gap: 9px; background: #fdf6e8; border: 1px solid #f3dfb2; border-radius: 9px; padding: 9px 13px; font-size: 13.5px; }
.alert-item.atraso { background: #fbe9e9; border-color: #f0c4c4; }

/* ---------- forms / modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(12, 22, 34, .55); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 14px; z-index: 100; overflow-y: auto; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 640px; padding: 22px; box-shadow: 0 18px 60px rgba(0,0,0,.35); }
.modal h3 { margin-bottom: 16px; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid rgba(20,40,60,.25); }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pass-wrap { position: relative; }
.eye-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 16px; line-height: 1; padding: 6px; cursor: pointer; opacity: .65; border-radius: 6px; }
.eye-toggle:hover { opacity: 1; }
.eye-toggle:focus-visible { outline: 2px solid rgba(20,40,60,.4); opacity: 1; }

/* impressão do relatório */
@media print {
  .sidebar, .topbar, .no-print, #toast-root { display: none !important; }
  .main { margin-left: 0 !important; padding: 0 !important; }
  body { background: #fff; }
  .print-head { display: block !important; text-align: center; margin-bottom: 16px; }
  .print-head h2 { font-size: 20px; color: var(--brand); }
  .print-foot { display: block !important; text-align: center; color: var(--muted); font-size: 11px; margin-top: 16px; }
  .panel { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .stat { box-shadow: none; border: 1px solid #ddd; }
  table { font-size: 11px; }
}

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--brand); color: #fff; border-radius: 10px; padding: 11px 17px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.3); animation: pop .18s; }
.toast.err { background: var(--bad); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

.empty { text-align: center; color: var(--muted); padding: 26px 0; font-size: 14px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--ok); font-weight: 600; } .neg { color: var(--bad); font-weight: 600; }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding: 14px 14px 60px; }
  .topbar { display: flex; align-items: center; gap: 12px; background: var(--brand); color: #fff; padding: 12px 14px; margin: -14px -14px 16px; position: sticky; top: 0; z-index: 20; }
  .topbar button { background: none; border: none; color: #fff; font-size: 22px; }
  .topbar .t { font-weight: 700; }
  .form-grid { grid-template-columns: 1fr; }
  .search { width: 100%; }
}
