/* ===================================================
   OERO LAW AI AGENT — Premium Design System
   KKTC Sözleşme Hazırlayıcı
   =================================================== */

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

/* ── Design Tokens ── */
:root {
  /* Colors — OERO Brand */
  --bg-primary: #F5F5F7;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #EAEAED;
  --bg-elevated: #FFFFFF;

  --glass-1: rgba(0, 0, 0, 0.02);
  --glass-2: rgba(0, 0, 0, 0.04);
  --glass-3: rgba(0, 0, 0, 0.07);
  --glass-border: rgba(0, 0, 0, 0.08);

  --accent-primary: #EC1E24;
  --accent-primary-dark: #C8181D;
  --accent-primary-light: #FF4A4F;
  --accent-gradient: linear-gradient(135deg, #EC1E24, #C8181D);
  --accent-gradient-light: linear-gradient(135deg, #EC1E24, #FF4A4F);

  --text-primary: #1A1A1A;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --text-on-accent: #FFFFFF;

  --success: #10B981;
  --warning: #F59E0B;
  --error: #EC1E24;
  --info: #6B7280;

  --border: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(236, 30, 36, 0.4);

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;

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

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --shadow-glow-red: 0 0 20px rgba(236, 30, 36, 0.2);
  --shadow-glow-accent: 0 4px 14px rgba(236, 30, 36, 0.25);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --sidebar-width: 280px;
  --topbar-height: 64px;
}

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

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

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

::selection {
  background: rgba(236, 30, 36, 0.3);
  color: var(--text-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.25); }

/* ── Keyframe Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(236, 30, 36, 0.3); }
  50% { box-shadow: 0 0 20px rgba(236, 30, 36, 0.6); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

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

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

@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

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

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* ── Utility Classes ── */
.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.5s ease forwards; }
.animate-slide-left { animation: slideInLeft 0.4s ease forwards; }
.animate-slide-right { animation: slideInRight 0.4s ease forwards; }
.animate-scale-in { animation: scaleIn 0.3s ease forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gold-text {
  color: var(--accent-primary);
}

.glow {
  box-shadow: var(--shadow-glow-red);
}

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Typography ── */
.heading-xl {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.heading-lg {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.3;
}

.heading-md {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
}

.heading-sm {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.text-body { font-size: 1rem; line-height: 1.6; }
.text-sm { font-size: 0.875rem; line-height: 1.5; }
.text-xs { font-size: 0.75rem; line-height: 1.4; }
.text-muted { color: var(--text-secondary); }

/* ── App Layout ── */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-body {
  display: flex;
  flex: 1;
  padding-top: var(--topbar-height);
}

/* ── Top Bar ── */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  background: #1A1A1A;
  border-bottom: 3px solid var(--accent-primary);
  z-index: 1000;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  cursor: pointer;
}

.logo-img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  box-shadow: var(--shadow-glow-red);
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #FFFFFF;
}

.logo-badge {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: #FFFFFF;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

/* Menu Toggle (Mobile) */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-xs);
}

/* ── Language Toggle ── */
.lang-toggle {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}

.lang-option {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-option.active {
  background: var(--accent-primary);
  color: white;
}

.lang-option:hover:not(.active) {
  color: #FFFFFF;
}

/* ── Hero Logo ── */
.hero-logo {
  height: 80px;
  width: auto;
  object-fit: contain;
  filter: invert(1);
  margin-bottom: var(--space-lg);
}

/* ── OERO Info Logo in Form ── */
.oero-info-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
  filter: invert(1);
  flex-shrink: 0;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - var(--topbar-height));
  background: rgba(245, 245, 247, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid var(--glass-border);
  padding: var(--space-lg) 0;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform var(--transition-base);
}

.sidebar-header {
  padding: 0 var(--space-lg) var(--space-md);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-md);
}

.sidebar-section {
  padding: var(--space-sm) var(--space-lg);
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  padding-left: var(--space-sm);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  position: relative;
  user-select: none;
}

