/* ==========================================================================
   FALCON — Console (Admin + Sales-Rep) Design-System layer
   Layered on top of style.css (tokens + buttons) and Bootstrap 5.
   Direction-neutral: uses CSS logical properties so ONE file powers both
   LTR (English) and RTL (Arabic). Arabic font swap lives in style-ar.css.
   ========================================================================== */

/* -------------------------------------------------------------------------- */
/* 0. Console-scoped tokens                                                    */
/* -------------------------------------------------------------------------- */
:root {
  --side-w: 268px;
  --side-w-collapsed: 82px;
  --top-h: 68px;
  --dash-gap: clamp(16px, 2.4vw, 28px);
  --card-radius: var(--r-lg);

  --info: #2563EB;
  --info-soft: #E7EEFE;
  --success-soft: #E3F4EC;
  --warning-soft: #FBF0D8;
  --danger-soft: #FBE6E4;
  --violet: #7A5AF8;
  --violet-soft: #ECE8FE;
}
[data-theme="dark"] {
  --info-soft: rgba(37,99,235,.16);
  --success-soft: rgba(30,158,98,.16);
  --warning-soft: rgba(201,136,10,.18);
  --danger-soft: rgba(210,58,46,.18);
  --violet-soft: rgba(122,90,248,.18);
}

