/* ==========================================================================
   SCB Engine Catalogue - Complete Redesign
   Primary: #223a68 | Accent: #3a7bd5 | Background: #f4f6f9
   ========================================================================== */

/* ---------- Base Reset & Typography ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --color-primary: #223a68;
  --color-primary-light: #2e4a7a;
  --color-primary-dark: #1a2d52;
  --color-accent: #3a7bd5;
  --color-accent-light: #5a9be5;
  --color-success: #2d8a4e;
  --color-success-light: #e8f5ed;
  --color-warning: #d4a017;
  --color-warning-light: #fef7e0;
  --color-error: #c23b3b;
  --color-error-light: #fdeaea;
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-border: #dce3eb;
  --color-border-light: #e8edf3;
  --color-text: #1a1a2e;
  --color-text-muted: #5a6778;
  --color-text-light: #8a95a5;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(34, 58, 104, 0.08);
  --shadow-md: 0 4px 12px rgba(34, 58, 104, 0.1);
  --shadow-lg: 0 8px 24px rgba(34, 58, 104, 0.12);
  --transition: 0.2s ease;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Site Header ---------- */
.site-header {
  background: var(--color-primary);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #fff;
}

.site-header__logo {
  height: 36px;
  width: auto;
}

.site-header__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .site-header__title {
    display: none;
  }
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* Draft/Basket link in center of header */
.site-header__draft {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-md);
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  margin-left: auto;
  margin-right: 1rem;
}

.site-header__draft:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.site-header__draft--active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.site-header__draft-icon {
  font-size: 1.1rem;
}

.site-header__draft-label {
  font-weight: 500;
}

.site-header__draft-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--color-accent);
  color: white;
  border-radius: 999px;
}

.site-header__link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.9rem;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition:
    background var(--transition),
    color var(--transition);
}

.site-header__link:hover,
.site-header__link:focus {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.site-header__link--active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.site-header__link--cta {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.site-header__link--cta:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Mobile menu toggle */
.site-header__toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: #fff;
}

.site-header__toggle-icon {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  position: relative;
}

.site-header__toggle-icon::before,
.site-header__toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: #fff;
}

.site-header__toggle-icon::before {
  top: -6px;
}

.site-header__toggle-icon::after {
  top: 6px;
}

@media (max-width: 768px) {
  .site-header__inner {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
  }

  .site-header__toggle {
    display: block;
  }

  .site-header__draft {
    margin-left: 0;
    margin-right: auto;
    order: -1;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  .site-header__draft-label {
    display: none;
  }

  .site-header__nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
  }

  .site-header__nav.is-open {
    display: flex;
  }

  .site-header__link {
    padding: 0.75rem 0.5rem;
    border-radius: 0;
  }
}

/* ---------- Main Container ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

@media (max-width: 768px) {
  main {
    padding: 1rem;
  }
}

/* ---------- Page Headers ---------- */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header__title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--color-primary);
}

.page-header__subtitle {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 1rem;
}

.page-header__contact {
  margin: 0.5rem 0 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.page-header__contact strong {
  color: var(--color-text);
  font-weight: 600;
}

/* ---------- Cards ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card--flush {
  padding: 0;
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-light);
}

.card__header--flush {
  padding: 1rem 1.5rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--color-border);
}

.card__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--color-primary);
}

.card__subtitle {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0.25rem 0 0;
}

.card__body {
  padding: 1.5rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

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

.btn--primary:hover {
  background: var(--color-primary-light);
}

.btn--accent {
  background: var(--color-accent);
  color: #fff;
}

.btn--accent:hover {
  background: var(--color-accent-light);
}

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

.btn--secondary:hover {
  background: var(--color-border-light);
}

.btn--success {
  background: var(--color-success);
  color: #fff;
}

.btn--danger {
  background: var(--color-error);
  color: #fff;
}

.btn--sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn--lg {
  padding: 0.8rem 1.75rem;
  font-size: 1rem;
}

.btn--block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Legacy button support */
button {
  font-family: inherit;
}

button:not([class]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

button:not([class]):hover {
  background: var(--color-primary-light);
}

button.secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

a.button,
a.button:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--color-primary);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}

