/* ==========================================================================
   스마트 투자 계산기 KR v2 — Flat Fintech Design System (common.css)
   Restrained Toss / Naver Pay inspired UI · Desktop 2-column split workspace
   Pretendard Variable · word-break: keep-all · Zero emoji / Zero neon slop
   ========================================================================== */

:root,
:root[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1c2029;
  --card-bg: #171a21;
  --row-bg: #1c2029;
  --input-bg: #1e232e;
  --result-bg: #171a21;

  --border: #272d3b;
  --border-strong: #353d4f;
  --card-border: #272d3b;
  --card-border-strong: #353d4f;
  --result-border: #2c3445;

  --header-bg: rgba(15, 17, 21, 0.9);
  --nav-bg: rgba(15, 17, 21, 0.9);

  --text: #f2f4f6;
  --subtext: #8b95a1;
  --muted: #6b7684;

  --primary: #3182f6;
  --primary-hover: #2272eb;
  --primary-soft: rgba(49, 130, 246, 0.14);
  --primary-text: #5b9dff;
  --hero-accent: #f2f4f6;

  --accent: #00c471;
  --accent-soft: rgba(0, 196, 113, 0.13);
  --accent-text: #20d686;

  --warning: #f59f00;
  --warning-soft: rgba(245, 159, 0, 0.13);
  --warning-text: #fcc419;

  --danger: #f04452;
  --danger-soft: rgba(240, 68, 82, 0.14);
  --danger-text: #ff6b78;

  --kr-up: #f04452;
  --kr-down: #3182f6;

  --chip-bg: #1e232e;
  --chip-border: #2d3444;

  --seg-bg: #12151b;
  --seg-active-bg: #262c3a;
  --seg-active-text: #f2f4f6;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.26);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.36);
  --focus-ring: 0 0 0 3px rgba(49, 130, 246, 0.3);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --container-max: 1040px;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --card-bg: #ffffff;
  --row-bg: #f9fafb;
  --input-bg: #f9fafb;
  --result-bg: #ffffff;

  --border: #e5e8eb;
  --border-strong: #d1d6db;
  --card-border: #e5e8eb;
  --card-border-strong: #d1d6db;
  --result-border: #e5e8eb;

  --header-bg: rgba(255, 255, 255, 0.92);
  --nav-bg: rgba(255, 255, 255, 0.92);

  --text: #191f28;
  --subtext: #4e5968;
  --muted: #6b7684;

  --primary: #3182f6;
  --primary-hover: #1b64da;
  --primary-soft: #e8f3ff;
  --primary-text: #1b64da;
  --hero-accent: #191f28;

  --accent: #00a862;
  --accent-soft: #e7f9f0;
  --accent-text: #00824b;

  --warning: #d97706;
  --warning-soft: #fff7e6;
  --warning-text: #b45309;

  --danger: #e11d48;
  --danger-soft: #ffeff1;
  --danger-text: #c81e3a;

  --kr-up: #f04452;
  --kr-down: #3182f6;

  --chip-bg: #f2f4f6;
  --chip-border: #e5e8eb;

  --seg-bg: #eceff3;
  --seg-active-bg: #ffffff;
  --seg-active-text: #191f28;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.1);
  --focus-ring: 0 0 0 3px rgba(49, 130, 246, 0.22);

  color-scheme: light;
}

/* ---------- Base Reset & Typography ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  font-family: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  word-break: keep-all;
  overflow-wrap: break-word;
  transition: background-color 0.18s ease, color 0.18s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

/* Monochrome Inline SVG Icons & Market Badges */
.sc-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.sc-icon-sm {
  width: 14px;
  height: 14px;
}

.sc-icon-lg {
  width: 18px;
  height: 18px;
}

.sc-badge-svg,
.flag-icon {
  width: 18px;
  height: 13px;
  border-radius: 2px;
  display: inline-block;
  flex-shrink: 0;
}

.sc-badge-coin {
  width: 16px;
  height: 16px;
  display: inline-block;
  flex-shrink: 0;
}

/* Tabular numerals for zero-jitter financial numbers */
.num,
.input-field,
.input-box,
.fx-input,
.fee-custom-input,
.result-num,
.res-val,
.kpi-value,
table.data-table td,
table.comp-table td {
  font-variant-numeric: tabular-nums;
}

