:root {
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;

    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;

    --success: #16a34a;
    --success-bg: #dcfce7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --warning: #d97706;
    --warning-bg: #fef3c7;

    --surface: #ffffff;
    --bg: #f4f6fb;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e5e9f2;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 6px 20px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 20px 45px rgba(15, 23, 42, 0.12);
}

html, body {
    font-family: 'Segoe UI', 'Inter', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
    color: var(--slate-900);
    font-weight: 700;
    letter-spacing: -0.01em;
}

a, .btn-link {
    color: var(--brand-600);
}

/* ---------- Page header ---------- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header .page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--slate-900);
}

.page-header .page-subtitle {
    margin: 0.25rem 0 0;
    color: var(--text-muted);
    font-size: 0.925rem;
}

.page-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-50);
    color: var(--brand-600);
    margin-right: 0.9rem;
    flex: 0 0 auto;
}

.page-icon svg { width: 22px; height: 22px; }

.page-title-wrap { display: flex; align-items: center; }

/* ---------- Cards ---------- */
.app-card, .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.app-card {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.app-card__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 1.1rem;
    color: var(--slate-800);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-card__title svg { width: 18px; height: 18px; color: var(--brand-600); }

/* ---------- Buttons ---------- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    transition: all 0.15s ease;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
    border: none;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(180deg, var(--brand-600), var(--brand-700));
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.32);
}

.btn-outline-primary {
    color: var(--brand-600);
    border: 1px solid var(--brand-500);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
}

.btn-outline-danger {
    color: var(--danger);
    border: 1px solid #fca5a5;
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8rem; }

.btn:focus, .btn:active:focus, .form-control:focus, .form-select:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.25);
}

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1px solid var(--slate-200);
    padding: 0.6rem 0.85rem;
    color: var(--text);
    background-color: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-500);
}

.form-control::placeholder { color: var(--slate-400); }

.form-floating > label { color: var(--slate-500); }

label, .form-label { font-weight: 600; color: var(--slate-700); font-size: 0.875rem; }

.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
    padding: 1.1rem 1.25rem;
    background: var(--slate-50);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}

.filters-bar .field { display: flex; flex-direction: column; gap: 0.3rem; }
.filters-bar .field label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--slate-500); }

/* ---------- Tables ---------- */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table {
    margin: 0;
    color: var(--text);
    --bs-table-bg: transparent;
}

.table thead th {
    background: var(--slate-50);
    color: var(--slate-500);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--slate-100);
    vertical-align: middle;
    font-size: 0.9rem;
}

.table.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: transparent;
    background: transparent;
}

.table tbody tr { transition: background 0.12s ease; }
.table tbody tr:hover td { background: var(--brand-50); }

/* ---------- Badges / status ---------- */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.status-pill.is-active { background: var(--success-bg); color: var(--success); }
.status-pill.is-inactive { background: var(--slate-100); color: var(--slate-500); }

/* ---------- Switch ---------- */
.form-switch .form-check-input {
    width: 2.4rem;
    height: 1.3rem;
    cursor: pointer;
    border-color: var(--slate-200);
}

.form-check-input:checked {
    background-color: var(--brand-600);
    border-color: var(--brand-600);
}

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state svg { width: 42px; height: 42px; color: var(--slate-400); margin-bottom: 0.75rem; }

/* ---------- Stat cards (dashboard) ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card__icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--brand-50); color: var(--brand-600);
}

.stat-card__value { font-size: 1.6rem; font-weight: 800; line-height: 1; color: var(--slate-900); }
.stat-card__label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ---------- Alerts ---------- */
.alert { border-radius: var(--radius-sm); border: none; }
.alert-info { background: var(--brand-50); color: var(--brand-700); }

/* ---------- Validation ---------- */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); }

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after { content: "Ocorreu um erro."; }
