:root {
  --bg: #f4f6f8;
  --bg-alt: #ebeef2;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #374151;
  --muted: #6b7280;
  --border: #d1d5db;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --accent2: #059669;
  --accent2-hover: #047857;
  --accent2-light: #d1fae5;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1), 0 8px 32px rgba(0,0,0,0.06);
  --transition: 0.2s ease;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max-width: 1200px;
}

[data-theme="dark"] {
  --bg: #0b0f19;
  --bg-alt: #111827;
  --card: #1e2433;
  --text: #e5e7eb;
  --text-secondary: #d1d5db;
  --muted: #9ca3af;
  --border: #374151;
  --accent: #60a5fa;
  --accent-hover: #93bbfd;
  --accent-light: #1e3a5f;
  --accent2: #34d399;
  --accent2-hover: #6ee7b7;
  --accent2-light: #064e3b;
  --danger: #f87171;
  --danger-light: #450a0a;
  --warning: #fbbf24;
  --warning-light: #451a03;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.4), 0 8px 32px rgba(0,0,0,0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}

main { flex: 1; }

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }

/* ===================== HEADER / NAV ===================== */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: background var(--transition), border-color var(--transition);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1rem;
}

.logo {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.02em;
}
.logo:hover { color: var(--accent); text-decoration: none; }
.logo-icon { color: var(--accent); }

.nav-menu {
  display: flex;
  list-style: none;
  gap: 0.25rem;
  align-items: center;
}
.nav-menu a {
  display: block;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all var(--transition);
  text-decoration: none;
}
.nav-menu a:hover, .nav-menu a.active {
  background: var(--accent-light);
  color: var(--accent);
  text-decoration: none;
}

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle, .menu-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.15rem;
  color: var(--text);
  transition: all var(--transition);
}
.theme-toggle:hover, .menu-toggle:hover { background: var(--bg-alt); }

.menu-toggle { display: none; }

/* ===================== HERO ===================== */
.hero {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  padding: 3.5rem 0 3rem;
  text-align: center;
}
[data-theme="dark"] .hero {
  background: linear-gradient(135deg, #1e3a5f 0%, #2d1b69 100%);
}
.hero-title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  opacity: 0.92;
  max-width: 700px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font);
  line-height: 1.4;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

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

.btn-secondary { background: var(--accent2); color: #fff; border-color: var(--accent2); }
.btn-secondary:hover { background: var(--accent2-hover); border-color: var(--accent2-hover); color: #fff; }

.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }

.btn-white { background: #fff; color: var(--accent); border-color: #fff; }
.btn-white:hover { background: #f0f0f0; color: var(--accent-hover); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { opacity: 0.9; }

.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-alt); color: var(--text); }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.85rem; }
.btn-xs { padding: 0.25rem 0.6rem; font-size: 0.78rem; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

/* ===================== CARDS ===================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all var(--transition);
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: var(--bg-alt); }

/* ===================== FORMS ===================== */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}
.form-hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }

.form-control, .form-select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font);
  background: var(--card);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-control.is-invalid { border-color: var(--danger); }
.form-error { font-size: 0.8rem; color: var(--danger); margin-top: 0.25rem; }