/* Accessibility Helpers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 200;
  background: var(--primary);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
  text-decoration: none;
}

/* ---------- Unified Slim Sticky Header (.site-header) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-link:hover {
  text-decoration: none;
  color: var(--primary-text);
}

.brand-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
}

.site-header .global-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.g-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--subtext);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.g-nav-link:hover {
  color: var(--text);
  background: var(--chip-bg);
  text-decoration: none;
}

.g-nav-link.active,
.g-nav-link[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 700;
}

.header-actions,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn,
.util-btn,
.bookmark-btn,
.lang-btn,
.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 34px;
  min-width: 34px;
  padding: 0 9px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--subtext);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.theme-btn,
.icon-btn-square {
  width: 34px;
  padding: 0;
}

.lang-btn {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.icon-btn:hover,
.util-btn:hover,
.bookmark-btn:hover,
.lang-btn:hover,
.theme-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--chip-bg);
  text-decoration: none;
}

/* Legacy topbar fallback (if any subpage hasn't migrated yet) */
.site-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.global-nav-wrap {
  margin-bottom: 16px;
}

.global-nav-wrap .global-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
  background: var(--seg-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}

/* ---------- Page Container & Split Workspace ---------- */
.page-shell,
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 22px 20px 64px;
  min-width: 0;
}

.page-shell-narrow {
  max-width: 760px;
}

.page-header {
  margin-bottom: 18px;
}

.page-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.48rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.3;
}

.page-header .page-subtitle,
.page-header p {
  font-size: 0.88rem;
  color: var(--subtext);
  margin-top: 4px;
  line-height: 1.5;
}

/* Desktop 2-Column Split Workspace (Inputs Left | Sticky Live Results Right) */
.calc-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 20px;
  align-items: start;
}

.calc-inputs {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.calc-results {
  min-width: 0;
  position: sticky;
  top: 76px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Segmented Controls (Tabs & Mode Switches) ---------- */
.tabs,
.main-tabs {
  display: flex;
  gap: 3px;
  background: var(--seg-bg);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 3px;
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--subtext);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tab-btn:hover:not(.active) {
  color: var(--text);
}

.tab-btn.active,
.tab-btn[aria-selected="true"] {
  background: var(--seg-active-bg);
  color: var(--seg-active-text);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

.sub-tabs {
  display: inline-flex;
  gap: 3px;
  background: var(--seg-bg);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
}

.sub-tab-btn {
  padding: 5px 11px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--subtext);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s ease;
}

.sub-tab-btn:hover:not(.active) {
  color: var(--text);
}

.sub-tab-btn.active {
  background: var(--seg-active-bg);
  color: var(--seg-active-text);
  font-weight: 700;
  box-shadow: var(--shadow-xs);
}

/* ---------- Asset / Market Selector Bar ---------- */
.asset-mode-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.asset-card-btn {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: var(--subtext);
  font-size: 0.83rem;
  font-weight: 600;
  white-space: nowrap;
  transition: 0.15s ease;
}

.asset-card-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.asset-card-btn.active,
.asset-card-btn[aria-pressed="true"] {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
}

/* ---------- Multi-Ticker Slot Bar ---------- */
.slot-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 6px;
}

.slide-arrow {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--subtext);
  width: 28px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: 0.15s ease;
}

.slide-arrow:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--chip-bg);
}

.slot-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 1px;
  scrollbar-width: none;
  flex: 1;
}

.slot-bar::-webkit-scrollbar {
  display: none;
}

.slot-chip {
  background: var(--chip-bg);
  border: 1px solid transparent;
  color: var(--subtext);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: 0.15s ease;
}

.slot-chip:hover {
  color: var(--text);
}

.slot-chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
}

.slot-chip .del-slot {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
}

.slot-chip .del-slot:hover {
  color: var(--danger);
}

.btn-fixed-add {
  background: var(--chip-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: 0.15s ease;
}

.btn-fixed-add:hover {
  border-color: var(--primary);
  color: var(--primary-text);
  background: var(--primary-soft);
}

/* ---------- Live FX Rate Bar (Flat, Zero Dashed Border) ---------- */
.fx-bar {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.82rem;
}

.fx-left,
.fx-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fx-label {
  color: var(--subtext);
  font-weight: 600;
}

.fx-input {
  width: 88px;
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 7px;
  text-align: right;
  font-size: 0.88rem;
  font-weight: 700;
}

.fx-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-fx-refresh {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--subtext);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: 0.15s ease;
}

