/* ========================================
   ShimSheet — Application Styles
   Industrial pipeline shim tracker
   Dense, mobile-first, field-ready
   Multi-mode: Shims | Shoes | Structural
   ======================================== */

/* ===== LAYOUT ===== */
html, body {
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ===== HEADER ===== */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  min-height: 52px;
  flex-shrink: 0;
  z-index: 20;
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.logo svg {
  display: block;
  width: 28px;
  height: 28px;
}

.logo-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.project-name {
  display: none;
}

/* ===== AUTH SECTION ===== */
.auth-section {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  margin-right: var(--space-3);
}
.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
}
.auth-name {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.auth-signed-in {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
@media (max-width: 600px) {
  .auth-section {
    margin-left: auto;
    margin-right: var(--space-1);
  }
  .auth-name {
    display: none;
  }
}

/* ===== ICON BUTTON ===== */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.icon-btn:active {
  background: var(--color-surface-dynamic);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  min-height: 44px;
  border: none;
  white-space: nowrap;
}

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

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover { color: var(--color-text); background: var(--color-surface-2); }

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

.btn-sm {
  padding: var(--space-2) var(--space-3);
  min-height: 36px;
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  min-height: 52px;
}

.btn-full { width: 100%; }

/* ===== MAIN CONTENT ===== */
.app-main {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ===== LOGIN SCREEN (unauthenticated — full viewport, no header/footer) ===== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
  background: linear-gradient(170deg, #0a0f1a 0%, #0f1a2e 40%, #1B3A5C 100%);
}

/* ===== SETUP SCREEN (new project form) ===== */
.setup-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
  min-height: calc(100dvh - 52px);
  padding: var(--space-4);
}

/* Background grid overlay */
.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* Login content wrapper */
.login-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 440px;
}

/* SVG Logo */
.login-logo-wrap {
  margin-bottom: var(--space-4);
}

.login-logo-svg {
  display: block;
  width: 120px;
  height: 120px;
}

/* Shim glow pulse */
.shim-glow-rect {
  animation: shimGlowPulse 2.5s ease-in-out infinite;
}

@keyframes shimGlowPulse {
  0%, 100% { opacity: 0.5; fill: #1a8f7a; }
  50% { opacity: 1; fill: #2DB8A0; }
}

/* Login title */
.login-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  text-align: center;
  text-shadow: 0 0 30px rgba(45, 184, 160, 0.3), 0 0 60px rgba(45, 184, 160, 0.1);
  animation: titleShimmer 4s ease-in-out infinite;
}

@keyframes titleShimmer {
  0%, 100% { text-shadow: 0 0 30px rgba(45, 184, 160, 0.3), 0 0 60px rgba(45, 184, 160, 0.1); }
  50% { text-shadow: 0 0 40px rgba(45, 184, 160, 0.5), 0 0 80px rgba(45, 184, 160, 0.2); }
}

/* Tagline */
.login-tagline {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  margin-top: var(--space-1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Glow divider */
.login-divider {
  width: 80px;
  height: 2px;
  margin: var(--space-6) auto;
  background: linear-gradient(90deg, transparent, #2DB8A0, transparent);
  box-shadow: 0 0 12px rgba(45, 184, 160, 0.5);
  border-radius: 1px;
}

/* Google sign-in wrapper on login */
.login-google-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-6);
  min-height: 44px;
}

/* Setup card (form container) */
.setup-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}

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

.setup-logo svg {
  display: inline-block;
  margin-bottom: var(--space-3);
}

.setup-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.setup-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* Login footnote */
.login-footnote {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  max-width: 300px;
  line-height: 1.5;
  margin-top: var(--space-2);
}

/* Cascade stagger animations */
.login-cascade-1 { animation: loginFadeUp 600ms ease-out both; animation-delay: 100ms; }
.login-cascade-2 { animation: loginFadeUp 600ms ease-out both; animation-delay: 200ms; }
.login-cascade-3 { animation: loginFadeUp 600ms ease-out both; animation-delay: 300ms; }
.login-cascade-4 { animation: loginFadeUp 600ms ease-out both; animation-delay: 400ms; }
.login-cascade-5 { animation: loginFadeUp 600ms ease-out both; animation-delay: 500ms; }
.login-cascade-6 { animation: loginFadeUp 600ms ease-out both; animation-delay: 600ms; }
.login-cascade-7 { animation: loginFadeUp 600ms ease-out both; animation-delay: 700ms; }

@keyframes loginFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== SPARK PARTICLES ===== */
.spark-container {
  position: absolute;
  bottom: 35%;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 200px;
  pointer-events: none;
  z-index: 1;
}

.spark {
  position: absolute;
  bottom: 0;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  animation: sparkRise 2s ease-out infinite;
  opacity: 0;
}

.spark:nth-child(1)  { left: 20%; background: #ff8c42; animation-delay: 0s; animation-duration: 1.8s; }
.spark:nth-child(2)  { left: 50%; background: #2DB8A0; animation-delay: 0.3s; animation-duration: 2.2s; }
.spark:nth-child(3)  { left: 70%; background: #fff; animation-delay: 0.7s; animation-duration: 1.6s; }
.spark:nth-child(4)  { left: 35%; background: #ff8c42; animation-delay: 1.1s; animation-duration: 2s; }
.spark:nth-child(5)  { left: 60%; background: #2DB8A0; animation-delay: 0.2s; animation-duration: 2.4s; }
.spark:nth-child(6)  { left: 80%; background: #fff; animation-delay: 0.9s; animation-duration: 1.7s; }
.spark:nth-child(7)  { left: 10%; background: #ff8c42; animation-delay: 1.5s; animation-duration: 2.1s; }
.spark:nth-child(8)  { left: 45%; background: #2DB8A0; animation-delay: 0.5s; animation-duration: 1.9s; }
.spark:nth-child(9)  { left: 90%; background: #ff8c42; animation-delay: 1.3s; animation-duration: 2.3s; }
.spark:nth-child(10) { left: 25%; background: #fff; animation-delay: 0.8s; animation-duration: 1.5s; }
.spark:nth-child(11) { left: 55%; background: #ff8c42; animation-delay: 1.7s; animation-duration: 2s; }
.spark:nth-child(12) { left: 75%; background: #2DB8A0; animation-delay: 0.4s; animation-duration: 2.2s; }
.spark:nth-child(13) { left: 40%; background: #fff; animation-delay: 1.0s; animation-duration: 1.8s; }
.spark:nth-child(14) { left: 65%; background: #ff8c42; animation-delay: 0.6s; animation-duration: 2.4s; }
.spark:nth-child(15) { left: 15%; background: #2DB8A0; animation-delay: 1.4s; animation-duration: 1.6s; }
.spark:nth-child(16) { left: 85%; background: #fff; animation-delay: 1.8s; animation-duration: 2.1s; }
.spark:nth-child(17) { left: 30%; background: #ff8c42; animation-delay: 0.1s; animation-duration: 2.3s; }
.spark:nth-child(18) { left: 50%; background: #2DB8A0; animation-delay: 1.2s; animation-duration: 1.7s; }

@keyframes sparkRise {
  0% {
    opacity: 0;
    transform: translateY(0) translateX(0);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-180px) translateX(var(--spark-drift, 10px));
  }
}

.spark:nth-child(odd)  { --spark-drift: -15px; }
.spark:nth-child(even) { --spark-drift: 12px; }
.spark:nth-child(3n)   { --spark-drift: -8px; width: 2px; height: 2px; }
.spark:nth-child(5n)   { --spark-drift: 20px; width: 4px; height: 4px; }



@media (max-width: 480px) {
  .login-logo-svg {
    width: 90px;
    height: 90px;
  }
  .login-title {
    font-size: 1.75rem;
  }
  .setup-card {
    padding: var(--space-4);
  }
}

/* ===== FORM ELEMENTS ===== */
.setup-form { display: flex; flex-direction: column; gap: var(--space-4); }

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}

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

.form-label .optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-text-faint);
}

.form-input {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text);
  min-height: 44px;
  width: 100%;
}

.form-input:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--color-primary) 20%, transparent);
}

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

.form-input-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums lining-nums;
}

.form-input-lg {
  font-size: var(--text-lg);
  padding: var(--space-4);
  min-height: 56px;
  text-align: center;
}

.form-row {
  display: flex;
  gap: var(--space-3);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
}

/* ===== PROGRESS ===== */
.progress-section {
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
}

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

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

.progress-value {
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  height: 6px;
  background: var(--color-surface-dynamic);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== MODE TOGGLE ===== */
.mode-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
}

.mode-toggle {
  display: flex;
  background: var(--color-surface-2);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--color-border);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: color 180ms ease, background 180ms ease;
  white-space: nowrap;
  min-height: 32px;
}

.mode-btn svg {
  flex-shrink: 0;
}

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

.mode-btn.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(45, 184, 160, 0.4);
}

@media (max-width: 480px) {
  .mode-btn {
    padding: 6px 10px;
    font-size: 11px;
    gap: 4px;
  }
  .mode-btn svg {
    display: none;
  }
}

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: var(--space-1); padding: var(--space-2); }
}

.stat-card {
  text-align: center;
  padding: var(--space-2) var(--space-1);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.2;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin-top: 2px;
}

/* Shim mode stat colors */
.stat-unchecked .stat-value { color: var(--color-gray); }
.stat-verified .stat-value { color: var(--color-success); }
.stat-staged .stat-value { color: var(--color-warning); }
.stat-installed .stat-value { color: var(--color-blue); }
.stat-welded .stat-value { color: var(--color-purple); }
.stat-inspected .stat-value { color: var(--color-success); }
.stat-flagged .stat-value { color: var(--color-error); }

/* Shoe mode stat colors (warm tones) */
.stat-shoe-not-started .stat-value { color: var(--color-gray); }
.stat-shoe-staged .stat-value     { color: #f59e0b; }
.stat-shoe-set .stat-value        { color: #d97706; }
.stat-shoe-torqued .stat-value    { color: #b45309; }
.stat-shoe-welded .stat-value     { color: #92400e; }
.stat-shoe-verified .stat-value   { color: var(--color-success); }
.stat-shoe-inspected .stat-value  { color: var(--color-success); }

/* Structural mode stat colors (cool blues) */
.stat-struct-total .stat-value        { color: var(--color-text); }
.stat-struct-unconfigured .stat-value { color: var(--color-gray); }
.stat-struct-not-started .stat-value  { color: #60a5fa; }
.stat-struct-in-progress .stat-value  { color: #3b82f6; }
.stat-struct-complete .stat-value     { color: var(--color-success); }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  flex-wrap: wrap;
}

.filter-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex: 1;
}

.filter-right {
  display: flex;
  align-items: center;
}

.search-wrap {
  position: relative;
  flex: 0 1 180px;
  min-width: 120px;
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-faint);
  pointer-events: none;
}

.search-input {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-3) + 20px);
  font-size: var(--text-xs);
  color: var(--color-text);
  width: 100%;
  min-height: 36px;
}

.search-input:focus {
  border-color: var(--color-primary);
  outline: none;
}

.filter-select {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text);
  min-height: 36px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b90a0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.filter-select:focus {
  border-color: var(--color-primary);
  outline: none;
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  min-height: 36px;
  cursor: pointer;
}

.filter-btn:hover { color: var(--color-text); }
.filter-btn.active {
  background: var(--color-error-highlight);
  color: var(--color-error);
  border-color: var(--color-error);
}

.result-count {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
  white-space: nowrap;
}

@media (max-width: 600px) {
  .filter-bar { padding: var(--space-2); }
  .search-wrap { flex: 1 1 100%; }
  .filter-select { flex: 1; min-width: 0; font-size: 12px; }
}

/* ===== BULK BAR ===== */
.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary-highlight);
  border-bottom: 1px solid var(--color-primary);
  gap: var(--space-3);
  flex-wrap: wrap;
}

.bulk-count {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  white-space: nowrap;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ===== TABLE ===== */
.table-wrap {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.support-table {
  width: 100%;
  border-collapse: collapse;
}

.support-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-surface-offset);
}

.support-table th {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
  user-select: none;
}

.support-table td {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}

.support-table tbody tr {
  cursor: pointer;
}

.support-table tbody tr:hover {
  background: var(--color-surface-2);
}

.support-table tbody tr:active {
  background: var(--color-surface-dynamic);
}

.support-table tbody tr.row-flagged {
  border-left: 3px solid var(--color-error);
  background: var(--color-error-highlight);
}

.support-table tbody tr.row-flagged:hover {
  background: color-mix(in oklch, var(--color-error) 12%, var(--color-surface));
}

.support-table tbody tr.row-selected {
  background: var(--color-primary-highlight);
}

.th-check { width: 40px; text-align: center; }
.th-support { width: 100px; }
.th-commodity { width: 120px; }
.th-width { width: 80px; }
.th-length { width: 80px; }
.th-thickness { width: 80px; }
.th-status { width: 120px; }
.th-comment { width: 48px; text-align: center; }
.th-flag { width: 48px; text-align: center; }
.th-type { width: 90px; }
.th-progress { width: 70px; }

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

.td-support {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}

.td-commodity {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.td-measurement {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--color-text-muted);
}

.td-measurement.has-value { color: var(--color-text); }

/* Status Badge — Shim mode */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.status-badge:active { transform: scale(0.95); }

/* Shim statuses */
.badge-Unchecked { background: var(--color-gray-highlight); color: var(--color-gray); }
.badge-Verified  { background: var(--color-success-highlight); color: var(--color-success); }
.badge-Staged    { background: var(--color-warning-highlight); color: var(--color-warning); }
.badge-Installed { background: var(--color-blue-highlight); color: var(--color-blue); }
.badge-Welded    { background: var(--color-purple-highlight); color: var(--color-purple); }
.badge-Inspected { background: var(--color-success-highlight); color: var(--color-success); }

/* Shoe statuses — warm tone palette */
.badge-shoe-Not-Started { background: rgba(107,114,128,0.12); color: #6b7280; }
.badge-shoe-Staged      { background: rgba(245,158,11,0.12); color: #d97706; }
.badge-shoe-Set         { background: rgba(217,119,6,0.15); color: #b45309; }
.badge-shoe-Torqued     { background: rgba(180,83,9,0.15); color: #92400e; }
.badge-shoe-Welded      { background: rgba(146,64,14,0.15); color: #7c2d12; }
.badge-shoe-Verified    { background: var(--color-success-highlight); color: var(--color-success); }
.badge-shoe-Inspected   { background: var(--color-success-highlight); color: var(--color-success); }

/* Structural statuses — cool blue palette */
.badge-struct-Not-Started  { background: rgba(96,165,250,0.1); color: #60a5fa; }
.badge-struct-In-Progress  { background: rgba(59,130,246,0.12); color: #3b82f6; }
.badge-struct-Complete     { background: var(--color-success-highlight); color: var(--color-success); }
.badge-struct-Not-Configured { background: rgba(107,114,128,0.1); color: #6b7280; }

/* Component statuses — within structural editor */
.badge-comp-Not-Started { background: rgba(107,114,128,0.12); color: #6b7280; }
.badge-comp-Cut        { background: rgba(251,191,36,0.12); color: #d97706; }
.badge-comp-Cap-Set    { background: rgba(59,130,246,0.12); color: #3b82f6; }
.badge-comp-Tacked     { background: rgba(124,58,237,0.12); color: #7c3aed; }
.badge-comp-Welded     { background: var(--color-success-highlight); color: var(--color-success); }
.badge-comp-Set        { background: rgba(59,130,246,0.12); color: #3b82f6; }

/* Flag button */
.flag-cell {
  text-align: center;
}

.flag-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-faint);
  margin: 0 auto;
}

.flag-icon:hover { color: var(--color-error); background: var(--color-error-highlight); }
.flag-icon.flagged { color: var(--color-error); background: var(--color-error-highlight); }
.flag-icon.flagged svg { fill: var(--color-error); }

/* Comment indicator */
.comment-cell {
  text-align: center;
}

.comment-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  color: var(--color-primary);
  margin: 0 auto;
  cursor: pointer;
  opacity: 0.7;
}

.comment-indicator:hover {
  opacity: 1;
  background: var(--color-primary-highlight);
}

/* Row checkbox */
.row-check {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* Mobile responsive table */
@media (max-width: 700px) {
  .th-commodity, .td-commodity-cell { display: none; }
  .th-width, .th-length, .th-thickness { display: none; }
  .td-width-cell, .td-length-cell, .td-thickness-cell { display: none; }
  .th-support { width: auto; }
  .support-table th, .support-table td { padding: var(--space-2); }
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-4);
  color: var(--color-text-faint);
  text-align: center;
  gap: var(--space-4);
}

.empty-state p { font-size: var(--text-sm); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(0 0 0 / 0.6);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn 150ms ease-out;
}

@media (min-width: 600px) {
  .modal-overlay { align-items: center; padding: var(--space-4); }
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 520px;
  max-height: 92dvh;
  overflow-y: auto;
  animation: slideUp 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 600px) {
  .modal {
    border-radius: var(--radius-xl);
    max-height: 85dvh;
  }
}

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

.modal-title-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.modal-title {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-weight: 700;
}

.modal-mode-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  letter-spacing: 0.03em;
}

.modal-close { color: var(--color-text-muted); }
.modal-close:hover { color: var(--color-text); }

.modal-body { padding: var(--space-4) var(--space-5); }

.modal-section { margin-bottom: var(--space-5); }
.modal-section:last-child { margin-bottom: 0; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-divider);
  gap: var(--space-2);
}

/* Notes textarea in modal */
.modal-notes-textarea {
  min-height: 60px;
  resize: vertical;
  font-family: var(--font-body);
  font-size: var(--text-sm);
}

/* Quick commodity buttons */
.quick-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.quick-btn {
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 2px solid transparent;
  min-height: 48px;
  cursor: pointer;
  text-align: center;
}

.quick-btn:hover { color: var(--color-text); background: var(--color-surface-dynamic); }
.quick-btn.active {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-highlight);
}

/* Status workflow buttons */
.status-workflow {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-2);
}

.status-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 2px solid transparent;
  min-height: 44px;
  cursor: pointer;
  justify-content: center;
}

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

/* Shim status buttons */
.status-btn.active-Unchecked { border-color: var(--color-gray); color: var(--color-gray); background: var(--color-gray-highlight); }
.status-btn.active-Verified  { border-color: var(--color-success); color: var(--color-success); background: var(--color-success-highlight); }
.status-btn.active-Staged    { border-color: var(--color-warning); color: var(--color-warning); background: var(--color-warning-highlight); }
.status-btn.active-Installed { border-color: var(--color-blue); color: var(--color-blue); background: var(--color-blue-highlight); }
.status-btn.active-Welded    { border-color: var(--color-purple); color: var(--color-purple); background: var(--color-purple-highlight); }
.status-btn.active-Inspected { border-color: var(--color-success); color: var(--color-success); background: var(--color-success-highlight); }

/* Shoe status buttons — warm amber/brown tones */
.status-btn.active-Not-Started { border-color: var(--color-gray); color: var(--color-gray); background: var(--color-gray-highlight); }
.status-btn.active-Set         { border-color: #d97706; color: #d97706; background: rgba(217,119,6,0.1); }
.status-btn.active-Torqued     { border-color: #b45309; color: #b45309; background: rgba(180,83,9,0.1); }
.status-btn.active-Verified    { border-color: var(--color-success); color: var(--color-success); background: var(--color-success-highlight); }

/* Structural component status buttons — cool tones */
.status-btn.active-Cut      { border-color: #f59e0b; color: #d97706; background: rgba(245,158,11,0.1); }
.status-btn.active-Cap-Set  { border-color: #3b82f6; color: #3b82f6; background: rgba(59,130,246,0.1); }
.status-btn.active-Tacked   { border-color: #7c3aed; color: #7c3aed; background: rgba(124,58,237,0.1); }

/* The Staged & Welded classes apply to both shim and shoe so reuse the classes below */
.status-btn.active-Staged  { border-color: var(--color-warning); color: var(--color-warning); background: var(--color-warning-highlight); }
/* Welded for shoe/structural gets a different shade */
.status-shoe-welded.active-Welded { border-color: #92400e; color: #92400e; background: rgba(146,64,14,0.1); }

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

/* Shim dots */
.dot-unchecked { background: var(--color-gray); }
.dot-verified  { background: var(--color-success); }
.dot-staged    { background: var(--color-warning); }
.dot-installed { background: var(--color-blue); }
.dot-welded    { background: var(--color-purple); }
.dot-inspected { background: var(--color-success); }

/* Shoe dots */
.dot-shoe-not-started { background: var(--color-gray); }
.dot-shoe-staged      { background: #f59e0b; }
.dot-shoe-set         { background: #d97706; }
.dot-shoe-torqued     { background: #b45309; }
.dot-shoe-welded      { background: #92400e; }
.dot-shoe-verified    { background: var(--color-success); }
.dot-shoe-inspected   { background: var(--color-success); }

/* Structural / component dots */
.dot-struct-not-started  { background: var(--color-gray); }
.dot-struct-cut          { background: #f59e0b; }
.dot-struct-cap-set      { background: #3b82f6; }
.dot-struct-tacked       { background: #7c3aed; }
.dot-struct-welded       { background: var(--color-success); }
.dot-struct-set          { background: #3b82f6; }

/* Flag toggle */
.flag-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 2px solid transparent;
  width: 100%;
  min-height: 48px;
  cursor: pointer;
  justify-content: center;
}

.flag-toggle:hover { color: var(--color-error); }
.flag-toggle.active {
  background: var(--color-error-highlight);
  color: var(--color-error);
  border-color: var(--color-error);
}
.flag-toggle.active svg { fill: var(--color-error); }

/* ===== SETTINGS — Lines Manager ===== */
.lines-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.line-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-2);
  background: var(--color-raised);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: var(--font-body);
}

.line-item-name {
  flex: 1;
  font-weight: 500;
}

.line-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-faint);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.line-item-remove:hover {
  color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 10%, transparent);
}

.lines-add-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.lines-add-row .form-input {
  flex: 1;
}

/* Backup section */
.settings-backup-section {
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-3);
  margin-top: var(--space-2);
}

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

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== SETTINGS MODAL ===== */
.settings-modal {
  max-width: 500px;
}

.settings-hint {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-3);
  line-height: 1.5;
}

.logo-upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-interactive), background var(--transition-interactive);
}

.logo-upload-area:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-2);
}

.logo-upload-area.has-logo {
  border-style: solid;
  padding: var(--space-4);
}

.logo-preview-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}

.logo-preview-img {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
}

.logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
}

.logo-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
  justify-content: center;
}

/* ===== PRINT MODAL ===== */
.print-modal {
  max-width: 540px;
}

.print-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.print-record-count {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-family: var(--font-mono);
}

.print-record-summary {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.print-status-btn.active-all {
  border-color: var(--color-text-muted);
  color: var(--color-text);
  background: var(--color-surface-dynamic);
}

/* ===== PROJECT SWITCHER ===== */
.project-switcher-wrap {
  position: relative;
}

.project-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  min-height: 36px;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
}

.project-switcher:hover {
  background: var(--color-surface-dynamic);
  border-color: var(--color-primary);
}

.switcher-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switcher-chevron {
  flex-shrink: 0;
  color: var(--color-text-muted);
  display: block;
  width: 14px;
  height: 14px;
}

.project-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 260px;
  max-width: 320px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  animation: fadeIn 100ms ease-out;
}

.project-dropdown-list {
  padding: var(--space-1);
}

.dropdown-project-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  gap: var(--space-2);
}

.dropdown-project-item:hover {
  background: var(--color-surface-2);
}

.dropdown-project-item.active {
  background: var(--color-primary-highlight);
  border-left: 3px solid var(--color-primary);
}

.dropdown-project-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.dropdown-project-name {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-project-meta {
  font-size: 10px;
  color: var(--color-text-faint);
  white-space: nowrap;
}

.dropdown-project-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  color: var(--color-text-faint);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 120ms;
}

.dropdown-project-item:hover .dropdown-project-delete {
  opacity: 1;
}

.dropdown-project-delete:hover {
  background: var(--color-error-highlight);
  color: var(--color-error);
}

.dropdown-new-project {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  border-top: 1px solid var(--color-divider);
  margin-top: var(--space-1);
}

.dropdown-new-project:hover {
  background: var(--color-primary-highlight);
}

.dropdown-new-project svg {
  display: block;
  width: 16px;
  height: 16px;
}

/* Mobile bottom-sheet dropdown */
@media (max-width: 600px) {
  .project-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    min-width: 100%;
    max-width: 100%;
    max-height: 60vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -8px 40px oklch(0 0 0 / 0.5);
    z-index: 200;
    animation: slideUp 200ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .project-dropdown-backdrop {
    position: fixed;
    inset: 0;
    background: oklch(0 0 0 / 0.45);
    z-index: 199;
    animation: fadeIn 150ms ease-out;
  }
}

/* ===== SAVE INDICATOR ===== */
.save-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--color-success);
  opacity: 0;
  transition: opacity 300ms ease;
  white-space: nowrap;
  pointer-events: none;
}

.save-indicator svg {
  display: block;
  width: 12px;
  height: 12px;
}

.save-indicator.visible {
  opacity: 1;
}

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

/* ===== SAVED PROJECTS (Setup Screen) ===== */
.saved-projects-section {
  width: 100%;
  max-width: 440px;
  margin-top: var(--space-6);
}

.saved-projects-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.saved-projects-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.saved-project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  gap: var(--space-3);
  transition: border-color var(--transition-interactive), background var(--transition-interactive);
}

.saved-project-card:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-2);
}

.saved-project-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.saved-project-card-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-project-card-meta {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.saved-project-card-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-faint);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 120ms;
}

.saved-project-card:hover .saved-project-card-delete {
  opacity: 1;
}

.saved-project-card-delete:hover {
  background: var(--color-error-highlight);
  color: var(--color-error);
}


/* ===== TOOLBAR: OVERFLOW MENU & HAMBURGER ===== */

/* Hamburger button: hidden on desktop */
.hamburger-btn {
  display: none;
}

/* Overflow three-dot menu: shown on desktop */
.overflow-menu-wrap {
  position: relative;
}

/* On desktop: hide secondary action direct-buttons, show overflow menu */
@media (min-width: 601px) {
  .header-action-secondary {
    display: none;
  }
  .hamburger-btn {
    display: none;
  }
  .hamburger-panel {
    display: none !important;
  }
}

/* Overflow dropdown */
.overflow-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  padding: var(--space-1);
  animation: fadeIn 100ms ease-out;
}

.overflow-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
}

.overflow-item:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.overflow-item svg {
  flex-shrink: 0;
  color: var(--color-text-faint);
}

.overflow-item:hover svg {
  color: var(--color-text-muted);
}

/* ===== MOBILE (<=600px): Hamburger replaces all right buttons ===== */
@media (max-width: 600px) {
  .header-action-primary,
  .header-action-secondary,
  .overflow-menu-wrap {
    display: none;
  }

  .hamburger-btn {
    display: flex;
  }

  .auth-section .btn {
    display: none;
  }
}

/* Hamburger slide-down panel */
.hamburger-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-divider);
  box-shadow: 0 8px 24px oklch(0 0 0 / 0.3);
  z-index: 19;
  padding: var(--space-2);
  animation: slideDown 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.hamburger-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
  min-height: 44px;
}

