@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   PREMIUM SHADCN-INSPIRED GLASS DESIGN SYSTEM (RTL / DARK SHOWROOM)
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Core Surfaces & Depth Hierarchy */
  --bg-canvas: #070b14;
  --glass-shell: rgba(11, 17, 30, 0.72);
  --glass-panel: rgba(17, 25, 42, 0.64);
  --glass-card: rgba(24, 34, 56, 0.56);
  --glass-elevated: rgba(20, 29, 48, 0.94);
  --glass-input: rgba(8, 13, 24, 0.68);

  /* Borders & Highlights */
  --border-subtle: rgba(226, 232, 240, 0.09);
  --border-default: rgba(226, 232, 240, 0.14);
  --border-strong: rgba(226, 232, 240, 0.24);
  --border-highlight: rgba(255, 255, 255, 0.18);

  /* Typography */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  /* Semantic Accents */
  --accent-primary: #e11d48;
  --accent-primary-hover: #f43f5e;
  --accent-primary-soft: rgba(225, 29, 72, 0.15);
  --accent-primary-border: rgba(244, 63, 94, 0.45);

  --status-success: #10b981;
  --status-success-text: #6ee7b7;
  --status-success-soft: rgba(16, 185, 129, 0.14);

  --status-warning: #f59e0b;
  --status-warning-text: #fcd34d;
  --status-warning-soft: rgba(245, 158, 11, 0.14);

  --status-info: #3b82f6;
  --status-info-text: #93c5fd;
  --status-info-soft: rgba(59, 130, 246, 0.14);

  --status-danger: #ef4444;
  --status-danger-text: #fda4af;
  --status-danger-soft: rgba(239, 68, 68, 0.14);

  /* Geometry & Blur */
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --blur-md: 14px;
  --blur-lg: 22px;

  /* Shadows & Focus */
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);
  --shadow-inset: inset 0 1px 0 var(--border-highlight);
  --focus-ring: 0 0 0 3px rgba(225, 29, 72, 0.25);

  --ease-snappy: 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: 340ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==================== Reset & Base ==================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Vazirmatn", "Vazir", system-ui, -apple-system, Tahoma, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html {
  direction: rtl;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.showroom-body {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg-canvas);
  background-image: url('../images/bg-main.webp');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  user-select: none;
}

body.module-body {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg-canvas);
  background-image: url('../images/bg-main.webp');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-primary);
  padding: 24px 32px;
}

::selection {
  color: #fff;
  background: rgba(225, 29, 72, 0.45);
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 99px;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.48); }

/* ==================== Login Screen ==================== */
.login-box-standalone {
  width: min(410px, 92vw);
  background: var(--glass-elevated);
  backdrop-filter: blur(var(--blur-lg)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(140%);
  border: 1px solid var(--border-default);
  border-top-color: var(--border-highlight);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg), var(--shadow-inset);
  text-align: center;
}

.login-logo-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}

.login-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.field { margin-bottom: 14px; }
.field input { text-align: center; }
.login-error {
  color: var(--status-danger-text);
  font-size: 0.82rem;
  min-height: 22px;
  margin-bottom: 8px;
}

/* ==================== Minimal Logout Button ==================== */
.minimal-logout {
  position: fixed;
  top: 18px;
  left: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  box-shadow: var(--shadow-sm);
  transition: all var(--ease-snappy);
}
.minimal-logout svg { width: 18px; height: 18px; fill: currentColor; }
.minimal-logout:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

/* ==================== Main Workspace Shell (Layer 1) ==================== */
.workspace-host {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 28px;
  z-index: 20;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.workspace-host.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.975);
}

.ultra-light-glass {
  width: 95vw;
  height: 92vh;
  height: 92dvh;
  background: linear-gradient(155deg, rgba(13, 20, 36, 0.76), rgba(9, 14, 26, 0.68));
  backdrop-filter: blur(var(--blur-lg)) saturate(145%);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(145%);
  border: 1px solid var(--border-default);
  border-top-color: var(--border-highlight);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), var(--shadow-inset);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 30px;
  user-select: text;
}

/* ==================== Launcher Mode 1: Showroom ==================== */
.hub-wrapper.mode-showroom {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 88%;
  max-width: 1120px;
  gap: 48px;
  z-index: 50;
}