.btn-fx-refresh:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary-text);
  background: var(--primary-soft);
}

.btn-fx-refresh:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ---------- Flat Cards & Section Headers ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.calc-inputs > .card,
.calc-results > .card,
.calc-results > .result-card {
  margin-bottom: 0;
}

.card + .card {
  margin-top: 14px;
}

.calc-inputs > .card + .card,
.calc-results > .card + .card {
  margin-top: 0;
}

.card-head,
.slim-card-head,
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.title-inline-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.section-title,
.card-title-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inline-edit-input {
  background: var(--input-bg);
  border: 1px solid var(--primary);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 0.92rem;
  font-weight: 700;
  width: 148px;
}

.btn-mini-rename {
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--subtext);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: 0.15s ease;
}

.btn-mini-rename:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* Flat Minimal Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.73rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.badge-primary {
  background: var(--primary-soft);
  color: var(--primary-text);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.badge-muted {
  background: var(--chip-bg);
  color: var(--subtext);
}

/* ---------- Grids & Form Controls ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.form-group,
.input-group {
  margin-bottom: 12px;
  min-width: 0;
}

.grid-2 > .form-group,
.grid-2 > .input-group,
.grid-3 > .form-group,
.grid-3 > .input-group,
.grid-4 > .form-group,
.grid-4 > .input-group {
  margin-bottom: 0;
}

.input-group label,
.form-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--subtext);
  margin-bottom: 6px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix,
.input-suffix {
  position: absolute;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  pointer-events: none;
  user-select: none;
}

.input-prefix {
  left: 12px;
}

.input-suffix {
  right: 12px;
}

.input-field,
.input-box,
.select-field {
  width: 100%;
  min-height: 44px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 1rem;
  font-weight: 700;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.input-field,
.input-box {
  text-align: right;
}

.input-box.text-left,
.input-field.text-left {
  text-align: left;
}

.input-wrap.has-prefix .input-field,
.input-wrap.has-prefix .input-box {
  padding-left: 30px;
}

.input-wrap.has-suffix .input-field,
.input-wrap.has-suffix .input-box {
  padding-right: 36px;
}

.input-field::placeholder,
.input-box::placeholder {
  color: var(--muted);
  font-weight: 500;
}

.input-field:hover,
.input-box:hover,
.select-field:hover {
  border-color: var(--border-strong);
}

.input-field:focus,
.input-box:focus,
.select-field:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--focus-ring);
}

.kor-unit-sub {
  font-size: 0.75rem;
  color: var(--subtext);
  text-align: right;
  margin-top: 4px;
  font-weight: 600;
  min-height: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-hint {
  font-size: 0.76rem;
  color: var(--subtext);
  margin-top: 4px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"],
.checkbox-label input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ---------- Dynamic Step Rows (Clean Divider Style, No Nested-Box Clutter) ---------- */
.row-list {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
  border-top: 1px solid var(--border);
}

.slim-row {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slim-row-main {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1.15fr) 28px;
  gap: 8px;
  align-items: center;
}

.row-num-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--subtext);
  background: var(--chip-bg);
  padding: 8px 0;
  border-radius: 7px;
  text-align: center;
  white-space: nowrap;
}

.qty-wrap {
  display: flex;
  gap: 4px;
  align-items: center;
}

.btn-quick {
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--subtext);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: 0.15s ease;
}

.btn-quick:hover {
  border-color: var(--primary);
  color: var(--primary-text);
  background: var(--primary-soft);
}

.pct-chips-bar {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.pct-chip {
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--subtext);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: 0.15s ease;
}

.pct-chip:hover {
  border-color: var(--primary);
  color: var(--primary-text);
  background: var(--primary-soft);
}

.pct-chip.highlight {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary-text);
  font-weight: 700;
}

.pct-chip.highlight:hover {
  background: var(--primary);
  color: #ffffff;
}

.slim-row-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.76rem;
  padding-left: 52px;
}

