/* =============================================
   TERMO DE ADESÃO – VERTERON DATACENTER
   Design System & Styles (ORANGE THEME)
   ============================================= */

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

/* ── CSS Variables ── */
:root {
  /* Colors */
  --bg-primary: #f8f9fc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-glass: rgba(241, 245, 249, 0.7);
  --bg-glass-hover: rgba(226, 232, 240, 0.7);
  --bg-input: rgba(248, 250, 252, 0.9);
  --bg-input-focus: rgba(255, 255, 255, 1);

  --border-subtle: rgba(100, 116, 139, 0.15);
  --border-input: rgba(100, 116, 139, 0.25);
  --border-focus: #f97316;
  --border-accent: rgba(249, 115, 22, 0.3);

  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #ea580c;

  --accent-primary: #f97316;
  --accent-secondary: #ea580c;
  --accent-gradient: linear-gradient(135deg, #ea580c 0%, #f97316 50%, #fb923c 100%);
  --accent-glow: rgba(249, 115, 22, 0.15);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

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

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(249, 115, 22, 0.08);
  --shadow-glow-lg: 0 0 40px rgba(249, 115, 22, 0.12);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Background animated gradient */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 20%, rgba(249, 115, 22, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(234, 88, 12, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(249, 115, 22, 0.02) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

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

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

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

.header-logo img {
  height: 44px;
  width: auto;
  object-fit: contain;
  filter: brightness(1.1);
}

.header-title {
  display: flex;
  flex-direction: column;
}

.header-title h1 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-title span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

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

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-accent);
}

.header-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* Header saved contracts button */
.btn-saved-contracts {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-input);
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-saved-contracts:hover {
  background: var(--bg-glass-hover);
  color: var(--text-accent);
  border-color: var(--border-accent);
}

.btn-saved-contracts .count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0 5px;
}

/* ── Main Layout ── */
.app-main {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-xl);
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-xl);
  min-height: calc(100vh - 80px);
}

/* ── Stepper Sidebar ── */
.stepper {
  position: sticky;
  top: 100px;
  height: fit-content;
}

.stepper-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stepper-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px var(--space-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
}

.stepper-item:hover {
  background: var(--bg-glass);
}

.stepper-item.active {
  background: var(--bg-glass-hover);
}

.stepper-item.active .step-number {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

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

.stepper-item.completed .step-number::after {
  content: '✓';
  font-size: 0.7rem;
  font-weight: 700;
}

.stepper-item.completed .step-number span {
  display: none;
}

.step-number {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  border: 2px solid var(--border-input);
  color: var(--text-muted);
  transition: all var(--transition-base);
}

.step-info {
  display: flex;
  flex-direction: column;
}

.step-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition-base);
}

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

.stepper-item.completed .step-label {
  color: var(--text-secondary);
}

.step-sublabel {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Connector line between steps */
.stepper-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: calc(var(--space-md) + 15px);
  top: calc(100% - 2px);
  width: 2px;
  height: 8px;
  background: var(--border-input);
  transition: background var(--transition-base);
}

.stepper-item.completed:not(:last-child)::after {
  background: var(--success);
}

/* ── Form Area ── */
.form-area {
  position: relative;
}

.form-step {
  display: none;
  animation: fadeSlideIn 0.4s ease forwards;
}

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

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

/* ── Glass Card ── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.glass-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.card-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Form Elements ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-lg);
}

.form-grid.cols-2 {
  grid-template-columns: 1fr 1fr;
}

.form-grid.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

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

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

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-label .required {
  color: var(--error);
  font-weight: 700;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  outline: none;
}

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

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: rgba(100, 116, 139, 0.5);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.form-input.error,
.form-select.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px var(--error-bg);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

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

.error-message {
  font-size: 0.75rem;
  color: var(--error);
  display: none;
  align-items: center;
  gap: 4px;
}

.error-message.visible {
  display: flex;
}

/* ── Checkbox & Toggle ── */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--border-input);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  font-size: 0.7rem;
  color: transparent;
}