.mode-showroom .side-column {
  display: flex;
  flex-direction: column;
  gap: 40px;
  z-index: 10;
}
.mode-showroom .right-column .module-node:nth-child(2) { transform: translateX(22px); }
.mode-showroom .left-column .module-node:nth-child(2) { transform: translateX(-22px); }

.mode-showroom .car-hub {
  position: relative;
  width: 460px;
  height: 320px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: transform 0.32s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.mode-showroom .car-hub:hover { transform: scale(1.08); }
.mode-showroom .car-hub:hover .car-closed { opacity: 0; }
.mode-showroom .car-hub:hover .car-open {
  opacity: 1;
  filter: drop-shadow(0 28px 38px rgba(225, 29, 72, 0.42));
}
.mode-showroom.car-hovered .module-node:not(.disabled) {
  transform: scale(0.86);
  opacity: 0.55;
}
.fab-sub-actions { display: none; }

/* ==================== Launcher Mode 2: Floating Action Button (FAB) ==================== */
.hub-wrapper.mode-fab {
  position: fixed;
  left: 32px;
  bottom: 28px;
  width: 104px;
  height: 104px;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  transition: left 0.32s cubic-bezier(0.22, 1, 0.36, 1), top 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.hub-wrapper.mode-fab.is-dragging {
  transition: none !important;
  cursor: grabbing !important;
}

.mode-fab .car-hub {
  position: relative;
  width: 104px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(24, 34, 56, 0.92), rgba(13, 19, 34, 0.88));
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1.5px solid var(--border-strong);
  box-shadow: var(--shadow-md), var(--shadow-inset);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  opacity: 0.88;
  transition: transform var(--ease-spring), opacity 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.mode-fab .car-floor-shadow, .mode-fab .car-caption { display: none !important; }
.mode-fab .car-hub:hover, .mode-fab.fab-open .car-hub {
  opacity: 1;
  transform: scale(1.18);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--accent-primary-soft), var(--shadow-lg);
}
.mode-fab .car-hub:hover .car-closed, .mode-fab.fab-open .car-hub .car-closed { opacity: 0; }
.mode-fab .car-hub:hover .car-open, .mode-fab.fab-open .car-hub .car-open { opacity: 1; }

.mode-fab .side-column {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mode-fab .module-node {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.1) !important;
  opacity: 0;
  pointer-events: none;
  transition: transform var(--ease-spring), opacity 0.22s ease;
}
.mode-fab .node-icon {
  width: 54px;
  height: 54px;
  background: var(--glass-elevated);
  border-color: var(--border-default);
}
.mode-fab .node-icon svg { width: 22px; height: 22px; }
.mode-fab .node-title {
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(10, 15, 28, 0.92);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}

.mode-fab.fab-open .module-node { opacity: 1; pointer-events: auto; }
.mode-fab.fab-open .module-node.disabled { opacity: 0.3; }

.mode-fab.fab-open .fab-orbit-1 { transform: translate(calc(-50% + 92px), calc(-50% - 72px)) scale(1) !important; }
.mode-fab.fab-open .fab-orbit-2 { transform: translate(calc(-50% + 120px), calc(-50% + 14px)) scale(1) !important; }
.mode-fab.fab-open .fab-orbit-3 { transform: translate(calc(-50% + 52px), calc(-50% + 100px)) scale(1) !important; }
.mode-fab.fab-open .fab-orbit-4 { transform: translate(calc(-50% - 52px), calc(-50% + 100px)) scale(1) !important; }
.mode-fab.fab-open .fab-orbit-5 { transform: translate(calc(-50% - 120px), calc(-50% + 14px)) scale(1) !important; }
.mode-fab.fab-open .fab-orbit-6 { transform: translate(calc(-50% - 92px), calc(-50% - 72px)) scale(1) !important; }

.mode-fab.fab-open .fab-orbit-1:not(.disabled):hover { transform: translate(calc(-50% + 92px), calc(-50% - 72px)) scale(1.16) !important; }
.mode-fab.fab-open .fab-orbit-2:not(.disabled):hover { transform: translate(calc(-50% + 120px), calc(-50% + 14px)) scale(1.16) !important; }
.mode-fab.fab-open .fab-orbit-3:not(.disabled):hover { transform: translate(calc(-50% + 52px), calc(-50% + 100px)) scale(1.16) !important; }
.mode-fab.fab-open .fab-orbit-4:not(.disabled):hover { transform: translate(calc(-50% - 52px), calc(-50% + 100px)) scale(1.16) !important; }
.mode-fab.fab-open .fab-orbit-5:not(.disabled):hover { transform: translate(calc(-50% - 120px), calc(-50% + 14px)) scale(1.16) !important; }
.mode-fab.fab-open .fab-orbit-6:not(.disabled):hover { transform: translate(calc(-50% - 92px), calc(-50% - 72px)) scale(1.16) !important; }

.module-node.active-module .node-icon {
  background: linear-gradient(145deg, var(--accent-primary-hover), #be123c);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 4px var(--accent-primary-soft), var(--shadow-md);
}

.mode-fab.fab-open .fab-sub-actions {
  display: flex;
  gap: 6px;
  position: absolute;
  top: -40px;
  white-space: nowrap;
  z-index: 30;
}

/* Shared Car Hub & Orbit Nodes */
.car-floor-shadow {
  position: absolute;
  bottom: 18px;
  width: 300px;
  height: 36px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.8) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 1;
}
.car-img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 20px 26px rgba(0, 0, 0, 0.8));
  transition: opacity 0.25s ease;
  z-index: 2;
  pointer-events: none;
}
.car-open { opacity: 0; }
.car-caption {
  position: absolute;
  bottom: -10px;
  background: var(--glass-elevated);
  border: 1px solid var(--border-default);
  padding: 6px 18px;
  border-radius: 99px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  z-index: 5;
}
.mode-showroom .car-hub:hover .car-caption { opacity: 1; }

