/* ===== CSS Custom Properties ===== */
:root {
  --color-primary: #4F46E5;
  --color-primary-dark: #3730A3;
  --color-primary-light: #EEF2FF;
  --color-primary-border: #A5B4FC;
  --color-accent: #0D9488;
  --color-accent-light: #F0FDFA;
  --color-danger: #DC2626;
  --color-danger-light: #FEF2F2;
  --color-bg: #FAFAF9;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F5F5F4;
  --color-text: #1C1917;
  --color-text-secondary: #57534E;
  --color-text-muted: #78716C;
  --color-border: #E7E5E4;
  --color-border-light: #F5F5F4;
  --color-focus: #4F46E5;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1120px;
  --header-height: 64px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 16px); }
body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ===== Focus Styles ===== */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.logo:hover { text-decoration: none; }
.logo-text { letter-spacing: -0.01em; }
.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.main-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.main-nav a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
  text-decoration: none;
}

/* ===== Hero ===== */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 20px 48px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
}
.hero-content { flex: 1; max-width: 580px; }
.hero h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.hero-sub {
  font-size: 1.125rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 28px;
}
.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 24px 32px;
  background: var(--color-primary-light);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-primary-border);
  flex-shrink: 0;
}
.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--color-primary);
  line-height: 1;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover { background: var(--color-surface-alt); border-color: var(--color-text-muted); }
.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--color-primary-light); }
.btn-danger {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border-color: transparent;
}
.btn-danger:hover { background: #FECACA; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }

/* ===== Section Styles ===== */
.section-heading {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.section-sub {
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  font-size: 0.95rem;
}

/* ===== Generator Section ===== */
.generator-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 20px;
}
.generator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

/* ===== Form ===== */
.prep-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text);
}
.req { color: var(--color-danger); }
.form-hint {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
input[type="text"], select, textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
input[type="text"]:focus, select:focus, textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
  outline: none;
}
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 d='M2 4l4 4 4-4' stroke='%2357534E' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
textarea { resize: vertical; min-height: 80px; }
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== Result Card ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 32px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.empty-state h3 {
  font-size: 1.1rem;
  margin: 16px 0 8px;
  color: var(--color-text-secondary);
}
.empty-state p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  max-width: 280px;
}
.empty-icon { opacity: 0.6; }

.result-card {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--color-primary-light);
}
.card-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.card-badge {
  padding: 4px 12px;
  background: var(--color-primary);
  color: white;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.card-body { padding: 20px 24px; }
.card-section { margin-bottom: 20px; }
.card-section:last-child { margin-bottom: 0; }
.card-section h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}
.card-list li {
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
  font-size: 0.925rem;
  line-height: 1.5;
}
.card-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
}
.card-notes textarea {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: 100%;
  resize: vertical;
  background: var(--color-accent-light);
  border-color: #99F6E4;
}
.card-notes textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.15);
  outline: none;
}
.card-actions {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--color-surface-alt);
}

.hidden { display: none !important; }

/* ===== Saved Contacts ===== */
.contacts-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 20px;
}
.contacts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: box-shadow 0.15s;
}
.contact-item:hover { box-shadow: var(--shadow-sm); }
.contact-info { flex: 1; min-width: 0; }
.contact-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 2px;
}
.contact-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.contact-preview {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.contacts-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
}
.contacts-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* ===== Tips Section ===== */
.tips-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 20px;
}
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.tip-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
}
.tip-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--color-text);
}
.tip-card ul { display: flex; flex-direction: column; gap: 8px; }
.tip-card li {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  padding-left: 18px;
  position: relative;
  line-height: 1.5;
}
.tip-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}
.assumptions-block {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
}
.assumptions-block h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.assumptions-block p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

/* ===== Legal Pages ===== */
.legal-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}
.legal-page h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 32px;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footer-logo {
  font-weight: 700;
  font-size: 1rem;
}
.footer-tagline {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.footer-nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-nav a {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.footer-nav a:hover { color: var(--color-primary); }
.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--color-text);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: toastIn 0.2s ease-out;
}
.toast-out { animation: toastOut 0.2s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }

/* ===== Print Styles ===== */
@media print {
  .site-header, .site-footer, .generator-form-wrap, .contacts-section, .tips-section, .card-actions, .hero { display: none !important; }
  .generator-layout { display: block; }
  .result-card { box-shadow: none; border-color: #ccc; }
  .card-header { background: #f0f0f0; }
  body { background: white; }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-inner { padding: 0 16px; }
  .main-nav a { padding: 6px 8px; font-size: 0.825rem; }
  .logo-text { display: none; }
  .hero { flex-direction: column; padding: 40px 16px 32px; }
  .hero h1 { font-size: 1.75rem; }
  .hero-sub { font-size: 1rem; }
  .hero-stat { width: 100%; flex-direction: row; justify-content: center; gap: 12px; padding: 16px; }
  .generator-layout { grid-template-columns: 1fr; gap: 24px; }
  .generator-section, .contacts-section, .tips-section { padding: 32px 16px; }
  .contact-item { flex-direction: column; align-items: flex-start; gap: 12px; }
  .contact-actions { width: 100%; }
  .contact-actions .btn { flex: 1; }
  .tips-grid { grid-template-columns: 1fr; }
  .card-actions { flex-wrap: wrap; }
  .card-actions .btn { flex: 1; }
}

@media (max-width: 480px) {
  .main-nav { gap: 2px; }
  .main-nav a { font-size: 0.75rem; padding: 4px 6px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .footer-meta { flex-direction: column; gap: 4px; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
