/* =============================================
   LHGROUP CRM — Slate Pro Design System
   ============================================= */

:root {
    --navy:          #161C2D;
    --navy-2:        #1F2840;
    --blue:          #3D6FF8;
    --blue-hover:    #2F5CE0;
    --blue-lt:       #EEF3FF;
    --coral:         #F4735A;
    --coral-lt:      #FEF0ED;
    --emerald:       #18B882;
    --emerald-lt:    #E6F9F1;
    --amber:         #F59C1A;
    --amber-lt:      #FEF5E7;
    --bg:            #F0F2F7;
    --bg-card:       #FFFFFF;
    --bg-card-hover: #F8F9FC;
    --bg-sidebar:    #161C2D;
    --bg-input:      #F5F6FA;
    --border:        #E4E7EF;
    --border-focus:  #3D6FF8;
    --text:          #0F1729;
    --text-muted:    #7B82A0;
    --text-heading:  #0F1729;
    --primary:       #3D6FF8;
    --primary-hover: #2F5CE0;
    --primary-bg:    #EEF3FF;
    --success:       #18B882;
    --warning:       #F59C1A;
    --danger:        #F4735A;
    --info:          #06b6d4;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 1px 4px rgba(15,23,41,0.08), 0 4px 16px rgba(15,23,41,0.04);
    --shadow-md:     0 4px 20px rgba(15,23,41,0.12);
    --transition:    0.18s ease;
    --font:          'Inter', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:     'DM Mono', 'JetBrains Mono', monospace;
    --sidebar-w:     210px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }

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

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

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* LOGIN */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0F1729 0%, #1B2550 50%, #0F1729 100%);
}
.login-container { width: 100%; max-width: 400px; padding: 1rem; }
.login-card {
    background: #FFFFFF; border-radius: 16px; padding: 2.5rem;
    box-shadow: 0 24px 80px rgba(0,0,0,0.35);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-logo { font-size: 2.8rem; display: block; margin-bottom: 0.75rem; }
.login-header h1 { font-size: 1.5rem; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.login-header p { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }
.login-form .form-group { margin-bottom: 1.1rem; }
.login-footer {
    text-align: center; margin-top: 1.5rem; padding-top: 1.2rem;
    border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.78rem; line-height: 1.6;
}

/* THEME TOGGLE */
.theme-toggle {
    background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
    width: 34px; height: 34px; border-radius: var(--radius-sm); cursor: pointer;
    font-size: 1rem; display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.theme-toggle:hover { background: var(--blue-lt); color: var(--blue); border-color: var(--blue); }

/* SIDEBAR */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
    background: var(--navy); display: flex; flex-direction: column;
    z-index: 100; transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 20px 16px 16px; border-bottom: 1px solid var(--navy-2);
    display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, #ffffff 0%, #e0eaff 100%);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.logo-text { font-size: 14px; font-weight: 800; color: #FFFFFF; letter-spacing: -0.3px; line-height: 1.1; }
.logo-sub { font-size: 10px; color: rgba(255,255,255,0.35); font-weight: 400; text-transform: none; }
.sidebar-close { display: none; background: none; border: none; color: rgba(255,255,255,0.4); font-size: 1.1rem; cursor: pointer; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px; }
.nav-item {
    display: flex; align-items: center; gap: 9px; padding: 8px 10px;
    border-radius: 7px; color: rgba(255,255,255,0.5); font-size: 13px; font-weight: 500;
    cursor: pointer; transition: all var(--transition); text-decoration: none; margin-bottom: 2px;
}
.nav-item:hover { color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.06); }
.nav-item.active { color: #FFFFFF; background: var(--blue); font-weight: 600; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-badge {
    margin-left: auto; background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.9);
    font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 6px;
    min-width: 18px; text-align: center;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,0.25); }
