/* =============================================
   QUOTATION SYSTEM — Shared Design System
   Dark Theme + Modern UI
   ============================================= */

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

/* ---------- TOKENS ---------- */
:root {
  --primary: #4F46E5;
  --primary-light: #6366F1;
  --primary-dark: #3730A3;
  --secondary: #06B6D4;
  --accent: #F59E0B;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  --bg: #0F172A;
  --surface: #1E293B;
  --surface2: #273044;
  --surface3: #2E3A50;
  --border: #334155;
  --border-light: #3E4F68;

  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --text-dim: #64748B;

  --gradient: linear-gradient(135deg, #4F46E5, #06B6D4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --sidebar-w: 260px;
  --topbar-h: 64px;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Sarabun', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}
a { color: var(--primary-light); text-decoration: none; }
input, select, textarea, button { font-family: inherit; }
img { max-width: 100%; }

/* ---------- LAYOUT ---------- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  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;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand .brand-icon {
  width: 40px; height: 40px;
  background: var(--gradient);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; color: #fff;
  flex-shrink: 0;
}
.sidebar-brand .brand-name {
  font-size: 1rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}
.sidebar-brand .brand-sub {
  font-size: 0.7rem;
  color: var(--text-dim);
  -webkit-text-fill-color: var(--text-dim);
}

.sidebar-nav {
  padding: 12px;
}
.sidebar-nav h5 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  padding: 8px 8px 4px;
  margin-top: 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.nav-link i { width: 18px; text-align: center; font-size: 0.9rem; }
.nav-link:hover { background: var(--surface2); color: var(--text); }
.nav-link.active {
  background: rgba(79,70,229,0.15);
  color: var(--primary-light);
  font-weight: 600;
}

.sidebar-stores {
  flex: 1;
  padding: 12px;
  border-top: 1px solid var(--border);
  overflow-y: auto;
}
.sidebar-stores h5 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  padding: 4px 8px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-stores h5 a {
  font-size: 0.75rem;
  color: var(--primary-light);
  letter-spacing: 0;
  text-transform: none;
}

.store-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.store-item:hover { background: var(--surface2); color: var(--text); }
.store-item.active {
  background: rgba(6,182,212,0.12);
  color: var(--secondary);
  font-weight: 600;
}
.store-item .store-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.store-item.active .store-dot { background: var(--secondary); }

/* ---------- MAIN ---------- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- TOPBAR ---------- */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 1.25rem;
  font-weight: 700;
  flex: 1;
}
.topbar-title span { font-size: 0.85rem; color: var(--text-muted); font-weight: 400; margin-left: 8px; }

/* ---------- PAGE CONTENT ---------- */
.page-content {
  flex: 1;
  padding: 28px;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
}
.btn i { font-size: 0.85rem; }

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79,70,229,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(79,70,229,0.5); }

.btn-success {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(16,185,129,0.5); }

.btn-warning {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #fff;
  box-shadow: 0 4px 12px rgba(245,158,11,0.35);
}
.btn-warning:hover { transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239,68,68,0.35);
}
.btn-danger:hover { transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--surface2); color: var(--text); border-color: var(--border-light); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  padding: 6px 10px;
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }
.btn-icon-sm { padding: 5px; width: 28px; height: 28px; justify-content: center; }