.sidebar-item:hover {
  background: var(--glass-2);
  color: var(--text-primary);
  border-color: var(--glass-border);
}

.sidebar-item.active {
  background: rgba(236, 30, 36, 0.12);
  color: var(--accent-primary);
  border-color: rgba(236, 30, 36, 0.25);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
}

.sidebar-item-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-item-badge {
  margin-left: auto;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(236, 30, 36, 0.15);
  color: var(--accent-primary);
  font-weight: 600;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-md) var(--space-lg);
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  padding: var(--space-xl);
  overflow-y: auto;
  min-height: calc(100vh - var(--topbar-height));
}

/* ── Page Section ── */
.page-section {
  max-width: 900px;
  margin: 0 auto;
  animation: fadeInUp 0.5s ease;
}

/* ── Hero Section ── */
.hero-section {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  animation: fadeInUp 0.6s ease;
}

.hero-icon {
  font-size: 4rem;
  margin-bottom: var(--space-lg);
  animation: float 3s ease-in-out infinite;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: var(--space-md);
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto var(--space-2xl);
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

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

.glass-card:hover {
  background: var(--glass-2);
  border-color: rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ── Agreement Type Cards ── */
.agreement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.agreement-card {
  background: var(--glass-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.agreement-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.agreement-card:hover {
  background: var(--glass-2);
  border-color: rgba(236, 30, 36, 0.25);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow-red);
}

.agreement-card:hover::before {
  transform: scaleX(1);
}

.agreement-card-icon {
  font-size: 2rem;
  margin-bottom: var(--space-md);
  display: inline-block;
}

.agreement-card-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.agreement-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.agreement-card-law {
  margin-top: var(--space-md);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--accent-primary);
  background: rgba(236, 30, 36, 0.08);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

/* ── Form System ── */
.form-container {
  max-width: 800px;
  margin: 0 auto;
}

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

.form-back-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-body);
  transition: color var(--transition-fast);
}

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

.form-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
}

/* Step Indicator */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-2xl);
}

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

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

.step.active .step-number {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-glow-red);
}

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

.step-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--transition-fast);
}

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

.step-line {
  width: 40px;
  height: 2px;
  background: var(--border);
  transition: background var(--transition-base);
}

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

/* Form Groups */
.form-section {
  margin-bottom: var(--space-xl);
  animation: fadeInUp 0.4s ease;
}

.form-section-title {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.form-section-title .icon {
  color: var(--accent-primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-md);
}

.form-group {
  margin-bottom: var(--space-md);
  position: relative;
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  transition: color var(--transition-fast);
}

.form-label .required {
  color: var(--error);
  margin-left: 2px;
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(236, 30, 36, 0.15);
  background: var(--glass-2);
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238892A4' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

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

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

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--error);
  margin-top: 4px;
}

.form-input.error,
.form-select.error {
  border-color: var(--error);
}

/* Checkbox */
.form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: 0.875rem;
}

.form-checkbox input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--glass-border);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.form-checkbox input[type="checkbox"]:checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.form-checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 11px;
  font-weight: 700;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  box-shadow: var(--shadow-glow-red);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--glass-2);
  color: var(--text-primary);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
  background: var(--glass-3);
  border-color: rgba(0, 0, 0, 0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--glass-1);
}

.btn-gold {
  background: var(--accent-gradient);
  color: #FFFFFF;
}
.btn-gold:hover {
  box-shadow: var(--shadow-glow-red);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(236, 30, 36, 0.15);
  color: var(--error);
  border: 1px solid rgba(236, 30, 36, 0.3);
}
.btn-danger:hover {
  background: rgba(236, 30, 36, 0.25);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--glass-1);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}
.btn-icon:hover {
  background: var(--glass-2);
  color: var(--text-primary);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.form-actions {
  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);
}