.hamburger-item:hover {
  background: var(--color-surface-2);
}

.hamburger-item:active {
  background: var(--color-surface-dynamic);
}

.hamburger-item svg {
  flex-shrink: 0;
  color: var(--color-text-muted);
}

/* ===== ADD SUPPORTS MODAL ===== */
.add-support-modal {
  max-width: 480px;
}

.add-support-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  padding: 3px;
}

.add-support-tab {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  cursor: pointer;
  border: none;
  background: transparent;
  min-height: 36px;
}

.add-support-tab:hover {
  color: var(--color-text);
}

.add-support-tab.active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.add-single-row {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.add-single-row .form-input {
  flex: 1;
}

.add-single-row .btn {
  flex-shrink: 0;
}

.add-support-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: var(--space-2);
  font-weight: 600;
}

.add-recent-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: 160px;
  overflow-y: auto;
  padding: var(--space-2);
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.add-recent-item {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-success);
  padding: var(--space-1) var(--space-2);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.add-recent-item svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.add-recent-empty {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  text-align: center;
  padding: var(--space-2);
}

/* ===== PROJECT DROPDOWN BACKDROP ===== */
.project-dropdown-backdrop {
  display: none;
}

/* ===== COMMODITY TABLE GROUPING ===== */
.commodity-group-first td {
  border-top: 1px solid var(--color-border);
}