/* Button extensions (layered on style.css .btn-fal) */
.btn-fal--ghost { background: var(--surface); color: var(--text); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn-fal--ghost:hover { border-color: var(--brand); color: var(--brand-text); background: var(--fal-50); transform: translateY(-2px); }
[data-theme="dark"] .btn-fal--ghost:hover { background: rgba(213,66,34,.12); }
.btn-fal--danger { background: var(--danger); color: #fff; }
.btn-fal--danger:hover { color: #fff; filter: brightness(.93); transform: translateY(-2px); box-shadow: var(--shadow); }

/* -------------------------------------------------------------------------- */
/* 1. App shell                                                                */
/* -------------------------------------------------------------------------- */
body.dash {
  background: var(--surface-2);
  overflow-x: hidden;
  min-height: 100vh;
}
.dash-shell { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.dash-side {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: var(--side-w);
  z-index: 1045;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-inline-end: 1px solid var(--line);
  transition: transform var(--t), width var(--t);
}
.dash-side__brand {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: .6rem;
  padding-inline: 22px;
  border-block-end: 1px solid var(--line);
  flex: 0 0 auto;
}
.dash-side__brand .brand-logo__word { font-size: 1.32rem; }
.dash-side__brand .brand-logo__mark { width: 30px; color: var(--brand); }
.dash-side__badge {
  font-family: var(--font-head);
  font-size: .58rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase;
  color: var(--on-brand); background: var(--brand-grad);
  padding: 3px 8px; border-radius: var(--r-pill); margin-inline-start: auto;
}
.dash-nav { flex: 1 1 auto; overflow-y: auto; padding: 16px 14px 24px; }
.dash-nav__group { margin-block-start: 18px; }
.dash-nav__group:first-child { margin-block-start: 4px; }
.dash-nav__label {
  display: block; font-size: .68rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-3);
  padding-inline: 14px; margin-block-end: 8px;
}
.dash-nav__link {
  position: relative;
  display: flex; align-items: center; gap: .8rem;
  padding: 11px 14px; margin-block-end: 3px;
  border-radius: var(--r);
  color: var(--text-2); font-weight: 600; font-size: .95rem;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.dash-nav__link .bi { font-size: 1.2rem; flex: 0 0 auto; width: 24px; text-align: center; }
.dash-nav__link:hover { background: var(--surface-2); color: var(--text); }
.dash-nav__link.active { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-brand); }
.dash-nav__link.active .bi { color: var(--on-brand); }
.dash-nav__badge {
  margin-inline-start: auto; font-size: .72rem; font-weight: 700;
  background: var(--brand); color: #fff; border-radius: var(--r-pill);
  min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.dash-nav__link.active .dash-nav__badge { background: rgba(255,255,255,.25); }

.dash-side__foot { flex: 0 0 auto; padding: 14px; border-block-start: 1px solid var(--line); }
.side-user {
  display: flex; align-items: center; gap: .7rem;
  padding: 8px 10px; border-radius: var(--r); background: var(--surface-2);
}
.side-user__av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.side-user__meta { min-width: 0; }
.side-user__name { font-weight: 700; font-size: .9rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user__role { font-size: .76rem; color: var(--text-3); }

/* --- Main column --- */
.dash-main {
  flex: 1 1 auto; min-width: 0;
  margin-inline-start: var(--side-w);
  display: flex; flex-direction: column;
  transition: margin var(--t);
}

/* --- Topbar --- */
.dash-top {
  position: sticky; top: 0; z-index: 1030;
  height: var(--top-h);
  display: flex; align-items: center; gap: .7rem;
  padding-inline: clamp(14px, 2.5vw, 28px);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-block-end: 1px solid var(--line);
}
.dash-burger { display: none; }
.dash-search {
  position: relative; flex: 1 1 auto; min-width: 0; max-width: 440px;
}
.dash-search .bi {
  position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.dash-search input {
  width: 100%; height: 42px;
  padding-inline: 42px 14px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: .92rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.dash-search input:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 4px var(--fal-50); }
[data-theme="dark"] .dash-search input:focus { box-shadow: 0 0 0 4px rgba(213,66,34,.18); }

.dash-top__actions { display: flex; align-items: center; gap: .35rem; margin-inline-start: auto; }
.top-btn {
  position: relative;
  width: 42px; height: 42px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; color: var(--text-2);
  font-size: 1.15rem; cursor: pointer; transition: background var(--t-fast), color var(--t-fast);
}
.top-btn:hover { background: var(--surface-2); color: var(--text); }
.top-btn__dot {
  position: absolute; top: 8px; inset-inline-end: 8px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
  border: 2px solid var(--surface);
}
.top-user {
  display: flex; align-items: center; gap: .55rem; padding: 5px 6px 5px 10px;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; transition: border-color var(--t-fast);
}
.top-user:hover { border-color: var(--line-strong); }
.top-user img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.top-user__name { font-size: .88rem; font-weight: 600; }

/* dropdown panels (notifications, user) */
.pop { position: relative; }
.pop__panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + 10px);
  width: min(340px, 86vw);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 8px; z-index: 1050;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--t-fast), transform var(--t-fast), visibility var(--t-fast);
}
.pop.open .pop__panel { opacity: 1; visibility: visible; transform: translateY(0); }
.pop__head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; }
.pop__head h6 { margin: 0; font-size: .95rem; }
.noti { display: flex; gap: .7rem; padding: 10px; border-radius: var(--r); transition: background var(--t-fast); }
.noti:hover { background: var(--surface-2); }
.noti__ic { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 1.05rem; }
.noti__t { font-size: .88rem; font-weight: 600; color: var(--text); line-height: 1.4; }
.noti__time { font-size: .76rem; color: var(--text-3); }
.pop__menu a { display: flex; align-items: center; gap: .6rem; padding: 10px 12px; border-radius: var(--r); color: var(--text-2); font-weight: 600; font-size: .9rem; }
.pop__menu a:hover { background: var(--surface-2); color: var(--text); }
.pop__menu a.danger:hover { background: var(--danger-soft); color: var(--danger); }
.pop__divider { height: 1px; background: var(--line); margin: 6px 4px; }

/* --- Content --- */
.dash-content { padding: var(--dash-gap); flex: 1 1 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin-block-end: var(--dash-gap); }
.page-head__main { min-width: 0; }
.page-head .crumb { display: flex; gap: .4rem; flex-wrap: wrap; font-size: .82rem; color: var(--text-3); margin-block-end: .35rem; list-style: none; padding: 0; }
.page-head .crumb a { color: var(--text-3); }
.page-head .crumb a:hover { color: var(--brand-text); }
.page-head h1 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0; }
.page-head p { color: var(--text-2); margin: .25rem 0 0; font-size: .95rem; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-inline-start: auto; }

/* -------------------------------------------------------------------------- */
/* 2. Cards / panels                                                           */
/* -------------------------------------------------------------------------- */
.card-fal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--card-radius); box-shadow: var(--shadow-sm);
}
.card-fal__head { display: flex; align-items: center; gap: .8rem; padding: 18px 20px; border-block-end: 1px solid var(--line); }
.card-fal__head h2, .card-fal__head h3 { margin: 0; font-size: 1.05rem; }
.card-fal__head .sub { font-size: .84rem; color: var(--text-3); font-weight: 500; }
.card-fal__tools { margin-inline-start: auto; display: flex; gap: .5rem; align-items: center; }
.card-fal__body { padding: 20px; }
.card-fal__body--flush { padding: 0; }