.slim-row-sub-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sub-hint-text {
  color: var(--subtext);
  white-space: nowrap;
}

.sub-sum-text {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.del-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: 0.15s ease;
}

.del-btn:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* ---------- Quick Chips & Presets (Zero Orphan Full-Width Stretch) ---------- */
.quick-bar,
.fee-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.q-chip,
.curr-btn,
.unit-btn,
.preset-chip {
  flex: 0 0 auto;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--subtext);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: 0.15s ease;
}

.q-chip {
  padding: 6px 11px;
  font-size: 0.78rem;
}

.curr-btn {
  min-width: 84px;
  padding: 7px 12px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.unit-btn {
  min-width: 60px;
  padding: 6px 12px;
  font-size: 0.78rem;
}

.preset-chip {
  padding: 5px 10px;
  font-size: 0.76rem;
  border-radius: 7px;
}

.q-chip:hover,
.curr-btn:hover,
.unit-btn:hover,
.preset-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.q-chip.active,
.curr-btn.active,
.unit-btn.active,
.preset-chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-text);
  font-weight: 700;
}

.fee-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.fee-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.fee-top label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.fee-top input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.fee-custom-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.fee-custom-input {
  width: 68px;
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 5px 7px;
  border-radius: 7px;
  text-align: right;
  font-size: 0.84rem;
  font-weight: 700;
}

.fee-custom-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- Flat Action Buttons ---------- */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.btn,
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: 0.15s ease;
}

.action-btn {
  flex: 1;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  text-decoration: none;
}

.btn-secondary {
  background: var(--chip-bg);
  border-color: var(--chip-border);
  color: var(--text);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--subtext);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary-text);
  text-decoration: none;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger-text);
}

.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

/* Solid clean secondary add button (NO dashed border!) */
.btn-add {
  background: var(--chip-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.btn-add:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
}

.btn-reset {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--subtext);
  flex: 0 0 auto;
  min-width: 78px;
}

.btn-reset:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--chip-bg);
}

.btn-sync-data,
.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--primary-soft);
  border: 1px solid transparent;
  color: var(--primary-text);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s ease;
}

.btn-sync-data:hover,
.btn-copy:hover {
  background: var(--primary);
  color: #ffffff;
}

.btn-image-save {
  width: 100%;
  min-height: 40px;
  background: var(--chip-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: 0.15s ease;
}

.btn-image-save:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
}

/* ---------- Result Boards, KPIs & Permanent Action Bar ---------- */
.result-card {
  background: var(--result-bg);
  border: 1px solid var(--result-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.result-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-box {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.result-box.full {
  grid-column: span 2;
}

.result-box.border-top {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 2px;
}

.result-lbl {
  font-size: 0.78rem;
  color: var(--subtext);
  font-weight: 600;
  margin-bottom: 4px;
}

.result-num {
  font-size: 1.06rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.result-num.hero {
  font-size: 1.62rem;
  font-weight: 800;
  color: var(--hero-accent);
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.result-num.green,
.result-num.profit,
.res-val.profit {
  color: var(--accent-text);
}

.result-num.yellow,
.result-num.warn,
.res-val.warn {
  color: var(--warning-text);
}

.result-num.red,
.result-num.loss,
.res-val.loss {
  color: var(--danger-text);
}

.result-num.blue {
  color: var(--primary-text);
}

.res-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.res-row > div {
  min-width: 0;
}

.res-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.res-row:first-child {
  padding-top: 0;
}

.res-label {
  font-size: 0.84rem;
  color: var(--subtext);
  font-weight: 500;
  flex-shrink: 0;
}

.res-val {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}

.res-val.highlight {
  font-size: 1.44rem;
  font-weight: 800;
  color: var(--hero-accent);
  letter-spacing: -0.03em;
}

.sub-krw {
  display: block;
  font-size: 0.76rem;
  color: var(--subtext);
  font-weight: 600;
  margin-top: 3px;
  white-space: normal;
  word-break: keep-all;
  line-height: 1.4;
}

/* Compact KPI Tiles */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.kpi-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}

.kpi-label {
  font-size: 0.74rem;
  color: var(--subtext);
  font-weight: 600;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.kpi-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Always-Visible Result Action Bar */
.result-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.calc-results .result-actions:has(> :nth-child(4)) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.result-actions > button,
.result-actions > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: 0.15s ease;
}

.result-actions > button:hover,
.result-actions > a:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
  text-decoration: none;
}

.result-actions > .btn-act-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 700;
}

.result-actions > .btn-act-primary:hover {
  background: var(--primary-hover);
  color: #ffffff;
}

.result-actions > .btn-act-reset {
  background: transparent;
  color: var(--subtext);
}

/* Status Toggle Pill */
.status-toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--chip-bg);
  color: var(--subtext);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: 0.15s ease;
}

