/* TI Toolkit – Shared Styles */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e8e8ea;
  --text: #18181b;
  --text-muted: #71717a;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #10b981;
  --warning: #f59e0b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.06), 0 4px 10px rgba(0,0,0,0.03);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
header {
  background: rgba(255,255,255,0.85);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.nav {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.logo {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 800;
}
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-links a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--text); background: var(--primary-light); }

/* Hero */
.hero {
  padding: 64px 24px 48px;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}
.hero .badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
}
.hero.small { padding: 48px 24px 24px; }
.hero.small h1 { font-size: clamp(24px, 4vw, 36px); }

/* Container */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 64px;
}
.container.narrow { max-width: 820px; }

/* Tabs / Calculator nav */
.calc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 32px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.calc-nav button {
  background: transparent;
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
  font-family: inherit;
}
.calc-nav button:hover { background: var(--bg); color: var(--text); }
.calc-nav button.active { background: var(--text); color: white; }

/* Main layout */
.layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
}

/* Calculator card */
.calc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  box-shadow: var(--shadow);
  display: none;
}
.calc.active { display: block; }
.calc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.calc-header h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.calc-header p { color: var(--text-muted); font-size: 14px; }
.formula {
  background: var(--primary-light);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.field { margin-bottom: 4px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.field label .unit {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 12px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: all 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.field small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 5px;
  line-height: 1.4;
}
textarea { resize: vertical; font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; }

/* Buttons */
.btn {
  background: var(--text);
  color: white;
  border: none;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  display: inline-block;
  text-decoration: none;
}
.btn:hover { background: #000; transform: translateY(-1px); text-decoration: none; color: white; }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); transform: none; color: var(--text); }
.btn-sm { padding: 7px 14px; font-size: 13px; font-weight: 500; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* Results */
.results {
  margin-top: 24px;
  padding: 24px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.results.hidden { display: none; }
.results h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.result-item {
  background: var(--surface);
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.result-item .label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1.3;
}
.result-item .value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  word-break: break-all;
}
.result-item .value.primary { color: var(--primary); }
.result-detail {
  margin-top: 14px;
  padding: 14px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
}
.result-detail strong { color: var(--text); font-weight: 600; }
.copy-row {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

/* Chart */
.chart-wrapper {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

/* Sidebar */
aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.side-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
}
.side-card h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.side-card ul { list-style: none; }
.side-card li a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  margin: 0 -10px;
}
.side-card li a:hover { background: var(--bg); text-decoration: none; }
.tips-list { list-style: none; }
.tips-list li {
  font-size: 13px;
  color: var(--text-muted);
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}
.tips-list li:last-child { border-bottom: none; }

/* Statistics input table */
.stat-input-wrapper {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.stat-table {
  width: 100%;
  border-collapse: collapse;
}
.stat-table thead th {
  background: var(--bg);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.stat-table tbody tr { border-bottom: 1px solid var(--border); }
.stat-table tbody tr:last-child { border-bottom: none; }
.stat-table tbody tr:hover { background: #fafafa; }
.stat-input-wrapper > button { margin: 10px 12px 12px; }

/* SEO section */
.seo-section {
  margin-top: 56px;
  max-width: 820px;
}
.seo-section h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.seo-section h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 24px 0 8px;
}
.seo-section p {
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.7;
}

/* Content pages (about, privacy, contact) */
.page-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
.content-page {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px;
  box-shadow: var(--shadow);
}
.content-page h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.content-page .subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 16px;
}
.content-page h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 28px 0 10px;
}
.content-page h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 6px;
}
.content-page p, .content-page ul, .content-page ol {
  color: #3f3f46;
  margin-bottom: 12px;
  line-height: 1.7;
}
.content-page ul, .content-page ol { padding-left: 24px; }
.content-page li { margin-bottom: 6px; }
.content-page .meta-info {
  padding: 14px 16px;
  background: var(--primary-light);
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--primary);
}
.content-page .divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

/* Contact form */
.contact-form .field { margin-bottom: 16px; }
.contact-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  transition: all 0.15s;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.form-message {
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 14px;
  font-size: 14px;
  display: none;
}
.form-message.success { background: #dcfce7; color: #166534; display: block; }
.form-message.error-msg { background: #fee2e2; color: #991b1b; display: block; }

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  background: var(--surface);
}
footer .logo { justify-content: center; margin-bottom: 12px; }
footer .footer-links {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 14px 0;
}
footer .footer-links a { color: var(--text-muted); font-size: 14px; }
footer .footer-links a:hover { color: var(--text); }

/* Data table */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
  font-size: 13px;
}
table.data-table th, table.data-table td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
}
table.data-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.data-table tr:nth-child(even) td { background: #fafafa; }

.error { color: #dc2626; font-size: 13px; margin-top: 8px; }

/* Responsive tweaks */
@media (max-width: 600px) {
  .calc { padding: 20px 16px; }
  .calc-header { gap: 12px; }
  .calc-header h2 { font-size: 18px; }
  .content-page { padding: 24px 20px; }
  .results { padding: 16px; }
  .result-item .value { font-size: 17px; }
}