/* --- Stat cards --- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--dash-gap); margin-block-end: var(--dash-gap); }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--card-radius);
  padding: 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card__top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.stat-card__ic { width: 46px; height: 46px; border-radius: var(--r); display: grid; place-items: center; font-size: 1.4rem; }
.stat-card__val { font-family: var(--font-head); font-size: 2rem; font-weight: 800; line-height: 1.1; margin-block: 14px 2px; letter-spacing: -.02em; }
.stat-card__label { font-size: .9rem; color: var(--text-2); font-weight: 500; }
.stat-card__trend { display: inline-flex; align-items: center; gap: .25rem; font-size: .8rem; font-weight: 700; padding: 3px 8px; border-radius: var(--r-pill); margin-block-start: 12px; }
.trend-up { color: var(--success); background: var(--success-soft); }
.trend-down { color: var(--danger); background: var(--danger-soft); }
.trend-flat { color: var(--text-3); background: var(--surface-2); }

/* soft icon tints */
.ic-brand { background: var(--fal-50); color: var(--brand-text); }
.ic-info { background: var(--info-soft); color: var(--info); }
.ic-success { background: var(--success-soft); color: var(--success); }
.ic-warning { background: var(--warning-soft); color: var(--warning); }
.ic-danger { background: var(--danger-soft); color: var(--danger); }
.ic-violet { background: var(--violet-soft); color: var(--violet); }

/* -------------------------------------------------------------------------- */
/* 3. Charts (dependency-free SVG/CSS)                                          */
/* -------------------------------------------------------------------------- */
.chart-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: var(--dash-gap); margin-block-end: var(--dash-gap); }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }

.bars { display: flex; align-items: flex-end; gap: clamp(8px, 2vw, 20px); height: 220px; padding-block-start: 10px; }
.bars__col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars__track { width: 100%; max-width: 40px; height: 100%; display: flex; align-items: flex-end; }
.bars__bar { width: 100%; border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--brand-grad); transition: height 1s cubic-bezier(.4,0,.2,1); position: relative; }
.bars__bar--soft { background: var(--fal-100); }
[data-theme="dark"] .bars__bar--soft { background: var(--surface-3); }
.bars__x { font-size: .76rem; color: var(--text-3); font-weight: 600; }
.bars__val { font-size: .74rem; font-weight: 700; color: var(--text-2); }

.donut { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; justify-content: center; }
.donut svg { transform: rotate(-90deg); }
.donut__hole { font-family: var(--font-head); }
.legend { display: flex; flex-direction: column; gap: 10px; }
.legend__item { display: flex; align-items: center; gap: .55rem; font-size: .88rem; color: var(--text-2); font-weight: 600; }
.legend__dot { width: 12px; height: 12px; border-radius: 4px; flex: 0 0 auto; }

