/* ===== calcmoa.kr - Main Stylesheet ===== */
/* Mobile-first, single CSS file, CSS custom properties for dark mode */

/* ===== CSS Variables ===== */
:root {
  --cm-primary-50: #eff6ff;
  --cm-primary-100: #dbeafe;
  --cm-primary-200: #bfdbfe;
  --cm-primary-300: #93c5fd;
  --cm-primary-400: #60a5fa;
  --cm-primary-500: #3b82f6;
  --cm-primary-600: #2563eb;
  --cm-primary-700: #1d4ed8;
  --cm-primary-800: #1e40af;
  --cm-primary-900: #1e3a8a;

  --cm-neutral-50: #f8fafc;
  --cm-neutral-100: #f1f5f9;
  --cm-neutral-200: #e2e8f0;
  --cm-neutral-300: #cbd5e1;
  --cm-neutral-400: #94a3b8;
  --cm-neutral-500: #64748b;
  --cm-neutral-600: #475569;
  --cm-neutral-700: #334155;
  --cm-neutral-800: #1e293b;
  --cm-neutral-900: #0f172a;

  --cm-bg: #ffffff;
  --cm-card: #ffffff;
  --cm-text: #111827;
  --cm-text-secondary: #64748b;
  --cm-border: #e2e8f0;
  --cm-success: #16a34a;
  --cm-danger: #ef4444;

  --cm-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --cm-radius: 0.75rem;
  --cm-radius-sm: 0.5rem;
  --cm-shadow: 0 1px 3px rgba(0,0,0,0.08);
  --cm-shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --cm-max-width: 1200px;
}

html.dark {
  --cm-primary-50: rgba(30, 58, 138, 0.15);
  --cm-primary-100: rgba(30, 64, 175, 0.2);
  --cm-primary-200: rgba(37, 99, 235, 0.3);
  --cm-primary-300: #93c5fd;
  --cm-primary-400: #60a5fa;
  --cm-primary-500: #3b82f6;
  --cm-primary-600: #2563eb;
  --cm-primary-700: #1d4ed8;
  --cm-primary-800: rgba(30, 64, 175, 0.5);
  --cm-primary-900: rgba(30, 58, 138, 0.2);

  --cm-neutral-50: #1e293b;
  --cm-neutral-100: #1e293b;
  --cm-neutral-200: #334155;
  --cm-neutral-300: #475569;
  --cm-neutral-400: #64748b;
  --cm-neutral-500: #94a3b8;
  --cm-neutral-600: #cbd5e1;
  --cm-neutral-700: #e2e8f0;
  --cm-neutral-800: #f1f5f9;
  --cm-neutral-900: #f8fafc;

  --cm-bg: #0f172a;
  --cm-card: #1e293b;
  --cm-text: #f1f5f9;
  --cm-text-secondary: #94a3b8;
  --cm-border: #334155;
  --cm-success: #4ade80;
  --cm-danger: #f87171;
  --cm-shadow: 0 1px 3px rgba(0,0,0,0.3);
  --cm-shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}


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

html {
  font-family: var(--cm-font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--cm-text);
  background: var(--cm-bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--cm-primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }
html.dark a { color: var(--cm-primary-400); }

img { max-width: 100%; height: auto; }


/* ===== Layout ===== */
.cm-wrap {
  flex: 1;
  width: 100%;
  max-width: var(--cm-max-width);
  margin: 0 auto;
  padding: 0 1rem;
}


/* ===== Header (Desktop) ===== */
.cm-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--cm-bg);
  border-bottom: 1px solid var(--cm-border);
  backdrop-filter: blur(8px);
}

.cm-header-inner {
  max-width: var(--cm-max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 2rem;
}

.cm-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--cm-primary-600);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.02em;
}
.cm-logo:hover { text-decoration: none; }
html.dark .cm-logo { color: var(--cm-primary-400); }