.commodity-group-sub td {
  border-bottom-color: color-mix(in oklch, var(--color-divider) 50%, transparent);
}

.commodity-group-sub .td-commodity-cell {
  padding-left: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.commodity-group-last td {
  border-bottom: 1px solid var(--color-divider);
}

/* ===== PER-COMMODITY SECTIONS (Edit Modal) ===== */
.commodity-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.commodity-section {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: opacity 200ms ease, border-color 200ms ease;
}

.commodity-section:not(.commodity-disabled) {
  border-color: var(--color-primary);
}

.commodity-disabled {
  opacity: 0.5;
}

.commodity-disabled:hover {
  opacity: 0.7;
}

.commodity-header {
  padding: var(--space-3) var(--space-4);
}

.commodity-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  user-select: none;
}

.commodity-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.commodity-name {
  font-family: var(--font-body);
}

.commodity-body {
  padding: 0 var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.commodity-body .form-row {
  gap: var(--space-3);
}

.commodity-body .form-input {
  min-height: 40px;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
}

.commodity-status-workflow {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-1);
}

.commodity-status-workflow .status-btn {
  min-height: 36px;
  font-size: 11px;
  padding: var(--space-1) var(--space-2);
}

/* Shoe mode — per-commodity body */
.commodity-shoe-body {
  padding: 0 var(--space-4) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.shoe-status-workflow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
}

