/* ============================================================
   STOCKPRO — Design System
   Mobile-first, responsive, dark/light
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root, [data-theme="light"] {
    --navy: #0B1E3D; --navy-2: #112448; --navy-3: #1A3260;
    --accent: #2E6FE8; --accent-2: #4A87FF; --accent-glow: rgba(46,111,232,0.12); --accent-hover: #1D5DD4;
    --gold: #D4A843; --gold-bg: rgba(212,168,67,0.1);
    --bg-base: #F0F3FA; --bg-surface: #FFFFFF; --bg-elevated: #FFFFFF; --bg-hover: #F5F7FC; --bg-input: #F7F9FD;
    --border: rgba(11,30,61,0.09); --border-strong: rgba(11,30,61,0.16);
    --text-1: #0B1E3D; --text-2: #3A4F72; --text-3: #7A8FAD; --text-4: #B0BFCF;
    --green: #1A9B6C; --green-bg: #E6F7F2; --red: #C53030; --red-bg: #FEF0F0;
    --yellow: #A06C00; --yellow-bg: #FDF6E3; --purple: #6D44CC; --purple-bg: #F0EBFF;
    --cyan: #0891B2; --cyan-bg: #E0F5FA;
    --sidebar-w: 248px; --topbar-h: 56px;
    --radius: 10px; --radius-lg: 14px; --radius-xl: 18px;
    --shadow-sm: 0 1px 4px rgba(11,30,61,0.07); --shadow: 0 2px 12px rgba(11,30,61,0.09); --shadow-md: 0 4px 24px rgba(11,30,61,0.13);
    --transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
}
[data-theme="dark"] {
    --navy: #0D1117; --navy-2: #161C27; --navy-3: #1E2840;
    --accent: #4A87FF; --accent-2: #6B9EFF; --accent-glow: rgba(74,135,255,0.15); --accent-hover: #3A77FF;
    --gold: #E8C06A; --gold-bg: rgba(232,192,106,0.12);
    --bg-base: #0D1117; --bg-surface: #161C27; --bg-elevated: #1E2636; --bg-hover: #222E42; --bg-input: #131924;
    --border: rgba(255,255,255,0.07); --border-strong: rgba(255,255,255,0.13);
    --text-1: #E8EDF5; --text-2: #94A3BE; --text-3: #546480; --text-4: #3A4A60;
    --green: #22C97A; --green-bg: rgba(34,201,122,0.12); --red: #F26B6B; --red-bg: rgba(242,107,107,0.12);
    --yellow: #F5B942; --yellow-bg: rgba(245,185,66,0.12); --purple: #A78BFA; --purple-bg: rgba(167,139,250,0.12);
    --cyan: #22D3EE; --cyan-bg: rgba(34,211,238,0.12);
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.3); --shadow: 0 2px 12px rgba(0,0,0,0.4); --shadow-md: 0 4px 24px rgba(0,0,0,0.5);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg-base); color: var(--text-1); line-height: 1.6; display: flex; min-height: 100vh; overflow-x: hidden; transition: background 0.3s, color 0.3s; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-2); }
img { max-width: 100%; display: block; }
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); background: var(--navy); display: flex; flex-direction: column; z-index: 300; overflow-y: auto; overflow-x: hidden; transform: translateX(-100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1), box-shadow 0.28s; }
.sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,0.35); }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 290; display: none; backdrop-filter: blur(2px); }
.sidebar-overlay.open { display: block; }
.main-wrapper { flex: 1; display: flex; flex-direction: column; min-height: 100vh; width: 100%; }
.sidebar-header { padding: 18px 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.07); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { width: 36px; height: 36px; background: var(--accent); border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; box-shadow: 0 0 16px rgba(46,111,232,0.35); }
.logo-icon svg { width: 18px; height: 18px; }
.logo-name { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: -0.3px; display: block; line-height: 1.2; }
.logo-tag { font-size: 9.5px; color: rgba(255,255,255,0.3); letter-spacing: 0.14em; text-transform: uppercase; display: block; }
.sidebar-close { background: none; border: none; color: rgba(255,255,255,0.5); cursor: pointer; padding: 6px; border-radius: 6px; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; }
.sidebar-close:hover { color: #fff; background: rgba(255,255,255,0.08); }
.sidebar-close svg { width: 18px; height: 18px; }
.sidebar-nav { flex: 1; padding: 10px; overflow-y: auto; }
.nav-section { margin-bottom: 16px; }
.nav-label { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.13em; color: rgba(255,255,255,0.25); padding: 0 8px; display: block; margin-bottom: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 10px; border-radius: 8px; color: rgba(255,255,255,0.5); font-size: 14px; font-weight: 500; margin-bottom: 2px; transition: var(--transition); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.9; }
.nav-item span { flex: 1; }
.nav-item:hover, .nav-item:active { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 2px 12px rgba(46,111,232,0.4); }
.badge { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px; line-height: 1.6; }
.badge-gold { background: var(--gold); color: #3D2500; }
.badge-accent { background: rgba(255,255,255,0.2); color: #fff; }
.badge-success { background: var(--green); color: #fff; }
.badge-danger { background: var(--red); color: #fff; }
.sidebar-footer { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,0.07); flex-shrink: 0; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; transition: var(--transition); }
.user-card:hover { background: rgba(255,255,255,0.06); }
.user-avatar { width: 34px; height: 34px; background: var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-avatar.sm { width: 28px; height: 28px; font-size: 10.5px; }
.user-avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.user-name { font-size: 12.5px; font-weight: 600; color: #fff; display: block; line-height: 1.2; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.35); display: block; }
.topbar { height: var(--topbar-h); background: var(--bg-surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; position: sticky; top: 0; z-index: 200; flex-shrink: 0; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.menu-toggle { background: none; border: none; cursor: pointer; color: var(--text-2); padding: 8px; border-radius: 8px; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; }
.menu-toggle:hover { background: var(--bg-hover); color: var(--text-1); }
.menu-toggle svg { width: 20px; height: 20px; }
.breadcrumb { font-size: 14px; font-weight: 600; color: var(--text-1); }
.icon-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; color: var(--text-2); position: relative; transition: var(--transition); -webkit-tap-highlight-color: transparent; }
.icon-btn:hover { background: var(--bg-base); border-color: var(--border-strong); color: var(--text-1); }
.icon-btn svg { width: 16px; height: 16px; }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; border: 2px solid var(--bg-surface); }
.notif-wrapper, .user-menu-wrapper { position: relative; }
.notif-dropdown, .user-dropdown { position: absolute; right: 0; top: calc(100% + 8px); background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); min-width: 260px; box-shadow: var(--shadow-md); opacity: 0; visibility: hidden; transform: translateY(-6px); transition: var(--transition); z-index: 400; }
.notif-dropdown.open, .user-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }
.notif-header, .user-dropdown-header { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); }
.user-dropdown-header strong { display: block; font-size: 13px; color: var(--text-1); }
.user-dropdown-header small { color: var(--text-3); font-size: 11.5px; }
.notif-item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 16px; color: var(--text-1); border-bottom: 1px solid var(--border); font-size: 12.5px; transition: var(--transition); }
.notif-item:hover { background: var(--bg-hover); }
.notif-item svg { width: 15px; height: 15px; color: var(--yellow); flex-shrink: 0; margin-top: 1px; }
.notif-item strong { display: block; }
.notif-item small { color: var(--text-3); font-size: 11px; }
.notif-empty { padding: 16px; text-align: center; color: var(--text-3); font-size: 12.5px; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 11px 16px; color: var(--text-2); font-size: 13px; transition: var(--transition); -webkit-tap-highlight-color: transparent; }
.dropdown-item:hover { background: var(--bg-hover); color: var(--text-1); }
.dropdown-item.danger:hover { background: var(--red-bg); color: var(--red); }
.dropdown-item svg { width: 14px; height: 14px; }
.user-menu-btn { display: flex; align-items: center; gap: 7px; background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px; padding: 4px 9px 4px 4px; cursor: pointer; transition: var(--transition); color: var(--text-2); -webkit-tap-highlight-color: transparent; }
.user-menu-btn:hover { border-color: var(--border-strong); color: var(--text-1); }
.user-menu-btn svg { width: 13px; height: 13px; }
.page-content { flex: 1; padding: 20px 16px; width: 100%; max-width: 1400px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 700; color: var(--text-1); letter-spacing: -0.3px; }
.page-subtitle { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.welcome-banner { background: var(--navy); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; overflow: hidden; position: relative; }
[data-theme="dark"] .welcome-banner { background: var(--navy-2); border: 1px solid var(--border); }
.welcome-banner::before { content: ''; position: absolute; right: -30px; top: -30px; width: 160px; height: 160px; background: radial-gradient(circle, rgba(46,111,232,0.3) 0%, transparent 70%); pointer-events: none; }
.wb-text h2 { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 3px; }
.wb-text p { font-size: 12px; color: rgba(255,255,255,0.45); }
.wb-actions { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.wb-actions .btn { flex: 1; justify-content: center; min-width: 120px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.stat-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; position: relative; overflow: hidden; transition: var(--transition); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--sc, var(--accent)); }
.stat-card:active { transform: scale(0.98); }
.stat-icon { width: 36px; height: 36px; border-radius: 9px; background: var(--si, var(--accent-glow)); display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.stat-icon svg { width: 17px; height: 17px; stroke: var(--sc, var(--accent)); fill: none; stroke-width: 1.9; stroke-linecap: round; }
.stat-val { font-size: 22px; font-weight: 700; color: var(--text-1); letter-spacing: -0.5px; line-height: 1; }
.stat-label { font-size: 11px; color: var(--text-3); margin-top: 4px; font-weight: 500; }
.stat-sub { font-size: 10.5px; color: var(--text-4); margin-top: 2px; }
.stat-delta { position: absolute; top: 14px; right: 14px; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 20px; }
.delta-up { background: var(--green-bg); color: var(--green); }
.delta-down { background: var(--red-bg); color: var(--red); }
.delta-warn { background: var(--yellow-bg); color: var(--yellow); }
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 0; flex-wrap: wrap; gap: 8px; }
.card-title { font-size: 13.5px; font-weight: 700; color: var(--text-1); }
.card-subtitle { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.card-action { font-size: 11.5px; font-weight: 600; color: var(--accent); background: var(--accent-glow); padding: 4px 12px; border-radius: 6px; white-space: nowrap; }
.card-action:hover { background: var(--accent); color: #fff; }
.card-body { padding: 14px 16px 16px; }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
thead th { padding: 10px 12px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text-1); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:active { background: var(--bg-hover); }
.td-mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--accent); }
.td-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }
input[type="text"], input[type="number"], input[type="email"], input[type="password"], input[type="date"], input[type="search"], select, textarea { width: 100%; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 11px 12px; font-size: 16px; font-family: inherit; color: var(--text-1); outline: none; transition: var(--transition); -webkit-appearance: none; appearance: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); background: var(--bg-surface); }
select { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A8FAD' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea { resize: vertical; min-height: 85px; font-size: 15px; }
.form-help { font-size: 11px; color: var(--text-3); }
.form-error { font-size: 11px; color: var(--red); }
.search-bar { display: flex; align-items: center; gap: 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; width: 100%; }
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-bar svg { width: 15px; height: 15px; color: var(--text-3); flex-shrink: 0; }
.search-bar input { border: none; background: transparent; padding: 11px 0; flex: 1; font-size: 15px; }
.search-bar input:focus { box-shadow: none; }
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; border: 1px solid transparent; transition: var(--transition); white-space: nowrap; text-decoration: none; min-height: 42px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-3); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { opacity: 0.88; color: #fff; }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--text-2); }
.btn-outline:hover { background: var(--bg-hover); color: var(--text-1); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); padding: 8px 10px; min-height: 38px; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-1); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; min-height: 36px; }
.btn-icon { padding: 9px; min-height: unset; width: 38px; height: 38px; justify-content: center; }
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-left: 3px solid; border-radius: 0 8px 8px 0; margin: 0 16px 14px; font-size: 13px; }
.alert svg { width: 15px; height: 15px; flex-shrink: 0; }
.alert-success { background: var(--green-bg); border-color: var(--green); color: var(--green); }
.alert-error { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.alert-warning { background: var(--yellow-bg); border-color: var(--yellow); color: var(--yellow); }
.alert-info { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }
.stock-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.stock-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.stock-ok { background: var(--green-bg); color: var(--green); }
.stock-low { background: var(--yellow-bg); color: var(--yellow); }
.stock-critical { background: var(--red-bg); color: var(--red); }
.status { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; gap: 4px; white-space: nowrap; }
.status-pending { background: var(--yellow-bg); color: var(--yellow); }
.status-approved { background: var(--green-bg); color: var(--green); }
.status-rejected { background: var(--red-bg); color: var(--red); }
.status-delivered { background: var(--cyan-bg); color: var(--cyan); }
.status-active { background: var(--green-bg); color: var(--green); }
.status-inactive { background: var(--bg-hover); color: var(--text-3); }
.tag { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 600; border: 1px solid; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 500; display: none; align-items: flex-end; justify-content: center; padding: 0; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--radius-xl) var(--radius-xl) 0 0; width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow-md); animation: slideUp 0.25s cubic-bezier(0.4,0,0.2,1); }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-elevated); z-index: 1; }
.modal-header::before { content: ''; display: block; width: 40px; height: 4px; background: var(--border-strong); border-radius: 2px; position: absolute; top: -12px; left: 50%; transform: translateX(-50%); }
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-1); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-3); padding: 4px; border-radius: 6px; -webkit-tap-highlight-color: transparent; }
.modal-close:hover { background: var(--bg-hover); color: var(--text-1); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: stretch; gap: 10px; position: sticky; bottom: 0; background: var(--bg-elevated); }
.modal-footer .btn { flex: 1; justify-content: center; }
.tabs { display: flex; gap: 2px; background: var(--bg-hover); border-radius: var(--radius); padding: 3px; margin-bottom: 16px; }
.tab-btn { flex: 1; padding: 9px 10px; border: none; background: transparent; border-radius: 7px; font-size: 12.5px; font-weight: 600; font-family: inherit; color: var(--text-3); cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; -webkit-tap-highlight-color: transparent; }
.tab-btn svg { width: 13px; height: 13px; }
.tab-btn:hover { color: var(--text-1); }
.tab-btn.active { background: var(--bg-surface); color: var(--accent); box-shadow: var(--shadow-sm); }
.chart-wrapper { position: relative; height: 200px; }
.filters-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters-bar > * { flex: 1; min-width: 140px; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.pagination-links { display: flex; gap: 4px; }
.page-link { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 7px; color: var(--text-2); font-size: 12.5px; transition: var(--transition); }
.page-link:hover { background: var(--bg-hover); color: var(--text-1); }
.page-link.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty-state svg { width: 44px; height: 44px; margin: 0 auto 12px; opacity: 0.25; display: block; }
.empty-state h3 { font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: 12.5px; }
.vehicle-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.vehicle-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; transition: var(--transition); }
.vehicle-card:active { border-color: var(--accent); }
.vehicle-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.vehicle-emoji { font-size: 2rem; line-height: 1; }
.vehicle-plate { font-family: 'IBM Plex Mono', monospace; font-size: 14px; font-weight: 500; color: var(--accent); display: block; }
.vehicle-model { font-size: 11.5px; color: var(--text-3); display: block; margin-top: 1px; }
.km-bar-wrap { height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; margin: 10px 0 6px; }
.km-bar { height: 100%; border-radius: 3px; }
.km-bar-ok { background: var(--green); }
.km-bar-warn { background: var(--yellow); }
.km-bar-crit { background: var(--red); }
.login-page { width: 100%; min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-base); padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 32px 24px; box-shadow: var(--shadow-md); }
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo .logo-icon { width: 50px; height: 50px; margin: 0 auto 12px; border-radius: 13px; }
.login-logo .logo-icon svg { width: 24px; height: 24px; }
.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--text-1); letter-spacing: -0.4px; }
.login-logo p { color: var(--text-3); font-size: 12.5px; margin-top: 3px; }
.login-card .form-group { margin-bottom: 14px; }
.login-submit { width: 100%; justify-content: center; margin-top: 6px; }
.login-footer { text-align: center; margin-top: 16px; font-size: 11.5px; color: var(--text-4); }
.mono { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.text-muted { color: var(--text-3); }
.text-success { color: var(--green); }
.text-danger { color: var(--red); }
.text-warning { color: var(--yellow); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.hide-mobile { display: none; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ============================================================
   TABLET 600px+
   ============================================================ */