.cm-nav {
  display: none;
  gap: 0.25rem;
}
.cm-nav a {
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--cm-text-secondary);
  border-radius: var(--cm-radius-sm);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.cm-nav a:hover {
  color: var(--cm-text);
  background: var(--cm-neutral-100);
  text-decoration: none;
}

.cm-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cm-theme-btn {
  background: none;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: border-color 0.15s;
}
.cm-theme-btn:hover { border-color: var(--cm-primary-400); }

@media (min-width: 768px) {
  .cm-nav { display: flex; }
}


/* ===== Mobile Bottom Nav ===== */
.cm-mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--cm-bg);
  border-top: 1px solid var(--cm-border);
  display: flex;
  justify-content: space-around;
  padding: 0.4rem 0 calc(0.4rem + env(safe-area-inset-bottom));
}

.cm-mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  color: var(--cm-text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.cm-mobile-nav a:hover { text-decoration: none; }
.cm-mobile-nav .nav-icon { font-size: 1.25rem; }
.cm-mobile-nav a.active { color: var(--cm-primary-600); }
html.dark .cm-mobile-nav a.active { color: var(--cm-primary-400); }

@media (min-width: 768px) {
  .cm-mobile-nav { display: none; }
  body { padding-bottom: 0; }
}
@media (max-width: 767px) {
  body { padding-bottom: 64px; }
}


/* ===== Footer ===== */
.cm-footer {
  border-top: 1px solid var(--cm-border);
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--cm-text-secondary);
}
.cm-footer a { color: var(--cm-text-secondary); }
.cm-footer a:hover { color: var(--cm-primary-600); }
@media (max-width: 767px) {
  .cm-footer { padding-bottom: 80px; }
}


/* ===== Hero (Homepage) ===== */
.cm-hero {
  text-align: center;
  padding: 2.5rem 1rem 2rem;
}

.cm-hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  word-break: keep-all;
}

.cm-hero-sub {
  font-size: 0.95rem;
  color: var(--cm-text-secondary);
  margin-bottom: 1.5rem;
  word-break: keep-all;
}

.cm-search-wrap {
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.cm-search-wrap input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  font-size: 1rem;
  border: 2px solid var(--cm-border);
  border-radius: 999px;
  background: var(--cm-card);
  color: var(--cm-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cm-search-wrap input:focus {
  outline: none;
  border-color: var(--cm-primary-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
html.dark .cm-search-wrap input:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.cm-search-wrap input::placeholder { color: var(--cm-neutral-400); }

.cm-search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--cm-neutral-400);
  pointer-events: none;
}


/* ===== Category Grid ===== */
.cm-section {
  margin-bottom: 2.5rem;
}

.cm-section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--cm-primary-600);
  display: inline-block;
}
html.dark .cm-section-title { border-color: var(--cm-primary-400); }

.cm-category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.cm-category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1rem 0.5rem;
  background: var(--cm-card);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  text-decoration: none;
  color: var(--cm-text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
}
.cm-category-card:hover {
  border-color: var(--cm-primary-400);
  box-shadow: var(--cm-shadow-lg);
  transform: translateY(-2px);
  text-decoration: none;
}

.cm-category-icon { font-size: 1.75rem; }
.cm-category-name {
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  word-break: keep-all;
}

@media (min-width: 768px) {
  .cm-category-grid { grid-template-columns: repeat(7, 1fr); }
}
@media (max-width: 359px) {
  .cm-category-grid { grid-template-columns: repeat(3, 1fr); }
}


/* ===== Calculator Cards ===== */
.cm-calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.cm-calc-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--cm-card);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.cm-calc-card:hover {
  border-color: var(--cm-primary-400);
  box-shadow: var(--cm-shadow-lg);
  transform: translateY(-2px);
  text-decoration: none;
}

