/* ═══════════════════════════════════════════
   PAGE-SPECIFIC STYLES
   ═══════════════════════════════════════════ */

/* ─── LOGIN PAGE ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: var(--space-4);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-elevated);
  animation: scale-in var(--duration-enter) var(--ease-out);
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.login-logo img {
  width: 200px;
  height: auto;
  margin: 0 auto var(--space-4);
  display: block;
}

.login-logo h1 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-1);
}

.login-logo p {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.login-error {
  background: var(--red-subtle);
  color: var(--red);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-5);
  display: none;
}

.login-error.visible { display: block; }

.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
}

.login-btn {
  width: 100%;
  padding: 12px;
  margin-top: var(--space-2);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.remember-row input {
  accent-color: var(--cyan);
}

.login-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.6;
  padding: var(--space-4);
  opacity: 0.6;
}

/* ─── DASHBOARD PAGE ─── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.dashboard-grid .full-width {
  grid-column: 1 / -1;
}

.quick-actions {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.activity-feed {
  max-height: 400px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-dot.scan { background: var(--cyan); }
.activity-dot.status { background: var(--amber); }
.activity-dot.delivery { background: var(--mint); }
.activity-dot.alert { background: var(--red); }

.activity-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  flex: 1;
}

.activity-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.progress-bar-container {
  margin-top: var(--space-4);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.progress-label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  width: 100px;
  flex-shrink: 0;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

.progress-fill.cyan { background: var(--cyan); }
.progress-fill.mint { background: var(--mint); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.red { background: var(--red); }

.progress-value {
  font-size: var(--text-xs);
  color: var(--text-muted);
  width: 40px;
  text-align: right;
}

/* ─── ORDERS PAGE ─── */
.order-row-clickable {
  cursor: pointer;
}

.order-number {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--cyan);
}

.order-patient {
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.order-type {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.order-due {
  font-size: var(--text-sm);
}

.order-due.overdue {
  color: var(--red);
  font-weight: var(--font-semibold);
}

/* ─── ORDER DETAIL ─── */
.order-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.order-detail-number {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
}

.order-detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-6);
}

.order-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.info-item {
  padding: var(--space-3);
}

.info-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.info-value {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.order-notes {
  margin-top: var(--space-6);
}

.notes-list {
  max-height: 300px;
  overflow-y: auto;
}

.note-item {
  padding: var(--space-3);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.note-item:last-child { border-bottom: none; }

.note-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-1);
}

.note-author {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.note-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.note-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.add-note-form {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.add-note-form .form-input { flex: 1; }

.qr-section {
  text-align: center;
  padding: var(--space-6);
}

.qr-code-display {
  width: 180px;
  height: 180px;
  margin: 0 auto var(--space-4);
  background: var(--white);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: var(--neu);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code-display canvas,
.qr-code-display img {
  width: 100%;
  height: 100%;
}

.scan-log {
  margin-top: var(--space-6);
}

.scan-log-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(148, 163, 184, 0.05);
}

.scan-log-step {
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.scan-log-action {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.scan-log-action.start { background: var(--cyan-subtle); color: var(--cyan); }
.scan-log-action.end { background: var(--mint-subtle); color: var(--mint); }
.scan-log-action.rework { background: var(--amber-subtle); color: var(--amber); }

/* ─── ORDER FORM ─── */
.order-form-container {
  max-width: 800px;
}

.form-section {
  margin-bottom: var(--space-8);
}

.form-section-title {
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

/* ─── DELIVERY PAGE ─── */
.delivery-tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  width: fit-content;
}

.delivery-tab {
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  transition: all var(--duration-normal) var(--ease-out);
}

.delivery-tab.active {
  background: var(--white);
  color: var(--cyan);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.delivery-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--neu);
  margin-bottom: var(--space-3);
  transition: transform var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.delivery-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--neu-hover);
}

.delivery-info {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1;
}

.delivery-order-num {
  font-family: var(--font-mono);
  font-weight: var(--font-semibold);
  color: var(--cyan);
}

.delivery-meta {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.delivery-actions {
  display: flex;
  gap: var(--space-2);
}

/* ─── SERVERS PAGE ─── */
.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-5);
}

.server-card {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--neu);
}

.server-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.server-name {
  font-weight: var(--font-semibold);
  font-size: var(--text-md);
}

.server-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.server-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.server-status-dot.online { background: var(--mint); animation: status-pulse 2s infinite; }
.server-status-dot.offline { background: var(--red); }
.server-status-dot.unknown { background: var(--slate); }

