:root {
    --bg: #f4f5f7;
    --panel: #ffffff;
    --text: #1f2430;
    --muted: #6b7280;
    --border: #e2e4e9;
    --primary: #2952e3;
    --primary-dark: #1e3fb8;
    --danger: #d64545;
    --success: #1f9d55;
    --warning: #b7791f;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; }
h3 { font-size: 1rem; margin: 0 0 0.75rem; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: #111827;
    color: #f4f5f7;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    gap: 0.25rem;
}

.sidebar .brand {
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 1.25rem;
    color: #ffffff;
}

.sidebar :is(a, .nav-link) {
    color: #cbd2e1;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    display: block;
}

.sidebar a.active,
.sidebar a:hover {
    background: #1f2937;
    color: #ffffff;
    text-decoration: none;
}

.logout-form {
    margin-top: auto;
}

.logout-form button {
    width: 100%;
    background: transparent;
    border: 1px solid #374151;
    color: #cbd2e1;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
}

.logout-form button:hover {
    background: #1f2937;
    color: #fff;
}

main {
    flex: 1;
    padding: 2rem;
    max-width: 1100px;
}

.subtitle { color: var(--muted); margin-top: -0.5rem; }

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
}

.data-table th, .data-table td {
    text-align: left;
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
}

.data-table th { color: var(--muted); font-weight: 600; }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover { background: #f9fafb; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: capitalize;
    background: #e5e7eb;
    color: #374151;
}

.badge-active { background: #dcfce7; color: var(--success); }
.badge-expired { background: #fee2e2; color: var(--danger); }
.badge-cancelled { background: #fee2e2; color: var(--danger); }
.badge-suspended { background: #fef3c7; color: var(--warning); }
.badge-pendingpayment { background: #fef3c7; color: var(--warning); }

.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.tabs button, .tab {
    background: none;
    border: none;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--muted);
    border-bottom: 2px solid transparent;
}

.tabs button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

label {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
    margin: 0.75rem 0 0.25rem;
}

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input:not([type]), select, textarea {
    width: 100%;
    max-width: 420px;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.92rem;
    background: #fff;
    color: var(--text);
}

textarea { min-height: 70px; font-family: inherit; }

button, .button-link {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}

button:hover, .button-link:hover { background: var(--primary-dark); color: #fff; text-decoration: none; }

.form-actions { margin-top: 1rem; display: flex; gap: 0.5rem; }

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
    margin: 0.75rem 0 1rem;
}

.inline-form label { margin: 0; }
.inline-form input, .inline-form select { max-width: 200px; }

.action-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

/* Login page (rendered outside Blazor) */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #111827;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem 2.25rem;
    width: 320px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}

.login-card h1 { margin-bottom: 0.1rem; }
.login-card .subtitle { margin-top: 0; margin-bottom: 1.25rem; }
.login-card input { max-width: none; }
.login-card button { width: 100%; margin-top: 1.25rem; padding: 0.6rem; }
.login-card .error { color: var(--danger); font-size: 0.85rem; }
