@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #0f1117;
  --bg2: #161b27;
  --bg3: #1e2537;
  --bg4: #252d42;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --text: #f0f2f8;
  --text2: #8b94b0;
  --text3: #5a6480;
  --accent: #4f8ef7;
  --accent2: #3d6fd4;
  --success: #34c97e;
  --warning: #f5a623;
  --danger: #f05252;
  --purple: #9b7ef8;
  --teal: #2dd4bf;
  --font-head: 'Space Grotesk', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); font-size: 14px; min-height: 100vh; overflow-x: hidden; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 99px; }

/* ── LAYOUT ── */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex-shrink: 0; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; overflow-y: auto; }
.sidebar-logo { padding: 24px 20px 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo .brand { font-family: var(--font-head); font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.3px; }
.sidebar-logo .brand span { color: var(--accent); }
.sidebar-logo .tagline { font-size: 11px; color: var(--text3); margin-top: 2px; }
.nav-section { padding: 16px 12px 8px; }
.nav-section-label { font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text3); padding: 0 8px; margin-bottom: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); cursor: pointer; color: var(--text2); font-size: 13.5px; font-weight: 400; transition: all 0.15s; text-decoration: none; margin-bottom: 2px; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: rgba(79,142,247,0.15); color: var(--accent); font-weight: 500; }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item .nav-badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px; }
.sidebar-user { margin-top: auto; padding: 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--text3); }

