/* ═══════════════════════════════════════════════════════════════
   CIScomer — Premium Design System
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Light Color Palette */
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-glass-hover: rgba(255, 255, 255, 0.95);

  --accent-primary: #4f46e5;
  --accent-secondary: #0ea5e9;
  --accent-gradient: linear-gradient(135deg, #4f46e5, #0ea5e9);
  --accent-gradient-soft: linear-gradient(135deg, rgba(79, 70, 229, 0.1), rgba(14, 165, 233, 0.1));

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border-color: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(79, 70, 229, 0.3);

  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --profit: #34d399;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Reset & Base ──────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  -webkit-font-smoothing: antialiased;
}

/* ─── Background Effects ────────────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.08;
  pointer-events: none;
  z-index: 0;
}

.bg-glow-1 {
  top: -200px;
  left: -100px;
  background: var(--accent-primary);
  animation: floatGlow 15s ease-in-out infinite;
}

.bg-glow-2 {
  bottom: -200px;
  right: -100px;
  background: var(--accent-secondary);
  animation: floatGlow 18s ease-in-out infinite reverse;
}

@keyframes floatGlow {

  0%,
  100% {
    transform: translate(0, 0);
  }

  33% {
    transform: translate(40px, -40px);
  }

  66% {
    transform: translate(-30px, 30px);
  }
}

/* ─── Header ────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  flex-shrink: 0;
}

.logo-name {
  font-size: 1.15rem;
  line-height: 1;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@media (max-width: 600px) {
  .logo-name {
    font-size: 0.85rem;
  }
}

.logo-tag {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.btn-history {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.btn-history:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: var(--bg-glass);
}

/* ─── Stepper ───────────────────────────────────────────────── */
.stepper-container {
  max-width: 600px;
  margin: var(--space-xl) auto var(--space-lg);
  padding: 0 var(--space-lg);
  position: relative;
  z-index: 1;
}

.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  position: relative;
  z-index: 2;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  background: var(--bg-elevated);
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  transition: all var(--transition-normal);
}

.step.active .step-circle {
  background: var(--accent-gradient);
  border-color: transparent;
  color: white;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.step.completed .step-circle {
  background: var(--success);
  border-color: transparent;
  color: white;
}

.step-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color var(--transition-normal);
}

.step.active .step-label {
  color: var(--text-primary);
}

.step.completed .step-label {
  color: var(--success);
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border-color);
  min-width: 40px;
  margin: 0 var(--space-sm);
  margin-bottom: 20px;
  transition: background var(--transition-normal);
}

.step-line.completed {
  background: var(--success);
}

/* ─── Main Content ──────────────────────────────────────────── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-lg) var(--space-2xl);
  position: relative;
  z-index: 1;
}

/* ─── Panel ─────────────────────────────────────────────────── */
.panel {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  box-shadow: var(--shadow-lg);
}

.step-panel {
  display: none;
  animation: fadeSlideIn 0.4s var(--transition-slow) forwards;
}

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

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-header {
  margin-bottom: var(--space-xl);
}

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

.panel-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
  letter-spacing: -0.02em;
}

.panel-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ─── Two Column Layout ─────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}

@media (max-width: 768px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ─── Upload Zone ───────────────────────────────────────────── */
.upload-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.upload-zone {
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: rgba(99, 102, 241, 0.03);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
}

.upload-zone.drag-over {
  box-shadow: var(--shadow-glow);
}

.upload-icon {
  color: var(--accent-primary);
  margin-bottom: var(--space-md);
  opacity: 0.7;
}

.upload-zone h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.upload-zone p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.upload-hint {
  color: var(--text-muted) !important;
  font-size: 0.75rem !important;
  margin-top: var(--space-sm);
}

.upload-status {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.upload-progress {
  height: 4px;
  background: var(--bg-primary);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.upload-progress-bar {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 2px;
  width: 0;
  transition: width 0.3s ease;
  animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
  }
}

.upload-status p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.ai-badge {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  background: var(--accent-gradient-soft);
  color: var(--accent-secondary);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ─── Form ──────────────────────────────────────────────────── */
.form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

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

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-group input,
.form-group select {
  padding: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all var(--transition-normal);
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.divider-text {
  text-align: center;
  position: relative;
  margin: var(--space-sm) 0;
}

.divider-text::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border-color);
}

.divider-text span {
  position: relative;
  background: var(--bg-glass);
  padding: 0 var(--space-md);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ─── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-hover);
  background: var(--bg-glass-hover);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--danger);
  color: white;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn-download {
  background: var(--accent-gradient);
  color: white;
  font-size: 1.1rem;
  padding: var(--space-lg) var(--space-2xl);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
  transition: all var(--transition-normal);
}

.btn-download:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.4);
}

.btn-generate {
  font-size: 1rem;
  padding: var(--space-lg) var(--space-2xl);
}

.btn-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-close:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

/* ─── Margin Control ────────────────────────────────────────── */
.margin-control {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

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

.margin-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

@media (max-width: 600px) {
  .client-actions-wrapper {
    flex-direction: column;
    align-items: stretch !important;
  }

  .client-actions-wrapper>.form-group {
    width: 100%;
    margin-bottom: var(--space-sm) !important;
  }

  .client-actions-wrapper>.btn {
    width: 100%;
    justify-content: center;
  }
}

.margin-reason {
  font-size: 0.8rem;
  color: var(--accent-secondary);
  margin-top: var(--space-xs);
}

.margin-input-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.margin-input-group input[type="number"] {
  width: 70px;
  text-align: center;
  padding: var(--space-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  outline: none;
}

.margin-input-group input[type="number"]:focus {
  border-color: var(--accent-primary);
}

.margin-symbol {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.margin-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-primary);
  border-radius: 3px;
  outline: none;
}

.margin-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-gradient);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
  transition: transform var(--transition-fast);
}