.status-toggle-chip.on {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-text);
  font-weight: 700;
}

.status-toggle-chip:hover {
  border-color: var(--primary);
  color: var(--text);
}

/* Receipt-Style Fee & Tax Breakdown */
.receipt-list {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--subtext);
}

.receipt-row strong,
.receipt-row .num {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.receipt-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2px 0;
}

.receipt-row.receipt-total {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

/* Callouts & Summary Banners (Clean Flat Tints) */
.callout {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.5;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.callout-info {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary-text);
}

.callout-success {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-text);
}

.callout-warning {
  background: var(--warning-soft);
  border-color: transparent;
  color: var(--warning-text);
}

.callout-danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger-text);
}

.dopamine-box,
.reward-box {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dopamine-box {
  justify-content: center;
  text-align: center;
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-text);
}

.reward-text {
  color: var(--text);
  font-weight: 600;
  font-size: 0.83rem;
  line-height: 1.45;
}

/* Inline SVG Chart & Comparison Bars */
.chart-box {
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--subtext);
}

.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.74rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.compare-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.compare-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--chip-bg);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.22s ease;
}

.progress-fill.accent {
  background: var(--accent);
}

.progress-fill.danger {
  background: var(--danger);
}

/* ---------- Collapsible Pro Drawer (Solid Clean Hairline) ---------- */
.pro-drawer-wrap {
  margin-top: 12px;
}

.pro-toggle-btn,
.btn-pro-toggle {
  width: 100%;
  min-height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--subtext);
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: 0.15s ease;
}

