* { box-sizing: border-box; }
:root {
  --bg: #07111f;
  --panel: #0d1b2d;
  --panel2: #10233a;
  --text: #edf5ff;
  --muted: #91a4bd;
  --line: #203852;
  --accent: #2e7df6;
  --accent2: #175fc7;
  --danger: #ff6577;
  --success: #41d399;
}
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #06101e 0%, #09172a 100%);
  color: var(--text);
  min-height: 100vh;
}
button, input { font: inherit; }
.app { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 30px 0 60px; }
.topbar { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
.eyebrow { color: #6ea8ff; font-weight: 800; letter-spacing: .18em; margin: 0 0 6px; font-size: 12px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(27px, 4vw, 42px); }
h2 { margin-bottom: 6px; font-size: 19px; }
.sub, .panel-head p, .report-action p { color: var(--muted); margin-bottom: 0; }
.status-pill { background: #0e2530; border: 1px solid #1d4d52; color: #a9f0d4; border-radius: 999px; padding: 10px 14px; font-size: 13px; white-space: nowrap; }
.status-pill span { display:inline-block; width: 8px; height: 8px; background: var(--success); border-radius: 50%; margin-right: 7px; }
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 12px 14px; cursor: pointer; border-bottom: 2px solid transparent; min-height: 44px; }
.tab.active { color: var(--text); border-color: var(--accent); }
.badge { display:inline-flex; min-width: 21px; height:21px; align-items:center; justify-content:center; background:#18304d; border-radius:99px; margin-left:5px; font-size:12px; }
.view { display:none; }
.view.active { display:block; }
.stats { display:grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.stat span { display:block; color:var(--muted); font-size:13px; margin-bottom:8px; }
.stat strong { font-size:26px; }
.stat.highlight { background: linear-gradient(145deg, #10294a, #0d1d33); border-color:#2c5d9c; }
.grid { display:grid; grid-template-columns: 360px 1fr; gap:16px; }
.panel { background: var(--panel); border:1px solid var(--line); border-radius:18px; padding:18px; }
.panel-head { margin-bottom:16px; }
.panel-head.between { display:flex; justify-content:space-between; align-items:flex-start; gap:14px; }
.form { display:grid; gap:14px; }
.form label { display:grid; gap:7px; color:#c6d6e8; font-size:13px; font-weight:650; }
.form-row { display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
input {
  width:100%; min-height:46px; border-radius:11px; border:1px solid #2a425d;
  background:#081522; color:var(--text); padding:10px 12px; outline:none; font-size:16px;
}
input:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(46,125,246,.17); }
.btn { min-height:44px; border-radius:11px; border:1px solid transparent; padding:10px 14px; cursor:pointer; font-weight:750; }
.btn.primary { background:var(--accent); color:white; }
.btn.primary:hover { background:var(--accent2); }
.btn.secondary { background:#16283d; color:var(--text); border-color:#29415c; }
.btn.danger-outline { background:transparent; color:#ff9aa6; border-color:#693442; }
.btn.small { min-height:34px; padding:6px 9px; font-size:12px; }
.btn.large { min-height:50px; padding:12px 18px; }
.message { min-height:18px; margin:0; color:#9fe7c8; font-size:13px; }
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; min-width:560px; }
th, td { padding:12px 10px; border-bottom:1px solid #1b3149; text-align:left; }
th { color:#8ea3bb; font-size:12px; text-transform:uppercase; letter-spacing:.05em; }
td { font-size:14px; }
.right { text-align:right; }
.amount-positive { color:#9ee9ca; font-weight:800; }
.amount-negative { color:#ff9aa6; font-weight:800; }
.empty { padding:28px 8px; color:var(--muted); text-align:center; }
.report-action { margin-top:16px; display:flex; align-items:center; justify-content:space-between; gap:18px; padding:20px; border:1px solid #275389; background:linear-gradient(135deg,#0e2138,#102b4a); border-radius:18px; }
.report-action h2 { margin-bottom:5px; }
.reports-list { display:grid; gap:12px; }
.report-card { background:#0a1827; border:1px solid var(--line); border-radius:14px; padding:15px; display:flex; align-items:center; justify-content:space-between; gap:15px; }
.report-meta strong { display:block; margin-bottom:5px; }
.report-meta span { color:var(--muted); font-size:13px; }
.report-total { font-size:21px; font-weight:850; text-align:right; }
.report-buttons { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:7px; margin-top:8px; }
dialog { width:min(900px, calc(100% - 24px)); border:1px solid #334f6d; padding:0; border-radius:18px; background:#07111f; color:var(--text); }
dialog::backdrop { background:rgba(0,0,0,.72); }
.dialog-card { padding:18px; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-bottom:16px; }
.invoice { background:white; color:#18202a; border-radius:12px; padding:32px; }
.invoice .invoice-head { display:flex; justify-content:space-between; gap:20px; border-bottom:2px solid #dce4ec; padding-bottom:18px; margin-bottom:20px; }
.invoice .brand { font-size:23px; font-weight:900; color:#0f3970; }
.invoice .muted { color:#66788d; }
.invoice table { min-width:0; }
.invoice th { color:#5f7185; border-bottom:1px solid #d8e0e9; }
.invoice td { color:#1b2632; border-bottom:1px solid #e7edf3; }
.invoice .summary { width:min(360px,100%); margin-left:auto; margin-top:22px; }
.invoice .summary-row { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid #e3e9ef; }
.invoice .summary-row.net { font-size:20px; font-weight:900; color:#0f3970; border-top:2px solid #0f3970; border-bottom:0; margin-top:8px; padding-top:12px; }

@media (max-width: 850px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .app { width:min(100% - 18px,1180px); padding-top:18px; }
  .topbar { flex-direction:column; }
  .stats { grid-template-columns:1fr 1fr; }
  .stat strong { font-size:21px; }
  .form-row { grid-template-columns:1fr; }
  .panel-head.between, .report-action, .report-card { flex-direction:column; align-items:stretch; }
  .report-total { text-align:left; }
  .report-buttons { justify-content:flex-start; }
  .invoice { padding:18px; }
  .invoice .invoice-head { flex-direction:column; }
}
@media print {
  body * { visibility:hidden !important; }
  #reportPreview, #reportPreview * { visibility:visible !important; }
  #reportPreview { position:absolute; left:0; top:0; width:100%; }
  .invoice { box-shadow:none; border-radius:0; padding:20px; }
  dialog { position:static; border:0; }
  .no-print { display:none !important; }
}