a.button:hover {
  background: var(--color-primary-light);
}

a.button.secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.button.small,
a.button.small {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
}

.form-label--required::after {
  content: " *";
  color: var(--color-error);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.15);
}

.form-input::placeholder {
  color: var(--color-text-light);
}

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

.form-hint {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.form-error {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--color-error);
}

/* Stacked form layout */
form.stacked label {
  display: block;
  margin-bottom: 1rem;
  font-weight: 500;
}

form.stacked input,
form.stacked textarea,
form.stacked select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-top: 0.3rem;
}

form.stacked input:focus,
form.stacked textarea:focus,
form.stacked select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.15);
}

.form-actions {
  margin-top: 1.5rem;
}

/* Inline forms */
.inline-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form select,
.inline-form input[type="text"],
.inline-form input[type="number"] {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.6rem;
  font: inherit;
}

/* ---------- Alerts ---------- */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert--info {
  background: #e8f4fd;
  color: var(--color-primary);
  border: 1px solid #b8d8f5;
}

.alert--success {
  background: var(--color-success-light);
  color: var(--color-success);
  border: 1px solid #b8e0c8;
}

.alert--warning {
  background: var(--color-warning-light);
  color: #8a6d00;
  border: 1px solid #f0d58a;
}

.alert--error {
  background: var(--color-error-light);
  color: var(--color-error);
  border: 1px solid #f5b7b3;
}

/* Legacy alert classes */
.alert-info {
  background: #e8f4fd;
  color: var(--color-primary);
  border: 1px solid #b8d8f5;
}

.alert-error {
  background: var(--color-error-light);
  color: var(--color-error);
  border: 1px solid #f5b7b3;
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
}

th,
td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
}

th {
  background: var(--color-bg);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #f9fafc;
}

th[data-sortable] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.5rem;
}

th[data-sort-direction="asc"]::after,
th[data-sort-direction="desc"]::after {
  content: "";
  border: 5px solid transparent;
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
}

th[data-sort-direction="asc"]::after {
  border-bottom-color: var(--color-accent);
}

th[data-sort-direction="desc"]::after {
  border-top-color: var(--color-accent);
}

.blacklisted-row td {
  text-decoration: line-through;
  color: var(--color-error);
  opacity: 0.7;
}

/* ---------- Status Pills & Chips ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: capitalize;
}

.status-pill--draft {
  background: #fff3d6;
  color: #8d6200;
}

.status-pill--submitted {
  background: var(--color-primary);
  color: #fff;
}

.status-pill--quoted,
.status-pill--review {
  background: var(--color-warning-light);
  color: #8a6d00;
}

.status-pill--complete,
.status-pill--completed {
  background: var(--color-success-light);
  color: var(--color-success);
}

.status-pill--cancelled {
  background: var(--color-error-light);
  color: var(--color-error);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
  background: #e4e9f0;
  color: var(--color-primary);
}

.status-chip--draft {
  background: #fff3d6;
  color: #8d6200;
}

.status-chip--submitted {
  background: var(--color-success-light);
  color: var(--color-success);
}

.status-chip--success {
  background: #d4edda;
  color: #155724;
}

/* ---------- Grid Layouts ---------- */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid--4 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ---------- Stats Cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-card--primary {
  border-left: 4px solid var(--color-primary);
}

.stat-card--accent {
  border-left: 4px solid var(--color-accent);
}

.stat-card--warning {
  border-left: 4px solid var(--color-warning);
}

.stat-card--success {
  border-left: 4px solid var(--color-success);
}

.stat-card__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.stat-card__link {
  font-size: 0.85rem;
  color: var(--color-accent);
  text-decoration: none;
}