.pro-toggle-btn:hover,
.btn-pro-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.pro-toggle-btn.open,
.btn-pro-toggle.open {
  border-color: var(--border-strong);
  color: var(--text);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.pro-drawer-body {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-top: none;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  padding: 14px;
  flex-direction: column;
  gap: 12px;
}

.pro-drawer-body.open {
  display: flex;
}

.pro-section {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.pro-section:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.pro-sec-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

/* ---------- Data Tables ---------- */
.table-wrap {
  margin-top: 12px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}

.table-wrap.no-max-height {
  max-height: none;
}

table.data-table,
table.comp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

table.data-table th,
table.comp-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  color: var(--subtext);
  padding: 10px 10px;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

table.data-table th:first-child,
table.data-table td:first-child,
table.comp-table th:first-child,
table.comp-table td:first-child {
  text-align: center;
}

table.data-table td,
table.comp-table td {
  padding: 9px 10px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

table.data-table tbody tr:last-child td,
table.comp-table tbody tr:last-child td {
  border-bottom: none;
}

table.data-table tbody tr:hover,
table.comp-table tbody tr:hover {
  background: var(--primary-soft);
}

table.data-table tr.row-highlight,
table.comp-table tr.row-highlight {
  background: var(--primary-soft);
}

.pos {
  color: var(--accent-text);
  font-weight: 700;
}

.neg {
  color: var(--danger-text);
  font-weight: 700;
}

.kr-up {
  color: var(--kr-up);
  font-weight: 700;
}

.kr-down {
  color: var(--kr-down);
  font-weight: 700;
}

/* ---------- Cross-Calculator Handoff Bar (.handoff-bar) ---------- */
.handoff-bar {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.handoff-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.handoff-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.handoff-links-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.handoff-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.81rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  word-break: keep-all;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.handoff-link:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text);
  text-decoration: none;
}

.handoff-link-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  line-height: 1.35;
}

.handoff-link-sub {
  font-size: 0.73rem;
  color: var(--subtext);
  font-weight: 500;
}

.handoff-arrow {
  color: var(--primary-text);
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.handoff-link:hover .handoff-arrow {
  transform: translateX(2px);
}

/* ---------- Editorial Lower Sections (Insight Feed / Reference / FAQ / Related) ---------- */
.editorial-wrap {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.guide-section,
.insight-section,
.faq-section,
.related-section {
  background: transparent;
  border: none;
  padding: 0;
  margin-top: 28px;
}

.editorial-wrap .guide-section,
.editorial-wrap .insight-section,
.editorial-wrap .faq-section,
.editorial-wrap .related-section {
  margin-top: 0;
}

.guide-section + .faq-section,
.insight-section + .faq-section,
.faq-section + .related-section,
.guide-section + .related-section,
.insight-section + .related-section {
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.editorial-wrap > section + section {
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.guide-section h2,
.insight-section h2,
.faq-section h2,
.related-section h2 {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}

.section-intro {
  font-size: 0.86rem;
  color: var(--subtext);
  margin-top: -6px;
  margin-bottom: 16px;
  line-height: 1.55;
}

/* Toss-Feed Style Practical Investment Notes (.insight-grid) */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

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

.insight-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 18px 16px;
  min-width: 0;
  word-break: keep-all;
}

.insight-kicker {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--primary-text);
  letter-spacing: -0.01em;
}

.insight-kicker.accent {
  color: var(--accent-text);
}

.insight-kicker.warn {
  color: var(--warning-text);
}

.insight-kicker.danger {
  color: var(--danger-text);
}

.insight-kicker.muted {
  color: var(--subtext);
}

.insight-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.42;
  letter-spacing: -0.025em;
  margin: 0;
}

.guide-section h3.insight-title,
.insight-section h3.insight-title {
  font-size: 0.98rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.42;
}

.insight-body {
  font-size: 0.84rem;
  color: var(--subtext);
  line-height: 1.62;
  flex: 1;
}

.insight-body strong {
  color: var(--text);
  font-weight: 700;
}

.insight-stat {
  margin-top: 4px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.insight-stat.primary {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary-text);
}

.insight-stat.accent {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-text);
}

.insight-stat.danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger-text);
}

.insight-stat.warn {
  background: var(--warning-soft);
  border-color: transparent;
  color: var(--warning-text);
}

.guide-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 18px 0 8px;
}

.guide-section p,
.guide-section li {
  font-size: 0.88rem;
  color: var(--subtext);
  line-height: 1.7;
}

.guide-section p + p {
  margin-top: 8px;
}

.guide-list {
  margin: 8px 0;
  padding-left: 18px;
}

.guide-list li + li {
  margin-top: 6px;
}

.guide-list strong {
  color: var(--text);
}

.formula-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 0.86rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.6;
  overflow-x: auto;
}

/* Editorial FAQ (Clean Divider List) */
.faq-list {
  display: flex;
  flex-direction: column;
}

.faq-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.faq-item:first-child {
  padding-top: 2px;
}

.faq-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.faq-item h3,
.faq-q {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.45;
}

.faq-item p,
.faq-a {
  font-size: 0.86rem;
  color: var(--subtext);
  line-height: 1.65;
}

/* Related Calculators Grid */
.related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.related-card:hover {
  border-color: var(--primary);
  background: var(--surface-2);
  text-decoration: none;
}

.related-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.related-card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.related-card-arrow {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  transition: transform 0.15s ease, color 0.15s ease;
}

.related-card:hover .related-card-arrow {
  color: var(--primary-text);
  transform: translateX(2px);
}

