:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --muted: #718096;
  --primary: #3b82f6;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --blue: #3b82f6;
  --green: #16a34a;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* Navbar */
.navbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 24px; height: 52px; display: flex; align-items: center; gap: 24px; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.brand { font-weight: 700; font-size: 16px; color: var(--text); text-decoration: none; }
.nav-links { display: flex; gap: 16px; }
.nav-links a { color: var(--muted); text-decoration: none; font-size: 13px; }
.nav-links a:hover { color: var(--primary); }
.poll-form { margin-left: auto; }

/* Container */
.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Summary bar */
.summary-bar { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 24px; display: flex; flex-direction: column; align-items: center; min-width: 140px; box-shadow: var(--shadow); }
.summary-card .num { font-size: 28px; font-weight: 700; }
.summary-card .label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-danger { border-color: var(--danger); background: #fff5f5; }
.card-danger .num { color: var(--danger); }
.card-warning { border-color: var(--warning); background: #fffbeb; }
.card-warning .num { color: var(--warning); }
.card-neutral .num { color: var(--muted); }

/* Filters */
.filters { display: flex; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-group { display: flex; gap: 4px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 7px 14px; border-radius: 6px; border: none; cursor: pointer; font-size: 13px; font-weight: 500; text-decoration: none; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-secondary { background: #e2e8f0; color: var(--text); }

/* Table */
.invoice-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.invoice-table th { background: #f8fafc; padding: 10px 12px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); text-transform: uppercase; letter-spacing: .5px; }
.invoice-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.invoice-table tr:last-child td { border-bottom: none; }
.invoice-table tbody tr:hover { background: #f8fafc; }
.row-overdue { background: #fff5f5 !important; }
.row-soon { background: #fffbeb !important; }
.right { text-align: right; }
.mono { font-family: "SF Mono", "Fira Code", monospace; font-size: 13px; }
.big { font-size: 16px; font-weight: 600; }
.small { font-size: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.text-danger { color: var(--danger); font-weight: 600; }
.actions { white-space: nowrap; }
.inline-form { display: inline; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 9999px; font-size: 11px; font-weight: 600; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-success { background: #dcfce7; color: #15803d; }
.badge-neutral { background: #f1f5f9; color: var(--muted); }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #dcfce7; color: #15803d; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; white-space: pre-line; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* Detail */
.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.detail-header h1 { font-size: 22px; font-weight: 700; }
.detail-header small { font-size: 14px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.detail-card h3 { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; }
dt { color: var(--muted); font-size: 12px; padding-top: 2px; }
dd { font-size: 13px; }

/* Action bar */
.action-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.form-row { display: flex; gap: 8px; align-items: center; }
.input { flex: 1; padding: 7px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; outline: none; }
.input:focus { border-color: var(--primary); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