/* -------------------------------------------------------------------------- */
/* 4. Tables                                                                   */
/* -------------------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.dtable { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
table.dtable thead th {
  text-align: start; font-family: var(--font-head); font-size: .76rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
  padding: 14px 16px; border-block-end: 1px solid var(--line); white-space: nowrap; background: var(--surface-2);
}
table.dtable tbody td { padding: 14px 16px; border-block-end: 1px solid var(--line); color: var(--text); vertical-align: middle; }
table.dtable tbody tr { transition: background var(--t-fast); }
table.dtable tbody tr:hover { background: var(--surface-2); }
table.dtable tbody tr:last-child td { border-block-end: 0; }
.cell-strong { font-weight: 700; color: var(--text); }
.cell-muted { color: var(--text-3); font-size: .84rem; }
.cell-actions { display: flex; gap: .3rem; }
.cell-user { display: flex; align-items: center; gap: .6rem; }
.cell-user img, .avatar-xs { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.avatar-initials { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--fal-100); color: var(--brand-text); font-weight: 800; font-size: .8rem; flex: 0 0 auto; }
.thumb { width: 46px; height: 46px; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-3); flex: 0 0 auto; }

.icon-act {
  width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2); display: inline-grid; place-items: center;
  cursor: pointer; font-size: .95rem; transition: all var(--t-fast);
}
.icon-act:hover { border-color: var(--brand); color: var(--brand); background: var(--fal-50); }
.icon-act.danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }

/* -------------------------------------------------------------------------- */
/* 5. Badges / status pills                                                     */
/* -------------------------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .76rem; font-weight: 700; padding: 4px 11px; border-radius: var(--r-pill); white-space: nowrap; line-height: 1.5; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--new { color: var(--info); background: var(--info-soft); }
.pill--quoted { color: var(--success); background: var(--success-soft); }
.pill--pending { color: var(--warning); background: var(--warning-soft); }
.pill--approved { color: var(--success); background: var(--success-soft); }
.pill--rejected, .pill--disabled { color: var(--danger); background: var(--danger-soft); }
.pill--active, .pill--published { color: var(--success); background: var(--success-soft); }
.pill--draft { color: var(--text-3); background: var(--surface-3); }
.pill--role { color: var(--violet); background: var(--violet-soft); }
.pill--no-dot::before { display: none; }

/* -------------------------------------------------------------------------- */
/* 6. Forms                                                                    */
/* -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid .col-full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: .86rem; font-weight: 600; color: var(--text); }
.field .req { color: var(--danger); }
.field .hint { font-size: .78rem; color: var(--text-3); }
.control, .field input, .field select, .field textarea {
  width: 100%; height: 46px; padding-inline: 14px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  color: var(--text); font: inherit; font-size: .92rem; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input[type="checkbox"], .field input[type="radio"] { width: auto; height: auto; }
.field textarea { height: auto; min-height: 108px; padding-block: 12px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus, .control:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--fal-50);
}
[data-theme="dark"] .field input:focus, [data-theme="dark"] .field select:focus, [data-theme="dark"] .field textarea:focus { box-shadow: 0 0 0 4px rgba(213,66,34,.18); }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%2379828C' d='M4 6l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-inline-end: 40px; }
[dir="rtl"] .field select { background-position: left 14px center; padding-inline-end: 14px; padding-inline-start: 40px; }

.input-icon { position: relative; }
.input-icon > .bi { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.input-icon input { padding-inline-start: 42px; }

/* file / image dropzone */
.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--r);
  background: var(--surface-2); padding: 22px; text-align: center; cursor: pointer;
  color: var(--text-3); transition: border-color var(--t-fast), background var(--t-fast);
}
.dropzone:hover { border-color: var(--brand); background: var(--fal-50); color: var(--brand-text); }
.dropzone .bi { font-size: 1.8rem; display: block; margin-block-end: 6px; }
.dropzone strong { color: var(--text); }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch__track { width: 44px; height: 25px; border-radius: var(--r-pill); background: var(--line-strong); transition: background var(--t-fast); flex: 0 0 auto; }
.switch__track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t); }
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(19px); }
[dir="rtl"] .switch input:checked + .switch__track::after { transform: translateX(-19px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 4px var(--fal-50); }

/* qty stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.stepper button { width: 38px; height: 42px; border: 0; background: var(--surface-2); color: var(--text); font-size: 1.1rem; cursor: pointer; transition: background var(--t-fast); }
.stepper button:hover { background: var(--fal-50); color: var(--brand-text); }
.stepper input { width: 54px; height: 42px; border: 0; text-align: center; font: inherit; font-weight: 700; background: var(--surface); color: var(--text); }
.stepper input:focus { outline: none; }

/* -------------------------------------------------------------------------- */
/* 7. Tabs, segmented filters, pagination                                      */
/* -------------------------------------------------------------------------- */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 4px; gap: 2px; flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: .86rem; padding: 7px 16px; border-radius: var(--r-pill); cursor: pointer; transition: all var(--t-fast); white-space: nowrap; }
.seg button.active { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow-sm); }
/* Phones: the segmented filter drops to its own row as a full-width control with
   equal-width buttons (instead of sharing the head row and wrapping/scrolling). */