/* ── Document Preview ── */
.document-preview {
  background: #FAFAF8;
  color: #1a1a2e;
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  min-height: 600px;
  font-family: 'Times New Roman', Georgia, serif;
  line-height: 1.8;
  font-size: 0.95rem;
  box-shadow: var(--shadow-lg);
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.document-preview::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50px;
  right: 50px;
  height: 4px;
  background: var(--accent-gradient);
  border-radius: 0 0 4px 4px;
}

.document-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 4rem;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.03);
  font-family: var(--font-heading);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.1em;
}

/* ── Formatted Document Styles ── */
.doc-formatted {
  position: relative;
  z-index: 1;
}

.doc-title {
  font-weight: 700;
  font-size: 1.3rem;
  text-align: center;
  margin: 2px 0;
  letter-spacing: 0.02em;
}

.doc-heading {
  font-weight: 700;
  font-size: 1.05rem;
  margin-top: 20px;
  margin-bottom: 6px;
  color: #1a1a2e;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding-bottom: 4px;
}

.doc-party-header {
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 14px;
  margin-bottom: 4px;
  color: #333;
}

.doc-clause {
  margin: 4px 0;
  line-height: 1.7;
}

.doc-sub-item {
  margin: 2px 0;
  padding-left: 24px;
  line-height: 1.6;
}

.doc-meta {
  color: #666;
  margin: 2px 0;
  font-size: 0.9rem;
}

.doc-signature {
  margin: 4px 0;
  font-family: 'Times New Roman', Georgia, serif;
}

.doc-label {
  margin: 2px 0;
  padding-left: 16px;
}

.doc-body {
  margin: 3px 0;
  line-height: 1.7;
}

/* ── Preview Layout (doc + editing panel) ── */
.preview-layout {
  display: flex;
  gap: var(--space-lg);
  align-items: flex-start;
}

.preview-layout .document-preview {
  flex: 1;
  min-width: 0;
}

/* ── Clause Prompt Bar ── */
.clause-prompt-bar {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-sm) var(--space-md);
  box-shadow: var(--shadow-sm);
}

.clause-prompt-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  background: transparent;
  color: var(--text-primary);
}

.clause-prompt-input::placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ── Section Editing Panel ── */
.edit-sections-panel {
  width: 320px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.edit-panel-header {
  padding: var(--space-md) var(--space-lg);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--glass-border);
  background: var(--bg-primary);
}

.edit-section-list {
  overflow-y: auto;
  flex: 1;
  max-height: 300px;
}

.edit-section-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  border-bottom: 1px solid var(--glass-border);
  transition: all 0.15s ease;
}

.edit-section-item:hover {
  background: rgba(236, 30, 36, 0.04);
}

.edit-section-item.active {
  background: rgba(236, 30, 36, 0.08);
  border-left: 3px solid var(--accent-primary);
}

.edit-section-title {
  font-size: 0.8rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: var(--space-sm);
}

.edit-section-action {
  font-size: 0.72rem;
  color: var(--accent-primary);
  font-weight: 500;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.edit-section-item:hover .edit-section-action {
  opacity: 1;
}

/* ── Section Editor (textarea area) ── */
.section-editor {
  border-top: 1px solid var(--glass-border);
  background: var(--bg-primary);
}

.section-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--glass-border);
}

.section-editor-label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--accent-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-editor-textarea {
  width: 100%;
  min-height: 200px;
  padding: var(--space-md);
  font-family: 'Times New Roman', Georgia, serif;
  font-size: 0.85rem;
  line-height: 1.6;
  border: none;
  outline: none;
  resize: vertical;
  background: #FAFAF8;
  color: var(--text-primary);
  box-sizing: border-box;
}

.section-editor-actions {
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  border-top: 1px solid var(--glass-border);
}

.btn-sm {
  padding: 6px 16px;
  font-size: 0.8rem;
}