.module-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform var(--ease-spring), opacity 0.25s ease;
}
.node-icon {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--glass-panel);
  backdrop-filter: blur(var(--blur-md));
  -webkit-backdrop-filter: blur(var(--blur-md));
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-md), var(--shadow-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  transition: all var(--ease-snappy);
}
.node-icon svg { width: 32px; height: 32px; fill: currentColor; }
.lock-icon {
  display: none;
  position: absolute;
  bottom: -2px;
  left: -2px;
  width: 24px;
  height: 24px;
  background: #1e293b;
  border: 2px solid #0f172a;
  border-radius: 50%;
  color: var(--text-muted);
  align-items: center;
  justify-content: center;
}
.lock-icon svg { width: 11px; height: 11px; fill: currentColor; }
.node-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}
.mode-showroom .module-node:not(.disabled):hover { transform: scale(1.16) !important; }
.module-node:not(.disabled):hover .node-icon {
  background: linear-gradient(145deg, var(--accent-primary-hover), #be123c);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 28px rgba(225, 29, 72, 0.55);
}
.module-node.disabled { opacity: 0.32; filter: grayscale(100%); cursor: not-allowed; }
.module-node.disabled .lock-icon { display: flex; }

/* ==================== Module Containers & Surfaces (Layer 2 & 3) ==================== */
.module-container {
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--glass-panel);
  border: 1px solid var(--border-default);
  border-top-color: var(--border-highlight);
  padding: 16px 22px;
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}

.header-title h1 {
  font-size: clamp(1.05rem, 1.4vw, 1.28rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.glass-panel,
.archive-tree-panel,
.selected-car-header-card {
  background: var(--glass-panel);
  border: 1px solid var(--border-default);
  border-top-color: var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-md), var(--shadow-inset);
}

.glass-panel h3 {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 11px;
  margin-bottom: 16px;
}

.sub-heading {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 18px 0 12px;
}

.panel-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.75;
}

.panel-top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

/* Badges */
.phase-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 11px;
  border-radius: 99px;
  background: var(--status-info-soft);
  border: 1px solid rgba(59, 130, 246, 0.28);
  color: var(--status-info-text);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ==================== Layout Grids ==================== */
.grid-2col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4col { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-5col, .kpi-5grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }

/* ==================== Forms & Inputs ==================== */
.struct-form .form-row { margin-bottom: 15px; }
.struct-form .form-row-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}
.struct-form label {
  display: block;
  font-size: 0.81rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control,
.field input,
.tree-search-box input,
input[type="text"], input[type="search"], input[type="number"],
input[type="email"], input[type="tel"], input[type="date"],
input[type="password"], select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 13px;
  background: var(--glass-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.86rem;
  outline: none;
  transition: border-color var(--ease-snappy), background var(--ease-snappy), box-shadow var(--ease-snappy);
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-subtle);
}

.form-control:hover, input:hover, select:hover, textarea:hover {
  border-color: var(--border-strong);
}