.stat-card__link:hover {
  text-decoration: underline;
}

/* ---------- Catalogue ---------- */
.catalogue {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.catalogue__intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.catalogue__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  padding: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.catalogue__filters label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  flex: 1 1 160px;
  min-width: 140px;
}

.catalogue__filters select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--color-surface);
}

.catalogue__filters input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--color-surface);
}

.catalogue__filters input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(34, 58, 104, 0.15);
}

.catalogue__search {
  flex: 1 1 200px;
  min-width: 180px;
}

.catalogue__filters button {
  height: 2.4rem;
  flex: 0 0 auto;
  align-self: flex-end;
}

.catalogue__alert-cta {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.catalogue__alert-cta a {
  color: var(--color-accent);
  font-weight: 500;
}

/* Catalogue table engine cell */
.engine-code-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.engine-code-link__code {
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.engine-code-link__code:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.engine-code-link__sources {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.make-models {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.85rem;
}

/* Stock status in catalogue */
.stock-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stock-status__count {
  font-weight: 600;
  color: var(--color-success);
}

.stock-status__count--zero {
  color: var(--color-text-light);
}

/* Order cell in catalogue */
.order-cell {
  min-width: 160px;
}

.order-cell__status {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.order-cell__stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.order-cell__stat {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: 0.35rem;
  text-align: center;
}

.order-cell__stat strong {
  display: block;
  font-size: 1rem;
  color: var(--color-primary);
}

.order-cell__stat-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
}

.order-cell__cta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.order-cell__hint,
.order-cell__sample {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--color-text-muted);
}

.order-cell__sample {
  font-weight: 500;
}

/* Notify button */
.notify-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.notify-btn:hover {
  background: var(--color-border-light);
}

.notify-btn.is-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.notify-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Legacy notify button */
.notify-button {
  width: 100%;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.notify-button.is-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.notify-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.stock-alert-control {
  margin-top: 0.5rem;
}

/* ---------- Engine Detail ---------- */
.engine-detail {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.engine-detail__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.engine-detail__code {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0;
}

.engine-chart {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  height: 280px;
}

.engine-chart canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ---------- Orders ---------- */
.order-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.order-card__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .order-card__grid {
    grid-template-columns: 1fr 380px;
  }
}

.order-card__table table {
  margin-bottom: 0;
}

.order-card__form {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.order-card__form h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: var(--color-primary);
}

/* Offer input in order table */
.order-card__table input[type="number"] {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  width: 90px;
  text-align: right;
}

.order-card__table input[type="number"]:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(58, 123, 213, 0.15);
}

.order-card__table input[type="number"]::placeholder {
  color: var(--color-text-light);
  font-style: italic;
}

/* Order contact summary (for submit confirmation) */
.order-contact-summary {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-top: 1rem;
}

.order-contact-summary__row {
  display: flex;
  justify-content: space-between;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--color-border-light);
}

.order-contact-summary__row:last-child {
  border-bottom: none;
}

.order-contact-summary__label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.order-contact-summary__value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
}

/* Order history */
.order-history-section {
  margin-top: 2rem;
}

.order-history-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.order-history-card {
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}

.order-history-card--color-0 {
  border-left-color: #1e40af;
}
.order-history-card--color-1 {
  border-left-color: #7c3aed;
}
.order-history-card--color-2 {
  border-left-color: #db2777;
}
.order-history-card--color-3 {
  border-left-color: #ea580c;
}
.order-history-card--color-4 {
  border-left-color: #16a34a;
}
.order-history-card--color-5 {
  border-left-color: #0891b2;
}
.order-history-card--color-6 {
  border-left-color: #4f46e5;
}
.order-history-card--color-7 {
  border-left-color: #be185d;
}

.order-history-card--highlight {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(58, 123, 213, 0.15);
}