.server-details {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.server-detail-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.06);
}

.server-detail-row:last-child { border-bottom: none; }

.server-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* ─── USERS PAGE ─── */
.user-status-active {
  color: var(--mint);
}

.user-status-inactive {
  color: var(--slate);
}

/* ─── PORTAL ─── */
.portal-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-header {
  height: var(--header-height);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-8);
}

.portal-content {
  flex: 1;
  padding: var(--space-8);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ─── RESPONSIVE PAGES ─── */
@media (max-width: 1200px) {
  .order-detail-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .quick-actions {
    flex-direction: column;
    gap: var(--space-2);
  }
  .quick-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .order-detail-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .delivery-card {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  .delivery-actions {
    width: 100%;
  }
  .delivery-actions .btn {
    flex: 1;
  }
  .login-card {
    padding: var(--space-6);
  }

  /* Dashboard tables: horizontal scroll */
  .dashboard-grid .card {
    overflow: hidden;
  }
  #dashboard-orders {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Activity feed mobile */
  .activity-text {
    word-break: break-word;
    font-size: var(--text-xs);
  }
  .activity-feed {
    max-height: 300px;
  }
  .activity-item {
    gap: var(--space-2);
    padding: var(--space-2) 0;
  }

  /* Progress bars mobile */
  .progress-label {
    width: 70px;
    font-size: 0.65rem;
  }
  .progress-bar-container {
    margin-top: var(--space-2);
  }
  .progress-row {
    gap: var(--space-2);
    margin-bottom: var(--space-2);
  }

  .delivery-timeline-visual { flex-direction: column; }
  .delivery-line { width: 2px; height: 30px; min-width: unset; margin: 0; }
  .delivery-info-portal { flex-direction: column; gap: var(--space-3); }
  .files-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .message-item { max-width: 90%; }
}

@media (max-width: 480px) {
  .progress-label {
    width: 56px;
    font-size: 0.6rem;
  }
  .progress-value {
    width: 28px;
  }
  .activity-time {
    display: none;
  }
}

/* ─── DOCUMENTATION PAGE ─── */
.docs-page {
  max-width: 1200px;
  margin: 0 auto;
}

/* Search */
.docs-search {
  margin-bottom: var(--space-5);
}

.docs-search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: all var(--duration-normal) var(--ease-out);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
}

.docs-search-input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
  background-color: var(--bg-primary);
}

.docs-search-input::placeholder {
  color: var(--text-muted);
}

/* Hero */
.docs-hero {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08) 0%, rgba(59, 130, 246, 0.06) 100%);
  border: 1px solid rgba(6, 182, 212, 0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-7);
  margin-bottom: var(--space-6);
}

.docs-hero-text {
  font-size: var(--text-md);
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
}

.docs-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}

.docs-hero-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  background: var(--bg-primary);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
}

.docs-hero-card:hover {
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.04);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.docs-hero-icon {
  font-size: 28px;
  line-height: 1;
}

.docs-hero-label {
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  text-align: center;
  color: var(--text-secondary);
}

/* Tabs */
.docs-tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  width: fit-content;
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.docs-tab {
  position: relative;
  padding: 8px 22px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  border: none;
  background: none;
}

.docs-tab:hover {
  color: var(--text-secondary);
  background: rgba(148, 163, 184, 0.06);
}

.docs-tab.active {
  background: var(--bg-primary);
  color: var(--cyan);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(6, 182, 212, 0.12);
}

/* Layout */
.docs-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-6);
  align-items: start;
}

/* TOC Sidebar */
.docs-toc {
  position: sticky;
  top: calc(var(--header-height) + var(--space-4));
  max-height: calc(100vh - var(--header-height) - var(--space-8));
  overflow-y: auto;
  padding: var(--space-3);
  background: rgba(var(--bg-secondary-rgb, 248, 250, 252), 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.docs-toc-item {
  display: block;
  padding: 7px 12px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: all var(--duration-normal) var(--ease-out);
  cursor: pointer;
  margin-bottom: 2px;
}

.docs-toc-icon {
  margin-right: 6px;
  font-size: 14px;
}

.docs-toc-item:hover {
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.05);
}

.docs-toc-item.active {
  color: var(--cyan);
  border-left-color: var(--cyan);
  background: rgba(6, 182, 212, 0.08);
  font-weight: var(--font-medium);
}

/* Content area */
.docs-content {
  padding: var(--space-8);
  min-height: 400px;
  scroll-behavior: smooth;
}

/* Sections */
.docs-section {
  margin-bottom: var(--space-10);
}

.docs-section:last-child {
  margin-bottom: 0;
}

.docs-section-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  margin-bottom: var(--space-5);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.docs-section-icon {
  font-size: 22px;
  line-height: 1;
}

.docs-section-link {
  margin-left: auto;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--cyan);
  text-decoration: none;
  padding: 4px 12px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-full);
  transition: all var(--duration-normal) var(--ease-out);
  white-space: nowrap;
}