.nav-divider { height: 1px; background: var(--navy-2); margin: 8px 0; }
.sidebar-footer { padding: 14px; border-top: 1px solid var(--navy-2); }
.user-info { display: flex; align-items: center; gap: 9px; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 8px; background: var(--blue);
    color: #FFFFFF; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-name { font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,0.9); }
.user-role { font-size: 10.5px; color: rgba(255,255,255,0.35); }
.logout-btn { margin-left: auto; font-size: 1.1rem; opacity: 0.4; transition: opacity var(--transition); color: #fff; }
.logout-btn:hover { opacity: 0.9; color: var(--coral); }

/* MAIN */
.main-content { margin-left: var(--sidebar-w); min-height: 100vh; }
.top-bar {
    display: flex; align-items: center; gap: 1rem; padding: 0 24px; height: 56px;
    border-bottom: 1px solid var(--border); background: var(--bg-card);
    position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 0 var(--border);
}
.hamburger { display: none; background: none; border: none; color: var(--text-muted); font-size: 1.3rem; cursor: pointer; }
.page-title { font-size: 15px; font-weight: 700; color: var(--text-heading); letter-spacing: -0.2px; }
.top-bar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.today-date { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.content-area { padding: 24px; max-width: 1440px; }

/* ALERTS */
.alert {
    padding: 0.75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13.5px; font-weight: 500; animation: slideDown 0.25s ease;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.alert-success { background: #E6F9F1; color: #0F7A56; border: 1px solid #A7EDCF; }
.alert-danger  { background: #FEF0ED; color: #C0392B; border: 1px solid #FBBCB2; }
.alert-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

/* BUTTONS */
.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 0.5rem 1rem;
    border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
    font-family: var(--font); border: none; cursor: pointer;
    transition: all var(--transition); text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 1px 3px rgba(61,111,248,0.3); }
.btn-primary:hover { background: var(--blue-hover); color: #fff; box-shadow: 0 2px 8px rgba(61,111,248,0.4); }
.btn-success { background: var(--emerald); color: #fff; }
.btn-success:hover { background: #14A072; color: #fff; }
.btn-danger { background: var(--coral); color: #fff; }
.btn-danger:hover { background: #E05A42; color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); border-color: #C8CCDB; }
.btn-sm { padding: 0.28rem 0.65rem; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

/* FORMS */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block; font-size: 11.5px; font-weight: 600; color: var(--text-muted);
    margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.4px;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="url"], input[type="number"],
input[type="date"], input[type="time"], input[type="month"],
input[type="search"], select, textarea {
    width: 100%; padding: 0.55rem 0.8rem; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-size: 13.5px; font-family: var(--font);
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--blue); background: #fff;
    box-shadow: 0 0 0 3px rgba(61,111,248,0.1);
}
select { cursor: pointer; }
textarea { resize: vertical; min-height: 60px; }
input[type="color"] {
    width: 60px; height: 36px; padding: 2px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--bg-input); cursor: pointer;
}
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem 1rem; }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-section {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.section-title {
    font-size: 13.5px; font-weight: 700; color: var(--text-heading);
    margin-bottom: 1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border);
}
.form-actions { display: flex; justify-content: flex-end; gap: 0.7rem; margin-top: 1rem; padding-top: 1rem; }
.form-page { max-width: 900px; }
.inline-form .form-group { margin-bottom: 0; }

/* CARDS */
.card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 1rem;
    overflow: hidden; box-shadow: var(--shadow);
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 13.5px; font-weight: 700; color: var(--text-heading); letter-spacing: -0.2px; }
.card-body { padding: 16px 18px; }

/* STATS GRID */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 14px; margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px; display: flex;
    align-items: center; gap: 14px; box-shadow: var(--shadow);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.stat-card:hover { border-color: var(--blue); box-shadow: var(--shadow-md); }
.stat-card.accent { border-color: var(--coral); }
.stat-icon {
    width: 44px; height: 44px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; flex-shrink: 0; background: var(--blue-lt);
}
.stat-value {
    font-size: 22px; font-weight: 800; color: var(--text-heading);
    line-height: 1.1; letter-spacing: -0.5px;
}
.stat-label { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }

/* GRIDS */
.dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.dashboard-grid .span-2 { grid-column: span 2; }
.reports-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.reports-grid .span-2 { grid-column: span 2; }

/* TABLES */
.table-responsive { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border); background: var(--bg);
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.table-hover tbody tr { transition: background var(--transition); }
.table-hover tbody tr:hover { background: var(--bg-card-hover); }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--coral); }
.sort-link { color: var(--text-muted); }
.sort-link:hover { color: var(--blue); }
.customer-link { color: var(--text-heading); font-weight: 500; }
.customer-link:hover { color: var(--blue); }
.actions-cell { white-space: nowrap; }

/* BADGES */
.badge, .status-badge {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge-pending  { background: #FEF5E7; color: #C07A00; }
.badge-partial  { background: #EEF3FF; color: #3D6FF8; }
.badge-paid     { background: #E6F9F1; color: #0F7A56; }
.badge-overdue  { background: #FEF0ED; color: #C0392B; }
.badge-shipped  { background: #EEF3FF; color: #3D6FF8; }
.badge-delivered { background: #E6F9F1; color: #0F7A56; }
.badge-returned  { background: #FEF0ED; color: #C0392B; }
.stars { font-size: 0.7rem; margin-left: 4px; }

/* LIST ITEMS */
.list-items { display: flex; flex-direction: column; }
.list-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 4px; border-bottom: 1px solid var(--border); gap: 10px;
}
.list-item:last-child { border-bottom: none; }
.list-item.overdue { background: rgba(244,115,90,0.04); }
.list-item.completed { opacity: 0.5; }
.list-item-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; color: var(--text-heading); font-size: 13px; }
.list-item-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.comm-type-icon { font-size: 1.2rem; flex-shrink: 0; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.priority-low    { background: #9CA3AF; }
.priority-medium { background: #F59C1A; }
.priority-high   { background: #F97316; }
.priority-urgent { background: #F4735A; box-shadow: 0 0 5px rgba(244,115,90,0.5); }

/* TOOLBAR */
.toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-form { flex: 1; }
.search-group { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.search-input { min-width: 200px; max-width: 280px; }
.filter-select { min-width: 130px; max-width: 200px; }
.toolbar-actions { display: flex; gap: 0.5rem; align-items: center; }
.results-info { font-size: 12.5px; color: var(--text-muted); margin-bottom: 1rem; }

/* FILTER BAR */
.filter-bar { display: flex; gap: 6px; margin-bottom: 1.2rem; flex-wrap: wrap; }
.filter-btn {
    padding: 0.42rem 0.9rem; border-radius: var(--radius-sm); font-size: 12.5px;
    font-weight: 600; color: var(--text-muted); background: var(--bg-card);
    border: 1px solid var(--border); cursor: pointer; transition: all var(--transition);
    text-decoration: none;
}
.filter-btn:hover { border-color: var(--blue); color: var(--text); }
.filter-btn.active { background: var(--blue-lt); border-color: var(--blue); color: var(--blue); }
.filter-btn.danger.active { border-color: var(--coral); color: var(--coral); background: var(--coral-lt); }
.filter-btn .count { display: inline-block; background: var(--bg); padding: 0 5px; border-radius: 6px; font-size: 11px; margin-left: 4px; }

/* PAGINATION */
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1.5rem; }
.page-info { font-size: 12.5px; color: var(--text-muted); }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state.small { padding: 1.5rem 1rem; }
.empty-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.empty-state h3 { color: var(--text); margin-bottom: 0.4rem; font-size: 15px; }

/* CUSTOMER DETAIL */
.detail-header {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; margin-bottom: 1rem;
    flex-wrap: wrap; gap: 1rem; box-shadow: var(--shadow);
}
.detail-header-left { display: flex; align-items: center; gap: 14px; }
.detail-avatar {
    width: 52px; height: 52px; border-radius: 13px; display: flex;
    align-items: center; justify-content: center; font-weight: 700;
    font-size: 1.1rem; flex-shrink: 0; background: var(--blue); color: #fff;
}
.detail-header h2 { font-size: 18px; color: var(--text-heading); font-weight: 700; letter-spacing: -0.3px; }
.detail-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.detail-actions { display: flex; gap: 6px; }
.detail-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 14px; margin-bottom: 14px;
}
.info-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.info-card.full-width { grid-column: 1 / -1; }
.info-card h4 {
    font-size: 10.5px; color: var(--text-muted); margin-bottom: 0.8rem;
    text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700;
}
.info-rows { display: flex; flex-direction: column; gap: 0.4rem; }
.info-row { font-size: 13px; color: var(--text); }
.info-label { color: var(--text-muted); font-size: 12px; margin-right: 0.3rem; }
.note-text { font-size: 13.5px; color: var(--text); line-height: 1.7; }

/* TABS */
.tabs { display: flex; gap: 2px; margin-bottom: 1rem; border-bottom: 2px solid var(--border); }
.tab-btn {
    padding: 0.65rem 1.1rem; background: none; border: none;
    color: var(--text-muted); font-size: 13px; font-weight: 600;
    font-family: var(--font); cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all var(--transition); white-space: nowrap;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* TIMELINE */
.timeline { position: relative; padding-left: 2.5rem; }
.timeline::before {
    content: ''; position: absolute; left: 14px; top: 0; bottom: 0;
    width: 2px; background: var(--border);
}
.timeline-item { position: relative; margin-bottom: 14px; }
.timeline-icon {
    position: absolute; left: -2.5rem; top: 0.2rem; width: 28px; height: 28px;
    border-radius: 50%; background: var(--bg-card); border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; z-index: 1; box-shadow: 0 0 0 3px var(--bg);
}
.timeline-content {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow);
}
.timeline-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; flex-wrap: wrap; gap: 6px; }
.timeline-date { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }
.timeline-body { font-size: 13px; color: var(--text); margin: 6px 0; }
.timeline-outcome { font-size: 12.5px; color: var(--emerald); font-style: italic; }
.timeline-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 11.5px; color: var(--text-muted); }

/* STAT LIST */
.stat-list { display: flex; flex-direction: column; gap: 4px; }
.stat-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }

/* BAR */
.bar { transition: width 0.5s ease; }

/* MODAL */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,41,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; backdrop-filter: blur(4px);
}
.modal-content {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px; width: 100%; max-width: 480px;
    box-shadow: 0 24px 60px rgba(15,23,41,0.25);
}
.modal-content h3 { margin-bottom: 1.2rem; color: var(--text-heading); font-size: 16px; font-weight: 700; }

/* FU CARD */
.fu-card { border-radius: var(--radius-sm); padding: 0.8rem !important; }

/* BRANDS GRID */
.brands-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; }
.brand-checkbox {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    cursor: pointer; transition: all var(--transition); font-size: 13px;
    background: var(--bg-input);
}
.brand-checkbox:hover { border-color: var(--blue); background: var(--blue-lt); }
.brand-checkbox.checked { border-color: var(--blue); background: var(--blue-lt); }
.brand-checkbox input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; flex-shrink: 0; }
.brand-code { font-weight: 700; color: var(--blue); min-width: 28px; font-size: 11px; font-family: var(--font-mono); }
.brand-name { color: var(--text); font-size: 12.5px; }

/* SC VALUE */
.sc-value { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }

/* TODO BUTTONS */
.todo-pending-btn, .todo-done-btn {
    padding: 0.3rem 0.7rem; border-radius: var(--radius-sm); font-size: 12px;
    font-weight: 600; cursor: pointer; border: none; font-family: var(--font); transition: all var(--transition);
}
.todo-pending-btn { background: #FEF5E7; color: #C07A00; }
.todo-pending-btn:hover { background: #FEDC99; }
.todo-done-btn { background: #E6F9F1; color: #0F7A56; }
.todo-done-btn:hover { background: #B2F0D8; }

/* RESPONSIVE */
@media (max-width: 1024px) {
    .form-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .form-grid .span-3 { grid-column: span 2; }
    .dashboard-grid, .reports-grid { grid-template-columns: 1fr; }
    .dashboard-grid .span-2, .reports-grid .span-2 { grid-column: span 1; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
    .sidebar-close { display: block; }
    .hamburger { display: block; }
    .main-content { margin-left: 0; }
    .form-grid, .form-grid.cols-4 { grid-template-columns: 1fr; }
    .form-grid .span-2, .form-grid .span-3 { grid-column: span 1; }
    .toolbar { flex-direction: column; }
    .search-group { flex-direction: column; }
    .search-input, .filter-select { max-width: 100%; }
    .detail-header { flex-direction: column; align-items: flex-start; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .content-area { padding: 12px; }
    /* Topbar user info — hide name on small screens */
    .top-bar-user-name { display: none; }
    /* Cards list — hide stats on mobile */
    .cust-card-stats, .fu-stats, .ord-stats { display: none; }
    .cust-card-badges { display: none; }
    .cust-card { flex-wrap: wrap; }
    /* Modals */
    .modal-content { margin: 1rem; max-width: calc(100vw - 2rem) !important; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .tabs { overflow-x: auto; }
    .tab-btn { white-space: nowrap; font-size: 12px; padding: 0.5rem 0.8rem; }
    .top-bar-right { gap: 4px; }
    /* hide date on very small */
    .today-date { display: none; }
}
@media print {
    .sidebar, .top-bar, .toolbar, .form-actions, .actions-cell { display: none !important; }
    .main-content { margin-left: 0; }
    body { background: #fff; color: #000; }
    .card, .stat-card, .info-card { border-color: #ddd; background: #fff; box-shadow: none; }
}

/* SIDEBAR OVERLAY (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,41,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* MOBILE TOPBAR FIX */
@media (max-width: 768px) {
    .top-bar { padding: 0 14px; gap: 8px; }
    .page-title { font-size: 14px; }
    .today-date { display: none; }
    .top-bar-right { gap: 6px; }
}