.cm-calc-card-icon { font-size: 1.75rem; flex-shrink: 0; }
.cm-calc-card-body { flex: 1; min-width: 0; }
.cm-calc-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
  color: var(--cm-text);
}
.cm-calc-card-desc {
  font-size: 0.8rem;
  color: var(--cm-text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cm-calc-card-cat {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--cm-primary-600);
  margin-top: 0.35rem;
}
html.dark .cm-calc-card-cat { color: var(--cm-primary-400); }

@media (min-width: 768px) {
  .cm-calc-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .cm-calc-grid { grid-template-columns: repeat(3, 1fr); }
}


/* ===== Filter Chips ===== */
.cm-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tool-filter-chip {
  padding: 0.4rem 0.9rem;
  border-radius: 1.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--cm-border);
  background: transparent;
  color: var(--cm-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.tool-filter-chip:hover {
  border-color: var(--cm-primary-400);
  color: var(--cm-primary-600);
}
html.dark .tool-filter-chip:hover { color: var(--cm-primary-400); }

.tool-filter-chip--active {
  background: var(--cm-primary-600);
  border-color: var(--cm-primary-600);
  color: #fff;
}
html.dark .tool-filter-chip--active {
  background: var(--cm-primary-500);
  border-color: var(--cm-primary-500);
  color: #0f172a;
}
.tool-filter-chip--active:hover {
  background: var(--cm-primary-700);
  border-color: var(--cm-primary-700);
  color: #fff;
}

#no-result {
  display: none;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--cm-text-secondary);
  font-size: 0.95rem;
}


/* ===== Calculator Single Page ===== */
.cm-calc-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.cm-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--cm-text-secondary);
  margin-bottom: 1rem;
}
.cm-breadcrumb a { color: var(--cm-text-secondary); }
.cm-breadcrumb a:hover { color: var(--cm-primary-600); }
.cm-breadcrumb-sep { color: var(--cm-neutral-400); }

.cm-calc-page h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  word-break: keep-all;
  letter-spacing: -0.02em;
}

.cm-calc-content {
  line-height: 1.7;
  word-break: keep-all;
}

.cm-calc-content h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--cm-border);
}

.cm-calc-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.cm-calc-content p {
  margin-bottom: 0.75rem;
  color: var(--cm-text);
}

.cm-calc-content ul, .cm-calc-content ol {
  margin-bottom: 0.75rem;
  padding-left: 1.25rem;
}

.cm-calc-content li { margin-bottom: 0.25rem; }

.cm-calc-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 1rem 0;
}
.cm-calc-content table th,
.cm-calc-content table td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--cm-border);
  text-align: left;
}
.cm-calc-content table th {
  background: var(--cm-neutral-100);
  font-weight: 600;
}


/* ===== Category Landing Page ===== */
.cm-cat-header {
  text-align: center;
  padding: 2rem 1rem;
}
.cm-cat-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.cm-cat-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}
.cm-cat-desc {
  color: var(--cm-text-secondary);
  font-size: 0.9rem;
  word-break: keep-all;
}
.cm-cat-count {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--cm-primary-50);
  color: var(--cm-primary-600);
  border-radius: 1rem;
}
html.dark .cm-cat-count { color: var(--cm-primary-400); }


/* ===== 404 ===== */
.cm-404 {
  text-align: center;
  padding: 4rem 1rem;
}
.cm-404-code {
  font-size: 4rem;
  font-weight: 800;
  color: var(--cm-primary-600);
}
html.dark .cm-404-code { color: var(--cm-primary-400); }
.cm-404-msg {
  font-size: 1.1rem;
  color: var(--cm-text-secondary);
  margin: 0.5rem 0 1.5rem;
}
.cm-404-btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: var(--cm-primary-600);
  color: #fff;
  border-radius: var(--cm-radius-sm);
  font-weight: 600;
  text-decoration: none;
}
.cm-404-btn:hover { background: var(--cm-primary-700); text-decoration: none; }


/* ===== About / Privacy ===== */
.cm-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}
.cm-page h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
}
.cm-page h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.5rem 0 0.5rem;
}
.cm-page p { margin-bottom: 0.75rem; }
.cm-page ul { padding-left: 1.25rem; margin-bottom: 0.75rem; }


