:root {
    --bg: #0b1220;
    --card: #0d1325;
    --muted: #94a3b8;
    --text: #e2e8f0;
    --primary: #3b82f6;
    --primary-contrast: #061224;
    --danger: #ef4444;
    --success: #10b981;
    --border: #1f2937;
    --surface: #0b1427;
    --hover: #0b1a33;
    --input-bg: #0c1426;
    --pill-open-bg: #1e293b;
    --pill-open-text: #93c5fd;
    --pill-paid-bg: #052e2b;
    --pill-paid-text: #10b981;
    --pill-canceled-bg: #3f2d2d;
    --pill-canceled-text: #fca5a5;
}
:root[data-theme="light"] {
    --bg: #f8fafc;
    --card: #ffffff;
    --muted: #64748b;
    --text: #0f172a;
    --primary: #2563eb;
    --primary-contrast: #e8eefc;
    --danger: #dc2626;
    --success: #0ea5e9;
    --border: #e2e8f0;
    --surface: #ffffff;
    --hover: #f1f5f9;
    --input-bg: #ffffff;
    --pill-open-bg: #e2e8f0;
    --pill-open-text: #0f172a;
    --pill-paid-bg: #dcfce7;
    --pill-paid-text: #166534;
    --pill-canceled-bg: #fee2e2;
    --pill-canceled-text: #991b1b;
}

* { box-sizing: border-box; }
body { font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; margin: 0; background: var(--bg); color: var(--text); font-size: 12px; text-transform: uppercase; }
.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: 0 10px 30px rgba(2,6,23,0.35); overflow: hidden; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 18px; margin: 16px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--border); padding: 18px; background: var(--surface); height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; margin-bottom: 16px; }
.brand .logo { width: 28px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, var(--primary), #06b6d4); }
.menu { display: flex; flex-direction: column; gap: 6px; }
.menu a { color: var(--muted); text-decoration: none; padding: 10px 12px; border-radius: 8px; transition: all 0.2s; }
.menu a:hover { background: var(--hover); color: var(--primary); }
.main { display: flex; flex-direction: column; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.user { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.content { padding: 20px; flex: 1; }
.avatar { width: 28px; height: 28px; border-radius: 999px; background: linear-gradient(135deg, var(--primary), #06b6d4); }

.btn { display: inline-flex; align-items: center; gap: 8px; border: none; border-radius: 10px; padding: 10px 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; text-decoration: none; font-size: 14px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-outline { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #052e2b; }
.badge { display: inline-block; background: var(--success); color: #052e2b; border-radius: 999px; padding: 4px 10px; font-size: 10px; font-weight: 600; }

.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -24px; padding: 0 24px; }
table { width: 100%; border-collapse: collapse; background: transparent; white-space: nowrap; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; }
thead th { color: var(--muted); text-transform: uppercase; font-size: 12px; letter-spacing: 0.04em; }
tbody tr:hover { background: var(--hover); }

input, select, textarea { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--input-bg); color: var(--text); outline: none; transition: border-color 0.2s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(2,6,23,0.75); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-backdrop.is-open { display: flex; }
.modal { width: 100%; max-width: 560px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 10px 30px rgba(2,6,23,0.5); max-height: 90vh; display: flex; flex-direction: column; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 18px; font-weight: 700; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

.table-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.pill { display: inline-block; padding: 6px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-open { background: var(--pill-open-bg); color: var(--pill-open-text); }
.pill-paid { background: var(--pill-paid-bg); color: var(--pill-paid-text); }
.pill-canceled { background: var(--pill-canceled-bg); color: var(--pill-canceled-text); }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; box-shadow: 0 6px 20px rgba(2,6,23,0.1); }
.kpi-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.kpi-actions { margin-top: 12px; }

.mobile-backdrop { display: none; }
.mobile-menu-toggle { display: none; }

.filter-form input, .filter-form select { padding: 6px 8px; font-size: 13px; border-radius: 6px; height: 32px; }
.filter-form label { font-size: 12px; margin-bottom: 4px; }
.filter-form .btn { padding: 6px 12px; font-size: 13px; height: 32px; }
.filter-form .grid { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 768px) {
    .shell { display: block; }
    .sidebar { position: fixed; top: 0; bottom: 0; left: -280px; width: 260px; z-index: 100; box-shadow: 5px 0 20px rgba(0,0,0,0.5); transition: left 0.3s ease; border-right: none; }
    .sidebar.open { left: 0; }
    .mobile-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; display: none; }
    .mobile-backdrop.open { display: block; }
    .mobile-menu-toggle { display: inline-flex !important; }
    .kpis { grid-template-columns: 1fr; }
    .grid { grid-template-columns: 1fr; }
    .filter-form .grid { grid-template-columns: 1fr; }
    .card { padding: 16px; }
    .content { padding: 16px; }
    .table-wrapper { margin: 0 -16px; padding: 0 16px; }
    .table-actions { flex-wrap: wrap; }
    h1 { font-size: 20px; }
    .modal { margin: 0; max-height: 100vh; border-radius: 0; height: 100%; }
}
