:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --border: #e2e8f0;
    --shadow-sm: 0 6px 24px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.09);
    --radius: 16px;
}

[data-theme="dark"] {
    --bg: #0b1220;
    --surface: #111827;
    --surface-soft: #0f172a;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #1f2937;
    --shadow-sm: 0 6px 24px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Tahoma, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 12%, var(--bg)) 0%, var(--bg) 55%, var(--bg) 100%);
    transition: background-color 0.2s ease, color 0.2s ease;
}

a {
    text-decoration: none;
    color: var(--primary);
}

.app-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.2rem 1rem 2rem;
}

.app-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.app-section-header {
    padding: 1.2rem 1.3rem;
    border-bottom: 1px solid var(--border);
}

.app-section-body {
    padding: 1.3rem;
}

.page-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
}

.page-subtitle {
    margin: 0.2rem 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.navbar-modern {
    background: rgba(15, 23, 42, 0.92);
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    backdrop-filter: blur(8px);
    box-shadow: 0 5px 15px rgba(2, 6, 23, 0.25);
}

.navbar-modern .navbar-brand {
    font-weight: 700;
    letter-spacing: 0.2px;
}

.navbar-modern .nav-link {
    color: #e2e8f0;
    border-radius: 10px;
    padding: 0.45rem 0.8rem;
}

.navbar-modern .nav-link:hover,
.navbar-modern .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.navbar-modern .dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.navbar-modern .dropdown-item {
    color: var(--text);
}

.navbar-modern .dropdown-item:hover,
.navbar-modern .dropdown-item.active {
    background: var(--surface-soft);
    color: var(--text);
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.1rem;
    height: 100%;
}

.stat-card h6 {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.stat-card .value {
    margin-top: 0.6rem;
    font-size: 1.65rem;
    font-weight: 800;
}

.app-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.app-table th,
.app-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.82rem 0.85rem;
    vertical-align: middle;
}

.app-table th {
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 700;
    font-size: 0.92rem;
}

.app-table tr:last-child td {
    border-bottom: 0;
}

.badge-soft {
    display: inline-block;
    font-size: 0.8rem;
    padding: 0.26rem 0.55rem;
    border-radius: 999px;
    font-weight: 600;
}

.badge-soft-success {
    background: #dcfce7;
    color: #166534;
}

[data-theme="dark"] .badge-soft-success {
    background: #14532d;
    color: #bbf7d0;
}

.badge-soft-danger {
    background: #fee2e2;
    color: #991b1b;
}

[data-theme="dark"] .badge-soft-danger {
    background: #7f1d1d;
    color: #fecaca;
}

.card-auth {
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border: none;
}

.btn-primary:hover {
    filter: brightness(0.98);
}

.hero-clean {
    background: linear-gradient(120deg, #111827 0%, #1e3a8a 70%);
    color: #fff;
    border-radius: 24px;
    box-shadow: var(--shadow-md);
}

.marketing-nav {
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.marketing-nav a {
    color: var(--text);
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
}

.feature-item {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.muted {
    color: var(--muted);
}

.form-control,
.form-select {
    color: var(--text);
    background: var(--surface);
    border-radius: 10px;
    border-color: color-mix(in srgb, var(--border) 80%, #cbd5e1);
}

.form-control:focus,
.form-select:focus {
    border-color: #8db1ff;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.17);
}

.text-secondary {
    color: var(--muted) !important;
}

code {
    color: color-mix(in srgb, var(--primary) 70%, var(--text));
}

.theme-fab {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1035;
    border-radius: 999px;
}

@media (max-width: 768px) {
    .app-shell {
        padding-top: 0.8rem;
    }

    .page-title {
        font-size: 1.2rem;
    }
}