/* ── Print overrides for formatted doc ── */
@media print {
  .clause-prompt-bar,
  .edit-sections-panel,
  .preview-actions {
    display: none !important;
  }
  .preview-layout {
    display: block;
  }
  .document-preview {
    box-shadow: none;
    border-radius: 0;
    max-width: none;
    padding: 20px 40px;
  }
  .doc-title { font-size: 14pt; }
  .doc-heading { font-size: 12pt; border-bottom: none; }
}

.document-header {
  text-align: center;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 2px solid #333;
}

.document-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a2e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.document-subtitle {
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
}

.document-number {
  font-size: 0.8rem;
  color: #999;
  margin-top: var(--space-xs);
}

.document-section {
  margin-bottom: var(--space-lg);
}

.document-section-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: var(--space-sm);
  color: #1a1a2e;
  text-transform: uppercase;
}

.document-clause {
  margin-bottom: var(--space-md);
  text-align: justify;
}

.document-clause-number {
  font-weight: 700;
  margin-right: var(--space-xs);
}

.document-sub-clause {
  margin-left: var(--space-xl);
  margin-bottom: var(--space-sm);
}

.signature-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2xl);
  margin-top: var(--space-3xl);
  padding-top: var(--space-xl);
  border-top: 1px solid #ccc;
}

.signature-party {
  text-align: center;
}

.signature-line {
  width: 100%;
  height: 1px;
  background: #333;
  margin: var(--space-2xl) 0 var(--space-sm);
}

.signature-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.signature-title {
  font-size: 0.85rem;
  color: #666;
}

.signature-date {
  font-size: 0.8rem;
  color: #999;
  margin-top: var(--space-xs);
}

/* ── Info Card ── */
.info-card {
  background: rgba(236, 30, 36, 0.08);
  border: 1px solid rgba(236, 30, 36, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.info-card.warning {
  background: rgba(255, 176, 32, 0.08);
  border-color: rgba(255, 176, 32, 0.2);
}

.info-card.gold {
  background: rgba(236, 30, 36, 0.06);
  border-color: rgba(236, 30, 36, 0.15);
}

.info-card-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.info-card-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-gold {
  background: rgba(236, 30, 36, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(236, 30, 36, 0.2);
}

.badge-info {
  background: rgba(236, 30, 36, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(236, 30, 36, 0.2);
}

.badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ── Dividers ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-lg) 0;
}

.divider-gold {
  height: 2px;
  background: var(--accent-gradient);
  margin: var(--space-lg) 0;
  border-radius: var(--radius-full);
}

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

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.3s ease;
  box-shadow: var(--shadow-lg);
}

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

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--glass-2);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--glass-3);
  color: var(--text-primary);
}

.modal-body {
  margin-bottom: var(--space-lg);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

/* ── Toast Notifications ── */
.toast-container {
  position: fixed;
  top: calc(var(--topbar-height) + var(--space-md));
  right: var(--space-lg);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s ease forwards;
  min-width: 280px;
  max-width: 400px;
}

.toast.removing {
  animation: toastSlideOut 0.3s ease forwards;
}

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast-message {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }

.toast-error { border-left: 3px solid var(--error); }
.toast-error .toast-icon { color: var(--error); }

.toast-warning { border-left: 3px solid var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }

.toast-info { border-left: 3px solid var(--info); }
.toast-info .toast-icon { color: var(--info); }

/* ── Loading Spinner ── */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-3xl);
  color: var(--text-secondary);
}

.loading-text {
  font-size: 0.9rem;
  animation: pulse 1.5s ease-in-out infinite;
}

/* ── Footer ── */
.app-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto;
  line-height: 1.6;
}

.footer-disclaimer a {
  color: var(--accent-primary);
  text-decoration: none;
}

.footer-disclaimer a:hover {
  text-decoration: underline;
}

/* ── Preview Actions Bar ── */
.preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.preview-actions-left {
  display: flex;
  gap: var(--space-sm);
}

.preview-actions-right {
  display: flex;
  gap: var(--space-sm);
}

