:root {
  --navy: #07162f;
  --navy-2: #0d2447;
  --blue: #1f6feb;
  --green: #159c6b;
  --orange: #f97316;
  --red: #dc2626;
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #162033;
  --muted: #64748b;
  --line: #dbe3ef;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 260px; background: var(--navy); color: #fff; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; }
.brand { padding: 22px 24px; display: flex; justify-content: center; align-items: center; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-logo { display: block; width: 150px; max-width: 100%; height: auto; }
.nav { padding: 18px 14px; display: grid; gap: 6px; }
.nav a { color: #dbeafe; padding: 12px 14px; border-radius: 10px; font-weight: 700; font-size: 14px; }
.nav a:hover, .nav a.active { background: var(--blue); color: #fff; }
.sidebar-user { margin-top: auto; padding: 20px 24px; border-top: 1px solid rgba(255,255,255,.12); display: grid; gap: 5px; }
.sidebar-user span, .sidebar-user a { color: #bfdbfe; font-size: 13px; }
.content { margin-left: 260px; width: calc(100% - 260px); padding: 28px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.page-header h1 { margin: 4px 0 0; font-size: 28px; }
.eyebrow { color: var(--blue); font-weight: 800; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.date-pill { background: #fff; border: 1px solid var(--line); padding: 10px 14px; border-radius: 999px; color: var(--muted); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 10px 24px rgba(15,23,42,.06); }
.card h2, .card h3 { margin-top: 0; }
.stat { color: #fff; border: 0; min-height: 130px; display: flex; flex-direction: column; justify-content: space-between; }
.stat.purple { background: linear-gradient(135deg, #4338ca, #6d5dfc); }
.stat.green { background: linear-gradient(135deg, #047857, #22c55e); }
.stat.orange { background: linear-gradient(135deg, #ea580c, #fb923c); }
.stat.blue { background: linear-gradient(135deg, #0f4c81, #1f6feb); }
.stat .value { font-size: 34px; font-weight: 800; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.selected-row { background: #eff6ff; }
.table-link { color: var(--blue); font-weight: 800; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 800; cursor: pointer; display: inline-block; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-secondary { background: var(--navy-2); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-muted { background: #e2e8f0; color: #334155; }
.form-stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
label { display: grid; gap: 6px; font-weight: 700; color: #334155; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; background: #fff; }
textarea { min-height: 90px; resize: vertical; }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 700; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.badge { border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 800; display: inline-block; }
.badge-pendente, .badge-aberta { background: #fef3c7; color: #92400e; }
.badge-finalizado, .badge-parcial { background: #dbeafe; color: #1d4ed8; }
.badge-faturado, .badge-paga { background: #dcfce7; color: #166534; }
.badge-cancelada { background: #fee2e2; color: #991b1b; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #07162f, #13315c); }
.login-card { width: min(440px, calc(100vw - 32px)); background: #fff; border-radius: 22px; padding: 34px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-brand { display: flex; justify-content: center; align-items: center; margin-bottom: 22px; }
.login-logo { display: block; width: 190px; max-width: 100%; height: auto; }
.confirm-modal-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 18px; background: rgba(7,22,47,.55); }
.confirm-modal { width: min(420px, 100%); background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 20px 60px rgba(15,23,42,.28); text-align: center; }
.confirm-modal p { margin: 0 0 18px; font-size: 18px; font-weight: 800; color: var(--text); }
.confirm-modal-actions { justify-content: center; }
.print-body { background: #e5eaf3; color: #111827; }
.print-page { width: min(920px, calc(100vw - 32px)); margin: 24px auto; background: #fff; padding: 34px; border-radius: 18px; box-shadow: 0 12px 36px rgba(15,23,42,.12); }
.print-actions { display: flex; justify-content: flex-end; gap: 10px; margin-bottom: 24px; }
.print-header { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; border-bottom: 2px solid var(--navy); padding-bottom: 18px; margin-bottom: 22px; }
.print-logo { width: 150px; height: auto; display: block; margin-bottom: 12px; }
.print-header h1 { margin: 0 0 6px; font-size: 26px; }
.print-header p { margin: 0; color: var(--muted); }
.print-company { text-align: right; line-height: 1.6; color: var(--navy); }
.print-card { border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.print-card h2 { margin-top: 0; }
.print-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.print-grid span { color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 800; }
.print-grid strong { display: block; margin-top: 4px; }
.print-section-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.print-table { margin-top: 16px; }
.print-statement-table th, .print-statement-table td { padding: 10px 8px; font-size: 13px; }
.print-statement-table td:nth-child(4) { min-width: 190px; }
.print-total { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 18px; border-top: 2px solid var(--navy); padding-top: 18px; font-size: 16px; }
.error-page { min-height: 100vh; display: grid; place-content: center; text-align: center; gap: 12px; }
.progress { height: 12px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--blue); }
@media print {
  @page { margin: 12mm; }
  body, .print-body { background: #fff; }
  .no-print { display: none !important; }
  .print-page { width: auto; margin: 0; padding: 0; border-radius: 0; box-shadow: none; }
  .print-card { break-inside: avoid; }
  .print-total { break-inside: avoid; }
}
@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; }
  .app-shell { display: block; }
  .content { margin-left: 0; width: 100%; padding: 18px; }
  .grid-2, .grid-3, .grid-4, .form-grid, .print-grid { grid-template-columns: 1fr; }
  .page-header { display: grid; gap: 12px; }
  .print-header, .print-section-title, .print-total { display: grid; text-align: left; }
  .print-company { text-align: left; }
}
