/* ===== DESIGN TOKENS ===== */
:root {
  --font-heading: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --color-bg: #faf7f2;
  --color-surface: #ffffff;
  --color-text: #292524;
  --color-text-secondary: #78716c;
  --color-text-muted: #a8a29e;
  --color-primary: #d97706;
  --color-primary-hover: #b45309;
  --color-primary-light: #fef3c7;
  --color-primary-bg: #fffbeb;
  --color-border: #e7e5e4;
  --color-border-light: #f0ede8;
  --color-success: #059669;
  --color-success-bg: #ecfdf5;
  --color-success-border: #a7f3d0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(41, 37, 36, 0.06);
  --shadow-md: 0 4px 14px rgba(41, 37, 36, 0.08);
  --shadow-lg: 0 10px 30px rgba(41, 37, 36, 0.1);
  --shadow-xl: 0 20px 50px rgba(41, 37, 36, 0.12);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  display: flex; flex-direction: column; min-height: 100vh;
}
img { max-width: 100%; height: auto; }
a { color: var(--color-primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--color-primary-hover); }

/* ===== HEADER ===== */
.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; max-width: 1140px; margin: 0 auto;
}
.logo {
  font-family: var(--font-heading);
  font-size: 1.2rem; color: var(--color-text);
  display: flex; align-items: center; gap: 10px;
  letter-spacing: -0.01em;
}
.logo:hover { text-decoration: none; color: var(--color-primary); }
.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-body);
  font-size: 1rem; font-weight: 700;
}
.nav { display: flex; gap: 28px; align-items: center; }
.nav a { color: var(--color-text-secondary); font-size: 0.88rem; font-weight: 500; }
.nav a:hover { color: var(--color-text); text-decoration: none; }

/* ===== HOMEPAGE HERO ===== */
.hero {
  text-align: center;
  padding: 56px 20px 36px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 200px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
  opacity: 0.3;
}
.hero h1 {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.hero p {
  font-size: 1.05rem;
  color: var(--color-text-secondary);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ===== CATEGORY GROUPS ===== */
.category-group {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 40px 32px 32px;
  margin: 0 auto 32px;
  max-width: 1140px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border-light);
}

.category-header {
  margin-bottom: 28px;
  padding-left: 20px;
  border-left: 4px solid var(--color-primary);
  position: relative;
}
.category-header::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 2px;
}
.category-header.financial { border-color: #d97706; }
.category-header.health { border-color: #059669; }
.category-header.utility { border-color: #7c3aed; }

.category-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.category-subtitle {
  color: var(--color-text-secondary);
  font-size: 0.92rem;
}

/* ===== TOOL GRID ===== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.tool-grid--centered {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}
.tool-grid--centered .tool-card {
  flex: 0 1 280px;
  min-width: 240px;
}

.tool-card {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--color-border-light);
  transition: all 0.3s ease;
  display: flex; flex-direction: column; align-items: flex-start;
  cursor: pointer;
}
.tool-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
  text-decoration: none;
  background: var(--color-surface);
}
.tool-card-icon {
  width: 46px; height: 46px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-body);
  font-size: 1.2rem; font-weight: 600; margin-bottom: 14px;
}
.tool-card h2 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.tool-card p {
  font-size: 0.84rem;
  color: var(--color-text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== TOOL PAGE LAYOUT ===== */
.tool-page { max-width: 1140px; margin: 0 auto; padding: 32px 20px; }
.tool-page h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 8px;
  color: var(--color-text);
  letter-spacing: -0.02em;
}
.tool-intro { color: var(--color-text-secondary); font-size: 1rem; margin-bottom: 28px; max-width: 720px; line-height: 1.7; }

.tool-layout { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
@media (max-width: 860px) { .tool-layout { grid-template-columns: 1fr; } }

.tool-main { min-width: 0; }
.tool-sidebar { position: sticky; top: 88px; }

/* ===== CALCULATOR FORM CARD ===== */
.calc-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  padding: 32px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}
.calc-card h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 400;
  margin-bottom: 24px;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--color-text-secondary); margin-bottom: 5px; letter-spacing: 0.01em; }
.form-group .input-wrap { position: relative; }
.form-group input, .form-group select {
  width: 100%; padding: 11px 15px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem; font-family: var(--font-body);
  color: var(--color-text); background: var(--color-surface);
  transition: all 0.2s;
  -webkit-appearance: none; appearance: none;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2378716c' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-group .prefix { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); font-size: 0.9rem; pointer-events: none; }
.form-group input.prefixed { padding-left: 28px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600;
  font-family: var(--font-body);
  border: none; cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.01em;
}
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: #fff;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.35);
}
.btn-secondary { background: var(--color-bg); color: var(--color-text); border: 1.5px solid var(--color-border); }
.btn-secondary:hover { background: var(--color-border-light); border-color: var(--color-text-muted); }
.btn-success {
  background: linear-gradient(135deg, var(--color-success), #047857);
  color: #fff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}
.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.35);
}
.btn-group { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }

/* ===== RESULTS ===== */
.result-box {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 20px;
  display: none;
}
.result-box.visible { display: block; animation: fadeSlideIn 0.3s ease; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.result-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 400;
  color: var(--color-success);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.result-label { font-size: 0.85rem; color: var(--color-text-secondary); }
.result-details { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--color-success-border); }
.result-details div { display: flex; justify-content: space-between; padding: 5px 0; font-size: 0.9rem; }
.result-details .label { color: var(--color-text-secondary); }
.result-details .value { font-weight: 600; color: var(--color-text); }

/* ===== CONTENT SECTIONS ===== */
.content-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.content-section h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 400;
  margin-bottom: 16px;
  color: var(--color-text);
  letter-spacing: -0.01em;
}
.content-section h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 400;
  margin-bottom: 12px;
  color: var(--color-text);
  margin-top: 24px;
  letter-spacing: -0.01em;
}
.content-section h3:first-child { margin-top: 0; }
.content-section p { color: var(--color-text-secondary); margin-bottom: 14px; font-size: 0.95rem; line-height: 1.7; }
.content-section ul, .content-section ol { color: var(--color-text-secondary); margin-bottom: 14px; padding-left: 20px; font-size: 0.95rem; line-height: 1.7; }
.content-section li { margin-bottom: 6px; }
.content-section .formula-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  padding: 18px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  margin: 14px 0;
  overflow-x: auto;
  color: var(--color-text);
}

/* ===== FAQ ACCORDION ===== */
.faq-item { border-bottom: 1px solid var(--color-border-light); }
.faq-item:first-child { border-top: 1px solid var(--color-border-light); }
.faq-question {
  width: 100%; padding: 16px 0;
  display: flex; justify-content: space-between;
  align-items: center;
  background: none; border: none; cursor: pointer;
  font-size: 0.95rem; font-weight: 500;
  color: var(--color-text);
  text-align: left;
  font-family: var(--font-body);
  transition: color 0.2s;
}
.faq-question:hover { color: var(--color-primary); }
.faq-question .arrow { transition: transform 0.3s ease; font-size: 0.8rem; color: var(--color-text-muted); }
.faq-item.open .faq-question .arrow { transform: rotate(180deg); color: var(--color-primary); }
.faq-answer { display: none; }
.faq-item.open .faq-answer { display: block; }
.faq-answer-inner { padding: 0 0 18px; color: var(--color-text-secondary); font-size: 0.9rem; line-height: 1.7; }

/* ===== INFO PAGES (About, Terms, Privacy) ===== */
.info-page { max-width: 760px; margin: 0 auto; padding: 48px 20px; }
.info-page h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 400;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}
.info-page h2 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 400;
  margin-top: 36px;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.info-page p { color: var(--color-text-secondary); margin-bottom: 14px; line-height: 1.8; }
.info-page ul { color: var(--color-text-secondary); margin-bottom: 14px; padding-left: 20px; line-height: 1.8; }
.info-page li { margin-bottom: 6px; }

/* ===== BREADCRUMB ===== */
.breadcrumb { font-size: 0.82rem; color: var(--color-text-muted); margin-bottom: 12px; }
.breadcrumb a { color: var(--color-text-secondary); }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb span { color: var(--color-text-muted); }

/* ===== FOOTER ===== */
.footer {
  background: #292524;
  color: #a8a29e;
  padding: 48px 0;
  margin-top: auto;
}
.footer-inner { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 36px; margin-bottom: 36px; }
.footer h3 {
  font-family: var(--font-heading);
  color: #f5f5f4;
  font-size: 1rem;
  font-weight: 400;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}
.footer ul { list-style: none; }
.footer ul li { margin-bottom: 10px; }
.footer ul li a { color: #a8a29e; font-size: 0.85rem; }
.footer ul li a:hover { color: #f5f5f4; text-decoration: none; }
.footer-bottom {
  border-top: 1px solid #44403c;
  padding-top: 24px;
  font-size: 0.8rem;
  text-align: center;
  color: #78716c;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .hero { padding: 40px 16px 28px; }
  .hero h1 { font-size: 1.7rem; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-grid--centered .tool-card { flex: 1 1 100%; min-width: 0; }
  .tool-page { padding: 24px 16px; }
  .tool-page h1 { font-size: 1.5rem; }
  .calc-card { padding: 24px; }
  .content-section { padding: 24px; }
  .header-inner { padding: 12px 16px; }
  .nav { gap: 16px; }
  .nav a { font-size: 0.82rem; }
  .result-value { font-size: 1.5rem; }
  .category-group { padding: 28px 20px 24px; margin: 0 12px 24px; border-radius: var(--radius-lg); }
  .category-header { margin-bottom: 20px; padding-left: 14px; }
  .category-title { font-size: 1.25rem; }
  .info-page { padding: 32px 16px; }
  .info-page h1 { font-size: 1.5rem; }
  .logo { font-size: 1.05rem; }
