/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif; background: #0f1117; color: #e2e8f0; min-height: 100vh; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: #60a5fa; text-decoration: none; transition: color .2s; }
a:hover { color: #93c5fd; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* === CSS VARIABLES === */
:root {
  --bg-base: #0f1117;
  --bg-surface: #161b27;
  --bg-card: #1e2535;
  --bg-input: #252d3d;
  --bg-hover: #2a3347;
  --bg-active: #2e3a52;
  --border: #2e3a52;
  --border-light: #3a4660;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: rgba(59,130,246,.15);
  --success: #22c55e;
  --success-light: rgba(34,197,94,.15);
  --warning: #f59e0b;
  --warning-light: rgba(245,158,11,.15);
  --danger: #ef4444;
  --danger-light: rgba(239,68,68,.15);
  --info: #06b6d4;
  --info-light: rgba(6,182,212,.15);
  --sidebar-w: 260px;
  --header-h: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
  --transition: .2s ease;
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === LAYOUT === */
.crm-wrapper { display: flex; min-height: 100vh; }
.crm-main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; transition: margin-left var(--transition); }
.crm-content { padding: 24px; flex: 1; }

/* === SIDEBAR === */
.sidebar { position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh; background: var(--bg-surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 100; overflow-y: auto; overflow-x: hidden; transition: transform var(--transition); }
.sidebar-logo { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; min-height: var(--header-h); }
.sidebar-logo-icon { width: 36px; height: 36px; background: var(--accent); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar-logo-icon ion-icon { font-size: 20px; color: #fff; }
.sidebar-logo-text { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.sidebar-logo-sub { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section { padding: 8px 16px 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: var(--text-secondary); font-size: 14px; cursor: pointer; border-radius: 0; transition: background var(--transition), color var(--transition); position: relative; text-decoration: none; }
.nav-item ion-icon { font-size: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-light); color: var(--accent); }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; background: var(--accent); border-radius: 0 2px 2px 0; }
.nav-badge { margin-left: auto; font-size: 11px; background: var(--accent); color: #fff; border-radius: 10px; padding: 1px 7px; font-weight: 600; }
.sidebar-user { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar-user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-active); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; font-weight: 600; color: var(--accent); }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }
.sidebar-user-logout { color: var(--text-muted); cursor: pointer; flex-shrink: 0; }
.sidebar-user-logout:hover { color: var(--danger); }
.sidebar-user-logout ion-icon { font-size: 18px; display: block; }

/* === HEADER === */
.crm-header { height: var(--header-h); background: var(--bg-surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 50; }
.header-toggle { display: none; background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 6px; border-radius: var(--radius-sm); }
.header-toggle ion-icon { font-size: 22px; display: block; }
.header-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.header-title { font-size: 16px; font-weight: 600; color: var(--text-primary); flex: 1; }
.header-actions { display: flex; align-items: center; gap: 8px; }

/* === PAGE HEADER === */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header-left { flex: 1; min-width: 0; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.page-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* === CARDS === */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.card-title ion-icon { font-size: 18px; color: var(--accent); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--bg-surface); }

/* === STATS CARDS === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon ion-icon { font-size: 24px; }
.stat-icon.blue { background: var(--accent-light); color: var(--accent); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.cyan { background: var(--info-light); color: var(--info); }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* === BUTTONS === */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: all var(--transition); white-space: nowrap; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.btn ion-icon { font-size: 17px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-warning { background: var(--warning); color: #0f1117; border-color: var(--warning); }
.btn-warning:hover { background: #d97706; color: #0f1117; }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border-color: var(--border-light); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-light); color: var(--text-primary); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }
.btn-icon ion-icon { font-size: 18px; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-sm ion-icon { font-size: 15px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* === FORMS === */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-label .required { color: var(--danger); margin-left: 3px; }
.form-control { background: var(--bg-input); border: 1px solid var(--border); color: var(--text-primary); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px; width: 100%; transition: border-color var(--transition), box-shadow var(--transition); -webkit-appearance: none; appearance: none; }
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { opacity: .5; cursor: not-allowed; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--danger); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px var(--danger-light); }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
.input-group-text { background: var(--bg-hover); border: 1px solid var(--border); padding: 9px 12px; font-size: 14px; color: var(--text-muted); white-space: nowrap; }
.input-group-text:first-child { border-right: none; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group-text:last-child { border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* === TABLE === */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--bg-surface); color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text-primary); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-hover); }
.table-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* === BADGES === */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge ion-icon { font-size: 12px; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: var(--bg-hover); color: var(--text-secondary); }
.badge-primary { background: var(--accent-light); color: var(--accent); }

/* === MODAL === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; pointer-events: none; transition: opacity var(--transition); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; transform: translateY(16px); transition: transform var(--transition); box-shadow: var(--shadow); }
.modal-overlay.active .modal { transform: translateY(0); }
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 1000px; }
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal-title { font-size: 16px; font-weight: 600; color: var(--text-primary); flex: 1; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: var(--radius-sm); display: flex; }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-close ion-icon { font-size: 20px; }
.modal-body { padding: 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* === TOAST === */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: 360px; pointer-events: none; }
.toast { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: flex-start; gap: 10px; box-shadow: var(--shadow); pointer-events: all; animation: toast-in .3s ease; font-size: 14px; }
.toast.hiding { animation: toast-out .3s ease forwards; }
@keyframes toast-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { to { transform: translateX(120%); opacity: 0; } }
.toast-icon { flex-shrink: 0; }
.toast-icon ion-icon { font-size: 20px; }
.toast-success .toast-icon ion-icon { color: var(--success); }
.toast-error .toast-icon ion-icon { color: var(--danger); }
.toast-warning .toast-icon ion-icon { color: var(--warning); }
.toast-info .toast-icon ion-icon { color: var(--info); }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.toast-msg { color: var(--text-secondary); font-size: 13px; }

/* === SEARCH & FILTER BAR === */
.filter-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: flex-end; }
.filter-bar .form-control { min-width: 160px; }
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search-box ion-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 17px; pointer-events: none; }
.search-box .form-control { padding-left: 34px; }

/* === PAGINATION === */
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-btn { min-width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; border: 1px solid var(--border); background: var(--bg-input); color: var(--text-secondary); transition: all var(--transition); }
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: .4; pointer-events: none; }

/* === TABS === */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tab { padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color var(--transition), border-color var(--transition); background: none; border-top: none; border-left: none; border-right: none; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state ion-icon { font-size: 48px; display: block; margin: 0 auto 12px; opacity: .4; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-text { font-size: 14px; }

/* === ALERTS === */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid transparent; }
.alert ion-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-light); color: var(--success); border-color: rgba(34,197,94,.3); }
.alert-danger { background: var(--danger-light); color: var(--danger); border-color: rgba(239,68,68,.3); }
.alert-warning { background: var(--warning-light); color: var(--warning); border-color: rgba(245,158,11,.3); }
.alert-info { background: var(--info-light); color: var(--info); border-color: rgba(6,182,212,.3); }

/* === DIVIDER === */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* === SECTION TITLE === */
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* === TRIP POINTS BUILDER === */
.points-list { display: flex; flex-direction: column; gap: 8px; }
.point-item { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; position: relative; }
.point-item.type-load { border-left: 3px solid var(--success); }
.point-item.type-unload { border-left: 3px solid var(--warning); }
.point-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.point-type-badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.point-type-badge.load { background: var(--success-light); color: var(--success); }
.point-type-badge.unload { background: var(--warning-light); color: var(--warning); }
.point-remove { margin-left: auto; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px; }
.point-remove:hover { color: var(--danger); }
.point-remove ion-icon { font-size: 18px; display: block; }

/* === LOGIN PAGE === */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg-base); }
.login-box { width: 100%; max-width: 400px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo ion-icon { font-size: 48px; color: var(--accent); display: block; margin: 0 auto 8px; }
.login-logo-title { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.login-logo-sub { font-size: 14px; color: var(--text-muted); }
.login-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); }
.login-card .form-group { margin-bottom: 16px; }
.login-btn { width: 100%; margin-top: 8px; padding: 11px; font-size: 15px; }