.shoe-status-workflow .status-btn {
  min-height: 36px;
  font-size: 11px;
  padding: var(--space-1) var(--space-2);
}

/* Shoe comment textarea */
.shoe-comment-textarea {
  min-height: 48px;
  resize: vertical;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  margin-top: var(--space-2);
}

/* ===== STRUCTURAL EDIT MODAL ===== */
.structural-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Type selector cards */
.structural-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.structural-type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
  min-height: 72px;
  text-align: center;
}

.structural-type-card:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
}

.structural-type-card.active {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--color-primary) 30%, transparent);
}

.structural-type-icon {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 28px;
}

.pile-dot {
  width: 8px;
  background: var(--color-primary);
  border-radius: 3px 3px 0 0;
  opacity: 0.8;
}

.beam-line {
  width: 100%;
  height: 4px;
  background: var(--color-text-muted);
  border-radius: 2px;
  margin-bottom: 4px;
}

.structural-type-label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.structural-type-sublabel {
  font-size: 10px;
  color: var(--color-text-faint);
}

/* Component grid */
.structural-components-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.structural-components-header {
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.structural-component-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

.structural-component-row:last-child {
  border-bottom: none;
}

.structural-component-name {
  font-size: var(--text-sm);
  font-weight: 600;
  min-width: 70px;
  flex-shrink: 0;
}

.structural-component-name.kind-pile {
  color: var(--color-primary);
}

.structural-component-name.kind-beam {
  color: #3b82f6;
}

.structural-component-name.kind-structural-top {
  color: #7c3aed;
}

.component-status-btns {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  flex: 1;
}

.comp-status-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 120ms ease;
}

