:root {
    --indigo: #4f46e5;
    --indigo-dark: #4338ca;
    --slate-900: #0f172a;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
    background: #f8fafc;
    color: #334155;
    margin: 0;
}

a { color: inherit; text-decoration: none; }

.wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ---------- Header ---------- */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 40;
}
.site-header .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Logo (assets/img/cadvincart-logo.png) is rendered at 72px tall
       (see includes/header.php) with 12px of breathing room above and
       below, so the row must be at least that tall or the logo overflows
       the header. Kept as a fixed height (not padding) so it matches the
       existing sticky-header layout. */
    height: 96px;
    gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--indigo); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 14px;
}
.brand-name { font-weight: 800; font-size: 1.05rem; color: #1e293b; line-height: 1.1; }
.brand-name span { color: var(--indigo); }
.brand-sub { font-size: 9px; color: #94a3b8; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }

.nav-links { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.nav-links a {
    padding: 8px 12px; font-size: 12.5px; font-weight: 600; border-radius: 8px; color: #475569;
    white-space: nowrap;
}
.nav-links a:hover { background: #f1f5f9; color: #0f172a; }
.nav-links a.active { background: #eef2ff; color: var(--indigo-dark); font-weight: 700; }

.header-right { display: flex; align-items: center; gap: 12px; }
.user-chip { text-align: right; line-height: 1.2; }
.user-chip .uname { font-size: 12px; font-weight: 700; color: #1e293b; }
.user-chip .urole {
    display: inline-block; margin-top: 3px; font-size: 9.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--indigo-dark);
    background: #eef2ff; border: 1px solid #e0e7ff; padding: 2px 8px; border-radius: 999px;
}
.btn-logout {
    padding: 8px; border-radius: 10px; color: #94a3b8; background: transparent; border: none; cursor: pointer;
}
.btn-logout:hover { background: #fef2f2; color: #dc2626; }

.btn {
    display: inline-flex; align-items: center; gap: 6px; justify-content: center;
    padding: 9px 16px; border-radius: 10px; font-size: 13px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; transition: .15s;
}
.btn-primary { background: var(--indigo); color: #fff; box-shadow: 0 4px 10px rgba(79,70,229,.18); }
.btn-primary:hover { background: var(--indigo-dark); }
.btn-outline { background: #fff; border-color: #cbd5e1; color: #334155; }
.btn-outline:hover { background: #f8fafc; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Mobile nav toggle ---------- */
.mobile-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: #334155; }
@media (max-width: 980px) {
    .nav-links { display: none; width: 100%; order: 3; flex-direction: column; align-items: stretch; padding: 8px 0 14px; }
    /* Mobile nav background fix: previously unset here, so the dropdown
       inherited a transparent background and page content behind it
       showed through. Solid, themed (matches .site-header's own white +
       border) — only applies at this breakpoint, so desktop (.nav-links
       with no .open class, or any width above 980px) is completely
       unaffected. */
    .nav-links.open {
        display: flex;
        background: #fff;
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 12px 24px rgba(15, 23, 42, .08);
    }
    .nav-links a { padding: 10px 12px; }
    .site-header .row { flex-wrap: wrap; }
    .mobile-toggle { display: block; }
}

/* ---------- Hero / sections ---------- */
.hero {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 55%, #4338ca 100%);
    color: #fff; padding: 80px 0 90px;
}
.hero h1 { font-size: 2.6rem; font-weight: 800; line-height: 1.15; max-width: 720px; }
.hero p { font-size: 1.05rem; color: #c7d2fe; max-width: 620px; margin-top: 16px; }
.hero .actions { margin-top: 32px; display: flex; gap: 12px; flex-wrap: wrap; }
.hero-badge {
    display: inline-block; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
    padding: 5px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #e0e7ff; margin-bottom: 20px;
}

section { padding: 64px 0; }
.section-header { max-width: 640px; margin: 0 auto 40px; text-align: center; }
.section-header h2 { font-size: 1.9rem; font-weight: 800; color: #0f172a; }
.section-header p { color: #64748b; margin-top: 10px; }
.eyebrow { color: var(--indigo); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; }

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 24px;
}
.card-hover:hover { border-color: #c7d2fe; box-shadow: 0 8px 24px rgba(15,23,42,.06); }
.icon-box {
    width: 44px; height: 44px; border-radius: 12px; background: #eef2ff; color: var(--indigo-dark);
    display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 14px;
}

.product-thumb { width: 100%; height: 170px; object-fit: cover; border-radius: 12px 12px 0 0; background: #e2e8f0; }
.product-card { border: 1px solid #e2e8f0; border-radius: 16px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.product-card .body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.product-card h3 { font-size: 1.05rem; font-weight: 700; color: #0f172a; }
.product-card p { font-size: 13px; color: #64748b; line-height: 1.5; }
.tag { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--indigo-dark); background: #eef2ff; padding: 3px 9px; border-radius: 6px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-slate { background: #f1f5f9; color: #475569; }

.alert { padding: 14px 16px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; border: 1px solid transparent; }
.alert-error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert-info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 700; color: #334155; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date],
input[type=file], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 9px; font-size: 13.5px;
    font-family: inherit; background: #fff; color: #1e293b;
}
textarea { resize: vertical; min-height: 90px; }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.hint { font-size: 11.5px; color: #94a3b8; margin-top: 4px; }

.chip-picker { border: 1px solid #cbd5e1; border-radius: 9px; padding: 8px; background: #fff; }
.chip-picker-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip-picker-chips:empty { margin-bottom: 0; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; background: #eef2ff; color: var(--indigo-dark);
    border: 1px solid #e0e7ff; border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 12.5px; font-weight: 600;
}
.chip button {
    background: rgba(79,70,229,.12); border: none; color: var(--indigo-dark); width: 18px; height: 18px;
    border-radius: 999px; cursor: pointer; font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.chip button:hover { background: rgba(79,70,229,.25); }
.chip-picker select { border: none; padding: 6px 4px; }
.chip-picker select:focus { outline: none; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; padding: 12px 16px; border-bottom: 1px solid #e2e8f0; background: #f8fafc; }
td { padding: 13px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tr:last-child td { border-bottom: none; }

/* ---------- Dashboard shell ---------- */
.dash { background: #f8fafc; min-height: calc(100vh - 96px); padding: 40px 0; }
.dash-title { font-size: 1.6rem; font-weight: 800; color: #0f172a; }
.dash-sub { color: #64748b; font-size: 13.5px; margin-top: 4px; }
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 20px; }
.stat-card .label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: #94a3b8; letter-spacing: .04em; }
.stat-card .value { font-size: 1.7rem; font-weight: 800; color: #0f172a; margin-top: 6px; }
.stat-card .foot { font-size: 12px; color: #64748b; margin-top: 6px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid #e2e8f0; margin-bottom: 28px; flex-wrap: wrap; }
.tabs a { padding: 10px 16px; font-size: 13px; font-weight: 700; color: #64748b; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--indigo-dark); border-color: var(--indigo); }
.tabs a:hover { color: #1e293b; }

.panel { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 24px; margin-bottom: 24px; }
.panel-title { font-size: 1rem; font-weight: 800; color: #0f172a; margin-bottom: 4px; }
.panel-sub { font-size: 12.5px; color: #64748b; margin-bottom: 18px; }

.kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed #e2e8f0; font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: #64748b; }
.kv .v { font-weight: 700; color: #0f172a; }

.license-key { font-family: ui-monospace, monospace; background: #0f172a; color: #a5f3fc; padding: 10px 14px; border-radius: 8px; font-size: 13px; letter-spacing: .5px; display: inline-block; }

.empty-state { text-align: center; padding: 50px 20px; color: #94a3b8; }
.empty-state .big { font-size: 40px; margin-bottom: 10px; }

.module-pick { border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 16px; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.module-pick:hover { border-color: #c7d2fe; }
.module-pick.checked { border-color: var(--indigo); background: #eef2ff; }
.module-pick input { margin-top: 3px; }

.summary-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 20px; position: sticky; top: 84px; }

footer.site-footer { background: #0f172a; color: #94a3b8; padding: 50px 0 24px; margin-top: 40px; }
footer.site-footer h4 { color: #fff; font-size: 13px; margin-bottom: 14px; }
footer.site-footer a { color: #94a3b8; font-size: 13px; display: block; margin-bottom: 8px; }
footer.site-footer a:hover { color: #fff; }
footer.site-footer .bottom { border-top: 1px solid #1e293b; margin-top: 30px; padding-top: 20px; font-size: 12px; text-align: center; color: #64748b; }

.pill-tab { display: inline-flex; gap: 6px; background: #f1f5f9; padding: 4px; border-radius: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.pill-tab a { padding: 7px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: #64748b; }
.pill-tab a.active { background: #fff; color: var(--indigo-dark); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.reply-bubble { padding: 12px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 10px; max-width: 85%; }
.reply-admin { background: #eef2ff; margin-right: auto; }
.reply-customer { background: #f1f5f9; margin-left: auto; }
.reply-meta { font-size: 10.5px; color: #94a3b8; margin-bottom: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Modal (AMC renewal popup, etc.) ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.55);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; padding: 20px;
}
.modal-box {
    background: #fff; border-radius: 16px; padding: 26px 28px; max-width: 440px; width: 100%;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.modal-title { font-size: 16px; font-weight: 800; color: #0f172a; }

/* ---------- Filter bar (admin search/filter panels) ---------- */
.filter-bar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 16px; margin-top: 22px;
}
.filter-bar .form-group { margin-bottom: 0; min-width: 200px; }
.filter-bar label { font-size: 11px; }

/* ---------- Report sections ---------- */
.report-section { margin-top: 24px; }
.report-section .panel-title { display: flex; align-items: center; justify-content: space-between; }