@media (min-width: 600px) {
    .page-content { padding: 22px 20px; }
    .stats-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
    .form-grid-2 { grid-template-columns: 1fr 1fr; }
    .vehicle-grid { grid-template-columns: repeat(2, 1fr); }
    .hide-mobile { display: block; }
    .welcome-banner { flex-direction: row; align-items: center; }
    .wb-actions .btn { flex: none; }
    .modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-width: 560px; margin: 0 auto; }
}

/* ============================================================
   DESKTOP 900px+
   ============================================================ */
@media (min-width: 900px) {
    .sidebar { transform: translateX(0); }
    .main-wrapper { margin-left: var(--sidebar-w); }
    .page-content { padding: 26px; }
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
    .form-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .form-grid-2 { grid-template-columns: 1fr 1fr; }
    .form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
    .vehicle-grid { grid-template-columns: repeat(3, 1fr); }
    .chart-wrapper { height: 240px; }
    .modal { border-radius: var(--radius-xl); max-width: 580px; }
    .modal-overlay { align-items: center; padding: 20px; }
    .stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
    .topbar { padding: 0 26px; }
    .breadcrumb { font-size: 14px; }
    .page-title { font-size: 21px; }
    .stat-val { font-size: 24px; }
}

/* ============================================================
   LARGE DESKTOP 1200px+
   ============================================================ */