/* =============================================== */
/* ===== Calculator Component CSS (from calc) ==== */
/* =============================================== */

/* Container */
.calc-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--cm-neutral-100);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
}

/* Section Divider */
.calc-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--cm-border);
}

/* Input Group */
.calc-input-group { margin-bottom: 1rem; }
.calc-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--cm-text);
  word-break: keep-all;
}
.calc-sublabel {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--cm-text-secondary);
  margin-left: 0.25rem;
}

/* Input & Select */
.calc-input,
.calc-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--cm-neutral-300);
  border-radius: var(--cm-radius-sm);
  background: var(--cm-card);
  color: var(--cm-text);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
html.dark .calc-input,
html.dark .calc-select {
  border-color: var(--cm-neutral-300);
}
.calc-input:focus,
.calc-select:focus {
  outline: none;
  border-color: var(--cm-primary-500);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
html.dark .calc-input:focus,
html.dark .calc-select:focus {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.calc-input::placeholder { color: var(--cm-neutral-400); }

/* Input with unit suffix */
.calc-input-wrap { position: relative; }
.calc-input-wrap .calc-input { padding-right: 2.75rem; }
.calc-input-unit {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--cm-text-secondary);
  pointer-events: none;
}

/* Grid Layouts */
.calc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.calc-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.75rem; }

@media (max-width: 480px) {
  .calc-grid-2, .calc-grid-3 { grid-template-columns: 1fr; }
  .calc-container { padding: 1rem; }
  .calc-big-number { font-size: 1.5rem; }
  .calc-compare-row { grid-template-columns: 1fr; }
  .calc-row { flex-direction: column; align-items: stretch; }
  .calc-row-remove { width: 44px; height: 44px; align-self: flex-end; }
  .calc-radio-group { flex-direction: column; }
  .calc-radio-group label { border-right: none; border-bottom: 1px solid var(--cm-neutral-300); }
  .calc-radio-group label:last-child { border-bottom: none; }
  .calc-toggle { padding: 0.5rem 1rem; }
  .calc-tab { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
  .calc-input-short { max-width: 100%; }
}

/* Primary Button */
.calc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.7rem 1.5rem;
  margin-top: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--cm-primary-600);
  border: none;
  border-radius: var(--cm-radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.calc-btn:hover { background: var(--cm-primary-700); }
.calc-btn:active { transform: scale(0.98); }

/* Secondary / Small Button */
.calc-btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; width: auto; margin-top: 0; }
.calc-btn-secondary {
  background: var(--cm-neutral-200);
  color: var(--cm-text);
}
.calc-btn-secondary:hover { background: var(--cm-neutral-300); }

/* Result Box */
.calc-result {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--cm-primary-50);
  border: 1px solid var(--cm-primary-200);
  border-radius: var(--cm-radius);
}

/* Big Number Display */
.calc-big-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--cm-primary-600);
  line-height: 1.2;
  margin-bottom: 0.25rem;
}
html.dark .calc-big-number { color: var(--cm-primary-400); }

.calc-result-label {
  font-size: 0.85rem;
  color: var(--cm-text-secondary);
  margin-bottom: 0.75rem;
  word-break: keep-all;
}

/* Sub Results Grid */
.calc-sub-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.calc-sub-item {
  text-align: center;
  padding: 0.75rem;
  background: var(--cm-neutral-100);
  border-radius: var(--cm-radius-sm);
}
.calc-sub-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cm-text);
}
.calc-sub-label {
  font-size: 0.75rem;
  color: var(--cm-text-secondary);
  margin-top: 0.15rem;
  word-break: keep-all;
}