.margin-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.margin-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: none;
}

/* ─── Products Table ────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.products-table th {
  background: var(--bg-elevated);
  padding: var(--space-md);
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  white-space: nowrap;
}

.products-table td {
  padding: var(--space-sm) var(--space-md);
  border-top: 1px solid var(--border-color);
  vertical-align: middle;
}

.products-table tr:hover td {
  background: rgba(99, 102, 241, 0.03);
}

.products-table input {
  width: 100%;
  padding: var(--space-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.products-table input:focus {
  border-color: var(--accent-primary);
}

.products-table input[type="number"] {
  font-family: 'JetBrains Mono', monospace;
  text-align: right;
}

.col-qty {
  width: 70px;
}

.col-unit {
  width: 80px;
}

.col-desc {
  min-width: 200px;
}

.col-price {
  width: 120px;
  text-align: right;
}

.col-actions {
  width: 40px;
}

.products-table .col-price {
  text-align: right;
}

.products-table td.col-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.btn-delete-row {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: 1rem;
}

.btn-delete-row:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.btn-add-product {
  width: 100%;
  margin-bottom: var(--space-xl);
  padding: var(--space-md);
}

/* ─── Totals Card ───────────────────────────────────────────── */
.totals-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  max-width: 400px;
  margin-left: auto;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) 0;
  font-size: 0.9rem;
}

.totals-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.totals-value.muted {
  color: var(--text-muted);
  text-decoration: line-through;
  font-size: 0.85rem;
}

.totals-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-sm) 0;
}

.total-final {
  font-size: 1.1rem;
  font-weight: 700;
}

.total-final .totals-value {
  font-size: 1.2rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.profit-row {
  margin-top: var(--space-xs);
}

.totals-value.profit {
  color: var(--profit);
}

/* ─── Step Actions ──────────────────────────────────────────── */
.step-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-2xl);
  gap: var(--space-md);
}

/* ─── Confirmation Card ─────────────────────────────────────── */
.confirmation-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.confirm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.confirm-badge {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.confirm-date {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.confirm-client,
.confirm-provider {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.confirm-client strong,
.confirm-provider strong {
  color: var(--text-primary);
}

.confirm-products {
  margin: var(--space-lg) 0;
  border-top: 1px solid var(--border-color);
}

.confirm-product-row {
  display: grid;
  grid-template-columns: 60px 60px 1fr 100px 100px;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
  align-items: center;
}

.confirm-product-row.header-row {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: var(--space-md) 0 var(--space-sm);
}

.confirm-product-row .price-col {
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.confirm-totals {
  padding-top: var(--space-md);
}

.confirm-totals-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-xs) 0;
  font-size: 0.9rem;
}

.confirm-totals-row span:last-child {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.confirm-total-final {
  font-size: 1.15rem;
  font-weight: 700;
  padding: var(--space-md) 0;
  border-top: 2px solid var(--border-color);
  margin-top: var(--space-sm);
}

.confirm-total-final span:last-child {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.confirm-margin-info,
.confirm-profit-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.confirm-profit-info span:last-child {
  color: var(--profit) !important;
  -webkit-text-fill-color: var(--profit) !important;
}

/* ─── Download / Success ────────────────────────────────────── */
.success-icon {
  color: var(--success);
  margin-bottom: var(--space-md);
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.success-details {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
}

.download-area {
  text-align: center;
  margin: var(--space-2xl) 0;
}

.generating {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#step4 .btn-secondary {
  margin-top: var(--space-lg);
}

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s var(--transition-slow);
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.modal-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: var(--space-lg) var(--space-xl);
  overflow-y: auto;
  flex: 1;
}

.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.empty-state p {
  margin-top: var(--space-md);
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  transition: all var(--transition-fast);
  cursor: default;
}

.history-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-glass);
}

.history-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-item-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.history-item-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-item-client {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.history-item-total {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--profit);
}

/* ─── Utility ───────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .panel {
    padding: var(--space-lg);
  }

  .panel-header h1 {
    font-size: 1.35rem;
  }

  .confirm-product-row {
    grid-template-columns: 50px 1fr 80px;
    font-size: 0.8rem;
  }

  .confirm-product-row.header-row>*:nth-child(2),
  .confirm-product-row>*:nth-child(2) {
    display: none;
  }

  .header-inner {
    padding: var(--space-sm) var(--space-md);
  }

  .btn-history span {
    display: none;
  }

  .stepper-container {
    margin: var(--space-md) auto;
  }

  .step-label {
    font-size: 0.6rem;
  }

  .step-circle {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
  }

  .margin-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .totals-card {
    max-width: 100%;
  }

  .step-actions {
    flex-direction: column-reverse;
    gap: var(--space-sm);
  }

  .step-actions .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .main {
    padding: 0 var(--space-md) var(--space-xl);
  }

  .modal {
    max-height: 90vh;
    border-radius: var(--radius-lg);
  }
}