.related-card-desc {
  font-size: 0.8rem;
  color: var(--subtext);
  line-height: 1.5;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.footer-links a,
.footer-links button {
  background: none;
  border: none;
  padding: 2px 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--subtext);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.footer-links a:hover,
.footer-links button:hover {
  color: var(--text);
  text-decoration: underline;
}

.footer-links .footer-en-link {
  color: var(--primary-text);
}

.footer-note {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #191f28;
  color: #f9fafb;
  border: 1px solid #333d4b;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 0.84rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  text-align: center;
  line-height: 1.45;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-success {
  border-color: var(--accent);
}

.toast.toast-warning {
  border-color: var(--warning);
}

.toast.toast-error {
  border-color: var(--danger);
}

/* ---------- 404 Error Page Layout ---------- */
.error-hero {
  text-align: center;
  padding: 36px 20px;
}

.error-code {
  display: inline-block;
  font-size: 3.2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--primary);
  margin-bottom: 12px;
}

.error-title {
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.error-desc {
  font-size: 0.9rem;
  color: var(--subtext);
  max-width: 460px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Small Utility Classes ---------- */
.hidden {
  display: none !important;
}

.muted {
  color: var(--subtext);
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 12px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 12px; }

/* ---------- Responsive Tablet / Mobile (< 900px) ---------- */
@media (max-width: 899px) {
  .site-header-inner {
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 8px;
    min-height: auto;
  }

  .site-header .global-nav {
    order: 3;
    flex: 1 0 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
  }

  .g-nav-link {
    min-width: 0;
    min-height: 34px;
    padding: 6px 4px;
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .page-shell,
  .container {
    padding: 16px 14px 52px;
  }

  .calc-workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .calc-results {
    position: static;
  }

  .insight-grid,
  .insight-grid-2 {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}

@media (max-width: 599px) {
  .global-nav-wrap .global-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-shell,
  .container {
    padding: 14px 12px 48px;
  }

  .card,
  .result-card {
    padding: 16px 14px;
    border-radius: 14px;
  }

  .page-header h1 {
    font-size: 1.26rem;
  }

  .page-header .page-subtitle,
  .page-header p {
    font-size: 0.8rem;
  }

  /* Prevent iOS Safari zoom on input focus */
  .input-field,
  .input-box,
  .select-field,
  .fx-input,
  .fee-custom-input,
  .inline-edit-input {
    font-size: 16px;
  }

  .fx-input {
    width: 96px;
  }

  .fee-custom-input {
    width: 76px;
  }

  .tab-btn {
    font-size: 0.8rem;
    padding: 8px 6px;
  }

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

  .grid-3 > .input-group:first-child,
  .grid-3 > .form-group:first-child {
    grid-column: span 2;
  }

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

  .kpi-grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .handoff-links-row {
    grid-template-columns: 1fr;
  }

  .insight-card {
    padding: 16px 15px 14px;
  }

  .bookmark-btn .btn-label {
    display: none;
  }

  .slim-row-main {
    grid-template-columns: 38px minmax(0, 1fr) minmax(0, 1.15fr) 26px;
    gap: 6px;
  }

  .slim-row-sub {
    padding-left: 0;
  }

  .res-row {
    flex-wrap: wrap;
    gap: 4px 10px;
  }

  .res-row > div,
  .res-row > .res-val {
    margin-left: auto;
    max-width: 100%;
  }

  .res-label {
    flex-shrink: 1;
  }

  .res-val {
    white-space: normal;
    word-break: keep-all;
  }

  .result-num.hero {
    font-size: 1.42rem;
  }
}

@media (max-width: 380px) {
  .brand-link span {
    font-size: 0.88rem;
  }

  .tab-btn {
    font-size: 0.76rem;
    padding: 8px 4px;
  }

  .result-num.hero {
    font-size: 1.32rem;
  }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ---------- Print / Share Friendliness ---------- */
@media print {
  :root,
  :root[data-theme="dark"],
  :root[data-theme="light"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --card-bg: #ffffff;
    --row-bg: #f9fafb;
    --input-bg: #ffffff;
    --result-bg: #ffffff;
    --border: #d1d6db;
    --border-strong: #94a3b8;
    --card-border: #d1d6db;
    --result-border: #94a3b8;
    --text: #191f28;
    --subtext: #4e5968;
    --muted: #6b7684;
  }

  body {
    background: #ffffff;
  }

  .site-header,
  .site-topbar,
  .global-nav-wrap,
  .btn-row,
  .quick-bar,
  .handoff-bar,
  .result-actions,
  .pro-toggle-btn,
  .btn-pro-toggle,
  .related-section,
  .toast-container,
  .skip-link {
    display: none !important;
  }

  .calc-workspace {
    grid-template-columns: 1fr;
  }

  .calc-results {
    position: static;
  }

  .card,
  .result-card {
    break-inside: avoid;
  }

  .table-wrap {
    max-height: none;
    overflow: visible;
  }
}