.checkbox-group input:checked + .checkbox-custom {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

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

/* ── Dynamic Table (Products) ── */
.products-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

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

.products-table th {
  background: rgba(249, 115, 22, 0.08);
  padding: 12px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-accent);
  border-bottom: 1px solid var(--border-subtle);
}

.products-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.products-table tr:last-child td {
  border-bottom: none;
}

.products-table .form-input {
  padding: 8px 10px;
  font-size: 0.85rem;
}

.products-table .btn-remove {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: var(--error);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.9rem;
}

.products-table .btn-remove:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--error);
}

.btn-add-product {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  margin-top: var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-accent);
  background: transparent;
  color: var(--text-accent);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-add-product:hover {
  background: var(--accent-glow);
  border-style: solid;
}

/* ── Navigation Buttons ── */
.form-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-sm), 0 0 20px rgba(249, 115, 22, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), var(--shadow-glow-lg);
}

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

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

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
  border-color: rgba(100, 116, 139, 0.5);
}

.btn-success {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
  box-shadow: var(--shadow-sm), 0 0 20px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 30px rgba(16, 185, 129, 0.3);
}

.btn-word {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: white;
  box-shadow: var(--shadow-sm), 0 0 20px rgba(37, 99, 235, 0.2);
}

.btn-word:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 30px rgba(37, 99, 235, 0.3);
}

.btn-pdf {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: white;
  box-shadow: var(--shadow-sm), 0 0 20px rgba(220, 38, 38, 0.2);
}

.btn-pdf:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 30px rgba(220, 38, 38, 0.3);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Download Section ── */
.download-section {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.download-card {
  flex: 1;
  min-width: 200px;
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
}

.download-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.download-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.download-card.word .download-icon {
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.download-card.pdf .download-icon {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.download-card h3 {
  font-size: 1rem;
  font-weight: 600;
}

.download-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Preview Section ── */
.preview-container {
  background: white;
  color: #1a1a1a;
  border-radius: var(--radius-md);
  padding: 48px 56px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 10pt;
  line-height: 1.5;
  max-width: 800px;
  margin: 0 auto var(--space-xl);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.preview-container .preview-header {
  text-align: center;
  margin-bottom: 24px;
}

.preview-container .preview-header img {
  max-height: 60px;
  margin-bottom: 16px;
}

.preview-container .preview-title {
  font-size: 13pt;
  font-weight: bold;
  text-align: center;
  margin-bottom: 20px;
  color: #1a1a1a;
}

.preview-container .preview-text {
  text-align: justify;
  margin-bottom: 12px;
  font-size: 8pt;
}

.preview-container .preview-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  border: 1px solid #333;
}

.preview-container .preview-table td,
.preview-container .preview-table th {
  border: none;
  border-bottom: 1px solid #ddd;
  padding: 5px 10px;
  font-size: 8pt;
  vertical-align: top;
}

.preview-container .preview-table .section-header {
  background: #1a1a1a;
  color: white;
  font-weight: bold;
  text-align: center;
  font-size: 9pt;
  padding: 6px 10px;
  border-bottom: 1px solid #1a1a1a;
}

.preview-container .preview-table .subsection-header {
  background: #ea580c;
  color: white;
  font-weight: bold;
  font-size: 8.5pt;
  padding: 5px 10px;
  border-bottom: 1px solid #ea580c;
}

.preview-container .preview-table .label {
  font-weight: 600;
  width: 35%;
  color: #333;
}

.preview-container .preview-table .value {
  color: #1a1a1a;
  width: 65%;
}

.preview-container .preview-table .prod-header {
  background: #f5f5f5;
  font-weight: 600;
  font-size: 8pt;
  color: #333;
  border-bottom: 1px solid #999;
}

.preview-container .signature-section {
  margin-top: 40px;
  text-align: center;
}

.preview-container .signature-line {
  display: inline-block;
  width: 300px;
  border-top: 1px solid #333;
  margin: 40px auto 8px;
  padding-top: 8px;
  font-size: 8pt;
}

/* ── Section Title Divider ── */
.section-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-xl) 0 var(--space-lg);
}

.section-divider span {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-accent);
  white-space: nowrap;
}