.form-control:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--accent-primary-border);
  background: rgba(8, 13, 24, 0.88);
  box-shadow: var(--focus-ring);
}

select option {
  background: #0f172a;
  color: var(--text-primary);
}

.currency-words {
  display: block;
  font-size: 0.76rem;
  color: var(--status-info-text);
  margin-top: 5px;
  min-height: 16px;
}
.field-hint {
  display: block;
  font-size: 0.75rem;
  margin-top: 4px;
  min-height: 15px;
  color: var(--text-muted);
}

/* ==================== Buttons & Interactive Pills ==================== */
#login-btn, .btn-action, .btn-secondary, .fab-mini-btn, .btn-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--ease-snappy), background var(--ease-snappy), border-color var(--ease-snappy), box-shadow var(--ease-snappy);
}

#login-btn, .btn-action {
  background: linear-gradient(135deg, var(--accent-primary-hover), #be123c);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.25), var(--shadow-inset);
}
#login-btn:hover, .btn-action:hover {
  background: linear-gradient(135deg, #fb7185, var(--accent-primary));
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(225, 29, 72, 0.35);
}

.btn-secondary, .fab-mini-btn {
  background: rgba(255, 255, 255, 0.055);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}
.btn-secondary:hover, .fab-mini-btn:hover {
  background: rgba(255, 255, 255, 0.11);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.filter-bar, .category-chips, .radio-pills, .upload-btns-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-bar {
  background: var(--glass-card);
  border: 1px solid var(--border-default);
  padding: 13px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
}

.chip-btn, .radio-pills label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border-default);
  border-radius: 99px;
  color: var(--text-secondary);
  font-size: 0.81rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--ease-snappy);
}
.chip-btn:hover, .radio-pills label:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.chip-btn.active {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary-border);
  color: #fff;
  font-weight: 600;
}

/* ==================== KPI Cards (Layer 3) ==================== */
.kpi-card {
  position: relative;
  min-width: 0;
  background: var(--glass-card);
  border: 1px solid var(--border-default);
  border-top-color: var(--border-highlight);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  transition: transform var(--ease-snappy), border-color var(--ease-snappy), background var(--ease-snappy);
}

.kpi-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.kpi-card span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.kpi-card strong {
  font-size: clamp(1.02rem, 1.5vw, 1.32rem);
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.kpi-tag {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.clickable-kpi { cursor: pointer; }
.clickable-kpi:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  background: rgba(30, 41, 66, 0.68);
}

.kpi-card.active-kpi {
  background: linear-gradient(145deg, rgba(225, 29, 72, 0.18), rgba(24, 34, 56, 0.74));
  border-color: var(--accent-primary-border);
  box-shadow: 0 0 0 1px rgba(225, 29, 72, 0.15), var(--shadow-md);
}
.kpi-card.active-kpi .kpi-tag {
  background: var(--accent-primary);
  border-color: transparent;
  color: #fff;
}

/* ==================== Car Gallery & Cards ==================== */
.car-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.car-card {
  position: relative;
  background: var(--glass-card);
  border: 1px solid var(--border-default);
  border-top-color: var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  transition: transform var(--ease-snappy), border-color var(--ease-snappy), box-shadow var(--ease-snappy);
}

.car-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.select-type-card { cursor: pointer; }
.type-visual svg {
  width: 64px;
  height: 64px;
  fill: var(--accent-primary-hover);
  transition: transform var(--ease-snappy);
}
.select-type-card:hover .type-visual svg { transform: scale(1.1); }

.car-card-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 3px 11px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  z-index: 2;
}
.badge-owned { background: var(--status-success-soft); color: var(--status-success-text); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-consign { background: var(--status-info-soft); color: var(--status-info-text); border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-sold { background: rgba(148, 163, 184, 0.14); color: var(--text-secondary); border: 1px solid var(--border-default); }

.car-card-img {
  height: 175px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  background: rgba(8, 13, 24, 0.35);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  padding: 8px;
}
.car-card-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  transition: transform 0.3s ease;
}
.car-card:hover .car-card-img img { transform: scale(1.04); }

.car-card-body h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}
.car-specs {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.79rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.car-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--status-success-text);
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}

.car-mini-ledger {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(8, 13, 24, 0.42);
  border: 1px solid var(--border-subtle);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.79rem;
}
.car-mini-ledger div { display: flex; justify-content: space-between; gap: 8px; }