.docs-section-link:hover {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--cyan);
}

/* Headings */
.docs-heading {
  font-size: var(--text-md);
  font-weight: var(--font-semibold);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  color: var(--text-primary);
}

h4.docs-heading {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  margin-top: var(--space-4);
}

/* Text */
.docs-paragraph {
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.docs-list {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
  color: var(--text-secondary);
}

.docs-list li {
  line-height: 1.7;
  margin-bottom: var(--space-2);
}

/* Info/Tip/Warning/Important boxes */
.docs-box {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border-left: 3px solid;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.docs-box strong {
  display: inline;
  margin-right: var(--space-1);
}

.docs-box-info {
  background: rgba(59, 130, 246, 0.06);
  border-left-color: #3b82f6;
  color: var(--text-secondary);
  box-shadow: 0 1px 6px rgba(59, 130, 246, 0.08);
}

.docs-box-info strong { color: #3b82f6; }

.docs-box-tip {
  background: rgba(6, 182, 212, 0.06);
  border-left-color: var(--cyan);
  color: var(--text-secondary);
  box-shadow: 0 1px 6px rgba(6, 182, 212, 0.08);
}

.docs-box-tip strong { color: var(--cyan); }

.docs-box-warning {
  background: rgba(245, 158, 11, 0.06);
  border-left-color: var(--amber);
  color: var(--text-secondary);
  box-shadow: 0 1px 6px rgba(245, 158, 11, 0.08);
}

.docs-box-warning strong { color: var(--amber); }

.docs-box-important {
  background: rgba(239, 68, 68, 0.06);
  border-left-color: var(--red);
  color: var(--text-secondary);
  box-shadow: 0 1px 6px rgba(239, 68, 68, 0.08);
}

.docs-box-important strong { color: var(--red); }

/* Badge row */
.docs-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

/* Production steps list */
.docs-step-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.docs-step-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.08);
  transition: all var(--duration-normal) var(--ease-out);
}

.docs-step-item:hover {
  border-color: rgba(6, 182, 212, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.docs-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), #3b82f6);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(6, 182, 212, 0.25);
}

.docs-step-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ─── RESPONSIVE DOCS ─── */
@media (max-width: 1024px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .docs-toc {
    position: static;
    max-height: none;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .docs-toc-item {
    border-left: none;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
  }
  .docs-toc-item.active {
    background: rgba(6, 182, 212, 0.1);
    border-left: none;
  }
  .docs-hero {
    padding: var(--space-5);
  }
  .docs-hero-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
}

@media (max-width: 768px) {
  .docs-tabs {
    width: 100%;
    overflow-x: auto;
  }
  .docs-tab {
    flex: 1;
    text-align: center;
    white-space: nowrap;
  }
  .docs-content {
    padding: var(--space-5);
  }
  .docs-step-list {
    grid-template-columns: 1fr;
  }
  .docs-hero {
    padding: var(--space-4);
  }
  .docs-hero-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-2);
  }
  .docs-section-title {
    font-size: var(--text-md);
  }
  .docs-section-link {
    margin-left: 0;
    margin-top: var(--space-2);
  }
}

/* Print */
@media print {
  .docs-toc,
  .docs-tabs,
  .docs-search {
    display: none;
  }
  .docs-layout {
    grid-template-columns: 1fr;
  }
  .docs-content {
    padding: 0;
  }
  .docs-hero {
    background: none;
    border: 1px solid #ddd;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* ─── SCAN PAGE — Tablet & Offline ─── */
.scan-offline-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  color: var(--amber);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-4);
}

.scan-offline-banner.hidden { display: none; }

.offline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
  animation: status-pulse 2s infinite;
}

.scan-queue-badge {
  padding: var(--space-2) var(--space-4);
  background: rgba(0, 188, 212, 0.1);
  border: 1px solid rgba(0, 188, 212, 0.2);
  border-radius: var(--radius-md);
  color: var(--cyan);
  font-size: var(--text-sm);
  text-align: center;
  margin-bottom: var(--space-4);
}

.scan-queue-badge.hidden { display: none; }

