/* ===== DESIGN TOKENS ===== */
:root {
    --primary: #1A8FB8;
    --primary-dark: #0E5E7C;
    --primary-light: #5BC8E8;
    --accent: #2BCC8E;
    --accent-dark: #1fa870;
    --text: #1a2332;
    --text-muted: #5a6a7e;
    --bg: #f4f8fb;
    --bg-alt: #ffffff;
    --border: #d0dce8;
    --radius: 14px;
    --radius-sm: 8px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    --shadow-sm: 0 1px 4px rgba(26,143,184,.08);
    --shadow-md: 0 4px 16px rgba(26,143,184,.12);
    --shadow-lg: 0 8px 32px rgba(26,143,184,.16);
    --shadow-xl: 0 16px 48px rgba(26,143,184,.2);
    --nav-h: 68px;
    --sidebar-w: 260px;
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Manrope', sans-serif;
}

[data-theme="dark"] {
    --text: #e8f1f8;
    --text-muted: #8fa4bc;
    --bg: #0d1620;
    --bg-alt: #162030;
    --border: #243446;
    --shadow-sm: 0 1px 4px rgba(0,0,0,.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.5);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
}

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

img { max-width: 100%; display: block; }

/* ===== LAYOUT ===== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform .25s ease;
}

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    height: var(--nav-h);
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2rem;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.page-content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* ===== SIDEBAR LOGO ===== */
.sidebar-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .75rem;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--primary);
    text-decoration: none;
}

.sidebar-brand svg { flex-shrink: 0; }

.brand-sub {
    font-size: .65rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: .08em;
    text-transform: uppercase;
    display: block;
    line-height: 1;
    margin-top: 2px;
}

/* ===== NAV MENU ===== */
.nav-section {
    padding: .75rem 0;
    flex: 1;
}

.nav-label {
    padding: .5rem 1.5rem .25rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1.5rem;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 0;
    transition: background .15s, color .15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    text-decoration: none;
}

.nav-item:hover { background: var(--bg); color: var(--primary); }

.nav-item.active {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, transparent);
    border-left: 3px solid var(--primary);
    font-weight: 600;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: .875rem;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: .875rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .72rem; color: var(--text-muted); }