@media (max-width: 575.98px) {
  .card-fal__head { flex-wrap: wrap; }
  .card-fal__head .seg { width: 100%; margin-inline: 0; }
  .card-fal__head .seg button { flex: 1 1 0; padding-inline: 6px; font-size: .82rem; }
}

.tabs { display: flex; gap: 4px; border-block-end: 1px solid var(--line); margin-block-end: var(--dash-gap); overflow-x: auto; }
.tabs a { padding: 12px 18px; font-weight: 600; color: var(--text-2); border-block-end: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--brand-text); border-block-end-color: var(--brand); }

.pager { display: flex; align-items: center; gap: .3rem; justify-content: center; flex-wrap: wrap; padding: 16px; }
.pager a, .pager span { min-width: 38px; height: 38px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--text-2); font-weight: 600; font-size: .88rem; }
.pager a:hover { border-color: var(--brand); color: var(--brand-text); }
.pager .current { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager .disabled { opacity: .45; pointer-events: none; }
[dir="rtl"] .pager .bi-chevron-left, [dir="rtl"] .pager .bi-chevron-right { transform: scaleX(-1); }

/* -------------------------------------------------------------------------- */
/* 8. Catalog / cart (sales rep)                                               */
/* -------------------------------------------------------------------------- */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--dash-gap); }
.cat-card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--card-radius);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
}
.cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.cat-card__media { aspect-ratio: 16/10; background: var(--surface-3); position: relative; display: grid; place-items: center; overflow: hidden; }
.cat-card__media img { width: 100%; height: 100%; object-fit: cover; }
.cat-card__media .bi { font-size: 2.6rem; color: var(--brand); opacity: .55; }
.cat-card__body { padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.cat-card__body h3 { margin: 0; font-size: 1rem; }
.cat-card__count { font-size: .8rem; color: var(--text-3); }

.prod-item {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--card-radius); background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.prod-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.prod-item__info { min-width: 0; flex: 1 1 auto; }
.prod-item__info h3 { margin: 0 0 2px; font-size: .98rem; }
.prod-item__meta { font-size: .82rem; color: var(--text-3); }
.prod-item__act { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
/* Phones: stack the product row — name + details on top (full width, readable),
   then the qty stepper + a wide Add button on their own row. */
@media (max-width: 560px) {
  .prod-item { flex-wrap: wrap; align-items: stretch; }
  .prod-item__info { flex: 1 1 100%; }
  .prod-item__act { flex: 1 1 100%; flex-wrap: nowrap; justify-content: space-between; gap: 12px; }
  .prod-item__act .stepper { flex: 0 0 auto; }
  .prod-item__act [data-add-cart] { flex: 1 1 auto; justify-content: center; }
}

.cart-line { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-block-end: 1px solid var(--line); }
.cart-line:last-child { border-block-end: 0; }
.cart-summary { position: sticky; top: calc(var(--top-h) + var(--dash-gap)); }
.summary-row { display: flex; justify-content: space-between; gap: 1rem; padding: 8px 0; color: var(--text-2); font-size: .92rem; }
.summary-row--total { border-block-start: 1px solid var(--line); margin-block-start: 6px; padding-block-start: 14px; font-weight: 800; font-size: 1.05rem; color: var(--text); }

/* -------------------------------------------------------------------------- */
/* 9. Auth (login)                                                             */
/* -------------------------------------------------------------------------- */
body.auth { background: var(--surface-2); }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } }
.auth-hero {
  position: relative; overflow: hidden; color: #fff;
  background:
    linear-gradient(150deg, rgba(213,66,34,.34) 0%, rgba(22,15,11,.52) 40%, rgba(12,9,7,.92) 100%),
    url("../img/hero-hvac.jpg") center / cover no-repeat;
  padding: clamp(32px, 5vw, 64px);
  display: flex; flex-direction: column; justify-content: space-between;
}
@media (max-width: 900px) { .auth-hero { display: none; } }
/* extra fade so the photo stays subtle behind the text */
.auth-hero::before { content: ""; position: absolute; inset: 0; background: rgba(9,6,4,.44); pointer-events: none; }
.auth-hero::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 -130px 130px -60px rgba(6,4,3,.85); pointer-events: none; }
.auth-hero__logo { display: flex; align-items: center; gap: .6rem; position: relative; z-index: 1; }
.auth-hero__logo .brand-logo__word { color: #fff; font-size: 1.5rem; }
.auth-hero__logo .brand-logo__mark { width: 34px; color: #fff; }
.auth-hero__body { position: relative; z-index: 1; }
.auth-hero__body h2 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.6rem); max-width: none; text-shadow: 0 2px 30px rgba(0,0,0,.4); }
.auth-hero__body p { color: rgba(255,255,255,.84); max-width: none; font-size: 1.05rem; }
.auth-feats { display: flex; flex-direction: column; gap: 14px; position: relative; z-index: 1; }
.auth-feat { display: flex; align-items: center; gap: .8rem; font-weight: 600; font-size: .96rem; padding: 11px 15px; border-radius: 12px; background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.16); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.auth-feat .bi { font-size: 1.2rem; flex: 0 0 auto; color: #fff; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: clamp(24px, 5vw, 56px); position: relative; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.7rem; margin-block-end: .3rem; }
.auth-card .muted { color: var(--text-2); margin-block-end: 26px; }
.auth-corner { position: absolute; top: 18px; inset-inline-end: 18px; display: flex; gap: .3rem; }
.demo-chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-block-start: 8px; }

