/* AutoCare Lite - Ultra-Lightweight Mobile-First Stylesheet (Zero External Dependencies) */
:root {
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --primary: #0284c7;
    --primary-dk: #0369a1;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0891b2;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 15px; line-height: 1.45; -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top Header */
.topbar { position: sticky; top: 0; z-index: 50; background: #0f172a; color: #fff; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.topbar-brand { font-weight: 700; font-size: 1rem; color: #fff; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-brand small { background: var(--primary); color: #fff; font-size: .7rem; padding: 2px 6px; border-radius: 4px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.top-pill { background: rgba(255,255,255,.14); color: #fff; padding: 5px 10px; border-radius: 6px; font-size: .78rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.top-pill:hover { background: rgba(255,255,255,.24); text-decoration: none; }

/* Desktop Top Sub-Nav (Scrollable on tablet/mobile) */
.subnav { background: #1e293b; display: flex; overflow-x: auto; scrollbar-width: none; padding: 0 8px; border-bottom: 1px solid #334155; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { color: #cbd5e1; padding: 10px 12px; font-size: .84rem; font-weight: 600; white-space: nowrap; border-bottom: 2px solid transparent; }
.subnav a.active { color: #38bdf8; border-bottom-color: #38bdf8; }
.subnav a:hover { color: #fff; text-decoration: none; }

/* Main Container */
.wrap { max-width: 960px; margin: 0 auto; padding: 14px 12px 82px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.page-title { font-size: 1.2rem; font-weight: 700; margin: 0; }
.page-sub { color: var(--muted); font-size: .84rem; margin: 2px 0 0; }

/* Cards & Grid */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.card-title { font-size: .95rem; font-weight: 700; margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: block; color: inherit; }
.kpi:hover { border-color: var(--primary); text-decoration: none; }
.kpi-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; }
.kpi-val { font-size: 1.3rem; font-weight: 800; margin: 4px 0 2px; color: var(--text); }
.kpi-sub { font-size: .76rem; color: var(--muted); }

/* Quick Action Row */
.actions-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 600px) { .actions-row { grid-template-columns: repeat(4, 1fr); } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; border-radius: 8px; border: 1px solid transparent; font-size: .88rem; font-weight: 600; cursor: pointer; text-align: center; min-height: 40px; font-family: inherit; }
.btn:hover { text-decoration: none; opacity: .94; }
.btn-sm { padding: 6px 10px; font-size: .78rem; min-height: 32px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-dark { background: #0f172a; color: #fff; }
.btn-outline { background: #fff; color: var(--text); border-color: #cbd5e1; }

/* Forms (16px prevents iOS zoom) */
.field { margin-bottom: 10px; }
.field label { display: block; font-size: .8rem; font-weight: 600; color: #334155; margin-bottom: 4px; }
.input, select.input, textarea.input { width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 16px; font-family: inherit; background: #fff; color: var(--text); }
.input:focus { outline: 2px solid rgba(2,132,199,.25); border-color: var(--primary); }
.input-ro { background: #f8fafc; font-weight: 600; }
.search-bar { display: flex; gap: 6px; margin-bottom: 12px; }
.search-bar .input { flex: 1; }

/* Badges & Pills */
.badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: .72rem; font-weight: 700; line-height: 1.2; }
.bg-dark { background: #0f172a; color: #fff; }
.bg-primary { background: #e0f2fe; color: #0369a1; }
.bg-success { background: #dcfce7; color: #166534; }
.bg-warning { background: #fef3c7; color: #92400e; }
.bg-danger { background: #fee2e2; color: #991b1b; }
.bg-info { background: #cffafe; color: #155e75; }
.bg-secondary { background: #e2e8f0; color: #334155; }
.pills { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { padding: 6px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--border); font-size: .78rem; font-weight: 600; color: #334155; white-space: nowrap; }
.pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Mobile Item List Cards */
.list-item { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.list-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.list-meta { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.list-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid #f1f5f9; }

/* Compact Table */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .84rem; }
table.tbl th, table.tbl td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; }
table.tbl th { background: #f8fafc; font-size: .74rem; text-transform: uppercase; color: var(--muted); }
.tr { text-align: right !important; }
.tc { text-align: center !important; }

/* Flash & Alerts */
.alert { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: .86rem; font-weight: 600; border: 1px solid transparent; }
.alert-success { background: #dcfce7; color: #166534; border-color: #86efac; }
.alert-danger { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }

/* Progress Bar */
.bar-bg { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); }

/* Collapsible details */
details.box { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
details.box summary { font-weight: 700; cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.box[open] summary { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* Bottom Mobile Navigation */
.bnav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: #fff; border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, 1fr); box-shadow: 0 -2px 10px rgba(0,0,0,.06); }
.bnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 7px 2px; font-size: .68rem; font-weight: 600; color: var(--muted); }
.bnav a.active { color: var(--primary); }
.bnav svg { width: 20px; height: 20px; margin-bottom: 2px; }
@media (min-width: 768px) { .bnav { display: none; } .wrap { padding-bottom: 24px; } }

/* Print Styles */
@media print {
    .no-print, .topbar, .subnav, .bnav { display: none !important; }
    body { background: #fff; }
    .wrap { padding: 0; max-width: 100%; }
    .card { box-shadow: none; border-color: #cbd5e1; }
}