@media (min-width: 1200px) {
    .page-content { padding: 28px 30px; }
}

/* ============================================================
   MOBILE FIXES — sobreescribir grids inline
   ============================================================ */
@media (max-width: 599px) {

    /* Grids inline en PHP → 1 columna */
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 280px"],
    [style*="grid-template-columns:1fr 280px"],
    [style*="grid-template-columns: 1fr 260px"],
    [style*="grid-template-columns:1fr 260px"],
    [style*="grid-template-columns: 1fr 300px"],
    [style*="grid-template-columns:1fr 300px"],
    [style*="grid-template-columns: 1fr 320px"],
    [style*="grid-template-columns:1fr 320px"],
    [style*="grid-template-columns: 300px 1fr"],
    [style*="grid-template-columns:300px 1fr"],
    [style*="grid-template-columns: 280px 1fr"],
    [style*="grid-template-columns:280px 1fr"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns:repeat(2"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns:repeat(3"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns: 1fr 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr auto"],
    [style*="grid-template-columns: 110px 1fr"],
    [style*="grid-template-columns:110px 1fr"],
    [style*="grid-template-columns: 1fr 90px"],
    [style*="grid-template-columns:1fr 90px"],
    [style*="grid-template-columns: 1fr 100px"],
    [style*="grid-template-columns:1fr 100px"] {
        grid-template-columns: 1fr !important;
    }

    /* Topbar */
    .topbar { padding: 0 12px; height: 52px; }
    .user-menu-btn span { display: none; }
    .breadcrumb { font-size: 13px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Page */
    .page-content { padding: 12px; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; justify-content: center; }
    .page-title { font-size: 17px; }

    /* Stats */
    .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-val { font-size: 18px; }
    .stat-label { font-size: 10px; }
    .stat-icon { width: 28px; height: 28px; margin-bottom: 8px; }
    .stat-delta { font-size: 9px; padding: 1px 5px; top: 10px; right: 10px; }

    /* Tablas */
    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 500px; }
    thead th { padding: 7px 9px; font-size: 9px; }
    tbody td { padding: 8px 9px; font-size: 12px; }

    /* Botones */
    .btn { padding: 9px 14px; font-size: 13px; }
    .btn-sm { padding: 5px 10px; font-size: 11px; min-height: 32px; }
    .btn-icon { width: 32px; height: 32px; padding: 6px; }
    .td-actions { gap: 4px; }

    /* Cards */
    .card-header { padding: 12px 13px 0; }
    .card-body { padding: 12px 13px 13px; }

    /* Formularios */
    .form-grid,
    .form-grid-2,
    .form-grid-3 { grid-template-columns: 1fr !important; gap: 10px; }

    /* Welcome banner */
    .welcome-banner { padding: 14px; gap: 10px; }
    .wb-text h2 { font-size: 14px; }
    .wb-text p { font-size: 11px; }
    .wb-actions { flex-direction: column; }
    .wb-actions .btn { width: 100%; min-width: unset; justify-content: center; }

    /* Modales */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-width: 100%; max-height: 90vh; }
    .modal-body { padding: 14px; }
    .modal-footer { padding: 10px 14px; flex-direction: column; }
    .modal-footer .btn { width: 100%; }

    /* Filtros */
    .filters-bar { flex-direction: column; align-items: stretch; }
    .filters-bar > * { min-width: unset; width: 100%; }

    /* Alertas */
    .alert { margin: 0 12px 12px; font-size: 12px; padding: 10px 13px; }

    /* Status y tags */
    .status { font-size: 10px; padding: 3px 7px; }
    .tag { font-size: 10px; padding: 2px 6px; }
    .stock-pill { font-size: 10px; padding: 3px 8px; }

    /* Paginación */
    .pagination { flex-direction: column; align-items: center; gap: 8px; }

    /* Notif y user dropdown fijo abajo */
    .notif-dropdown, .user-dropdown {
        position: fixed;
        left: 10px; right: 10px;
        top: auto; bottom: 0;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        min-width: unset;
        max-height: 70vh;
        overflow-y: auto;
    }

    /* Ocultar elementos no esenciales */
    .hide-mobile { display: none !important; }
}

/* Touch targets */
@media (hover: none) and (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .nav-item { min-height: 44px; padding: 12px 10px; }
    .page-link { width: 40px; height: 40px; }
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    select { font-size: 16px !important; min-height: 44px; }
}