/* Selected Car Dossier Header */
.selected-car-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 18px;
}
.car-header-info {
  display: flex;
  align-items: center;
  gap: 16px;
}
.car-header-info img {
  width: 108px;
  height: 70px;
  object-fit: contain;
  background: rgba(8, 13, 24, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px;
}
.car-header-info h2 { font-size: 1.08rem; font-weight: 700; color: var(--text-primary); }
.car-header-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.car-header-price span { font-size: 0.8rem; color: var(--text-muted); }
.car-header-price strong { font-size: 1.12rem; color: var(--status-success-text); font-variant-numeric: tabular-nums; }

/* ==================== Tables (Clean & Tabular) ==================== */
.struct-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.83rem;
  background: rgba(8, 13, 24, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

.struct-table th, .struct-table td {
  padding: 12px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.struct-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 0.77rem;
  font-weight: 700;
  white-space: nowrap;
}

.struct-table tbody tr { transition: background var(--ease-snappy); }
.struct-table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.015); }
.struct-table tbody tr:hover, .clickable-row:hover { background: rgba(59, 130, 246, 0.08); }
.struct-table tbody tr:last-child td { border-bottom: none; }
.clickable-row { cursor: pointer; }

.link-drilldown {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--status-info-soft);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--status-info-text);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.79rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--ease-snappy);
}
.link-drilldown:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #fff;
}

/* ==================== Archive Tree + Table Layout ==================== */
.archive-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.tree-search-box { margin-bottom: 14px; }

.tree-root-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 13px;
  background: var(--status-info-soft);
  border: 1px solid rgba(59, 130, 246, 0.24);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--status-info-text);
  cursor: pointer;
  margin-bottom: 8px;
}

.tree-branches {
  list-style: none;
  padding-right: 10px;
  border-right: 1px dashed var(--border-default);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 500;
  transition: all var(--ease-snappy);
}
.tree-item:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); }
.tree-item.active {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary-border);
  color: #fff;
  font-weight: 600;
}