/* ── MAIN ── */
.main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { background: var(--bg2); border-bottom: 1px solid var(--border); padding: 0 28px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-family: var(--font-head); font-size: 17px; font-weight: 600; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.content { padding: 28px; flex: 1; }

/* ── CARDS ── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.card-title { font-family: var(--font-head); font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.card-title .sub { font-size: 12px; font-weight: 400; color: var(--text3); }

/* ── KPI CARDS ── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; position: relative; overflow: hidden; }
.kpi-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; }
.kpi-card.blue::before { background: var(--accent); }
.kpi-card.green::before { background: var(--success); }
.kpi-card.yellow::before { background: var(--warning); }
.kpi-card.red::before { background: var(--danger); }
.kpi-card.purple::before { background: var(--purple); }
.kpi-card.teal::before { background: var(--teal); }
.kpi-label { font-size: 11px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.kpi-value { font-family: var(--font-head); font-size: 26px; font-weight: 700; color: var(--text); }
.kpi-sub { font-size: 11px; margin-top: 5px; }
.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; font-family: var(--font-body); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); }
.btn-ghost { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg4); }
.btn-danger { background: rgba(240,82,82,0.15); color: var(--danger); border: 1px solid rgba(240,82,82,0.3); }
.btn-danger:hover { background: rgba(240,82,82,0.25); }
.btn-success { background: rgba(52,201,126,0.15); color: var(--success); border: 1px solid rgba(52,201,126,0.3); }
.btn-success:hover { background: rgba(52,201,126,0.25); }
.btn-warning { background: rgba(245,166,35,0.15); color: var(--warning); border: 1px solid rgba(245,166,35,0.3); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-label .hint { font-weight: 400; color: var(--text3); margin-left: 4px; }
.form-control { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 13px; font-family: var(--font-body); padding: 9px 12px; outline: none; transition: border-color 0.15s; }
.form-control:focus { border-color: var(--accent); background: var(--bg4); }
.form-control.error { border-color: var(--danger); }
.form-control option { background: var(--bg3); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }
.field-error { font-size: 11px; color: var(--danger); margin-top: 4px; display: none; }
.field-error.show { display: block; }

/* ── INPUT GROUP ── */
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .input-addon { background: var(--bg4); border: 1px solid var(--border); border-left: none; border-radius: 0 var(--radius) var(--radius) 0; padding: 9px 12px; font-size: 13px; color: var(--text2); display: flex; align-items: center; white-space: nowrap; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text3); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 500; }
.badge-draft { background: rgba(139,148,176,0.15); color: var(--text2); }
.badge-open { background: rgba(79,142,247,0.15); color: var(--accent); }
.badge-partial { background: rgba(155,126,248,0.15); color: var(--purple); }
.badge-ordered { background: rgba(52,201,126,0.15); color: var(--success); }
.badge-lost { background: rgba(240,82,82,0.15); color: var(--danger); }
.badge-cancelled { background: rgba(139,148,176,0.15); color: var(--text2); }
.badge-expired { background: rgba(245,166,35,0.15); color: var(--warning); }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.65); backdrop-filter: blur(4px); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-lg); padding: 28px; width: 560px; max-width: 100%; max-height: 90vh; overflow-y: auto; animation: modalIn 0.2s ease; }
.modal-lg { width: 720px; }
.modal-xl { width: 900px; }
@keyframes modalIn { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.modal-title { font-family: var(--font-head); font-size: 16px; font-weight: 600; }
.modal-subtitle { font-size: 12px; color: var(--text3); margin-top: 2px; }
.modal-close { width: 28px; height: 28px; border-radius: var(--radius); background: var(--bg3); border: 1px solid var(--border); cursor: pointer; color: var(--text2); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.modal-close:hover { color: var(--text); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ── PROGRESS ── */
.progress-wrap { background: var(--bg3); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; transition: width 0.5s ease; }
.progress-blue { background: var(--accent); }
.progress-green { background: var(--success); }
.progress-yellow { background: var(--warning); }
.progress-red { background: var(--danger); }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; background: var(--bg3); padding: 4px; border-radius: var(--radius); margin-bottom: 20px; }
.tab-btn { flex: 1; text-align: center; padding: 7px 12px; border-radius: 8px; cursor: pointer; font-size: 12.5px; font-weight: 500; color: var(--text2); transition: all 0.15s; }
.tab-btn.active { background: var(--bg2); color: var(--text); box-shadow: var(--shadow); }

/* ── TOAST ── */
#toast { position: fixed; bottom: 24px; right: 24px; background: var(--bg3); border: 1px solid var(--border2); border-radius: var(--radius); padding: 12px 18px; font-size: 13px; z-index: 9999; transform: translateY(80px); opacity: 0; transition: all 0.3s ease; max-width: 320px; display: flex; align-items: center; gap: 8px; }
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-color: var(--success); }
#toast.error { border-color: var(--danger); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text3); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: 15px; color: var(--text2); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ── GRID LAYOUTS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

/* ── FUNNEL ── */
.funnel-step { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.funnel-label { font-size: 12px; color: var(--text2); width: 110px; flex-shrink: 0; }
.funnel-bar-wrap { flex: 1; background: var(--bg3); border-radius: 4px; height: 26px; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 4px; display: flex; align-items: center; padding-left: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.funnel-count { font-size: 12px; color: var(--text2); width: 60px; text-align: right; flex-shrink: 0; }

/* ── INSIGHT CARDS ── */
.insight-card { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; display: flex; gap: 12px; align-items: flex-start; }
.insight-icon { font-size: 20px; flex-shrink: 0; }
.insight-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.insight-text strong { color: var(--accent); }

/* ── AGING / BAR ROWS ── */
.aging-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.aging-label { width: 100px; font-size: 12px; color: var(--text2); flex-shrink: 0; }
.aging-bar-wrap { flex: 1; background: var(--bg3); border-radius: 3px; height: 18px; overflow: hidden; }
.aging-bar { height: 100%; display: flex; align-items: center; padding-left: 8px; font-size: 11px; font-weight: 500; }
.aging-val { width: 80px; text-align: right; font-size: 12px; color: var(--text2); flex-shrink: 0; }

/* ── RANK ── */
.rank-1 { color: #f5a623; font-weight: 700; }
.rank-2 { color: #8b94b0; font-weight: 700; }
.rank-3 { color: #cd7f32; font-weight: 700; }

/* ── AVATAR ── */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #fff; flex-shrink: 0; }

/* ════════════════════════════════
   DATA ENTRY SPECIFIC STYLES
════════════════════════════════ */

/* Setup wizard */
.wizard-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.wizard-box { background: var(--bg2); border: 1px solid var(--border2); border-radius: 20px; width: 600px; max-width: 100%; padding: 40px; }
.wizard-steps { display: flex; gap: 0; margin-bottom: 36px; }
.wizard-step { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
.wizard-step:not(:last-child)::after { content: ''; position: absolute; top: 14px; left: 50%; width: 100%; height: 2px; background: var(--border2); z-index: 0; }
.wizard-step.done:not(:last-child)::after { background: var(--success); }
.wizard-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border2); background: var(--bg3); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--text3); position: relative; z-index: 1; }
.wizard-step.active .wizard-dot { border-color: var(--accent); background: var(--accent); color: #fff; }
.wizard-step.done .wizard-dot { border-color: var(--success); background: var(--success); color: #fff; }
.wizard-step-label { font-size: 11px; color: var(--text3); margin-top: 6px; text-align: center; }
.wizard-step.active .wizard-step-label { color: var(--accent); font-weight: 500; }
.wizard-content { min-height: 220px; }
.wizard-title { font-family: var(--font-head); font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.wizard-desc { font-size: 14px; color: var(--text2); margin-bottom: 24px; line-height: 1.6; }

/* Data entry hub */
.entry-hub { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.entry-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px 20px; cursor: pointer; transition: all 0.2s; position: relative; overflow: hidden; text-align: center; }
.entry-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(79,142,247,0.15); }
.entry-card.primary { border-color: rgba(79,142,247,0.4); background: rgba(79,142,247,0.06); }
.entry-card .ec-icon { font-size: 36px; margin-bottom: 12px; }
.entry-card .ec-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.entry-card .ec-desc { font-size: 12px; color: var(--text3); line-height: 1.5; }
.entry-card .ec-badge { position: absolute; top: 12px; right: 12px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; }
.entry-card.primary .ec-badge { background: var(--success); }

/* Step indicator inside forms */
.step-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.step-info h3 { font-family: var(--font-head); font-size: 15px; font-weight: 600; }
.step-info p { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* Quick add panel */
.quick-add-bar { background: linear-gradient(135deg, rgba(79,142,247,0.12) 0%, rgba(155,126,248,0.08) 100%); border: 1px solid rgba(79,142,247,0.25); border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.quick-add-bar .qa-text h3 { font-family: var(--font-head); font-size: 15px; font-weight: 600; }
.quick-add-bar .qa-text p { font-size: 12px; color: var(--text2); margin-top: 3px; }
.quick-add-bar .qa-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* Inline row for bulk-like manual entry */
.inline-entry-row { display: grid; grid-template-columns: 2fr 1.5fr 1.5fr 1.2fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 8px; padding: 10px; background: var(--bg3); border-radius: var(--radius); }

/* CSV import area */
.drop-zone { border: 2px dashed var(--border2); border-radius: var(--radius-lg); padding: 40px 24px; text-align: center; transition: all 0.2s; cursor: pointer; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: rgba(79,142,247,0.05); }
.drop-zone .dz-icon { font-size: 40px; margin-bottom: 12px; }
.drop-zone h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.drop-zone p { font-size: 13px; color: var(--text3); }

/* Preview table for CSV */
.csv-preview { max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.csv-preview table th, .csv-preview table td { padding: 7px 10px; font-size: 12px; }

/* Status selector (visual) */
.status-selector { display: flex; flex-wrap: wrap; gap: 8px; }
.status-opt { padding: 6px 14px; border-radius: 99px; border: 1.5px solid var(--border2); font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.15s; color: var(--text2); }
.status-opt:hover { border-color: var(--text2); color: var(--text); }
.status-opt.selected-Draft { background: rgba(139,148,176,0.2); border-color: var(--text2); color: var(--text); }
.status-opt.selected-Open { background: rgba(79,142,247,0.2); border-color: var(--accent); color: var(--accent); }
.status-opt.selected-Partially\ Ordered { background: rgba(155,126,248,0.2); border-color: var(--purple); color: var(--purple); }
.status-opt.selected-Ordered { background: rgba(52,201,126,0.2); border-color: var(--success); color: var(--success); }
.status-opt.selected-Lost { background: rgba(240,82,82,0.2); border-color: var(--danger); color: var(--danger); }
.status-opt.selected-Cancelled { background: rgba(139,148,176,0.2); border-color: var(--text2); color: var(--text2); }
.status-opt.selected-Expired { background: rgba(245,166,35,0.2); border-color: var(--warning); color: var(--warning); }

/* Summary box after save */
.save-summary { background: rgba(52,201,126,0.08); border: 1px solid rgba(52,201,126,0.3); border-radius: var(--radius); padding: 16px; margin-top: 16px; display: none; }
.save-summary.show { display: block; }

/* Record count pill */
.record-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--bg3); border: 1px solid var(--border); border-radius: 99px; padding: 4px 10px; font-size: 12px; color: var(--text2); }
.record-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

/* Checklist */
.checklist { display: flex; flex-direction: column; gap: 10px; }
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg3); border-radius: var(--radius); border: 1px solid var(--border); }
.checklist-item .ci-icon { font-size: 20px; }
.checklist-item .ci-text { flex: 1; }
.checklist-item .ci-text strong { font-size: 13px; display: block; }
.checklist-item .ci-text span { font-size: 11px; color: var(--text3); }
.checklist-item .ci-count { font-size: 13px; font-weight: 600; color: var(--accent); }
.checklist-item .ci-action { flex-shrink: 0; }
.checklist-item.done { border-color: rgba(52,201,126,0.25); }
.checklist-item.done .ci-icon { filter: none; }

/* Chart containers */
.chart-container { position: relative; width: 100%; }

/* Print */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; color-adjust: exact; }
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { margin-left: 0; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ddd; background: #fff; }
  .kpi-card { border: 1px solid #ddd; background: #f9f9f9; }
  .kpi-value, .card-title { color: #000; }
  .kpi-label, .kpi-sub { color: #555; }
  td, th { color: #000; border-color: #ddd; }
}

/* ── MOBILE MENU TOGGLE (hidden on desktop) ── */
.menu-toggle {
  display: none;
  width: 36px; height: 36px; flex-shrink: 0;
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 18px; line-height: 1; cursor: pointer;
  align-items: center; justify-content: center; margin-right: 10px;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 99; opacity: 0; transition: opacity 0.2s ease;
}
.sidebar-overlay.show { display: block; opacity: 1; }

/* Responsive */
@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(2,1fr); } .entry-hub { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-1-2, .grid-2-1 { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar {
    transform: translateX(-260px);
    transition: transform 0.25s ease;
    z-index: 200;
    width: 260px;
    box-shadow: 8px 0 32px rgba(0,0,0,0.4);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .entry-hub { grid-template-columns: 1fr; }

  .topbar { padding: 0 12px; height: 56px; }
  .topbar-title { font-size: 15px; }
  .topbar-actions { gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; max-width: 55vw; }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions .btn { padding: 7px 10px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }

  .content { padding: 14px; }
  .card { padding: 14px; border-radius: var(--radius); }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 20px; }

  .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 10px; }
  .inline-entry-row { grid-template-columns: 1fr; }

  .modal { padding: 18px; width: 100% !important; border-radius: var(--radius); }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

  .wizard-box { padding: 22px; }
  .quick-add-bar { flex-direction: column; align-items: stretch; text-align: center; }

  .login-card { padding: 28px 22px; }

  .pos-layout { grid-template-columns: 1fr !important; }
  .pos-layout > div[style*="position:sticky"] { position: static !important; }
  #pos-productGrid { max-height: 50vh !important; }

  /* catch inline two-column grids used across expenses/finance/quotation/PO/CSV-import forms */
  [style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar-actions { max-width: 45vw; }
  .topbar-actions .btn span.btn-text { display: none; }
}

/* ══════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════ */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg1);
  background-image: radial-gradient(ellipse at 60% 20%, rgba(79,142,247,0.08) 0%, transparent 60%),
                    radial-gradient(ellipse at 20% 80%, rgba(155,126,248,0.06) 0%, transparent 60%);
}
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-brand { font-family: var(--font-head); font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.login-brand span { color: var(--accent); }
.pro-badge { font-size: 10px; background: var(--accent); color: #fff; padding: 2px 7px; border-radius: 5px; margin-left: 6px; vertical-align: middle; font-weight: 700; }
.login-tagline { font-size: 13px; color: var(--text3); margin-top: 4px; }
.login-error { background: rgba(240,82,82,0.12); border: 1px solid rgba(240,82,82,0.3); color: #f88; border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }
.login-hint { margin-top: 20px; padding: 14px; background: var(--bg3); border-radius: 10px; font-size: 12px; color: var(--text3); line-height: 1.8; }

/* ══════════════════════════════════════════
   EXTRA UTILITY CLASSES
══════════════════════════════════════════ */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 10px; }
.alert-danger  { background: rgba(240,82,82,0.12); border: 1px solid rgba(240,82,82,0.25); color: #f88; }
.alert-warning { background: rgba(245,166,35,0.12); border: 1px solid rgba(245,166,35,0.25); color: #f5a623; }
.alert-success { background: rgba(52,201,126,0.12); border: 1px solid rgba(52,201,126,0.25); color: #34c97e; }
.alert-info    { background: rgba(79,142,247,0.10); border: 1px solid rgba(79,142,247,0.25); color: #7ab8ff; }

.badge-partial { background: rgba(45,212,191,0.15); color: #2dd4bf; border: 1px solid rgba(45,212,191,0.2); }

.btn-success { background: rgba(52,201,126,0.15); color: #34c97e; border: 1px solid rgba(52,201,126,0.3); }
.btn-success:hover { background: rgba(52,201,126,0.25); }

.modal-subtitle { font-size: 12px; color: var(--text3); margin-top: 2px; }

.kpi-card.teal  { --card-accent: #2dd4bf; }
.kpi-card.teal  { border-left: 3px solid #2dd4bf; }
.kpi-card.purple{ border-left: 3px solid #9b7ef8; }

/* ══════════════════════════════════════════
   QUOTATION MODULE STYLES
══════════════════════════════════════════ */

/* Item search results */
#q-itemResults div:hover { background: var(--bg3) !important; }

/* Line item table rows */
#q-lineBody tr { transition: background 0.1s; }
#q-lineBody tr:hover { background: var(--bg3); }
#q-lineBody input.form-control {
  background: transparent;
  border-color: transparent;
  padding: 4px 8px;
  transition: border-color 0.15s, background 0.15s;
}
#q-lineBody input.form-control:focus,
#q-lineBody input.form-control:hover {
  background: var(--bg2);
  border-color: var(--border);
}

/* Modal full-width on smaller screens */
@media (max-width: 700px) {
  #modalQuotation .modal { width: 100% !important; }
}

/* Print: hide UI chrome */
@media print {
  .sidebar, .topbar, .no-print, .modal-overlay { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
}

/* tab-btn active state (in case not defined) */
.tab-btn.active {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
}

/* Supplier ledger ta-r */
.ta-r { text-align: right !important; }
