/* ═══════════════════════════════════════════════════════════════════════════
   Subito B2B — Global Styles
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #64748b;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #2563eb;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

/* ─── Layout ──────────────────────────────────────────────────────────────── */

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; font-size: 16px;
}

.sidebar-logo .logo-text {
  font-size: 16px; font-weight: 700; color: #fff;
}
.sidebar-logo .logo-sub {
  font-size: 11px; color: var(--sidebar-text); margin-top: -2px;
}

.sidebar-section {
  padding: 16px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #475569;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 6px;
  margin: 2px 8px;
  font-size: 13.5px;
  transition: background .15s, color .15s;
}

.sidebar nav a:hover {
  background: #334155;
  color: #fff;
}

.sidebar nav a.active {
  background: var(--primary);
  color: #fff;
}

.sidebar nav a .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid #334155;
}

.sidebar-footer a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  transition: background .15s;
}
.sidebar-footer a:hover { background: #334155; color: #fff; }

.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ──────────────────────────────────────────────────────────────── */

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.lang-switcher a {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--secondary);
  border: 1px solid var(--border);
  transition: all .15s;
}
.lang-switcher a.active, .lang-switcher a:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.user-badge {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text);
}
.user-badge .avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.role-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.role-admin { background: #fef3c7; color: #92400e; }
.role-supplier { background: #dcfce7; color: #166534; }
.role-salesperson { background: #dbeafe; color: #1e40af; }
.role-client { background: #f3e8ff; color: #6b21a8; }

/* ─── Page body ───────────────────────────────────────────────────────────── */

.page-body {
  padding: 24px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.page-header .page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Cards ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2, .card-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.card-body { padding: 20px; }

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ─── Stat cards ──────────────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.purple { background: #f3e8ff; color: #7c3aed; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }

.stat-info .stat-value {
  font-size: 28px; font-weight: 700; color: var(--text); line-height: 1;
}
.stat-info .stat-label {
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }

.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; color: #fff; }

.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }

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

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }
.btn-icon { padding: 7px; }

/* ─── Tables ──────────────────────────────────────────────────────────────── */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* ─── Badges ──────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-draft { background: #f1f5f9; color: #475569; }
.badge-sent { background: #dbeafe; color: #1e40af; }
.badge-accepted { background: #dcfce7; color: #166534; }
.badge-new { background: #fef3c7; color: #92400e; }
.badge-in_progress { background: #dbeafe; color: #1e40af; }
.badge-reserved { background: #f3e8ff; color: #6b21a8; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-awaiting_client { background: #ffedd5; color: #9a3412; }
.badge-needs_revision { background: #fee2e2; color: #991b1b; }

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* ─── Forms ───────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 5px;
}

label .required { color: var(--danger); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

textarea { resize: vertical; min-height: 80px; }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.form-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

/* ─── Alerts / Flash ──────────────────────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-success { background: #dcfce7; color: #166534; border-left: 4px solid #16a34a; }
.alert-danger   { background: #fee2e2; color: #991b1b; border-left: 4px solid #dc2626; }
.alert-warning  { background: #fef3c7; color: #92400e; border-left: 4px solid #d97706; }
.alert-info     { background: #dbeafe; color: #1e40af; border-left: 4px solid #2563eb; }

/* ─── Filters bar ─────────────────────────────────────────────────────────── */

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filters select, .filters input[type="text"] {
  width: auto;
  min-width: 140px;
  padding: 6px 10px;
  font-size: 13px;
}

/* ─── Catalog (client product list) ──────────────────────────────────────── */

.catalog-filter-bar {
  position: sticky;
  top: 60px;
  z-index: 100;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}

.catalog-cat-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
  flex-wrap: nowrap;
}
.catalog-cat-pills::-webkit-scrollbar { display: none; }

.cat-pill-stock { border-color: #16a34a !important; color: #15803d !important; }
.cat-pill-stock.active { background: #dcfce7 !important; color: #15803d !important; border-color: #16a34a !important; }

.product-card-img-link { display: block; text-decoration: none; }
.product-card-name-link { text-decoration: none; color: inherit; }

.stock-pill {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
}
.stock-pill-now  { background: #dcfce7; color: #166534; }
.stock-pill-soon { background: #fef3c7; color: #92400e; }

.catalog-item.in-cart {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,.14), var(--shadow-md);
}

.catalog-qty-wrap { display: flex; align-items: center; gap: 4px; }

.qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 5px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text);
  transition: background .15s, border-color .15s;
}
.qty-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.catalog-add-btn { flex-shrink: 0; min-width: 72px; }

/* ─── Product cards ───────────────────────────────────────────────────────── */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}

.product-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.product-card-img {
  width: 100%;
  height: 180px;
  background: #f8f8f8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 36px;
}

.product-card-img img {
  max-width: 100%;
  max-height: 180px;
  object-fit: contain;
  padding: 4px;
}

.product-card-body {
  padding: 14px;
}

.product-card-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card-cat {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.product-card-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.product-card-price-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.product-card-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
}

/* ─── Price breakdown table ───────────────────────────────────────────────── */

.price-table {
  width: 100%;
  border-collapse: collapse;
}
.price-table td {
  padding: 6px 0;
  font-size: 13px;
}
.price-table td:last-child { text-align: right; font-weight: 500; }
.price-table tr.divider td { border-top: 1px solid var(--border); padding-top: 8px; }
.price-table tr.total td { font-weight: 700; font-size: 15px; color: var(--primary); }

/* ─── Image upload ────────────────────────────────────────────────────────── */

.image-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.image-upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.image-upload-area input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

.image-preview-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.image-preview-item {
  position: relative;
  width: 100px; height: 100px;
}

.image-preview-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.image-preview-item .remove-btn {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  background: var(--danger);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  cursor: pointer;
  border: none;
}

/* ─── Offer builder ───────────────────────────────────────────────────────── */

.offer-product-selector {
  display: flex;
  flex-direction: column;
  max-height: 52vh;
  overflow-y: auto;
}

/* ─── Offer item rows ─────────────────────────────────────────────────────── */

.offer-item-grid {
  display: grid;
  grid-template-columns: 1fr 68px 110px 110px 1fr 32px;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
}

.offer-item-name {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.offer-item-qty  { width: 100%; }
.offer-item-price { width: 100%; }
.offer-item-notes { width: 100%; }

.offer-item-pieces {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.stock-item-grid {
  display: grid;
  grid-template-columns: 1fr 72px 110px 140px 1fr 32px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.stock-item-grid:last-child { border-bottom: none; }

.product-selector-filters {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.product-selector-filters input[type="text"] {
  width: 100%;
}

.product-selector-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-selector-tools select {
  flex: 1;
  padding: 5px 8px;
  font-size: 12px;
}

.product-selector-tools label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  margin: 0;
}

.product-selector-cats {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 5px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}

.cat-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: background .1s, border-color .1s;
  white-space: nowrap;
}

.cat-pill:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.cat-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.cat-pill.active .cat-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

.cat-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 15px;
  padding: 0 4px;
  background: var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
}

.product-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}

.product-select-item:last-child { border-bottom: none; }
.product-select-item:hover { background: var(--primary-light); }
.product-select-item.selected { background: var(--primary-light); }
.product-select-item.selected .psel-name { color: var(--primary); }

.product-select-item input[type="checkbox"] {
  width: 15px; height: 15px;
  min-width: 15px;
  cursor: pointer;
  accent-color: var(--primary);
}

.psel-thumb {
  width: 36px; height: 36px;
  object-fit: contain;
  background: #f8f8f8;
  border: 1px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  padding: 2px;
}

.psel-thumb-placeholder {
  width: 34px; height: 34px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.psel-name {
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.psel-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.psel-cat-tag {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 5px;
  font-size: 10px;
  line-height: 16px;
}

.psel-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 1px 9px;
  border-radius: 12px;
}

/* ─── Product page category pills ────────────────────────────────────────── */

.product-cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.product-cat-pills .cat-pill {
  text-decoration: none;
  color: var(--text);
}

.product-cat-pills .cat-pill:hover {
  color: var(--primary);
}

.product-cat-pills .cat-pill.active {
  color: #fff;
}

/* ─── Login page ──────────────────────────────────────────────────────────── */

.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-circle {
  width: 60px; height: 60px;
  background: var(--primary);
  border-radius: 16px;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 28px; font-weight: 900; color: #fff;
  margin-bottom: 12px;
}

.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); margin: 0; }
.login-logo p { font-size: 13px; color: var(--text-muted); margin: 4px 0 0; }

/* ─── Tabs ────────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  gap: 4px;
}

.tab {
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  text-decoration: none;
  transition: color .15s, border-color .15s;
}

.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ─── Empty state ─────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.empty-state p { font-size: 13px; margin: 0 0 16px; }

/* ─── Modals ──────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }

/* ─── Checkbox toggle ─────────────────────────────────────────────────────── */

.toggle-wrapper { display: flex; align-items: center; gap: 10px; }
.toggle {
  position: relative; width: 44px; height: 24px;
  background: var(--border); border-radius: 12px; cursor: pointer;
  transition: background .2s;
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: ''; position: absolute;
  width: 18px; height: 18px; background: #fff;
  border-radius: 50%; top: 3px; left: 3px;
  transition: left .2s;
}
.toggle.on::after { left: 23px; }

/* ─── Misc utils ──────────────────────────────────────────────────────────── */

.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.monospace { font-family: monospace; }
.nowrap { white-space: nowrap; }

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

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 8px; }
.mb-1 { margin-bottom: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }

.hidden { display: none !important; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ─── Sidebar overlay (mobile) ────────────────────────────────────────────── */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

.sidebar-toggle-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

/* Tablet (769px–1024px) */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .page-header { flex-wrap: wrap; gap: 10px; }
}

/* Mobile (≤768px) */
@media (max-width: 768px) {
  /* Sidebar */
  .sidebar {
    transform: translateX(-240px);
    z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle-btn { display: inline-flex; align-items: center; }

  /* Layout */
  .main-content { margin-left: 0; }
  .page-body { padding: 12px; }

  /* Topbar */
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 14px; }
  .user-badge > div:last-child { display: none; }  /* hide name/role, keep avatar */
  .lang-switcher { display: none; }

  /* Grids */
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }

  /* Tables: horizontal scroll */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table { min-width: 560px; }

  /* Page header */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header > *:last-child { width: 100%; }
  .page-header .btn { width: 100%; justify-content: center; }

  /* Cards */
  .card { border-radius: 8px; }

  /* Filters row */
  .filters { flex-direction: column; }
  .filters select, .filters input { width: 100%; }

  /* Login card */
  .login-card { margin: 12px; padding: 24px 20px; border-radius: 12px; }

  /* Catalog sticky cart */
  .catalog-cart-bar { padding: 10px 12px; }
  .catalog-cart-items { max-height: 30vh; }

  /* Modal */
  .modal { margin: 12px; width: calc(100% - 24px); }

  /* Offer/order detail tables */
  .nowrap { white-space: normal; }

  /* Newsletter composer */
  .nl-grid { grid-template-columns: 1fr !important; }
}

/* ─── Print (offer PDF preview) ──────────────────────────────────────────── */

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .page-body { padding: 0; }
}