.scan-action-btn {
  min-height: 64px;
  font-size: 1.2rem;
  padding: var(--space-4) var(--space-5);
}

.scan-order-info .scan-order-number {
  font-size: 1.4rem;
}

.scan-order-info .scan-detail-item .info-value {
  font-size: var(--text-md);
}

@media (max-width: 1024px) {
  .scan-action-btn {
    min-height: 72px;
    font-size: 1.3rem;
    padding: var(--space-5) var(--space-6);
  }

  .scan-actions {
    gap: var(--space-4);
  }

  .scan-order-info .scan-detail-item {
    padding: var(--space-3);
  }
}

@media (max-width: 768px) {
  .scan-action-btn {
    min-height: 64px;
    font-size: 1.1rem;
    width: 100%;
  }

  .scan-actions {
    flex-direction: column;
  }
}

/* ─── PORTAL TABS ─── */
.portal-tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  padding-bottom: 0;
}
.portal-tab {
  padding: var(--space-2) var(--space-4);
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  margin-bottom: -1px;
}
.portal-tab:hover { color: var(--text-primary); }
.portal-tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

/* ─── MESSAGES (chat) ─── */
.messages-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-3);
}
.message-item {
  display: flex;
  flex-direction: column;
  max-width: 75%;
  gap: var(--space-1);
}
.message-item.from-me {
  align-self: flex-end;
}
.message-item.from-other {
  align-self: flex-start;
}
.message-bubble {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.5;
  word-break: break-word;
}
.message-item.from-me .message-bubble {
  background: var(--cyan);
  color: white;
  border-bottom-right-radius: 4px;
}
.message-item.from-other .message-bubble {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}
.message-sender {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}
.message-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.message-file {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
}
.message-file:hover { background: var(--bg-secondary); opacity: 0.8; }
.message-file-icon { font-size: var(--text-md); }
.message-input-area {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3);
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  align-items: flex-end;
}
.message-input-area textarea {
  flex: 1;
  resize: none;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-family: inherit;
  min-height: 40px;
  max-height: 120px;
}
.message-input-area textarea:focus {
  outline: none;
  border-color: var(--cyan);
}
.message-attach-btn {
  background: none;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
}
.message-attach-btn:hover { background: var(--bg-secondary); }
.message-send-btn {
  background: var(--cyan);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  font-weight: 500;
  font-size: var(--text-sm);
}
.message-send-btn:hover { opacity: 0.9; }
.message-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── FILES GALLERY ─── */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
  padding: var(--space-3);
}
.file-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.08);
  position: relative;
}
.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-thumb:hover { border-color: var(--cyan); }
.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-primary);
}
.file-item:hover { background: var(--bg-secondary); }
.file-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
}
.files-upload-area {
  padding: var(--space-3);
  border-top: 1px solid rgba(148, 163, 184, 0.08);
}

/* ─── DELIVERY TIMELINE ─── */
.delivery-timeline-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--space-4);
  gap: 0;
}
.delivery-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  position: relative;
  z-index: 1;
}
.delivery-step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--text-sm);
  border: 2px solid rgba(148, 163, 184, 0.15);
  background: var(--bg-primary);
  color: var(--text-muted);
  transition: all 0.3s;
}
.delivery-step.done .delivery-step-circle {
  background: var(--mint);
  border-color: var(--mint);
  color: white;
}
.delivery-step.active .delivery-step-circle {
  background: var(--cyan);
  border-color: var(--cyan);
  color: white;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(6, 182, 212, 0); }
}
.delivery-step-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}
.delivery-step.done .delivery-step-label,
.delivery-step.active .delivery-step-label {
  color: var(--text-primary);
}
.delivery-step-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.delivery-line {
  flex: 1;
  height: 2px;
  background: rgba(148, 163, 184, 0.15);
  min-width: 60px;
  margin: 0 var(--space-1);
  margin-bottom: calc(var(--space-2) + var(--text-xs) * 1.5 + var(--space-2) + var(--text-xs) * 1.5);
}
.delivery-line.done {
  background: var(--mint);
}
.delivery-info-portal {
  display: flex;
  gap: var(--space-6);
  padding: var(--space-4);
  border-top: 1px solid rgba(148, 163, 184, 0.08);
}
.delivery-info-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.delivery-info-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 500;
}
.delivery-info-value {
  font-size: var(--text-sm);
  color: var(--text-primary);
}
.delivery-photo-thumb {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  cursor: pointer;
  border: 1px solid rgba(148, 163, 184, 0.08);
}
.delivery-photo-thumb:hover { border-color: var(--cyan); }