/* -------------------------------------------------------------------------- */
/* 10. Toasts, empty states, misc                                             */
/* -------------------------------------------------------------------------- */
.toast-stack { position: fixed; inset-block-end: 22px; inset-inline-end: 22px; z-index: 1080; display: flex; flex-direction: column; gap: 10px; max-width: 92vw; }
.toast-fal {
  display: flex; align-items: center; gap: .7rem; padding: 13px 16px;
  background: var(--surface); border: 1px solid var(--line); border-inline-start: 4px solid var(--brand);
  border-radius: var(--r); box-shadow: var(--shadow-lg); min-width: 280px;
  animation: toastIn .3s cubic-bezier(.4,0,.2,1);
}
.toast-fal.ok { border-inline-start-color: var(--success); }
.toast-fal.err { border-inline-start-color: var(--danger); }
.toast-fal .bi { font-size: 1.3rem; }
.toast-fal.ok .bi { color: var(--success); }
.toast-fal .t { font-weight: 600; font-size: .9rem; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty .bi { font-size: 3rem; color: var(--line-strong); display: block; margin-block-end: 12px; }
.empty h3 { color: var(--text-2); font-size: 1.1rem; }

.avatar-lg { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); box-shadow: var(--shadow); }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: 11px 0; border-block-end: 1px solid var(--line); font-size: .92rem; }
.kv:last-child { border-block-end: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 600; color: var(--text); text-align: end; }

.report-card { display: flex; align-items: center; gap: 1rem; padding: 20px; }
.report-card__ic { width: 54px; height: 54px; border-radius: var(--r); display: grid; place-items: center; font-size: 1.6rem; flex: 0 0 auto; }