.order-history-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.order-history-card__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--color-primary);
}

.order-history-card__meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0.2rem 0 0;
}

.order-history-card__body {
  padding: 1.25rem;
}

.order-history-card__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 1rem;
  margin: 0 0 1rem;
}

.order-history-card__stats dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.15rem;
}

.order-history-card__stats dd {
  margin: 0;
  font-weight: 600;
}

.order-history-card__items {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.order-history-card__items table {
  margin-bottom: 0;
}

.order-history-card__respond {
  min-width: 200px;
}

.order-history-card__timeline {
  min-width: 200px;
}

.order-history-card__timeline .negotiation-timeline {
  border-top: none;
  padding-top: 0;
}

.order-history-card-container {
  margin-top: 2rem;
}

.order-history__header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* ---------- Negotiation ---------- */
.negotiation-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.negotiation-timeline[open] summary {
  margin-bottom: 0.75rem;
}

.negotiation-timeline summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-accent);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.negotiation-timeline summary::-webkit-details-marker {
  display: none;
}

.negotiation-timeline summary::before {
  content: "▸";
  transition: transform var(--transition);
}

.negotiation-timeline[open] summary::before {
  transform: rotate(90deg);
}

.negotiation-timeline ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.negotiation-timeline li {
  font-size: 0.85rem;
  color: var(--color-text);
  padding: 0.5rem 0.75rem;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

.negotiation-chip {
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border: 1px solid transparent;
}

.negotiation-chip__role {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.negotiation-chip strong {
  font-size: 1rem;
}

.negotiation-chip small {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.negotiation-chip em {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.negotiation-chip--sales {
  background: #e8f4fd;
  border-color: #b8d8f5;
  color: var(--color-primary);
}

.negotiation-chip--customer {
  background: #f5e8f0;
  border-color: #e0c4d8;
  color: #6a2c5a;
}

.negotiation-inline-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.negotiation-inline-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.negotiation-inline-form input,
.negotiation-inline-form textarea {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  font: inherit;
}

.negotiation-inline-form.compact {
  gap: 0.5rem;
}

/* ---------- Admin Dashboard ---------- */
.admin-dashboard {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-section__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--color-text);
}

/* Admin company cards */
.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.company-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: box-shadow var(--transition);
}

.company-card:hover {
  box-shadow: var(--shadow-md);
}

.company-card h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--color-primary);
}

.company-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.company-card__meta {
  font-size: 0.8rem;
  color: var(--color-text-light);
}

/* Admin order cards */
.order-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

.order-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.order-card--color-0 {
  border-left-color: #1e40af;
}
.order-card--color-1 {
  border-left-color: #7c3aed;
}
.order-card--color-2 {
  border-left-color: #db2777;
}
.order-card--color-3 {
  border-left-color: #ea580c;
}
.order-card--color-4 {
  border-left-color: #16a34a;
}
.order-card--color-5 {
  border-left-color: #0891b2;
}
.order-card--color-6 {
  border-left-color: #4f46e5;
}
.order-card--color-7 {
  border-left-color: #be185d;
}

.order-card__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.order-card__company {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  color: var(--color-primary);
}

.order-card__meta {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.order-card__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.order-card__action-buttons {
  display: flex;
  gap: 0.4rem;
}

.order-card__body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.order-card__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg);
  border-radius: var(--radius-md);
}

.order-card__stats > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.order-card__stats span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.order-card__stats strong {
  font-size: 1rem;
  color: var(--color-text);
}

.order-card__info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.order-card__info > div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.order-card__info span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.order-card__info strong {
  font-size: 0.95rem;
  color: var(--color-text);
}