/* ─── LIGHTBOX OVERLAY ─── */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: pointer;
}
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-md);
  object-fit: contain;
}

/* ─── PRINT STYLES ─── */
@media print {
  .sidebar, .header, .hamburger-btn, .mobile-overlay, .btn { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .main-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd; }
  .qr-code-display { box-shadow: none !important; border: 1px solid #ddd; }
  .docs-tabs, .docs-toc { display: none !important; }
  .docs-layout { grid-template-columns: 1fr !important; }
  .docs-content { box-shadow: none !important; padding: 0 !important; }
}

/* ─── QUOTE WIZARD ─── */
.wizard-card {
  max-width: 720px;
  margin: var(--space-8) auto;
  background: var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--neu);
}

.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.wizard-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  position: relative;
}

.wizard-progress-num {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-muted);
  transition: all 0.2s;
}

.wizard-progress-step.active .wizard-progress-num {
  background: var(--cyan);
  color: var(--text-inverse);
  box-shadow: 0 0 0 4px var(--cyan-subtle);
}

.wizard-progress-step.done .wizard-progress-num {
  background: var(--mint);
  color: var(--text-inverse);
}

.wizard-progress-label {
  font-size: 0.625rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 60px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wizard-progress-step.active .wizard-progress-label {
  color: var(--cyan-dark);
  font-weight: 500;
}

.wizard-progress-line {
  width: 24px;
  height: 2px;
  background: var(--bg-secondary);
  margin: 0 var(--space-1);
  margin-bottom: 18px;
  transition: background 0.2s;
}

.wizard-progress-line.done {
  background: var(--mint);
}

.wizard-step-content {
  min-height: 200px;
  margin-bottom: var(--space-6);
}

.wizard-step-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-6);
  text-align: center;
}

.wizard-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}

.wizard-option-card {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--bg-secondary);
  background: var(--bg-primary);
  cursor: pointer;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.wizard-option-card:hover {
  border-color: var(--cyan);
  background: var(--cyan-subtle);
}

.wizard-option-card.selected {
  border-color: var(--cyan);
  background: var(--cyan-subtle);
  color: var(--cyan-dark);
  box-shadow: 0 0 0 3px var(--cyan-subtle);
}

/* Tooth chart */
.tooth-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.tooth-jaw-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tooth-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.tooth-cell {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.tooth-cell:hover {
  border-color: var(--cyan);
  background: var(--cyan-subtle);
}

.tooth-cell.selected {
  background: var(--cyan);
  color: var(--text-inverse);
  border-color: var(--cyan);
}

.tooth-separator {
  width: 12px;
}

.tooth-divider {
  width: 80%;
  height: 1.5px;
  background: var(--bg-secondary);
  margin: var(--space-2) 0;
}

.wizard-teeth-count {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

/* Wizard form */
.wizard-form {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Wizard summary */
.wizard-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-6);
}

.wizard-summary-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
}

.wizard-summary-row:nth-child(odd) {
  background: var(--bg-secondary);
}

.wizard-summary-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.wizard-summary-value {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  text-align: right;
  max-width: 60%;
}

/* Estimate boxes */
.wizard-estimate-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  text-align: center;
}

.wizard-estimate-row {
  margin-bottom: var(--space-2);
}

.wizard-estimate-preview {
  text-align: center;
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* Quote number display on confirmation */
.wizard-quote-number {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--cyan-dark);
  background: var(--cyan-subtle);
  display: inline-block;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  margin-top: var(--space-4);
}

/* Navigation */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-6);
  border-top: 1px solid var(--bg-secondary);
}

/* Responsive */
@media (max-width: 600px) {
  .wizard-card {
    margin: var(--space-4);
    padding: var(--space-5);
  }

  .wizard-option-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tooth-cell {
    width: 28px;
    height: 28px;
    font-size: 0.5625rem;
  }

  .wizard-progress-label {
    display: none;
  }

  .wizard-progress-line {
    margin-bottom: 0;
  }
}