/* -------------------------------------------------------------------------- */
/* 11. Responsive shell                                                        */
/* -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .dash-side { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  [dir="rtl"] .dash-side { transform: translateX(100%); }
  body.side-open .dash-side { transform: translateX(0); }
  .dash-main { margin-inline-start: 0; }
  .dash-burger { display: inline-flex; }
  .top-user__name { display: none; }
}
.dash-backdrop { position: fixed; inset: 0; background: rgba(5,7,10,.5); z-index: 1040; opacity: 0; visibility: hidden; transition: opacity var(--t); }
body.side-open .dash-backdrop { opacity: 1; visibility: visible; }
@media (min-width: 1101px) { .dash-backdrop { display: none; } }

@media (max-width: 560px) {
  .page-head__actions { width: 100%; }
  .page-head__actions .btn-fal { flex: 1 1 auto; justify-content: center; }
  /* Topbar search is redundant on phones (listing pages have an in-card search,
     dashboards only carry a short recent list) — hide it so the burger + action
     cluster never overflow the fixed-height topbar. */
  .dash-top .dash-search { display: none; }
  /* Tighten the topbar so the full action cluster fits down to 320px (incl. AR). */
  .dash-top { padding-inline: 10px; gap: .4rem; }
  .dash-top__actions { gap: .15rem; }
}

/* Tables keep their normal thead + rows layout on every screen size and scroll
   horizontally inside .table-wrap on narrow viewports (no card-stacking).
   The base `table.dtable { min-width: 640px }` guarantees the horizontal scroll;
   the legacy `.dtable--stack` class is now inert and behaves like `.dtable`. */

/* Cart line: on phones let the qty stepper + remove button wrap to a second row
   so the product name keeps full width and the stepper keeps a tappable size. */
@media (max-width: 560px) {
  .cart-line { flex-wrap: wrap; row-gap: 12px; }
  .cart-line .prod-item__info { flex: 1 0 calc(100% - 66px); }
  .cart-line .stepper { margin-inline-start: auto; }
}

/* -------------------------------------------------------------------------- */
/* 12. Print (quotes & reports)                                                */
/* -------------------------------------------------------------------------- */
@media print {
  .dash-side, .dash-top, .page-head__actions, .toast-stack, .no-print { display: none !important; }
  .dash-main { margin: 0 !important; }
  .dash-content { padding: 0 !important; }
  body, body.dash { background: #fff !important; }
  .card-fal { box-shadow: none !important; border-color: #ccc !important; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .stat-card:hover, .cat-card:hover { transform: none; }
  .bars__bar { transition: none; }
}

/* ============================================================== */
/*  BRAND LOGO — real logo artwork (added 2026-07-18)             */
/*  Console sidebar + auth pages. Same image assets as the        */
/*  marketing site (see style.css).                               */
/* ============================================================== */
/* Console sidebar brand — transparent logo, theme-aware */
.dash-side__brand .brand-logo__lockup { display: none; }
.dash-side__brand .brand-logo::before {
  content: "";
  display: block;
  width: 150px; height: 42px;
  background: url("../logos/falcon-logo.png") left center / contain no-repeat;
}
[dir="rtl"] .dash-side__brand .brand-logo::before { background-position: right center; }
[data-theme="dark"] .dash-side__brand .brand-logo::before {
  background-image: url("../logos/falcon-logo-inverted.png");
}

/* Auth hero — dark photo panel → inverted (orange + white) logo */
.auth-hero__logo .brand-logo__lockup { display: none; }
.auth-hero__logo::before {
  content: "";
  display: block;
  width: 188px; height: 53px;
  background: url("../logos/falcon-logo-inverted.png") left center / contain no-repeat;
}
[dir="rtl"] .auth-hero__logo::before { background-position: right center; }

/* Auth card — compact logo shown on mobile (light card / dark mode) */
.auth-card .brand-logo__lockup { display: inline-block; line-height: 0; }
.auth-card .brand-logo__lockup > * { display: none; }
.auth-card .brand-logo__lockup::before {
  content: "";
  display: inline-block;
  width: 150px; height: 42px;
  background: url("../logos/falcon-logo.png") left center / contain no-repeat;
}
[dir="rtl"] .auth-card .brand-logo__lockup::before { background-position: right center; }
[data-theme="dark"] .auth-card .brand-logo__lockup::before {
  background-image: url("../logos/falcon-logo-inverted.png");
}