.form-select { cursor: pointer; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group-text {
  padding: 0.65rem 0.75rem;
  background: var(--bg-alt);
  border: 1.5px solid var(--border);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ===================== TABLE ===================== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th {
  background: var(--bg-alt);
  font-weight: 700;
  text-align: left;
  padding: 0.75rem 0.65rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.data-table td {
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover td { background: var(--accent-light); }
.data-table .col-name { min-width: 160px; }
.data-table .col-cat { min-width: 120px; }
.data-table .col-unit { min-width: 80px; }
.data-table .col-qty, .data-table .col-price, .data-table .col-total { min-width: 100px; text-align: right; }
.data-table .col-actions { width: 50px; text-align: center; }

.data-table .form-control, .data-table .form-select {
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  min-width: 80px;
}
.data-table .col-total-value {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.row-delete-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.3rem;
  border-radius: 4px;
  transition: all var(--transition);
}
.row-delete-btn:hover { background: var(--danger-light); }

/* ===================== SUMMARY ===================== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.summary-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}
.summary-stat-label { font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.summary-stat-value { font-size: 1.75rem; font-weight: 800; color: var(--text); margin: 0.35rem 0; }
.summary-stat-note { font-size: 0.8rem; color: var(--muted); }
.summary-stat.highlight { border-color: var(--accent); background: var(--accent-light); }
.summary-stat.highlight .summary-stat-value { color: var(--accent); }

.category-breakdown { margin: 1.5rem 0; }
.category-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.category-row:last-child { border-bottom: none; }
.category-label { font-weight: 600; min-width: 130px; font-size: 0.9rem; }
.category-bar-bg {
  flex: 1;
  background: var(--bg-alt);
  border-radius: 6px;
  height: 24px;
  overflow: hidden;
  position: relative;
}
.category-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
  min-width: 2px;
}
.category-amount { font-weight: 700; min-width: 100px; text-align: right; font-size: 0.9rem; }
.category-percent { font-size: 0.8rem; color: var(--muted); min-width: 45px; text-align: right; }

/* Category colors */
.cat-boya { background: #3b82f6; } .badge-boya { background: #dbeafe; color: #1d4ed8; }
.cat-zemin { background: #8b5cf6; } .badge-zemin { background: #ede9fe; color: #6d28d9; }
.cat-banyo { background: #06b6d4; } .badge-banyo { background: #cffafe; color: #0891b2; }
.cat-mutfak { background: #f59e0b; } .badge-mutfak { background: #fef3c7; color: #b45309; }
.cat-elektrik { background: #ef4444; } .badge-elektrik { background: #fee2e2; color: #dc2626; }
.cat-tesisat { background: #10b981; } .badge-tesisat { background: #d1fae5; color: #059669; }
.cat-kapi { background: #f97316; } .badge-kapi { background: #ffedd5; color: #c2410c; }
.cat-seramik { background: #06b6d4; } .badge-seramik { background: #cffafe; color: #0891b2; }
.cat-vitrifiye { background: #8b5cf6; } .badge-vitrifiye { background: #ede9fe; color: #6d28d9; }
.cat-donanim { background: #ec4899; } .badge-donanim { background: #fce7f3; color: #be185d; }
.cat-dolap { background: #f59e0b; } .badge-dolap { background: #fef3c7; color: #b45309; }
.cat-tezgah { background: #d97706; } .badge-tezgah { background: #fef3c7; color: #92400e; }
.cat-fayans { background: #14b8a6; } .badge-fayans { background: #ccfbf1; color: #0d9488; }
.cat-beyaz { background: #6366f1; } .badge-beyaz { background: #e0e7ff; color: #4338ca; }
.cat-bolme { background: #a855f7; } .badge-bolme { background: #f3e8ff; color: #7c3aed; }
.cat-aydinlatma { background: #eab308; } .badge-aydinlatma { background: #fef9c3; color: #a16207; }
.cat-mobilya { background: #78716c; } .badge-mobilya { background: #f5f5f4; color: #57534e; }
.cat-diger { background: #6b7280; } .badge-diger { background: #f3f4f6; color: #374151; }

.category-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

/* ===================== BREADCRUMB ===================== */
.breadcrumb {
  padding: 1rem 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { margin: 0 0.4rem; opacity: 0.5; }

/* ===================== ACCORDION (FAQ) ===================== */
.accordion { margin: 1.5rem 0; }
.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  overflow: hidden;
  background: var(--card);
}
.accordion-header {
  width: 100%;
  padding: 1rem 1.25rem;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-family: var(--font);
  transition: background var(--transition);
}
.accordion-header:hover { background: var(--bg-alt); }
.accordion-icon {
  font-size: 1.2rem;
  transition: transform 0.3s;
  flex-shrink: 0;
}
.accordion-item.active .accordion-icon { transform: rotate(180deg); }
.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.accordion-body-inner { padding: 0 1.25rem 1.25rem; color: var(--text-secondary); line-height: 1.8; }

/* ===================== ARTICLE / PROSE ===================== */
.article-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0 3rem;
}
.article-content h1 { font-size: 2rem; font-weight: 800; margin-bottom: 1rem; line-height: 1.3; }
.article-content h2 { font-size: 1.4rem; font-weight: 700; margin: 2rem 0 0.75rem; color: var(--text); }
.article-content h3 { font-size: 1.15rem; font-weight: 700; margin: 1.5rem 0 0.5rem; }
.article-content p { margin-bottom: 1rem; color: var(--text-secondary); }
.article-content ul, .article-content ol { margin: 0.75rem 0 1.25rem 1.5rem; color: var(--text-secondary); }
.article-content li { margin-bottom: 0.4rem; }
.article-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 0.75rem 1.25rem;
  margin: 1.25rem 0;
  background: var(--accent-light);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}
.article-content strong { color: var(--text); }
.article-meta { font-size: 0.85rem; color: var(--muted); margin-bottom: 1.5rem; }

/* ===================== SEARCH ===================== */
.search-box { position: relative; max-width: 600px; margin: 0 auto 1.5rem; }
.search-input {
  width: 100%;
  padding: 0.85rem 1.2rem 0.85rem 3rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.05rem;
  background: var(--card);
  color: var(--text);
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-light); }
.search-icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.1rem; }

.filter-chips { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 1.5rem; flex-wrap: wrap; }
.chip {
  padding: 0.4rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--card);
  color: var(--muted);
  transition: all var(--transition);
  font-family: var(--font);
}
.chip:hover, .chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.search-results { max-width: 700px; margin: 0 auto; }
.search-result-item {
  display: block;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  background: var(--card);
  transition: all var(--transition);
  text-decoration: none;
}
.search-result-item:hover { border-color: var(--accent); box-shadow: var(--shadow); text-decoration: none; }
.search-result-title { font-weight: 700; color: var(--text); margin-bottom: 0.2rem; }
.search-result-url { font-size: 0.8rem; color: var(--muted); }
.search-result-type {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
  margin-left: 0.5rem;
}

/* ===================== PRESET / TEMPLATE GRID ===================== */
.preset-grid, .template-grid, .guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.preset-card, .template-card, .guide-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text);
  display: block;
}
.preset-card:hover, .template-card:hover, .guide-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text);
}
.preset-card-title, .template-card-title, .guide-card-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: var(--text);
}
.preset-card-meta { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.75rem; }
.preset-card-cta { font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.template-card-desc, .guide-card-desc { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.75rem; line-height: 1.6; }
.template-card-icon { font-size: 2rem; margin-bottom: 0.75rem; }

/* ===================== AD SLOTS ===================== */
.ad-slot {
  margin: 1.5rem 0;
  text-align: center;
  min-height: 90px;
  overflow: hidden;
}
.ad-slot ins { display: block; }

/* ===================== DISCLAIMER ===================== */
.disclaimer {
  background: var(--warning-light);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  font-size: 0.87rem;
  color: var(--text-secondary);
  margin: 1.25rem 0;
  line-height: 1.6;
}
.disclaimer strong { color: var(--warning); }

/* ===================== FOOTER ===================== */
.site-footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding-top: 2.5rem;
  transition: background var(--transition), border-color var(--transition);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  padding-bottom: 2rem;
}
.footer-grid h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.75rem; }
.footer-grid p { font-size: 0.87rem; color: var(--muted); line-height: 1.6; }
.footer-grid ul { list-style: none; }
.footer-grid li { margin-bottom: 0.4rem; }
.footer-grid a { color: var(--muted); font-size: 0.87rem; }
.footer-grid a:hover { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}
.footer-bottom p { margin-bottom: 0.25rem; }

/* ===================== TOAST ===================== */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  max-width: 360px;
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.toast.success { border-left: 4px solid var(--accent2); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
.toast.hiding { animation: slideOut 0.3s ease forwards; }

/* ===================== SECTION HELPERS ===================== */
.section { padding: 3rem 0; }
.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.section-subtitle {
  text-align: center;
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto 2rem;
  font-size: 1rem;
}

.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }

.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ===================== FORMULA PANEL ===================== */
.formula-panel {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-size: 0.85rem;
  display: none;
}
.formula-panel.visible { display: block; }
.formula-panel h4 { margin-bottom: 0.5rem; }
.formula-item { display: flex; justify-content: space-between; padding: 0.3rem 0; border-bottom: 1px dashed var(--border); }
.formula-item:last-child { border-bottom: none; }

/* ===================== EXPORT ACTIONS ===================== */
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0;
}

/* ===================== JSON IMPORT AREA ===================== */
.json-import-area {
  margin: 1rem 0;
  display: none;
}
.json-import-area.visible { display: block; }
.json-import-area textarea {
  width: 100%;
  min-height: 120px;
  font-family: monospace;
  font-size: 0.85rem;
  padding: 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  resize: vertical;
}

/* ===================== INTERNAL LINKS ===================== */
.internal-links {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
}
.internal-links h3 { margin-bottom: 1rem; font-size: 1.1rem; }
.internal-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
}
.internal-links-grid a {
  display: block;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}
.internal-links-grid a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ===================== PAGE-SPECIFIC ===================== */
.home-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}
.feature-card {
  text-align: center;
  padding: 2rem 1.5rem;
}
.feature-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.feature-title { font-weight: 700; margin-bottom: 0.5rem; }
.feature-desc { font-size: 0.9rem; color: var(--muted); }

.tool-section { margin-bottom: 2rem; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .menu-toggle { display: flex; }

  .nav-menu {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 99;
  }
  .nav-menu.open { display: flex; }
  .nav-menu a { padding: 0.75rem 1rem; }

  .hero { padding: 2.5rem 0 2rem; }
  .hero-title { font-size: 1.6rem; }

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

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

  .category-row { flex-wrap: wrap; }
  .category-label { min-width: 100%; }

  .footer-grid { grid-template-columns: repeat(2, 1fr); }

  .preset-grid, .template-grid, .guide-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .export-actions { flex-direction: column; }
  .export-actions .btn { justify-content: center; }
  .hero-actions { flex-direction: column; align-items: stretch; }
}

/* ===================== PRINT ===================== */
@media print {
  body { background: #fff; color: #000; font-size: 11pt; }

  .site-header, .site-footer, .ad-slot, .menu-toggle, .theme-toggle,
  .nav-actions, .export-actions, .hero-actions, .btn-danger,
  .row-delete-btn, .formula-panel, .json-import-area,
  .internal-links, .disclaimer, .form-check,
  #toast-container, .breadcrumb { display: none !important; }

  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }

  .data-table th { background: #f0f0f0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .data-table .form-control, .data-table .form-select {
    border: none;
    padding: 0;
    background: transparent;
    font-weight: 600;
    -webkit-appearance: none;
    appearance: none;
  }

  .summary-stat { border: 1px solid #ccc; }
  .category-bar-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .hero { background: #333 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  a { color: #000; text-decoration: none; }
  a[href]:after { content: none; }
}

/* ===================== ANIMATIONS ===================== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInLeft { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeInRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes gradientMove { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes countUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ==========================================================
   PREMIUM V2 ENHANCEMENTS
   ========================================================== */

/* --- Header glass effect --- */
.site-header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
[data-theme="dark"] .site-header {
  background: rgba(30,36,51,0.88);
}

.logo {
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Hero V2 --- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5rem 0 4.5rem;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 40%, #7c3aed 100%);
  background-size: 200% 200%;
  animation: gradientMove 8s ease infinite;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg);
  clip-path: ellipse(55% 100% at 50% 100%);
}
[data-theme="dark"] .hero {
  background: linear-gradient(135deg, #0b0f19 0%, #1e3a5f 40%, #2d1b69 100%);
  background-size: 200% 200%;
  animation: gradientMove 8s ease infinite;
}
.hero-title {
  animation: fadeInUp 0.6s ease both;
}
.hero-subtitle {
  animation: fadeInUp 0.6s 0.15s ease both;
}
.hero-actions {
  animation: fadeInUp 0.6s 0.3s ease both;
}

.hero-badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px;
  padding: 0.4rem 1.2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 1.25rem;
  animation: fadeInUp 0.5s ease both;
}

/* --- Stats bar --- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  padding: 2.5rem 0;
  margin: -2rem 0 2rem;
  position: relative;
  z-index: 2;
}
.stat-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
  animation: scaleIn 0.5s ease both;
}
.stat-item:nth-child(2) { animation-delay: 0.1s; }
.stat-item:nth-child(3) { animation-delay: 0.2s; }
.stat-item:nth-child(4) { animation-delay: 0.3s; }
.stat-item:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(37,99,235,0.15); }
.stat-number {
  font-size: 2.2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}
.stat-label { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; font-weight: 500; }

@media (max-width: 768px) {
  .stats-bar { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}
@media (max-width: 480px) {
  .stats-bar { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .stat-item { padding: 1rem; }
  .stat-number { font-size: 1.6rem; }
}

/* --- Steps/Process V2 --- */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin: 2rem 0;
  counter-reset: step;
}
.step-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem 2rem;
  text-align: center;
  transition: all 0.3s ease;
  overflow: hidden;
}
.step-card::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: 0 0 50% 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #fff;
  font-size: 1.15rem;
  line-height: 48px;
  text-align: center;
}
.step-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.step-icon { font-size: 2.5rem; margin: 1.5rem 0 0.75rem; }
.step-title { font-weight: 700; font-size: 1.1rem; margin-bottom: 0.5rem; }
.step-desc { font-size: 0.9rem; color: var(--muted); line-height: 1.6; }

@media (max-width: 768px) { .steps-grid { grid-template-columns: 1fr; gap: 1.25rem; } }

/* --- Template card V2 --- */
.template-card, .guide-card, .preset-card {
  position: relative;
  overflow: hidden;
}
.template-card::before, .guide-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #7c3aed, var(--accent2));
  opacity: 0;
  transition: opacity 0.3s;
}
.template-card:hover::before, .guide-card:hover::before { opacity: 1; }

.template-card-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  border-radius: 14px;
  font-size: 1.75rem;
  margin-bottom: 1rem;
  transition: all 0.3s;
}
.template-card:hover .template-card-icon {
  transform: scale(1.1) rotate(-3deg);
  background: linear-gradient(135deg, var(--accent), #7c3aed);
}

/* --- CTA Banner --- */
.cta-banner {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  color: #fff;
  margin: 3rem 0;
  position: relative;
  overflow: hidden;
}
.cta-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.06'%3E%3Cpath d='M20 0L0 20h40z'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.cta-banner h2 { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.75rem; position: relative; }
.cta-banner p { font-size: 1.05rem; opacity: 0.92; margin-bottom: 1.5rem; position: relative; }
.cta-banner .btn { position: relative; }
[data-theme="dark"] .cta-banner {
  background: linear-gradient(135deg, #1e3a5f, #2d1b69);
}

/* --- Tip cards --- */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.tip-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  transition: all 0.3s;
}
.tip-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tip-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.tip-content h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.3rem; }
.tip-content p { font-size: 0.85rem; color: var(--muted); line-height: 1.5; margin: 0; }

/* --- Guide card V2 with reading time --- */
.guide-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.guide-card-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.72rem;
}

/* --- Glossary --- */
.glossary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}
.glossary-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  transition: all 0.3s;
}
.glossary-item:hover { border-color: var(--accent); }
.glossary-term { font-weight: 700; color: var(--accent); margin-bottom: 0.3rem; font-size: 1rem; }
.glossary-def { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; }

/* --- Checklist --- */
.checklist { list-style: none; max-width: 700px; margin: 1rem auto; }
.checklist li {
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  position: relative;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1.6;
}
.checklist li::before {
  content: '☐';
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  font-size: 1.1rem;
  color: var(--accent);
}

/* --- Back to top --- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 90;
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { transform: translateY(-3px); background: var(--accent-hover); }

/* --- Section divider --- */
.section-divider {
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  border-radius: 2px;
  margin: 0 auto 2rem;
}

/* --- Number badge on cards --- */
.card-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Improved internal links --- */
.internal-links {
  border: 1px solid var(--border);
  position: relative;
}
.internal-links::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: var(--radius) var(--radius) 0 0;
}
.internal-links-grid a {
  position: relative;
  padding-left: 1.5rem;
}
.internal-links-grid a::before {
  content: '→';
  position: absolute;
  left: 0.5rem;
  color: var(--accent);
  font-weight: 700;
  transition: transform 0.2s;
}
.internal-links-grid a:hover::before {
  transform: translateX(3px);
}

/* --- Better focus states for a11y --- */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* --- Mobile menu animation --- */
.nav-menu {
  transition: all 0.3s ease;
}
@media (max-width: 768px) {
  .nav-menu.open {
    animation: fadeIn 0.2s ease;
  }
}

/* --- Print enhancements --- */
@media print {
  .cta-banner, .stats-bar, .back-to-top, .tips-grid { display: none !important; }
}

/* --- Quick calc grid enhancements --- */
.quick-calc-grid .template-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.quick-calc-grid .template-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

/* --- Article content styling --- */
.article-content {
  max-width: 780px;
  line-height: 1.85;
}
.article-content h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.35rem;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.4rem;
}
.article-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: 1.15rem;
  color: var(--accent);
}
.article-content ul, .article-content ol {
  padding-left: 1.5rem;
  margin: 1rem 0;
}
.article-content li {
  margin-bottom: 0.5rem;
}
.article-content p {
  margin-bottom: 1rem;
}
.article-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* --- Section subtitle under h2 --- */
.section-subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 1.05rem;
  margin-top: -0.5rem;
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Performance: reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero { animation: none; }
}