.tree-count {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.tree-item.active .tree-count { background: var(--accent-primary); color: #fff; }

.avatar-car-thumb {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--border-strong);
  background: rgba(8, 13, 24, 0.6);
  cursor: zoom-in;
  transition: transform var(--ease-snappy), border-color var(--ease-snappy);
}
.avatar-car-thumb:hover {
  transform: scale(1.16);
  border-color: var(--accent-primary);
}

/* ==================== SVG Analytics Charts ==================== */
.chart-box {
  min-height: 175px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(8, 13, 24, 0.3);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.donut-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.chart-legend-row { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-name { flex: 1; color: var(--text-secondary); }
.legend-val { font-variant-numeric: tabular-nums; }

.hbar-list { display: flex; flex-direction: column; gap: 11px; }
.hbar-meta { display: flex; justify-content: space-between; font-size: 0.8rem; margin-bottom: 4px; }
.hbar-track { width: 100%; height: 8px; background: rgba(255, 255, 255, 0.08); border-radius: 99px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 99px; transition: width 0.4s ease; }

.vbar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 160px;
  padding-top: 18px;
  border-bottom: 1px solid var(--border-default);
}
.vbar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vbar-val { font-size: 0.74rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.vbar-pillar { width: 32px; border-radius: 7px 7px 0 0; transition: height 0.4s ease; }
.vbar-lbl { font-size: 0.78rem; color: var(--text-secondary); }

/* Timeline */
.timeline-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tl-step {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  opacity: 0.55;
}
.tl-step.done {
  opacity: 1;
  border-color: rgba(16, 185, 129, 0.35);
  background: var(--status-success-soft);
}
.tl-step span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 700;
}
.tl-step.done span { background: var(--status-success); color: #052e16; }

/* Alerts, Dropzones & Checklists */
.balabood-alert-box {
  background: var(--status-warning-soft);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  margin-top: 12px;
}
.balabood-summary { display: flex; align-items: center; justify-content: space-between; font-size: 0.92rem; }

.upload-dropzone, .doc-upload-box {
  border: 1.5px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.025);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
  margin-top: 10px;
  transition: all var(--ease-snappy);
}
.upload-dropzone:hover { background: var(--status-info-soft); border-color: rgba(59, 130, 246, 0.5); }
.file-selected-badge { display: inline-block; margin-top: 8px; font-size: 0.8rem; color: var(--status-success-text); }

.docs-checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.doc-check-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
}
.doc-check-item label { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 0; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1200;
}
.modal-card {
  background: var(--glass-elevated);
  border: 1px solid var(--border-default);
  border-top-color: var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 22px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.btn-close {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.btn-close:hover { background: var(--status-danger-soft); color: #fff; }

/* Utility Classes */
.text-success { color: var(--status-success-text) !important; }
.text-danger { color: var(--status-danger-text) !important; }
.text-warning { color: var(--status-warning-text) !important; }
.mb-20 { margin-bottom: 18px; }
.mb-8 { margin-bottom: 8px; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.ltr-input { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; }

@media (min-width: 769px) { .mobile-only-btn { display: none; } }

/* ==================== Responsive Breakpoints ==================== */
@media (max-width: 1100px) {
  .kpi-5grid, .grid-5col { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .car-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-layout { grid-template-columns: 230px minmax(0, 1fr); }
}

@media (max-width: 768px) {
  body.module-body { padding: 12px; }
  .workspace-host { padding: 8px; }
  .ultra-light-glass {
    width: 100%;
    height: 95dvh;
    padding: 14px;
    border-radius: var(--radius-lg);
  }

  /* Showroom Mobile Layout */
  .hub-wrapper.mode-showroom {
    flex-direction: column;
    width: 94%;
    gap: 20px;
    justify-content: center;
  }
  .mode-showroom .car-hub { width: 240px; height: 155px; order: -1; }
  .mode-showroom .car-hub:hover { transform: scale(1.03); }
  .mode-showroom .car-floor-shadow { width: 180px; bottom: 6px; }
  .mode-showroom .side-column { flex-direction: row; justify-content: center; gap: 16px; width: 100%; }
  .mode-showroom .right-column .module-node:nth-child(2),
  .mode-showroom .left-column .module-node:nth-child(2) { transform: none; }
  .mode-showroom .node-icon { width: 60px; height: 60px; }
  .mode-showroom .node-icon svg { width: 25px; height: 25px; }
  .mode-showroom .node-title { font-size: 0.76rem; }

  /* FAB Mobile Layout */
  .hub-wrapper.mode-fab { width: 82px; height: 62px; }
  .mode-fab .car-hub { width: 82px; height: 62px; }
  .mode-fab .node-icon { width: 48px; height: 48px; }
  .mode-fab .node-icon svg { width: 20px; height: 20px; }
  .mode-fab.fab-open .fab-orbit-1 { transform: translate(calc(-50% + 70px), calc(-50% - 58px)) scale(0.9) !important; }
  .mode-fab.fab-open .fab-orbit-2 { transform: translate(calc(-50% + 90px), calc(-50% + 10px)) scale(0.9) !important; }
  .mode-fab.fab-open .fab-orbit-3 { transform: translate(calc(-50% + 40px), calc(-50% + 78px)) scale(0.9) !important; }
  .mode-fab.fab-open .fab-orbit-4 { transform: translate(calc(-50% - 40px), calc(-50% + 78px)) scale(0.9) !important; }
  .mode-fab.fab-open .fab-orbit-5 { transform: translate(calc(-50% - 90px), calc(-50% + 10px)) scale(0.9) !important; }
  .mode-fab.fab-open .fab-orbit-6 { transform: translate(calc(-50% - 70px), calc(-50% - 58px)) scale(0.9) !important; }

  /* Stacked Grids & Touch-Friendly Tables */
  .grid-2col, .grid-3col, .grid-4col, .car-gallery-grid,
  .docs-checklist, .struct-form .form-row-split, .archive-layout, .timeline-strip {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .kpi-5grid, .grid-5col { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .module-header {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }
  .header-actions { width: 100%; justify-content: flex-start; }
  .header-actions .form-control { width: 100% !important; }

  .glass-panel, .archive-tree-panel, .selected-car-header-card { padding: 15px; }
  .selected-car-header-card { flex-direction: column; align-items: flex-start; }
  .car-header-price { align-items: flex-start; }
  .donut-wrapper { flex-direction: column; }

  .struct-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .struct-table th, .struct-table td { padding: 10px 11px; font-size: 0.78rem; white-space: nowrap; }
}

@media (max-width: 440px) {
  .kpi-5grid, .grid-5col { grid-template-columns: minmax(0, 1fr); }
  .ultra-light-glass { padding: 10px; }
}