/* Table */
.calc-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: var(--cm-radius-sm);
  border: 1px solid var(--cm-border);
}
.calc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.calc-table th {
  padding: 0.6rem 0.75rem;
  text-align: right;
  font-weight: 600;
  background: var(--cm-neutral-100);
  color: var(--cm-text);
  white-space: nowrap;
}
.calc-table td {
  padding: 0.5rem 0.75rem;
  text-align: right;
  color: var(--cm-text);
  border-top: 1px solid var(--cm-border);
}
.calc-table th:first-child,
.calc-table td:first-child { text-align: center; }

/* Toggle Detail Button */
.calc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: var(--cm-primary-600);
  background: none;
  border: 1px solid var(--cm-primary-300);
  border-radius: 0.375rem;
  cursor: pointer;
}
html.dark .calc-toggle { color: var(--cm-primary-400); border-color: var(--cm-primary-700); }

/* Tabs */
.calc-tabs {
  display: flex;
  border-bottom: 2px solid var(--cm-border);
  margin-bottom: 1.25rem;
}
.calc-tab {
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cm-text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.calc-tab:hover { color: var(--cm-text); }
.calc-tab-active {
  color: var(--cm-primary-600);
  border-bottom-color: var(--cm-primary-600);
}
html.dark .calc-tab-active { color: var(--cm-primary-400); border-bottom-color: var(--cm-primary-400); }

/* Radio Group */
.calc-radio-group {
  display: flex;
  gap: 0;
  border: 1px solid var(--cm-neutral-300);
  border-radius: var(--cm-radius-sm);
  overflow: hidden;
}
.calc-radio-group label {
  flex: 1;
  padding: 0.55rem 0.75rem;
  text-align: center;
  font-size: 0.85rem;
  cursor: pointer;
  background: var(--cm-card);
  color: var(--cm-text-secondary);
  border-right: 1px solid var(--cm-neutral-300);
  transition: background 0.15s, color 0.15s;
}
.calc-radio-group label:last-child { border-right: none; }
.calc-radio-group input[type="radio"] { display: none; }
.calc-radio-group input[type="radio"]:checked + label,
.calc-radio-group label.active {
  background: var(--cm-primary-600);
  color: #fff;
}

/* Dynamic Row Add/Remove */
.calc-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.calc-row .calc-input-group { flex: 1; margin-bottom: 0; }
.calc-row-remove {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.1rem;
  font-size: 1.1rem;
  color: var(--cm-neutral-400);
  background: none;
  border: 1px solid var(--cm-neutral-300);
  border-radius: 0.375rem;
  cursor: pointer;
}
.calc-row-remove:hover { color: var(--cm-danger); border-color: var(--cm-danger); }
.calc-row-add {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  color: var(--cm-primary-600);
  background: none;
  border: 1px dashed var(--cm-primary-400);
  border-radius: 0.375rem;
  cursor: pointer;
  margin-bottom: 0.5rem;
}
html.dark .calc-row-add { color: var(--cm-primary-400); border-color: var(--cm-primary-600); }

/* Error */
.calc-error {
  font-size: 0.75rem;
  color: var(--cm-danger);
  margin-top: 0.25rem;
  display: none;
}
.calc-input.error { border-color: var(--cm-danger); }
.calc-input.error:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }

/* Note / Info */
.calc-note {
  font-size: 0.8rem;
  color: var(--cm-text-secondary);
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--cm-neutral-100);
  border-radius: 0.375rem;
  line-height: 1.5;
  word-break: keep-all;
}

/* Positive / Negative colors */
.calc-positive { color: var(--cm-success); }
.calc-negative { color: var(--cm-danger); }

/* Utility */
.calc-input-short { max-width: 200px; }

/* Pulse Animation */
@keyframes calcPulse {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.calc-animate { animation: calcPulse 0.3s ease-out; }

/* Comparison highlight */
.calc-compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.calc-compare-item {
  padding: 0.75rem;
  border-radius: var(--cm-radius-sm);
  text-align: center;
}
.calc-compare-item.a { background: var(--cm-primary-50); }
.calc-compare-item.b { background: var(--cm-neutral-100); }