/* ===== ROLE BADGE ===== */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .75rem;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.role-badge.admin    { background: color-mix(in srgb, #e74c3c 12%, transparent); color: #c0392b; }
.role-badge.company  { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary-dark); }
.role-badge.employee { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-dark); }
.role-badge.customer { background: color-mix(in srgb, #9b59b6 12%, transparent); color: #7d3c98; }

/* ===== TOP BAR ===== */
.topbar-greeting {
    font-size: .875rem;
    color: var(--text-muted);
    margin-right: auto;
    padding-left: .5rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .625rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .18s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.btn-accent:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: .4rem 1rem; font-size: .8rem; }
.btn-lg { padding: .875rem 2rem; font-size: 1rem; border-radius: var(--radius); }
.btn.btn-danger { background: #e74c3c; color: white; border-color: #e74c3c; }
.btn.btn-danger:hover { background: #922b21; border-color: #922b21; color: white; }
.btn.btn-danger:disabled, .btn.btn-danger[disabled] { background: #e74c3c; border-color: #e74c3c; opacity: .55; }
.btn-success { background: var(--accent); color: white; border-color: var(--accent); }

/* ===== CARDS ===== */
.card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--bg); }

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.teal   { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.stat-icon.cyan   { background: color-mix(in srgb, var(--primary-light) 15%, transparent); color: #0e7a9e; }
.stat-icon.mint   { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-dark); }
.stat-icon.purple { background: color-mix(in srgb, #9b59b6 12%, transparent); color: #7d3c98; }

.stat-icon svg { width: 24px; height: 24px; }

.stat-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    margin-bottom: .25rem;
}

.stat-label {
    font-size: .8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== PAGE HEADER ===== */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.875rem;
    color: var(--text);
    margin-bottom: .25rem;
}

.page-header p {
    color: var(--text-muted);
    font-size: .9375rem;
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .4rem;
}

.form-control, .form-select {
    width: 100%;
    padding: .625rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-alt);
    color: var(--text);
    font-family: var(--font-body);
    font-size: .9375rem;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

textarea.form-control { resize: vertical; min-height: 100px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead tr { background: var(--bg); }

th {
    padding: .75rem 1rem;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: .875rem 1rem;
    font-size: .875rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:hover td { background: color-mix(in srgb, var(--primary) 3%, transparent); }

/* ===== STATUS BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .65rem;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
}

.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

.badge-pending  { background: #fff3cd; color: #856404; }
.badge-review   { background: #cff4fc; color: #055160; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-available   { background: #d1fae5; color: #065f46; }
.badge-assigned    { background: #cff4fc; color: #055160; }
.badge-maintenance { background: #fff3cd; color: #856404; }

/* ===== HERO (public pages) ===== */
.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    color: white;
    padding: 5rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255,255,255,.08), transparent);
}

.hero-content { position: relative; max-width: 800px; margin: 0 auto; }

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero h1 span { color: var(--accent); }

.hero p {
    font-size: 1.125rem;
    opacity: .9;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.hero-btn-primary {
    background: white;
    color: var(--primary);
    border: 2px solid white;
    padding: .875rem 2rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    transition: all .18s;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.hero-btn-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.hero-btn-secondary {
    background: transparent;
    color: white;
    border: 2px solid rgba(255,255,255,.6);
    padding: .875rem 2rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    transition: all .18s;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}
.hero-btn-secondary:hover {
    border-color: white;
    background: rgba(255,255,255,.15);
    color: white;
    transform: translateY(-2px);
}

/* ===== PRODUCT CARDS ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.product-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.product-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 1.25rem;
}

.product-icon svg { width: 28px; height: 28px; }

.product-card h3 {
    font-size: 1.25rem;
    margin-bottom: .5rem;
}

.product-card p {
    color: var(--text-muted);
    font-size: .9rem;
    flex: 1;
    margin-bottom: 1.5rem;
}

/* ===== SECTION ===== */
.section { padding: 4rem 2rem; }

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-tag {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    color: var(--primary);
    padding: .3rem .9rem;
    border-radius: 99px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    margin-bottom: .75rem;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.0625rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== TRUST STATS ===== */
.trust-bar {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
    padding: 2rem;
    background: linear-gradient(to right, color-mix(in srgb, var(--primary) 5%, transparent), var(--bg-alt), color-mix(in srgb, var(--accent) 5%, transparent));
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.trust-stat { text-align: center; }

.trust-stat .value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.trust-stat .label { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

/* ===== CALCULATOR ===== */
.calc-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    max-width: 900px;
    margin: 0 auto;
}

.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }

.calc-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.range-group { margin-bottom: 1.25rem; }

.range-label {
    display: flex;
    justify-content: space-between;
    font-size: .875rem;
    margin-bottom: .4rem;
}

.range-label span:last-child { font-weight: 700; color: var(--primary); }

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
    cursor: pointer;
}

.result-box {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius);
    padding: 2rem;
}

.result-box h3 { font-size: .875rem; opacity: .85; margin-bottom: .5rem; }

.result-amount {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 1.5rem;
}

.result-breakdown { display: flex; flex-direction: column; gap: .5rem; }

.result-row {
    display: flex;
    justify-content: space-between;
    font-size: .875rem;
    opacity: .9;
    padding-bottom: .5rem;
    border-bottom: 1px solid rgba(255,255,255,.15);
}

.result-row:last-child { border-bottom: none; }

.saving-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: rgba(43,204,142,.2);
    color: #7bffcb;
    padding: .4rem .9rem;
    border-radius: 99px;
    font-size: .8rem;
    font-weight: 700;
    margin-top: 1rem;
}

/* ===== FAQ ===== */
.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    overflow: hidden;
}

.faq-question {
    padding: 1.1rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-alt);
    user-select: none;
    transition: background .15s;
}

.faq-question:hover { background: color-mix(in srgb, var(--primary) 5%, var(--bg-alt)); }

.faq-question.open { color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--bg-alt)); }

.faq-chevron { transition: transform .25s; }
.faq-question.open .faq-chevron { transform: rotate(180deg); }

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease, padding .3s ease;
    color: var(--text-muted);
    font-size: .9375rem;
}

.faq-answer.open { max-height: 400px; padding: 1rem 1.5rem; }

/* ===== ALERT ===== */
.alert {
    padding: .875rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .875rem;
    margin-bottom: 1rem;
}

.alert-info    { background: #e8f4fd; border-color: #bee3f8; color: #1a56db; }
.alert-success { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.alert-warning { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.alert-danger  { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state svg { margin: 0 auto 1.25rem; opacity: .4; }

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--text);
    margin-bottom: .5rem;
}

/* ===== MOBILE MENU TOGGLE ===== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: .5rem;
    color: var(--text);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: flex; }
    .top-bar { padding: 0 1rem; }
    .page-content { padding: 1.25rem; }
    .calc-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .products-grid { grid-template-columns: 1fr; }
    .hero h1 { font-size: 1.75rem; }
}

/* ===== UTILITY ===== */
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent) !important; }
.fw-bold { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.w-100 { width: 100%; }
.rounded { border-radius: var(--radius-sm); }
.text-center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; }
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ===== BLAZOR ERROR UI ===== */
#blazor-error-ui {
    background: #fee2e2;
    bottom: 0;
    box-shadow: 0 -1px 4px rgba(0,0,0,.1);
    display: none;
    left: 0;
    padding: .625rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #991b1b;
    font-size: .875rem;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