/* === DETAIL VIEW === */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }
.detail-item { background: var(--bg-card); padding: 14px 16px; }
.detail-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.detail-value { font-size: 14px; color: var(--text-primary); word-break: break-word; }

/* === SIDEBAR OVERLAY (mobile) === */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 99; }

/* === MOBILE MENU TOGGLE === */
.sidebar-close-btn { display: none; position: absolute; top: 12px; right: 12px; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; }
.sidebar-close-btn ion-icon { font-size: 22px; display: block; }

/* === UTILS === */
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-accent { color: var(--accent) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-18 { font-size: 18px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.nowrap { white-space: nowrap; }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; }
  .sidebar-close-btn { display: flex; }
  .crm-main { margin-left: 0; }
  .header-toggle { display: flex; }
  .crm-content { padding: 16px; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; justify-content: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-control, .search-box { max-width: 100%; width: 100%; }
  .modal { max-height: 95vh; }
  .toast-container { bottom: 16px; right: 16px; left: 16px; max-width: none; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .btn span { display: none; }
  .btn.btn-with-text span { display: inline; }
  thead th:nth-child(n+5) { display: none; }
  tbody td:nth-child(n+5) { display: none; }
  .crm-content { padding: 12px; }
  .card-body { padding: 14px; }
  .login-card { padding: 24px 20px; }
}
@media (max-width: 360px) {
  .page-title { font-size: 18px; }
  .stat-value { font-size: 20px; }
}

/* === SAFARI FIXES === */
@supports (-webkit-touch-callout: none) {
  .modal-body { -webkit-overflow-scrolling: touch; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  select.form-control { background-color: var(--bg-input); }
}

/* === PRINT (для PDF preview) === */
@media print {
  .sidebar, .crm-header, .page-header-actions, .filter-bar, .table-actions { display: none !important; }
  .crm-main { margin-left: 0; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ddd; box-shadow: none; }
}