/* ─── Order detail status bar (P1 audit 2026-04-26) ─── */
.order-statusbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border-default, #e5e7eb);
  border-radius: var(--radius-lg, 12px);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.order-statusbar-locked {
  background: var(--bg-secondary, #f9fafb);
  border-color: var(--border-default, #e5e7eb);
}

.order-statusbar-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.order-statusbar-step {
  font-size: var(--text-sm);
  color: var(--text-default);
  font-weight: 500;
}

.order-statusbar-sector {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.order-statusbar-sector.sector-platre      { background: #fef3c7; color: #92400e; }
.order-statusbar-sector.sector-cfao        { background: #dbeafe; color: #1e40af; }
.order-statusbar-sector.sector-metallurgie { background: #e5e7eb; color: #374151; }
.order-statusbar-sector.sector-adjointe    { background: #ede9fe; color: #5b21b6; }
.order-statusbar-sector.sector-ceramique   { background: #fce7f3; color: #9d174d; }
.order-statusbar-sector.sector-none        { background: var(--bg-secondary, #f3f4f6); color: var(--text-muted); }

.order-statusbar-deadline {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--bg-secondary, #f3f4f6);
  color: var(--text-secondary);
  white-space: nowrap;
}
.order-statusbar-deadline-today    { background: #fef3c7; color: #92400e; }
.order-statusbar-deadline-overdue  { background: #fee2e2; color: #991b1b; }

.order-statusbar-cta {
  margin-left: auto;
  min-height: 44px;
  min-width: 140px;
  font-weight: 600;
  border: 0;
  color: #fff;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  padding: 0 var(--space-4);
}
.order-statusbar-cta-start { background: #16a34a; }
.order-statusbar-cta-start:hover { background: #15803d; }
.order-statusbar-cta-end   { background: #0891b2; }
.order-statusbar-cta-end:hover   { background: #0e7490; }
.order-statusbar-cta:disabled    { opacity: 0.6; cursor: not-allowed; }

.order-statusbar-locked-pill {
  margin-left: auto;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-secondary, #f3f4f6);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--border-default, #e5e7eb);
}

/* Mobile: clone the CTA into a fixed bottom bar; reserve room with padding. */
.order-statusbar-cta-mobile {
  display: none;
}
@media (max-width: 640px) {
  .order-statusbar {
    /* Two visual rows on phones */
    gap: var(--space-2);
  }
  .order-statusbar-step,
  .order-statusbar-sector {
    flex-basis: 100%;
  }
  .order-statusbar-cta {
    /* The in-bar CTA hides; the fixed clone takes over. */
    display: none;
  }
  .order-statusbar-cta-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    min-height: 64px;
    border-radius: 0;
    margin: 0;
    font-size: var(--text-lg);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  }
  /* Reserve room so the fixed bottom CTA never covers the last card. */
  #app.has-mobile-cta,
  .has-mobile-cta {
    padding-bottom: 80px;
  }
}

/* ─── Technician dashboard (P2 audit 2026-04-26) ─── */
.tech-dashboard {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.tech-greeting {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: -var(--space-2);
}

/* Big primary scan CTA */
.tech-scan-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 96px;
  font-size: var(--text-xl);
  font-weight: 700;
  color: #fff;
  background: #16a34a;
  border: 0;
  border-radius: var(--radius-lg, 12px);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(22,163,74,0.18);
  transition: background 0.1s ease, transform 0.05s ease;
}
.tech-scan-cta:hover  { background: #15803d; }
.tech-scan-cta:active { transform: scale(0.99); }

.tech-atelier-link {
  align-self: center;
  color: var(--color-primary, #2563eb);
  font-weight: 500;
  text-decoration: none;
  font-size: var(--text-sm);
  margin-top: -var(--space-3);
}
.tech-atelier-link:hover { text-decoration: underline; }

/* Stats strip — 4 small cards */
.tech-stats-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
@media (min-width: 640px) {
  .tech-stats-strip { grid-template-columns: repeat(4, 1fr); }
}
.tech-stat {
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border-default, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tech-stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tech-stat-value {
  font-size: var(--text-2xl, 24px);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.tech-stat.cyan  .tech-stat-value { color: #0891b2; }
.tech-stat.red   .tech-stat-value { color: #dc2626; }
.tech-stat.mint  .tech-stat-value { color: #16a34a; }
.tech-stat.amber .tech-stat-value { color: #d97706; }

/* Sections */
.tech-section { display: flex; flex-direction: column; gap: var(--space-3); }
.tech-section-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.tech-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  border: 1px dashed var(--border-default, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  background: var(--bg-elevated, #fff);
}

/* Mine + Queue rows — same layout, different left accent */
.tech-mine-row,
.tech-queue-row {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr auto auto auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border-default, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  text-decoration: none;
  color: inherit;
  min-height: 56px;
  transition: background 0.1s ease, border-color 0.1s ease;
}
.tech-mine-row:hover,
.tech-queue-row:hover { background: var(--bg-hover, #f9fafb); border-color: var(--text-primary, #111827); }
.tech-mine-row { border-left: 3px solid #0891b2; }       /* in-progress accent */
.tech-queue-row.urgent  { border-left: 3px solid #dc2626; }
.tech-queue-row.overdue { box-shadow: inset 0 0 0 1px #dc2626; }

.tech-row-num     { font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 600; font-size: var(--text-sm); color: var(--text-primary); }
.tech-row-patient { font-size: var(--text-sm); color: var(--text-default); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-row-step    { font-size: var(--text-xs); color: var(--text-secondary); }
.tech-row-sector {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.tech-row-sector.sector-platre      { background: #fef3c7; color: #92400e; }
.tech-row-sector.sector-cfao        { background: #dbeafe; color: #1e40af; }
.tech-row-sector.sector-metallurgie { background: #e5e7eb; color: #374151; }
.tech-row-sector.sector-adjointe    { background: #ede9fe; color: #5b21b6; }
.tech-row-sector.sector-ceramique   { background: #fce7f3; color: #9d174d; }
.tech-row-sector.sector-none        { background: var(--bg-secondary, #f3f4f6); color: var(--text-muted); }

.tech-row-deadline,
.tech-row-elapsed {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.tech-row-deadline.overdue { color: #991b1b; font-weight: 600; }

@media (max-width: 640px) {
  .tech-scan-cta { min-height: 110px; font-size: var(--text-2xl, 24px); }
  .tech-mine-row, .tech-queue-row {
    grid-template-columns: 1fr auto;
    grid-auto-rows: auto;
    row-gap: 4px;
  }
  .tech-row-step, .tech-row-sector, .tech-row-deadline, .tech-row-elapsed { grid-column: 1 / -1; }
}

/* ─── Mobile bottom-bar nav (P2 audit 2026-04-26) ─── */
/* Hidden by default. Visible only on phones AND for technicien role. */
.bottom-bar {
  display: none;
}

@media (max-width: 768px) {
  body.role-technicien .bottom-bar {
    display: flex;
    align-items: stretch;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: 64px;
    background: var(--bg-elevated, #fff);
    border-top: 1px solid var(--border-default, #e5e7eb);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Hide every other navigation surface for tech-mobile so the bottom-bar
     is the single source of truth. Note: .hamburger-btn is the mobile
     opener (id="hamburger-btn"); .sidebar-toggle is the desktop collapse
     control. We hide both, plus the dimming overlay. */
  body.role-technicien .sidebar,
  body.role-technicien .sidebar-toggle,
  body.role-technicien .hamburger-btn,
  body.role-technicien .mobile-overlay { display: none !important; }
  body.role-technicien .app-layout { padding-left: 0 !important; }

  /* Reserve room so the fixed bar never covers content. */
  body.role-technicien .main-content {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* When the order detail mounts its own bottom CTA, hide the bottom-bar so
     the two don't overlap. Modern :has() selector — Chrome 105+, Safari 15.4+. */
  body.role-technicien:has(#app-mount.has-mobile-cta) .bottom-bar { display: none; }
}

.bottom-bar-tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted, #6b7280);
  font-size: 11px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  min-height: 56px;
}
.bottom-bar-tab svg { stroke-width: 2; }
.bottom-bar-tab.active {
  color: var(--text-primary, #111827);
  font-weight: 600;
}
.bottom-bar-tab.active svg { stroke: var(--cyan, #0891b2); }

/* Center scan tab — floating, larger, primary-green.
   The label sits below the floating circle so the tab still has a visible
   text affordance like the other 4 tabs (audit feedback 2026-04-26). */
.bottom-bar-tab-scan {
  flex: 0 0 80px;
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  align-self: stretch;
  position: relative;
  color: var(--text-muted, #6b7280);
}
.bottom-bar-tab-scan > svg {
  width: 32px;
  height: 32px;
  background: #16a34a;
  color: #fff;
  border-radius: 50%;
  padding: 12px;
  box-sizing: content-box;
  margin-top: -20px;
  box-shadow: 0 4px 12px rgba(22,163,74,0.32);
  stroke: #fff;
}
.bottom-bar-tab-scan.active { color: var(--text-primary, #111827); font-weight: 600; }
.bottom-bar-tab-scan.active > svg { background: #15803d; box-shadow: 0 4px 14px rgba(21,128,61,0.42); }
.bottom-bar-label-scan { margin-top: 4px; }

/* ─── Orders list filter row (P3 audit 2026-04-26) ───
   Search grows, the 3 selects share the remaining width on desktop; stacks
   on mobile. Overrides .table-filters defaults only for this page. */
.orders-filters {
  display: grid;
  grid-template-columns: 2fr repeat(3, minmax(120px, 1fr));
  gap: var(--space-3);
  width: 100%;
  align-items: stretch;
}
.orders-filters .form-input,
.orders-filters .form-select {
  min-width: 0; /* override .table-filters min-width:140px so grid wins */
  width: 100%;
}
.orders-filters-search { font-size: var(--text-sm); }

@media (max-width: 720px) {
  .orders-filters {
    grid-template-columns: 1fr;
  }
}

/* ─── Form section collapse (P3 audit 2026-04-26) ───
   Used for optional admin-only blocks (Tarification etc.). Built on <details>. */
.form-section-collapsible {
  padding-top: 0;
}
.form-section-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  user-select: none;
}
.form-section-summary::-webkit-details-marker { display: none; }
.form-section-summary::before {
  content: '▸';
  display: inline-block;
  color: var(--text-muted);
  font-size: var(--text-xs);
  transition: transform 0.15s ease;
}
.form-section-collapsible[open] .form-section-summary::before {
  transform: rotate(90deg);
}

/* ─── Delivery stepper (P3 audit 2026-04-26) ─── */
.delivery-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin: var(--space-4) 0 var(--space-6);
  padding: var(--space-3) var(--space-2);
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border-default, #e5e7eb);
  border-radius: var(--radius-md, 8px);
  overflow-x: auto;
}
.delivery-step {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--space-2);
  background: transparent;
  border: 0;
  cursor: pointer;
  position: relative;
  font: inherit;
  color: var(--text-muted, #6b7280);
  min-width: 0;
}
/* Connector line between steps */
.delivery-step + .delivery-step::before {
  content: '';
  position: absolute;
  top: 18px; /* aligns with marker center */
  left: -50%;
  right: 50%;
  height: 2px;
  background: var(--border-default, #e5e7eb);
  z-index: 0;
}
.delivery-step-marker {
  position: relative;
  z-index: 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-secondary, #f3f4f6);
  border: 2px solid var(--border-default, #e5e7eb);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.delivery-step-label {
  font-size: var(--text-xs);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.delivery-step.done .delivery-step-marker {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.delivery-step.done + .delivery-step::before { background: #16a34a; }
.delivery-step.done .delivery-step-label { color: var(--text-secondary); }

.delivery-step.active .delivery-step-marker {
  background: #0891b2;
  border-color: #0891b2;
  color: #fff;
  box-shadow: 0 0 0 4px rgba(8,145,178,0.12);
}
.delivery-step.active .delivery-step-label {
  color: var(--text-primary, #111827);
  font-weight: 600;
}

.delivery-step.upcoming .delivery-step-marker { /* default already handles muted */ }

@media (max-width: 640px) {
  .delivery-step-label { font-size: 10px; }
  .delivery-step-marker { width: 28px; height: 28px; font-size: var(--text-xs); }
  .delivery-step + .delivery-step::before { top: 16px; }
}

/* ─── SW update banner (P3 audit 2026-04-26) ─── */
.sw-update-banner {
  position: fixed;
  left: 50%;
  bottom: var(--space-4);
  transform: translateX(-50%);
  z-index: 1100; /* above modal overlay */
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--text-primary, #111827);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  max-width: calc(100vw - var(--space-4) * 2);
}
.sw-update-message {
  font-size: var(--text-sm);
  font-weight: 500;
}
.sw-update-actions { display: flex; gap: var(--space-2); }
.sw-update-banner .btn-primary { background: #16a34a; border: 0; }
.sw-update-banner .btn-primary:hover { background: #15803d; }
.sw-update-banner .btn-ghost { color: #d1d5db; background: transparent; }
.sw-update-banner .btn-ghost:hover { color: #fff; }

/* Sit above the mobile bottom-bar when present */
@media (max-width: 640px) {
  .sw-update-banner {
    bottom: calc(var(--space-3) + 80px);
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ─── Help-tip popover (P3 audit 2026-04-26) ─── */
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-secondary, #f3f4f6);
  color: var(--text-secondary, #6b7280);
  border: 1px solid var(--border-default, #e5e7eb);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-left: 6px;
  padding: 0;
  line-height: 1;
  vertical-align: middle;
  flex: 0 0 auto;
}
.help-tip:hover { background: var(--cyan, #0891b2); color: #fff; border-color: var(--cyan, #0891b2); }
