/* Sherman Mechanical CRM — Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --navy: #0f1b2d; --navy-light: #1a2d4a; --navy-mid: #132035; --navy-deep: #0c1829;
  --red: #c9362f; --red-light: #e8453e;
  --sky: #0284c7; --emerald: #059669; --amber: #d97706; --violet: #7c3aed;
  --slate-50: #f8fafc; --slate-100: #f1f5f9; --slate-200: #e2e8f0; --slate-300: #cbd5e1;
  --slate-400: #94a3b8; --slate-500: #64748b; --slate-600: #475569; --slate-700: #334155; --slate-800: #1e293b; --slate-900: #0f172a;
  --radius: 12px; --radius-sm: 8px; --radius-xs: 6px;
}
body { font-family: 'DM Sans', system-ui, sans-serif; background: var(--slate-50); color: var(--slate-900); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 5px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 3px; }

/* Layout */
.app-layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar { position: fixed; inset: 0; right: auto; width: 240px; display: flex; flex-direction: column; background: linear-gradient(180deg, #0c1829, #132035 50%, #182946); z-index: 40; }
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .label { display: none; }
.sidebar.collapsed .sidebar-brand, .sidebar.collapsed .sidebar-user { display: none; }
.sidebar-header { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 64px; border-bottom: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; }
.sidebar-logo { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 11px; color: white; background: linear-gradient(135deg, var(--red), var(--red-light)); flex-shrink: 0; box-shadow: 0 4px 12px rgba(201,54,47,0.3); }
.sidebar-brand { overflow: hidden; }
.sidebar-brand-name { color: white; font-weight: 700; font-size: 14px; letter-spacing: 0.05em; }
.sidebar-brand-sub { color: rgba(56,189,248,0.4); font-size: 9px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: var(--slate-400); position: relative; }
.nav-item.active { background: rgba(255,255,255,0.12); color: white; }
.nav-item .icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-item .label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user { padding: 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-user-info { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sidebar-user-name { font-size: 12px; font-weight: 500; color: white; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { font-size: 10px; color: var(--slate-500); text-transform: capitalize; }
.sidebar-signout { width: 100%; font-size: 11px; color: var(--slate-500); padding: 4px 0; }
.sidebar-signout:hover { color: var(--slate-300); }
.sidebar-toggle { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.1); color: var(--slate-600); display: flex; align-items: center; justify-content: center; font-size: 14px; }
.sidebar-toggle:hover { color: var(--slate-300); }

/* Main content */
.main-area { flex: 1; display: flex; flex-direction: column; margin-left: 240px; }
.sidebar.collapsed ~ .main-area { margin-left: 64px; }
.top-header { height: 56px; background: white; border-bottom: 1px solid var(--slate-200); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0; position: sticky; top: 0; z-index: 30; }
.header-title { font-size: 14px; font-weight: 500; color: var(--slate-400); text-transform: capitalize; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.page-content { flex: 1; overflow-y: auto; padding: 24px; }

/* Avatar */
.avatar { border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; background: linear-gradient(135deg, #182946, #2c5f8a); flex-shrink: 0; }
.avatar-sm { width: 24px; height: 24px; font-size: 9px; }
.avatar-md { width: 32px; height: 32px; font-size: 10px; }
.avatar-lg { width: 48px; height: 48px; font-size: 14px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;  white-space: nowrap; }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-light); box-shadow: 0 2px 8px rgba(15,27,45,0.25); }
.btn-secondary { background: var(--slate-100); color: var(--slate-700); }
.btn-secondary:hover { background: var(--slate-200); }
.btn-ghost { color: var(--slate-500); padding: 8px 12px; }
.btn-ghost:hover { color: var(--slate-700); background: var(--slate-100); }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 11px; }

/* Inputs */
.input, .select, .textarea { width: 100%; padding: 8px 12px; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: var(--radius-sm); font-size: 13px; color: var(--slate-800); outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: #7dd3fc; box-shadow: 0 0 0 3px rgba(14,165,233,0.1); background: white; }
.input::placeholder, .textarea::placeholder { color: var(--slate-400); }
.textarea { resize: none; }
.select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* Field */
.field { margin-bottom: 12px; }
.field-label { display: block; font-size: 10px; font-weight: 700; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.field-label .req { color: #f87171; }

/* Cards */
.card { background: white; border-radius: var(--radius); border: 1px solid rgba(226,232,240,0.8); }
.card-body { padding: 20px; }

/* Stat card */
.stat-card { padding: 16px; }
.stat-card-inner { display: flex; align-items: flex-start; gap: 14px; }
.stat-dot-wrap { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-dot { width: 12px; height: 12px; border-radius: 50%; }
.stat-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--slate-400); margin-bottom: 2px; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--slate-800); }
.stat-sub { font-size: 11px; color: var(--slate-400); margin-top: 2px; }

/* Badge */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge-open { background: #e0f2fe; color: #0369a1; } .badge-open .badge-dot { background: var(--sky); }
.badge-won { background: #d1fae5; color: #047857; } .badge-won .badge-dot { background: var(--emerald); }
.badge-lost { background: #fee2e2; color: #dc2626; } .badge-lost .badge-dot { background: #ef4444; }
.badge-dead { background: var(--slate-200); color: var(--slate-500); } .badge-dead .badge-dot { background: var(--slate-400); }
.stale-tag { font-size: 10px; color: var(--amber); background: #fffbeb; padding: 2px 6px; border-radius: 999px; font-weight: 700; }
.cr-badge { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.cr-good { background: #d1fae5; color: #047857; } .cr-mid { background: #fef3c7; color: #92400e; } .cr-none { background: var(--slate-100); color: var(--slate-400); }

/* Filter bar */
.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn { padding: 6px 12px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--slate-500); background: var(--slate-100);  }
.filter-btn:hover { background: var(--slate-200); }
.filter-btn:active { transform: scale(0.95); }
.filter-btn.active { background: var(--slate-800); color: white; box-shadow: 0 2px 6px rgba(15,27,45,0.2); }
.filter-count { margin-left: 4px; opacity: 0.6; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th { text-align: left; padding: 10px 16px; font-size: 10px; font-weight: 700; color: var(--slate-400); text-transform: uppercase; letter-spacing: 0.08em; background: rgba(248,250,252,0.5); border-bottom: 1px solid var(--slate-100); }
.data-table thead th.r { text-align: right; }
.data-table thead th.c { text-align: center; }
.data-table tbody td { padding: 10px 16px; border-bottom: 1px solid var(--slate-50); }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: rgba(14,165,233,0.03); }
.data-table tbody tr:active { background: rgba(14,165,233,0.06); }
.data-table .cell-name { font-weight: 500; color: var(--slate-800); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table .cell-muted { color: var(--slate-500); }
.data-table .cell-money { text-align: right; font-weight: 600; color: var(--slate-800); font-variant-numeric: tabular-nums; }
.data-table .cell-center { text-align: center; }
.data-table .cell-link { color: var(--sky); font-weight: 500; }
.data-table .empty-row td { text-align: center; color: var(--slate-400); padding: 40px 16px; font-size: 14px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding-top: 10vh; padding-left: 16px; padding-right: 16px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.modal-content { position: relative; background: white; border-radius: 16px; box-shadow: 0 25px 50px rgba(0,0,0,0.15); width: 100%; max-height: 80vh; display: flex; flex-direction: column; }
.modal-overlay.modal-closing .modal-backdrop { }
.modal-overlay.modal-closing .modal-content { }
.modal-sm { max-width: 480px; } .modal-md { max-width: 560px; } .modal-lg { max-width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--slate-100); flex-shrink: 0; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--slate-800); }
.modal-close { color: var(--slate-400); font-size: 20px; line-height: 1; padding: 4px; }
.modal-close:hover { color: var(--slate-600); }
.modal-body { overflow-y: auto; padding: 16px 24px; flex: 1; }
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--slate-100); }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.flex-center { display: flex; align-items: center; gap: 8px; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.pt-3 { padding-top: 12px; } .pt-4 { padding-top: 16px; }
.border-t { border-top: 1px solid var(--slate-100); }
.space-y > * + * { margin-top: 20px; }

/* Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0c1829, #132035 50%, #182946); }
.login-box { width: 100%; max-width: 400px; }
.login-header { text-align: center; margin-bottom: 32px; }
.login-card { background: white; border-radius: 16px; box-shadow: 0 25px 50px rgba(0,0,0,0.15); padding: 32px; }
.login-footer { text-align: center; font-size: 12px; color: var(--slate-500); margin-top: 24px; }
.login-error { padding: 12px; background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-sm); font-size: 13px; color: #dc2626; margin-bottom: 16px; }

/* Toggle */
.toggle-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.toggle-track { width: 32px; height: 20px; border-radius: 999px; position: relative; }
.toggle-track.off { background: var(--slate-200); }
.toggle-track.on { background: var(--sky); }
.toggle-knob { position: absolute; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle-track.off .toggle-knob { left: 2px; }
.toggle-track.on .toggle-knob { left: 14px; }
.toggle-label { font-size: 13px; color: var(--slate-600); }
.toggle-label { font-size: 13px; color: var(--slate-700); }

/* Header actions */
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-user-menu { position: relative; }
.header-user-btn { display: flex; align-items: center; gap: 4px; padding: 4px 8px !important; }
.user-dropdown { display: none; position: absolute; right: 0; top: 100%; margin-top: 4px; background: white; border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(0,0,0,0.12); border: 1px solid var(--slate-200); overflow: hidden; z-index: 60; min-width: 140px; transform-origin: top right; }
.user-dropdown.show { display: block; }
.user-dropdown button { display: block; width: 100%; text-align: left; padding: 10px 16px; font-size: 13px; color: var(--slate-700); background: none; border: none; cursor: pointer; }
.user-dropdown button:hover { background: var(--slate-50); }
.dropdown-item { display: block; width: 100%; text-align: left; padding: 8px 14px; font-size: 12px; color: var(--slate-700); background: none; border: none; cursor: pointer; white-space: nowrap; }
.dropdown-item:hover { background: var(--slate-50); }

/* Toast container */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; box-shadow: 0 4px 12px rgba(0,0,0,0.1);  }
.toast.toast-out {  }
.toast-success { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
.toast-error { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }

/* Loading spinner */
.spinner { width: 32px; height: 32px; border: 3px solid var(--slate-200); border-top-color: var(--sky); border-radius: 50%; }
.loading-center { display: flex; align-items: center; justify-content: center; padding: 80px 0; }

/* Page titles */
.page-title { font-size: 20px; font-weight: 700; color: var(--slate-800); }
.page-subtitle { font-size: 13px; color: var(--slate-400); }
.section-title { font-size: 15px; font-weight: 700; color: var(--slate-700); }
.back-link { font-size: 13px; color: var(--slate-400); display: inline-block; }
.toast-success { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }

/* Detail info grid */
.info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.info-label { font-size: 10px; font-weight: 700; color: var(--slate-400); text-transform: uppercase; letter-spacing: 0.06em; }
.info-value { font-size: 13px; color: var(--slate-700); margin-top: 2px; }
.info-value.lg { font-size: 18px; font-weight: 700; }

/* Note item */
.note-item { display: flex; gap: 12px; }
.note-meta { display: flex; align-items: center; gap: 8px; }
.note-author { font-size: 12px; font-weight: 700; color: var(--slate-700); }
.note-date { font-size: 10px; color: var(--slate-400); }
.note-content { font-size: 13px; color: var(--slate-600); margin-top: 4px; }

/* Revision card */
.rev-card { padding: 16px; }
.rev-card.current { border-color: #bae6fd; box-shadow: 0 0 0 1px #e0f2fe; }
.rev-header { display: flex; align-items: center; justify-content: space-between; }
.rev-num { font-size: 10px; font-weight: 700; color: var(--slate-400); text-transform: uppercase; }
.rev-price { font-size: 18px; font-weight: 700; color: var(--slate-800); }
.rev-detail { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.rev-notes { font-size: 12px; color: var(--slate-500); }
.rev-date { font-size: 10px; color: var(--slate-400); font-variant-numeric: tabular-nums; }

/* Company card */
.company-card { padding: 16px; cursor: pointer; }
.company-name { font-size: 14px; font-weight: 700; color: var(--slate-800); }
.company-location { font-size: 12px; color: var(--slate-400); margin-top: 2px; margin-bottom: 12px; }
.company-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; text-align: center; }
.company-stat-val { font-size: 14px; font-weight: 700; color: var(--slate-700); }
.company-stat-label { font-size: 10px; color: var(--slate-400); }

/* Contact card */
.contact-card { padding: 16px; cursor: pointer; }
.contact-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.contact-name { font-size: 13px; font-weight: 700; color: var(--slate-800); }
.contact-title { font-size: 12px; color: var(--slate-500); }
.contact-info { font-size: 12px; color: var(--slate-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-info.email { color: var(--sky); }
.contact-footer { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--slate-100); font-size: 12px; color: var(--slate-500); }

/* Search bar */
.search-bar { position: relative; }
.search-input { padding-left: 32px !important; padding-right: 28px !important; min-width: 180px; }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 13px; pointer-events: none; }

/* Sortable headers */
.sortable-th { cursor: pointer; user-select: none; white-space: nowrap; transition: color 0.15s; }
.sortable-th:hover { color: var(--sky); }
.sort-arrow { font-size: 10px; opacity: 0.3; margin-left: 2px; }
.sort-arrow.active { opacity: 0.85; color: var(--sky); }

/* Empty state */
.empty-state { text-align: center; padding: 60px 24px; color: var(--slate-400); }
.empty-state-msg { font-size: 14px; margin-bottom: 16px; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 16px 0; }
.pagination-info { font-size: 12px; color: var(--slate-500); }

/* Archived row */
.archived-row { opacity: 0.55; }

/* Type chip */
.type-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; background: var(--slate-100); color: var(--slate-700); border-radius: 8px; font-size: 12px; font-weight: 500; }
.type-chip-x { background: none; border: none; color: var(--slate-400); font-size: 14px; cursor: pointer; padding: 0 2px; line-height: 1; }
.type-chip-x:hover { color: #dc2626; }

/* Login success */
.login-success { padding: 12px; background: #d1fae5; border: 1px solid #a7f3d0; border-radius: var(--radius-sm); font-size: 13px; color: #047857; margin-bottom: 16px; }

/* Table scroll wrapper with fade hint */
.table-scroll-wrap { position: relative; overflow-x: auto; }
.table-scroll-wrap::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 32px; pointer-events: none; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.9)); opacity: 0; transition: opacity 0.2s; }
.table-scroll-wrap.has-scroll::after { opacity: 1; }
.table-scroll-wrap.scrolled-end::after { opacity: 0; }

/* Bid aging colors */
.age-fresh { color: var(--emerald); }
.age-warm { color: #d97706; }
.age-hot { color: #dc2626; }
.age-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }

/* Bulk select toolbar */
.bulk-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #e0f2fe; border-radius: var(--radius-sm); margin-bottom: 12px; }
.bulk-bar-count { font-size: 13px; font-weight: 600; color: #0369a1; }
.bulk-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--sky); }

/* Print */
@media print {
  .sidebar, .top-header, .no-print, .filter-bar, .toast-container, .btn, .search-bar, .bulk-bar { display: none !important; }
  .main-area { margin-left: 0 !important; }
  .app-layout { display: block !important; }
  .page-content { padding: 0 !important; overflow: visible !important; max-height: none !important; }
  .card { box-shadow: none !important; border: 1px solid #e2e8f0 !important; break-inside: avoid; }
  .stat-card { break-inside: avoid; }
  .data-table { font-size: 11px !important; }
  .data-table th, .data-table td { padding: 4px 6px !important; }
  .meeting-print .page-title { font-size: 18px !important; }
  .meeting-print .section-title { font-size: 13px !important; }
  .avatar { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .badge, .cr-badge, .stale-tag { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .grid-5 { grid-template-columns: repeat(5, 1fr) !important; }
  /* Fix #15: Meeting page and multi-column grids print properly */
  [style*="grid-template-columns: 1fr 1fr"] { display: block !important; }
  [style*="grid-template-columns:1fr 1fr"] { display: block !important; }
  .grid-cards { grid-template-columns: repeat(2, 1fr) !important; }
  [style*="overflow-x:auto"] { overflow: visible !important; }
  [style*="overflow-y:auto"] { overflow: visible !important; max-height: none !important; }
  a[href]:after { content: none !important; }
}

/* ============================================================
   MOBILE RESPONSIVE — Tablet (≤ 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .info-grid { grid-template-columns: repeat(3, 1fr); }
  .page-content { padding: 16px; }
}

/* ============================================================
   MOBILE RESPONSIVE — Phone (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Sidebar → bottom nav bar */
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    width: 100% !important; height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    flex-direction: row; border-radius: 0;
    background: var(--navy-deep);
    border-top: 1px solid rgba(255,255,255,0.1);
    z-index: 50;
  }
  .sidebar.collapsed { width: 100% !important; height: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .sidebar-header, .sidebar-brand, .sidebar-user, .sidebar-toggle { display: none !important; }
  .sidebar-nav {
    flex-direction: row; padding: 0; gap: 0;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    justify-content: space-around; align-items: stretch;
    width: 100%; scrollbar-width: none;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .nav-item {
    flex-direction: column; gap: 2px;
    padding: 6px 4px; font-size: 9px;
    justify-content: center; align-items: center;
    min-width: 0; flex: 1;
  }
  .nav-item .icon { font-size: 18px; width: auto; }
  .nav-item .label { font-size: 9px; white-space: nowrap; display: block !important; }
  .nav-item:hover { transform: none; } /* no hover shift on mobile */

  /* Main area — full width, bottom padding for nav bar */
  .app-layout { flex-direction: column; height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }
  .main-area { margin-left: 0 !important; padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); overflow: visible; }
  .sidebar.collapsed ~ .main-area { margin-left: 0 !important; }
  .page-content { overflow-y: visible; }

  /* Top header */
  .top-header { padding: 0 12px; height: 48px; }
  .header-title { font-size: 13px; }
  .header-desktop-only { display: none !important; }
  .header-user-btn { font-size: 12px !important; padding: 4px 8px !important; }

  /* Page content */
  .page-content { padding: 12px; }
  .space-y > * + * { margin-top: 12px; }

  /* ALL inline grids → stack on mobile */
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  .grid-4, .grid-5 { grid-template-columns: 1fr 1fr; }
  .info-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  /* Catch inline style grids */
  div[style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns:1fr 220px"] { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns: 1fr 220px"] { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns:100px 1fr"] { grid-template-columns: 1fr !important; }

  /* Page titles */
  .page-title { font-size: 17px; }
  .section-title { font-size: 13px; }

  /* Flex layouts wrap on mobile */
  .flex-between { flex-wrap: wrap; gap: 8px; }
  .flex-center { flex-wrap: wrap; gap: 6px; }

  /* Stat cards — 2 across */
  .stat-card { padding: 10px; }
  .stat-value { font-size: 16px; }
  .stat-sub { font-size: 10px; }
  .stat-dot-wrap { width: 32px; height: 32px; }
  .stat-card:hover { transform: none; } /* no hover lift on mobile touch */

  /* Cards */
  .card-body { padding: 12px; }
  .card:hover { transform: none; } /* no hover lift on touch */
  .company-card:hover, .contact-card:hover, .rev-card:hover { transform: none; }

  /* Buttons */
  .btn { padding: 8px 14px; font-size: 12px; min-height: 36px; } /* bigger touch targets */
  .btn-sm { padding: 6px 10px; font-size: 11px; min-height: 32px; }

  /* Inputs — 16px prevents iOS zoom */
  .input, .select, .textarea { font-size: 16px; padding: 10px 12px; }
  /* Override fixed-width inline styles on inputs */
  input[style*="width:100px"], input[style*="width:120px"], input[style*="width:80px"],
  input[style*="width:90px"], input[style*="width:70px"], select[style*="width:70px"] {
    width: 100% !important; min-width: 0 !important;
  }
  /* Search inputs */
  input[style*="width:200px"] { width: 100% !important; }
  input[style*="max-width:250px"] { max-width: 100% !important; }
  .search-input { min-width: 0 !important; width: 100% !important; }

  /* Filter bar — scrollable horizontally */
  .filter-bar { gap: 4px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-btn { padding: 5px 8px; font-size: 10px; flex-shrink: 0; }

  /* Tables — horizontal scroll with momentum */
  .data-table { font-size: 12px; }
  .data-table thead th { padding: 8px 10px; font-size: 9px; white-space: nowrap; }
  .data-table tbody td { padding: 8px 10px; }
  .cell-name { white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .table-scroll-wrap { -webkit-overflow-scrolling: touch; overflow-x: auto; }
  .card > .data-table, .card > table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Meeting table columns */
  .meeting-table th, .meeting-table td { white-space: nowrap; }

  /* Modal — near full screen on mobile */
  .modal-overlay { padding: 8px; padding-top: max(8px, env(safe-area-inset-top)); align-items: flex-start; }
  .modal-content { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); border-radius: 12px; }
  .modal-sm, .modal-md, .modal-lg { max-width: 100%; width: 100%; }
  .modal-header { padding: 12px 16px; }
  .modal-body { padding: 12px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .modal-footer { padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
  .modal-footer .btn { flex: 1; min-width: 0; }
  .modal-title { font-size: 15px; }

  /* Company cards grid — stack */
  .grid-cards { grid-template-columns: 1fr !important; }

  /* Contact cards */
  .contact-card { padding: 12px; }
  .contact-header { gap: 8px; }

  /* Login */
  .login-box { padding: 0 16px; }
  .login-card { padding: 20px; max-width: 100%; }

  /* Toast — above bottom nav */
  .toast-container { left: 12px; right: 12px; top: auto; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .toast { text-align: center; font-size: 12px; padding: 10px 16px; }

  /* Impersonation banner */
  .impersonation-banner, div[style*="background:#7c3aed"] { font-size: 11px !important; padding: 6px 12px !important; flex-wrap: wrap !important; gap: 6px !important; }

  /* Settings page specifics */
  /* Role permission 2-col layout → stack */
  div[style*="grid-template-columns:1fr 1fr;gap:0 32px"] { grid-template-columns: 1fr !important; }
  /* Settings general 2-col grid → stack */
  div[style*="grid-template-columns:1fr 1fr;gap:12px 24px"] { grid-template-columns: 1fr !important; }
  /* User list grid — make scrollable */
  div[style*="grid-template-columns:1fr 130px"] { font-size: 12px; }

  /* Performance page charts */
  div[style*="grid-template-columns:1fr 1fr;gap:20px"] { grid-template-columns: 1fr !important; }

  /* Calendar sidebar */
  div[style*="grid-template-columns:1fr 220px"] { grid-template-columns: 1fr !important; }

  /* Bulk bar */
  .bulk-bar { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }

  /* Empty state */
  .empty-state { padding: 32px 16px; }
  .empty-state-msg { font-size: 13px; }

  /* Pagination */
  .pagination { flex-wrap: wrap; gap: 6px; justify-content: center; }
  .pagination-info { font-size: 11px; }

  /* Note items */
  .note-item { gap: 8px; }
  .note-content { font-size: 12px; }
  .note-author { font-size: 11px; }

  /* Line items — force scroll */
  .li-desc, .li-qty, .li-price, .li-unit { font-size: 12px !important; padding: 6px 8px !important; }

  /* Toggle wraps */
  .toggle-wrap { flex-shrink: 0; }

  /* Avatar */
  .avatar-lg { width: 48px; height: 48px; font-size: 16px; }

  /* Dropdown menus */
  .user-dropdown { min-width: 120px; }
  div[id$="-more-dd"] { min-width: 120px !important; }

  /* Sortable table headers */
  .sort-arrow { font-size: 10px; }

  /* Calendar cells */
  .cal-cell { min-height: 60px; padding: 2px; }
  .cal-event { font-size: 9px; padding: 1px 3px; }
  .cal-date { font-size: 11px; }
  .cal-header { font-size: 10px; padding: 6px 2px; }
  .cal-overflow { font-size: 9px; }

  /* Mini calendar */
  .mcal-cell { font-size: 10px; padding: 2px 1px; }
  .mcal-hdr { font-size: 8px; }
}

/* ============================================================
   MOBILE RESPONSIVE — Small phone (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
  .grid-4, .grid-5 { grid-template-columns: 1fr 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .stat-card-inner { gap: 8px; }
  .stat-dot-wrap { width: 28px; height: 28px; }
  .stat-dot { width: 10px; height: 10px; }
  .stat-value { font-size: 14px; }
  .stat-sub { font-size: 9px; }
  .stat-label { font-size: 9px; }
  .page-title { font-size: 15px; }
  .nav-item .label { font-size: 8px; }
  .nav-item .icon { font-size: 16px; }
  .nav-item { padding: 4px 2px; }
  .modal-footer .btn { font-size: 11px; }
  .filter-btn { font-size: 9px; padding: 4px 6px; }
  .cal-cell { min-height: 48px; }
  .cal-event { font-size: 8px; }
  .cal-date { font-size: 10px; }
  .cal-header { font-size: 9px; padding: 4px 2px; }
  .cal-grid { border-radius: var(--radius-sm); }
  /* Stack action buttons */
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; }
}

/* ============================================================
   ANIMATIONS — all ≤200ms, respects [data-no-animate] + prefers-reduced-motion
   ============================================================ */


/* ── Global animation disable ── */
[data-no-animate] *, [data-no-animate] *::before, [data-no-animate] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ── Keyframes ── */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes page-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modal-in { from { opacity: 0; transform: scale(0.9) translateY(-20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes modal-out { from { opacity: 1; transform: scale(1) translateY(0); } to { opacity: 0; transform: scale(0.9) translateY(20px); } }
@keyframes dropdown-in { from { opacity: 0; transform: scale(0.85) translateY(-8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes slide-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slide-down { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(14,165,233,0.5); } 100% { box-shadow: 0 0 0 10px rgba(14,165,233,0); } }
@keyframes banner-in { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: translateY(0); } }
@keyframes check-pop { 0% { transform: scale(1); } 40% { transform: scale(0.75); } 100% { transform: scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(60px) scale(0.9); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toast-out { from { opacity: 1; transform: translateX(0) scale(1); } to { opacity: 0; transform: translateX(60px) scale(0.9); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes glow-focus { 0% { box-shadow: 0 0 0 0 rgba(14,165,233,0.3); } 100% { box-shadow: 0 0 0 4px rgba(14,165,233,0.1); } }

/* ── 1. Page transitions — JS adds .page-enter after innerHTML ── */
.page-enter { animation: page-in 0.35s cubic-bezier(0.22, 0.68, 0.32, 1) both; }
/* ── 2/3. Modals ── */
.modal-backdrop { animation: fade-in 0.25s ease both; }
.modal-content { animation: modal-in 0.4s cubic-bezier(0.34, 1.4, 0.64, 1) both; }
.modal-overlay.modal-closing .modal-backdrop { animation: fade-out 0.2s ease forwards; }
.modal-overlay.modal-closing .modal-content { animation: modal-out 0.3s ease forwards; }
/* ── 4. Toast ── */
.toast { animation: toast-in 0.4s cubic-bezier(0.34, 1.4, 0.64, 1) both; }
.toast.toast-out { animation: toast-out 0.35s ease forwards; }
/* ── 5. Dropdown ── */
.user-dropdown.show { animation: dropdown-in 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) both; }
/* ── 6. Login card ── */
.login-card { animation: pop-in 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) both; }
.login-card.shake { animation: shake 0.5s ease; }
/* ── 7. Slide-up items ── */
.bulk-bar { animation: slide-up 0.35s cubic-bezier(0.22, 0.68, 0.32, 1) both; }
.note-item { animation: slide-up 0.35s cubic-bezier(0.22, 0.68, 0.32, 1) both; }
.task-item { animation: slide-up 0.3s cubic-bezier(0.22, 0.68, 0.32, 1) both; }
/* ── 8. Banner ── */
.impersonation-banner { animation: banner-in 0.4s cubic-bezier(0.22, 0.68, 0.32, 1) both; }
/* ── 9. Fade-in elements ── */
.empty-state { animation: fade-in 0.4s ease both; }
.loading-center { animation: fade-in 0.3s ease both; }
/* ── 10. Spinner ── */
.spinner { animation: spin 0.8s linear infinite; }
/* ── 11. Input glow ── */
.input:focus, .select:focus, .textarea:focus { border-color: var(--sky); box-shadow: 0 0 0 4px rgba(14,165,233,0.12); background: white; animation: glow-focus 0.35s ease; }
/* ── 12. Badge pulse ── */
.badge-pulse { animation: pulse-ring 0.6s ease; }
/* ── 13. Check pop ── */
.check-pop { animation: check-pop 0.3s cubic-bezier(0.34, 1.4, 0.64, 1); }
/* ── 14. Login error ── */
.login-error { animation: slide-down 0.35s cubic-bezier(0.22, 0.68, 0.32, 1) both; }

/* ── 15. Stat card stagger — all children ── */
.grid-5 > * { animation: slide-up 0.35s cubic-bezier(0.22, 0.68, 0.32, 1) both; }
.grid-5 > *:nth-child(1) { animation-delay: 0s; }
.grid-5 > *:nth-child(2) { animation-delay: 0.05s; }
.grid-5 > *:nth-child(3) { animation-delay: 0.1s; }
.grid-5 > *:nth-child(4) { animation-delay: 0.15s; }
.grid-5 > *:nth-child(5) { animation-delay: 0.2s; }
/* ── 16/17. Grid card stagger — all children ── */
.grid-cards > * { animation: slide-up 0.35s cubic-bezier(0.22, 0.68, 0.32, 1) both; }
.grid-cards > *:nth-child(1) { animation-delay: 0s; }
.grid-cards > *:nth-child(2) { animation-delay: 0.03s; }
.grid-cards > *:nth-child(3) { animation-delay: 0.06s; }
.grid-cards > *:nth-child(4) { animation-delay: 0.09s; }
.grid-cards > *:nth-child(5) { animation-delay: 0.12s; }
.grid-cards > *:nth-child(6) { animation-delay: 0.15s; }
.grid-cards > *:nth-child(7) { animation-delay: 0.18s; }
.grid-cards > *:nth-child(8) { animation-delay: 0.21s; }
.grid-cards > *:nth-child(n+9) { animation-delay: 0.24s; }
/* ── 18. Table row stagger — all rows ── */
.data-table tbody tr { animation: fade-in 0.3s ease both; }
.data-table tbody tr:nth-child(1) { animation-delay: 0s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.02s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.04s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.06s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.08s; }
.data-table tbody tr:nth-child(6) { animation-delay: 0.1s; }
.data-table tbody tr:nth-child(7) { animation-delay: 0.12s; }
.data-table tbody tr:nth-child(8) { animation-delay: 0.14s; }
.data-table tbody tr:nth-child(9) { animation-delay: 0.16s; }
.data-table tbody tr:nth-child(10) { animation-delay: 0.18s; }
.data-table tbody tr:nth-child(n+11) { animation-delay: 0.2s; }
/* ── 19. Info grid stagger — all children ── */
.info-grid > div { animation: fade-in 0.35s ease both; }
.info-grid > div:nth-child(1) { animation-delay: 0s; }
.info-grid > div:nth-child(2) { animation-delay: 0.04s; }
.info-grid > div:nth-child(3) { animation-delay: 0.08s; }
.info-grid > div:nth-child(4) { animation-delay: 0.12s; }
.info-grid > div:nth-child(5) { animation-delay: 0.16s; }
.info-grid > div:nth-child(6) { animation-delay: 0.2s; }
.info-grid > div:nth-child(n+7) { animation-delay: 0.24s; }
/* ── Section cards in space-y ── */
.space-y > .card { animation: slide-up 0.35s cubic-bezier(0.22, 0.68, 0.32, 1) both; }
.space-y > .card:nth-child(2) { animation-delay: 0.06s; }
.space-y > .card:nth-child(3) { animation-delay: 0.12s; }
.space-y > .card:nth-child(4) { animation-delay: 0.18s; }
.space-y > .card:nth-child(5) { animation-delay: 0.24s; }

/* ── 20-38. Transitions ── */
.card { transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease; }
.card:hover { box-shadow: 0 6px 16px rgba(0,0,0,0.06); }
.stat-card { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); }
.company-card, .contact-card { transition: all 0.25s ease; }
.company-card:hover, .contact-card:hover { border-color: #bae6fd; box-shadow: 0 8px 20px rgba(0,0,0,0.08); transform: translateY(-3px); }
.rev-card { transition: all 0.25s ease; }
.rev-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
.btn { transition: all 0.2s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.btn:active:not(:disabled) { transform: scale(0.94) translateY(0); box-shadow: none; transition-duration: 0.08s; }
.input, .select, .textarea { transition: border-color 0.2s ease, box-shadow 0.25s ease, background 0.2s ease; }
.nav-item { transition: all 0.2s ease; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: var(--slate-200); transform: translateX(4px); }
.nav-item:active { transform: scale(0.96); transition-duration: 0.08s; }
.sidebar { transition: width 0.35s cubic-bezier(0.22, 0.68, 0.32, 1); }
.main-area { transition: margin-left 0.35s cubic-bezier(0.22, 0.68, 0.32, 1); }
.filter-btn { transition: all 0.2s ease; }
.filter-btn:active { transform: scale(0.92); transition-duration: 0.08s; }
.filter-btn.active { box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); }
.data-table tbody tr { transition: background 0.2s ease; }
.data-table tbody tr:hover { background: rgba(14,165,233,0.05); }
.perm-detail { overflow: hidden; transition: max-height 0.35s cubic-bezier(0.22, 0.68, 0.32, 1), opacity 0.3s ease, padding 0.35s ease; }
input[type="checkbox"] { transition: transform 0.15s ease; cursor: pointer; }
input[type="checkbox"]:active { transform: scale(0.8); }
.toggle-track { transition: background 0.25s ease; }
.toggle-knob { transition: left 0.25s cubic-bezier(0.34, 1.4, 0.64, 1); }
.back-link { transition: color 0.2s ease, transform 0.15s ease; }
.back-link:hover { color: var(--slate-600); transform: translateX(-4px); }
.badge { transition: transform 0.2s ease; }
.stale-tag { transition: transform 0.2s ease; }
.stale-tag:hover { transform: scale(1.1); }
.search-clear { transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.search-clear:hover { transform: translateY(-50%) scale(1.2); color: var(--slate-600); }
.avatar { transition: transform 0.2s ease, box-shadow 0.2s ease; }
.avatar:hover { transform: scale(1.1); }
.sidebar-logo { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.sidebar-logo:hover { transform: scale(1.12); box-shadow: 0 8px 20px rgba(201,54,47,0.5); }
.type-chip { transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease; }
.type-chip:hover { transform: translateY(-2px); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.cal-event { transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease; }
.cal-event:hover { transform: translateX(2px); opacity: 0.85; }
.cal-cell { transition: background 0.2s ease; }
.sidebar-signout, .sidebar-toggle { transition: color 0.2s ease; }
.sidebar-signout:hover, .sidebar-toggle:hover { color: var(--slate-300); }

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] { --slate-50: #1e293b; --slate-100: #1a2332; --slate-200: #2a3a50; --slate-300: #3a4f6b; --slate-400: #6b8299; --slate-500: #8899aa; --slate-600: #a0b0c0; --slate-700: #c0cdd8; --slate-800: #e2e8f0; --slate-900: #f1f5f9; }
[data-theme="dark"] body { background: #0f172a; color: #e2e8f0; }
[data-theme="dark"] .card { background: #1e293b; border-color: #2a3a50; }
[data-theme="dark"] .top-header { background: #1a2332; border-color: #2a3a50; }
[data-theme="dark"] .input, [data-theme="dark"] .select, [data-theme="dark"] .textarea { background: #1a2332; border-color: #2a3a50; color: #e2e8f0; }
[data-theme="dark"] .input:focus, [data-theme="dark"] .select:focus, [data-theme="dark"] .textarea:focus { background: #1e293b; border-color: var(--sky); }
[data-theme="dark"] .input::placeholder, [data-theme="dark"] .textarea::placeholder { color: #6b8299; }
[data-theme="dark"] .modal-content { background: #1e293b; }
[data-theme="dark"] .modal-header, [data-theme="dark"] .modal-footer { border-color: #2a3a50; }
[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.7); }
[data-theme="dark"] .toast-success { background: #064e3b; color: #a7f3d0; border-color: #065f46; }
[data-theme="dark"] .toast-error { background: #7f1d1d; color: #fecaca; border-color: #991b1b; }
[data-theme="dark"] .login-card { background: #1e293b; }
[data-theme="dark"] .login-error { background: #7f1d1d; border-color: #991b1b; color: #fecaca; }
[data-theme="dark"] .data-table thead th { background: #1a2332; color: #a0b0c0; border-color: #2a3a50; }
[data-theme="dark"] .data-table tbody tr:hover { background: rgba(14,165,233,0.08); }
[data-theme="dark"] .data-table tbody td { border-color: #2a3a50; }
[data-theme="dark"] .user-dropdown { background: #1e293b; border-color: #2a3a50; }
[data-theme="dark"] .user-dropdown button:hover, [data-theme="dark"] .dropdown-item:hover { background: #2a3a50; }
[data-theme="dark"] .filter-btn { background: #1a2332; color: #a0b0c0; border-color: #2a3a50; }
[data-theme="dark"] .filter-btn.active { background: #0f1b2d; color: white; border-color: var(--sky); }
[data-theme="dark"] .btn-secondary { background: #2a3a50; color: #c0cdd8; }
[data-theme="dark"] .btn-secondary:hover { background: #3a4f6b; }
[data-theme="dark"] .btn-ghost { color: #8899aa; }
[data-theme="dark"] .btn-ghost:hover { color: #c0cdd8; background: #2a3a50; }
[data-theme="dark"] .badge-open { background: #1a3655; color: #7dd3fc; border-color: #1e4a7a; }
[data-theme="dark"] .badge-won { background: #064e3b; color: #6ee7b7; border-color: #065f46; }
[data-theme="dark"] .badge-lost { background: #7f1d1d; color: #fca5a5; border-color: #991b1b; }
[data-theme="dark"] .border-t { border-color: #2a3a50; }
[data-theme="dark"] .cal-grid, [data-theme="dark"] .cal-cell { border-color: #2a3a50; }
[data-theme="dark"] .cal-header { background: #1a2332; border-color: #2a3a50; color: #8899aa; }
[data-theme="dark"] .cal-today { background: #1a3655 !important; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a4f6b; }
[data-theme="dark"] .note-meta { border-color: #2a3a50; }
[data-theme="dark"] .empty-state { color: #6b8299; }

/* ============================================================
   CALENDAR
   ============================================================ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--slate-200); border-radius: var(--radius); overflow: hidden; width: 100%; max-width: 100%; }
.cal-header { padding: 8px 4px; font-size: 11px; font-weight: 600; text-align: center; color: var(--slate-500); background: var(--slate-50); border-bottom: 1px solid var(--slate-200); }
.cal-cell { min-height: 90px; padding: 4px; border: 1px solid var(--slate-100); cursor: pointer; transition: background 0.1s; position: relative; overflow: hidden; }
.cal-cell:hover { background: rgba(14,165,233,0.03); }
.cal-today { background: #eff6ff !important; }
.cal-today .cal-date { background: #0284c7; color: white; border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.cal-other { background: var(--slate-50); opacity: 0.5; }
.cal-date { font-size: 12px; font-weight: 500; color: var(--slate-600); display: inline-block; margin-bottom: 2px; }
.cal-event { font-size: 10px; font-weight: 500; padding: 1px 4px; margin: 1px 0; border-radius: 2px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cal-event:hover { opacity: 0.8; }
.cal-overflow { font-size: 10px; color: var(--slate-400); padding: 1px 4px; cursor: pointer; }

/* Mini calendar (dashboard widget) */
.mcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.mcal-hdr { font-size: 9px; color: var(--slate-400); text-align: center; padding: 2px; font-weight: 600; }
.mcal-cell { font-size: 11px; text-align: center; padding: 3px 2px; cursor: pointer; border-radius: 4px; position: relative; color: var(--slate-600); }
.mcal-cell:hover { background: var(--slate-50); }
.mcal-today { font-weight: 700; color: #0284c7; background: #eff6ff; }
.mcal-dot { position: absolute; bottom: 1px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; }