/* ---------- CARDS ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 20px; }
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i { color: var(--primary-light); }

/* ---------- STAT CARDS ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.blue { background: rgba(79,70,229,0.15); color: var(--primary-light); }
.stat-icon.cyan { background: rgba(6,182,212,0.15); color: var(--secondary); }
.stat-icon.green { background: rgba(16,185,129,0.15); color: var(--success); }
.stat-icon.amber { background: rgba(245,158,11,0.15); color: var(--warning); }

.stat-info .stat-label { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 2px; }
.stat-info .stat-value { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.stat-info .stat-sub { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }

/* ---------- BADGES ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-draft    { background: rgba(100,116,139,0.2); color: #94A3B8; border: 1px solid rgba(100,116,139,0.3); }
.badge-sent     { background: rgba(59,130,246,0.15); color: #60A5FA; border: 1px solid rgba(59,130,246,0.3); }
.badge-approved { background: rgba(16,185,129,0.15); color: #34D399; border: 1px solid rgba(16,185,129,0.3); }
.badge-rejected { background: rgba(239,68,68,0.15);  color: #F87171; border: 1px solid rgba(239,68,68,0.3); }

/* ---------- FILTER BAR ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  flex: 1;
  min-width: 200px;
}
.search-box i { color: var(--text-dim); font-size: 0.85rem; }
.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'Sarabun', sans-serif;
  font-size: 0.875rem;
  width: 100%;
}
.search-box input::placeholder { color: var(--text-dim); }

.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Sarabun', sans-serif;
  font-size: 0.875rem;
  padding: 9px 14px;
  outline: none;
  cursor: pointer;
  min-width: 140px;
}
.filter-select:focus { border-color: var(--primary-light); }

/* ---------- DATA TABLE ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table thead {
  background: linear-gradient(135deg, rgba(79,70,229,0.12), rgba(6,182,212,0.08));
  border-bottom: 1px solid var(--border);
}
.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  background: var(--surface);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface2); }
.data-table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
}
.data-table .td-actions { display: flex; gap: 6px; }
.data-table .doc-num { font-weight: 700; color: var(--primary-light); }
.data-table .amount { font-weight: 700; color: var(--text); }
.data-table .store-tag {
  font-size: 0.75rem;
  background: rgba(6,182,212,0.1);
  color: var(--secondary);
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 0.95rem; margin-bottom: 20px; }

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-title i { color: var(--primary-light); }
.modal-close {
  background: none; border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- FORMS ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.form-group label span { color: var(--danger); }

.form-control {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Sarabun', sans-serif;
  font-size: 0.9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-control::placeholder { color: var(--text-dim); }
.form-control.error { border-color: var(--danger); }

textarea.form-control { resize: vertical; min-height: 80px; line-height: 1.6; }
select.form-control { cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ---------- STORE CARDS ---------- */
.stores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.store-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
  position: relative;
}
.store-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-light); }
.store-card-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.store-avatar {
  width: 52px; height: 52px;
  background: var(--gradient);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  flex-shrink: 0;
}
.store-card-name { font-size: 1rem; font-weight: 700; line-height: 1.2; }
.store-card-tagline { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }
.store-card-info { font-size: 0.8rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.store-card-info span { display: flex; align-items: center; gap: 6px; }
.store-card-info i { width: 14px; color: var(--primary-light); }
.store-card-stats {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 12px;
}
.store-stat { flex: 1; text-align: center; }
.store-stat-val { font-size: 1.1rem; font-weight: 800; color: var(--text); }
.store-stat-label { font-size: 0.7rem; color: var(--text-dim); }
.store-card-actions {
  position: absolute;
  top: 12px; right: 12px;
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.store-card:hover .store-card-actions { opacity: 1; }

/* ---------- ITEMS TABLE (editor) ---------- */
.items-table-wrap { border-radius: var(--radius-sm); border: 1px solid var(--border); overflow: hidden; }
.items-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.items-table thead { background: rgba(79,70,229,0.1); }
.items-table thead th {
  padding: 10px 12px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary-light);
  font-weight: 700;
  text-align: left;
}
.items-table thead th.center { text-align: center; }
.items-table thead th.right  { text-align: right; }
.items-table tbody tr { border-bottom: 1px solid var(--border); }
.items-table tbody tr:last-child { border-bottom: none; }
.items-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.items-table tbody td { padding: 8px 12px; vertical-align: middle; }

.t-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  color: var(--text);
  font-family: 'Sarabun', sans-serif;
  font-size: 0.875rem;
  padding: 4px 6px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
}
.t-input:focus { border-bottom-color: var(--primary-light); }
.t-input::placeholder { color: var(--text-dim); }
.t-input.tr { text-align: right; }
.row-total { color: var(--secondary); font-weight: 700; text-align: right; }
.del-row-btn {
  background: none; border: none;
  color: var(--text-dim);
  cursor: pointer; padding: 4px 8px;
  border-radius: 5px;
  transition: all 0.2s;
  font-size: 0.8rem;
}
.del-row-btn:hover { background: rgba(239,68,68,0.12); color: var(--danger); }

.add-row-btn {
  width: 100%;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-top: 10px;
  cursor: pointer;
  font-family: 'Sarabun', sans-serif;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}
.add-row-btn:hover { border-color: var(--primary-light); color: var(--primary-light); background: rgba(99,102,241,0.05); }

/* ---------- TOTALS ---------- */
.totals-panel {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.875rem;
}
.total-row:last-child { border-bottom: none; }
.total-row .lbl { color: var(--text-muted); }
.total-row .val { font-weight: 600; }
.total-row .pct-input {
  background: var(--surface3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: 'Sarabun', sans-serif;
  font-size: 0.8rem;
  padding: 3px 8px;
  width: 60px;
  text-align: right;
  outline: none;
  margin-right: 6px;
}
.grand-row {
  background: var(--gradient);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  box-shadow: 0 4px 16px rgba(79,70,229,0.3);
}
.grand-row .lbl { color: #fff; font-weight: 700; font-size: 0.95rem; }
.grand-row .val { color: #fff; font-weight: 800; font-size: 1.4rem; }

/* ---------- TOAST ---------- */
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { border-left: 3px solid var(--success); }
.toast-success i { color: var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-error i { color: var(--danger); }

/* ---------- QUOTATION VIEW (print) ---------- */
.q-view-header {
  background: var(--gradient);
  padding: 32px 40px;
  position: relative;
  overflow: hidden;
}
.q-view-header::before {
  content: '';
  position: absolute; top: -50px; right: -50px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.q-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.q-meta-block {
  padding: 24px 28px;
  border-right: 1px solid var(--border);
}
.q-meta-block:last-child { border-right: none; }
.q-meta-block h4 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.q-meta-block h4 i { color: var(--primary-light); }
.q-meta-row { margin-bottom: 6px; font-size: 0.875rem; }
.q-meta-row .lbl { font-size: 0.72rem; color: var(--text-dim); }
.q-meta-row .val { color: var(--text); font-weight: 500; }

/* ---------- ANIMATIONS ---------- */
.fade-in {
  animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.slide-in {
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .q-meta-grid { grid-template-columns: 1fr; }
  .q-meta-block { border-right: none; border-bottom: 1px solid var(--border); }
  .menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
  }
}
.menu-toggle { display: none; }

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ---------- PRINT ---------- */
@media print {
  .sidebar, .topbar, .topbar, .no-print { display: none !important; }
  .main { margin-left: 0 !important; }
  body { background: #fff !important; color: #1a1a2e; }
  .card, .q-view-header + * { border-color: #e0e0e0 !important; }
  .q-view-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .grand-row { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
