/* Shared application layout. Loaded after the legacy component styles. */
:root {
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --border-color: #e2e8f0;
    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    --radius-lg: 14px;
    --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.05);
    --sidebar-width: 252px;
    --header-height: 72px;
}
html.dark-theme, body.dark-theme {
    --bg-app: #0b0f19;
    --bg-surface: #131b2e;
    --bg-surface-elevated: #1e293b;
    --bg-subtle: #1e293b;
    --bg-input: #0f172a;
    --border-color: #1e293b;
    --text-main: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: rgba(59, 130, 246, 0.15);
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color-scheme: dark;
}
body { line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #3b82f6; outline-offset: 3px; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 3000; padding: 12px 18px; background: var(--bg-surface); color: var(--text-main); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.topbar, html.dark-theme .topbar, body.dark-theme .topbar {
    height: var(--header-height); background: var(--bg-surface);
    box-shadow: none; border-bottom: 1px solid var(--border-color);
}
.topbar-brand { width: var(--sidebar-width); min-width: var(--sidebar-width); padding: 0 20px; }
.topbar-content { padding: 0 28px; min-width: 0; }
.logo-title { letter-spacing: -.4px; font-size: 17px; font-weight: 800; color: var(--text-main); }
.logo-subtitle { font-size: 11px; letter-spacing: .6px; color: var(--text-muted); }
.logo-icon-img { background: transparent; box-shadow: none; }
.sidebar, html.dark-theme .sidebar, body.dark-theme .sidebar {
    width: var(--sidebar-width); top: var(--header-height);
    height: calc(100dvh - var(--header-height)); background: var(--bg-surface);
    box-shadow: none; border-right: 1px solid var(--border-color);
}
.sidebar::after, .content-container::before, .card::before { display: none; }
.sidebar-nav { padding: 16px 12px 28px; gap: 3px; }
.nav-section-title { color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: 1.1px; margin-top: 20px; padding-left: 12px; }
.nav-section-title:first-child { margin-top: 0; }
.nav-item { min-height: 42px; padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 550; gap: 11px; color: var(--text-secondary); transition: all 0.2s ease; }
.nav-item > i { width: 18px; font-size: 15px; text-align: center; flex-shrink: 0; transition: color 0.2s ease; }
.nav-item:hover { background: rgba(37, 99, 235, 0.08); color: var(--primary); transform: translateX(2px); }
.nav-item.active, html.dark-theme .nav-item.active, body.dark-theme .nav-item.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%) !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35) !important;
    font-weight: 700;
}
.nav-item.active i, .nav-item.active > i, html.dark-theme .nav-item.active i, body.dark-theme .nav-item.active i {
    color: #ffffff !important;
}
.nav-item.active::before { display: none; }
.nav-item:hover { transform: none; }
.nav-item .badge { font-size: 9.5px; font-weight: 700; }
.main-wrapper { margin-left: var(--sidebar-width); margin-top: var(--header-height); min-height: calc(100dvh - var(--header-height)); }
.content-container { width: 100%; max-width: 1680px; margin: 0 auto; padding: 30px 32px 48px; }
.content-container > .content-wrapper { padding: 0 !important; }
.page-header { margin-bottom: 24px; align-items: flex-start; }
.page-title { font-size: clamp(22px, 2vw, 30px); font-weight: 750; letter-spacing: -.8px; line-height: 1.3; }
.page-subtitle { font-size: 14px; line-height: 1.65; }
.card, .stat-card { border-radius: 14px; box-shadow: var(--shadow-card); }
.card:hover, .stat-card:hover { transform: none; box-shadow: var(--shadow-card); }
.card-header { padding: 18px 22px; background: transparent; flex-wrap: wrap; gap: 12px; }
.card-title { font-size: 16px; letter-spacing: -.2px; }
.card-body { padding: 22px; }
.stat-card { min-width: 0; padding: 22px; }
.stat-value { font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.stat-label { line-height: 1.5; }
.btn { min-height: 40px; padding: 9px 16px; border-radius: 10px; font-size: 13px; line-height: 1.4; font-weight: 600; transition: all 0.2s ease; }
.btn-primary { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); color: #fff; box-shadow: 0 3px 12px rgba(37, 99, 235, 0.25); border: none; }
.btn-primary:hover { background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35); }
.btn:hover { transform: none; }
.btn-icon, .theme-toggle-btn { min-width: 42px; min-height: 42px; }
.btn-sm { min-height: 34px; padding: 7px 11px; }
.form-control, .form-select { min-height: 44px; border-radius: 8px; border-color: var(--border-color); background: var(--bg-input); color: var(--text-main); }
.table-responsive { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border-radius: 12px; }
.table { font-size: 13px; }
.table th { padding: 14px 16px; background: var(--bg-subtle); color: var(--text-secondary); font-size: 10.5px; letter-spacing: .55px; box-shadow: none; }
.table td { padding: 16px; line-height: 1.55; border-color: var(--border-color); }
.table tr:hover td { background: var(--primary-light); }
.empty-state { padding: 44px 20px; border: 1px dashed var(--border-color); box-shadow: none; }
.empty-state i { font-size: 32px; }
.user-dropdown-menu { max-width: calc(100vw - 24px); }
.sidebar-overlay { top: var(--header-height); backdrop-filter: blur(2px); }
.rewards-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 26px; }
.rewards-heading-copy { flex: 1 1 380px; }
.section-eyebrow { color: var(--primary); text-transform: uppercase; letter-spacing: 1.5px; font-size: 10px; font-weight: 700; margin-bottom: 9px; }
.rewards-heading p { color: var(--text-muted); max-width: 700px; margin: 10px 0 0; font-size: 14px; line-height: 1.7; }
.rewards-heading .page-actions { padding-top: 8px; }
.rewards-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.rewards-metrics .card { margin: 0; border-left-width: 3px !important; }
.rewards-metrics .card > div:nth-child(2) { font-size: clamp(20px, 1.9vw, 28px) !important; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
@media (max-width: 1200px) { .rewards-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1024px) {
    :root { --header-height: 64px; }
    .topbar-brand { min-width: 0; width: auto; padding: 0 12px 0 16px; }
    .topbar-content { padding: 0 16px 0 4px; }
    .sidebar { transform: translateX(-100%); z-index: 1050; }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; width: 100%; }
    .content-container { padding: 24px; }
    .sidebar-overlay { z-index: 1040; }
    #sidebarToggle { display: inline-flex; }
}
@media (max-width: 600px) {
    .content-container { padding: 20px 14px 32px; }
    .topbar-brand { padding-left: 12px; }
    .topbar-content { padding-right: 10px; }
    .topbar-right { gap: 7px; }
    .logo-title { font-size: 14px; }
    .logo-subtitle { font-size: 9px; }
    .logo-icon { width: 34px; height: 34px; }
    .user-meta-wrap { display: none; }
    .user-dropdown-trigger { padding: 4px; }
    .page-title { font-size: 24px; }
    .page-actions { width: 100%; gap: 8px; }
    .page-actions .btn { flex: 1 1 auto; justify-content: center; }
    .card-header, .card-body { padding: 16px; }
    .rewards-heading { gap: 12px; }
    .rewards-heading-copy { flex-basis: 100%; }
    .rewards-metrics { gap: 10px; }
    .rewards-metrics .card { padding: 16px !important; }
    .rewards-metrics .card > div:first-child { font-size: 10px !important; }
    input, select, textarea, .form-control, .form-select { font-size: 16px; max-width: 100%; }
    .modal-content { max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; }
}
@media (max-width: 360px) { .rewards-metrics { grid-template-columns: 1fr; } .logo-subtitle { display: none; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