.comp-status-btn:hover {
  color: var(--color-text);
  border-color: var(--color-border);
}

.comp-status-btn.active {
  border-color: currentColor;
}

/* Comp button active states — piles */
.comp-status-btn.active-Not-Started { color: #6b7280; background: rgba(107,114,128,0.12); border-color: #6b7280; }
.comp-status-btn.active-Cut         { color: #d97706; background: rgba(217,119,6,0.12); border-color: #d97706; }
.comp-status-btn.active-Cap-Set     { color: #3b82f6; background: rgba(59,130,246,0.12); border-color: #3b82f6; }
.comp-status-btn.active-Tacked      { color: #7c3aed; background: rgba(124,58,237,0.12); border-color: #7c3aed; }
.comp-status-btn.active-Welded      { color: var(--color-success); background: var(--color-success-highlight); border-color: var(--color-success); }
/* Beams: Set, Tacked, Welded */
.comp-status-btn.active-Set         { color: #3b82f6; background: rgba(59,130,246,0.12); border-color: #3b82f6; }

/* Structural comment section */
.structural-comment-section {
  margin-top: var(--space-2);
}

.structural-comment-section textarea {
  min-height: 56px;
  resize: vertical;
  font-family: var(--font-body);
  font-size: var(--text-sm);
}

/* Structural empty state (no type selected) */
.structural-no-type {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--color-text-faint);
  font-size: var(--text-sm);
}

/* ===== SCROLLBAR ===== */
.table-wrap::-webkit-scrollbar,
.app-main::-webkit-scrollbar {
  width: 6px;
}

.table-wrap::-webkit-scrollbar-track,
.app-main::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrap::-webkit-scrollbar-thumb,
.app-main::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

.table-wrap::-webkit-scrollbar-thumb:hover,
.app-main::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-faint);
}

/* ===== TRACKER SCREEN LAYOUT ===== */
.tracker-screen {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 52px);
  overflow: hidden;
}

.tracker-screen .table-wrap {
  flex: 1;
  overflow-y: auto;
}