/* ── OERO Default Info Box ── */
.oero-info-box {
  background: rgba(236, 30, 36, 0.04);
  border: 1px solid rgba(236, 30, 36, 0.12);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.oero-info-box .oero-logo-small {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #FFFFFF;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.oero-info-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.oero-info-text strong {
  color: var(--accent-primary);
}

/* ── Date Indefinite Toggle ── */
.date-indefinite-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.date-indefinite-wrap .form-input {
  flex: 1;
}

.indefinite-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  transition: all var(--transition-fast);
}

.indefinite-toggle:hover {
  border-color: var(--accent-primary);
}

.indefinite-toggle:has(.indefinite-check:checked) {
  border-color: var(--accent-primary);
  background: rgba(236, 30, 36, 0.06);
}

.indefinite-check {
  accent-color: var(--accent-primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.indefinite-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.indefinite-toggle:has(.indefinite-check:checked) .indefinite-label {
  color: var(--accent-primary);
}

.date-indefinite-wrap .form-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Prompt Development Area ── */
.prompt-dev-group {
  position: relative;
}

.prompt-dev-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.prompt-dev-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-primary);
  letter-spacing: 0.02em;
}

.prompt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.prompt-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prompt-chip:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(236, 30, 36, 0.04);
  transform: translateY(-1px);
}

.prompt-chip:active {
  transform: scale(0.97);
}

.prompt-chip.used {
  border-color: var(--accent-primary);
  background: rgba(236, 30, 36, 0.08);
  color: var(--accent-primary);
  opacity: 0.6;
}

.prompt-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.7;
}

.prompt-char-count {
  text-align: right;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-muted);
}

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

.empty-state-text {
  font-size: 1rem;
  margin-bottom: var(--space-lg);
}

/* ── Tab System ── */
.tab-bar {
  display: flex;
  gap: 2px;
  background: var(--glass-1);
  border-radius: var(--radius-md);
  padding: 3px;
  border: 1px solid var(--glass-border);
  margin-bottom: var(--space-lg);
}

.tab-item {
  flex: 1;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.tab-item.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.tab-item:hover:not(.active) {
  color: var(--text-primary);
  background: var(--glass-2);
}

/* ── Custom Clause Builder ── */
.clause-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.clause-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--glass-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.clause-item-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--glass-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.clause-item-text {
  flex: 1;
}

.clause-item-actions {
  display: flex;
  gap: 4px;
}

.clause-item-btn {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.clause-item-btn:hover {
  color: var(--error);
  background: rgba(236, 30, 36, 0.1);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .form-row-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
  }

  .menu-toggle { display: block; }

  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 900;
    transform: translateX(-100%);
    background: var(--bg-secondary);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    top: var(--topbar-height);
    background: rgba(0, 0, 0, 0.5);
    z-index: 899;
  }

  .main-content {
    padding: var(--space-md);
  }

  .hero-title { font-size: 2rem; }
  .hero-subtitle { font-size: 1rem; }
  .hero-section { padding: var(--space-xl) var(--space-md); }

  .agreement-grid {
    grid-template-columns: 1fr;
  }

  .signature-block {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .document-preview {
    padding: var(--space-lg) var(--space-md);
  }

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

  .step-label { display: none; }
  .step-line { width: 20px; }

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

@media (max-width: 480px) {
  .hero-title { font-size: 1.6rem; }
  .top-bar { padding: 0 var(--space-md); }
  .logo-text { display: none; }

  .hero-cta {
    flex-direction: column;
    width: 100%;
  }

  .hero-cta .btn {
    width: 100%;
  }
}

/* ── Print Styles ── */
@media print {
  .top-bar, .sidebar, .form-actions,
  .preview-actions, .toast-container,
  .btn, .app-footer { display: none !important; }

  .main-content { padding: 0; }
  .document-preview {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }

  body {
    background: white;
    color: black;
  }
}