.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-accent);
}

/* ── Notification Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-accent);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all var(--transition-slow);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.5);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.5);
}

/* ── Loading Spinner ── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ═══════════════════════════════════════════
   SAVED CONTRACTS PANEL (Overlay/Modal)
   ═══════════════════════════════════════════ */

.saved-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.saved-overlay.open {
  opacity: 1;
  visibility: visible;
}

.saved-panel {
  position: fixed;
  top: 0;
  right: -500px;
  width: 480px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  z-index: 201;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.1);
  transition: right var(--transition-slow);
}

.saved-panel.open {
  right: 0;
}

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

.saved-panel-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.saved-panel-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-input);
  background: var(--bg-glass);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1.1rem;
}

.saved-panel-close:hover {
  background: var(--error-bg);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.3);
}

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

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

.saved-empty .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.saved-empty p {
  font-size: 0.85rem;
  line-height: 1.6;
}

/* Saved contract card */
.saved-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: all var(--transition-base);
  animation: fadeSlideIn 0.3s ease;
}

.saved-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-md);
}

.saved-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
}

.saved-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.saved-card-title .contract-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-accent);
}

.saved-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.saved-card-meta span {
  display: block;
  margin-bottom: 2px;
}

.saved-card-actions {
  display: flex;
  gap: var(--space-sm);
}

.saved-card-actions .btn {
  padding: 8px 16px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.btn-edit {
  background: var(--accent-glow);
  color: var(--text-accent);
  border: 1px solid var(--border-accent);
}

.btn-edit:hover {
  background: rgba(249, 115, 22, 0.25);
}

.btn-delete {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-delete:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Save button floating */
.save-float-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  background: rgba(248, 250, 252, 0.95);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 99;
  justify-content: center;
  transform: translateY(100%);
  transition: transform var(--transition-base);
}

.save-float-bar.visible {
  transform: translateY(0);
}

.save-float-bar .btn-save {
  background: var(--accent-gradient);
  color: white;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm), 0 0 20px rgba(249, 115, 22, 0.2);
}

.save-float-bar .btn-save:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), var(--shadow-glow-lg);
}

.save-float-bar .btn-new {
  background: var(--bg-glass);
  color: var(--text-secondary);
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-input);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-base);
}

.save-float-bar .btn-new:hover {
  background: var(--bg-glass-hover);
  color: var(--text-primary);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .app-main {
    grid-template-columns: 1fr;
    padding: var(--space-md);
  }

  .stepper {
    position: relative;
    top: 0;
  }

  .stepper-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 0;
    padding-bottom: var(--space-sm);
  }

  .stepper-item {
    flex-direction: column;
    text-align: center;
    padding: var(--space-sm);
    min-width: 80px;
  }

  .stepper-item::after {
    display: none !important;
  }

  .step-sublabel {
    display: none;
  }

  .form-grid.cols-3 {
    grid-template-columns: 1fr 1fr;
  }

  .saved-panel {
    width: 100%;
    max-width: 100vw;
  }
}

@media (max-width: 640px) {
  .form-grid,
  .form-grid.cols-2,
  .form-grid.cols-3 {
    grid-template-columns: 1fr;
  }

  .header-content {
    flex-wrap: wrap;
  }

  .header-badge {
    display: none;
  }

  .preview-container {
    padding: 24px 20px;
  }

  .glass-card {
    padding: var(--space-lg);
  }

  .download-section {
    flex-direction: column;
  }
}