.order-card__info small {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.order-card__table-wrapper {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.order-card__table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.order-card__table-header h4 {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text);
}

.order-card__table-header span {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.order-card__table-scroll {
  overflow-x: auto;
}

.order-card__table {
  margin: 0;
  min-width: 600px;
}

.order-card__table th {
  background: #fafbfc;
}

.order-card__negotiation-cell {
  min-width: 180px;
}

.order-card__offer-form {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.order-card__offer-form input[type="number"] {
  width: 5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
}

/* Order section (collapsible) */
.order-section {
  margin-top: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.order-section summary {
  cursor: pointer;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.order-section[open] summary {
  border-bottom: 1px solid var(--color-border);
}

.order-section > :not(summary) {
  padding: 1rem;
}

/* ---------- Auth Pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-primary-dark) 100%
  );
  position: relative;
  overflow: hidden;
  margin: 1rem;
  border-radius: var(--radius-xl, 1.5rem);
  min-height: calc(100vh - 2rem);
}

.auth-page::before {
  content: "";
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("/static/media/scb_white.png");
  background-size: 160px auto;
  background-repeat: repeat;
  transform: rotate(-45deg);
  opacity: 0.08;
  pointer-events: none;
}

.auth-page > * {
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-card__header {
  padding: 2rem 2rem 1.5rem;
  text-align: center;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.auth-card__logo {
  height: 48px;
  margin-bottom: 1rem;
}

.auth-card__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-primary);
}

.auth-card__subtitle {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0.5rem 0 0;
}

.auth-card__body {
  padding: 2rem;
}

.auth-card__footer {
  padding: 1.5rem 2rem;
  text-align: center;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.auth-card__footer a {
  color: var(--color-accent);
  font-weight: 500;
}

/* ---------- Utilities ---------- */
.muted {
  color: var(--color-text-muted);
}

.text-sm {
  font-size: 0.85rem;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.error {
  color: var(--color-error);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

.blacklisted-tag {
  color: var(--color-error);
  font-weight: 600;
}

.link-button {
  background: none;
  border: none;
  color: var(--color-accent);
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.link-button:hover {
  text-decoration: underline;
}

/* Table actions cell */
.table-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Quote form in tables */
.quote-form {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.quote-form input[type="number"] {
  width: 5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

/* Small utility class */
.small {
  font-size: 0.85rem;
}

/* ---------- Empty States ---------- */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--color-text-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--color-text);
}

.empty-state__text {
  margin: 0 0 1rem;
}

/* ---------- Request Cards (legacy) ---------- */
.request-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.request-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem;
}

.request-card__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.request-card__header h3 {
  margin: 0 0 0.2rem 0;
}

.request-card__meta {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.request-card__actions {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  text-align: right;
}

.request-card__actions a {
  color: var(--color-accent);
}

.request-card__contact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem 1rem;
  margin: 0;
}

.request-card__contact dt {
  font-weight: bold;
}

.request-card__contact dd {
  margin: 0;
}

.request-card__items summary {
  cursor: pointer;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.request-card__items table {
  margin-bottom: 0;
}

.request-card__footer {
  text-align: right;
  color: var(--color-text-muted);
}

/* ---------- Print Styles ---------- */
/* ---------- Tabs Component ---------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 1.5rem;
}

.tabs__tab {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}

.tabs__tab:hover {
  color: var(--color-text);
}

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

.tabs__tab .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--color-border);
  color: var(--color-text-muted);
}

.tabs__tab--active .badge {
  background: var(--color-primary);
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel--active {
  display: block;
}

/* Tab navigation (compact variant for customer pages) */
.tab-nav {
  display: flex;
  gap: 0.5rem;
}

.tab-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s;
}

.tab-nav__btn:hover {
  color: var(--color-text);
  border-color: var(--color-primary-light);
}

.tab-nav__btn--active {
  color: var(--color-surface);
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.tab-nav__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--color-border);
  color: var(--color-text-muted);
}

.tab-nav__btn--active .tab-nav__badge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

@media print {
  .site-header,
  .btn,
  button,
  .catalogue__filters {
    display: none !important;
  }

  main {
    padding: 0;
    max-width: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
