:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --surface-hover: #eef4fb;
  --border: #d7e0ea;
  --border-strong: #b6c6d8;
  --text: #162231;
  --text-muted: #435469;
  --header-bg: #103b66;
  --header-text: #ffffff;
  --accent: #1d5fa7;
  --accent-hover: #154a84;
  --accent-soft: #e7f0fa;
  --success: #136f45;
  --success-soft: #e7f6ee;
  --warn-bg: #fff8e6;
  --warn-border: #edd38b;
  --shadow: 0 2px 8px rgba(16, 40, 70, 0.06);
  --radius: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0e141b;
  --surface: #161f29;
  --surface-alt: #1c2733;
  --surface-hover: #213142;
  --border: #2a394a;
  --border-strong: #3d5168;
  --text: #e8eef5;
  --text-muted: #a9bacd;
  --header-bg: #0b2642;
  --header-text: #f3f7fb;
  --accent: #63a8f5;
  --accent-hover: #7fb9f8;
  --accent-soft: #1b324b;
  --success: #34c77b;
  --success-soft: #143324;
  --warn-bg: #2a2414;
  --warn-border: #635123;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ================= HEADER ================= */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--header-text);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
  opacity: 0.94;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-size: 17px;
  letter-spacing: -0.01em;
}

.brand-text small {
  font-size: 11px;
  opacity: 0.8;
}

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

.top-nav a {
  color: rgba(255, 255, 255, 0.9);
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s ease;
}

.top-nav a:hover {
  background: rgba(255, 255, 255, 0.14);
  text-decoration: none;
  color: #fff;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.precision-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.88);
}

.precision-control select {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 5px;
  padding: 4px 6px;
  font-size: 12.5px;
  cursor: pointer;
}

.precision-control select option {
  color: #111;
  background: #fff;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  width: 34px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* ================= PAGE LAYOUT ================= */
.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 20px;
  padding-top: 20px;
  padding-bottom: 36px;
  align-items: start;
}

.main-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 76px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

/* ================= EXPRESS CONVERTER ================= */
.express-card {
  padding: 0;
  overflow: hidden;
}

.express-top {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px 0;
}

.express-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.express-title-row h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.compact-select {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  max-width: 250px;
  cursor: pointer;
}

.express-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.express-tab {
  appearance: none;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}

.express-tab:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.express-tab.active {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border);
  position: relative;
}

.express-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--surface);
}

.converter-header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 10px;
}

.converter-header-bar h2 {
  margin: 0 0 2px;
  font-size: 20px;
  font-weight: 700;
}

.muted-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.category-badge {
  font-size: 11.5px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.info-banner {
  margin: 0 18px 12px;
  padding: 10px 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 6px;
  font-size: 13px;
}

.rate-editor {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rate-editor input {
  width: 110px;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
}

/* ================= DUAL CONVERTER PANES ================= */
.dual-converter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr);
  gap: 10px;
  padding: 4px 18px 14px;
  align-items: stretch;
}

.pane {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.pane-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pane-label {
  font-weight: 700;
  font-size: 14px;
}

.unit-pill {
  font-size: 12px;
  font-family: var(--font-mono);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
  color: var(--text-muted);
}

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

.value-input {
  width: 100%;
  padding: 10px 54px 10px 12px;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.value-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.result-input {
  background: var(--surface-alt);
}

.field-action-btn {
  position: absolute;
  right: 7px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.field-action-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.unit-filter-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-alt);
  color: var(--text);
}

.unit-filter-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.unit-listbox {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  padding: 3px;
  height: 218px;
  cursor: pointer;
}

.unit-listbox option {
  padding: 5px 8px;
  border-radius: 4px;
}

.unit-listbox option:checked {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.swap-column {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 28px;
}

.swap-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.swap-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: scale(1.06);
}

/* ================= RESULT & FORMULA BANNER ================= */
.result-banner {
  margin: 0 18px;
  padding: 12px 14px;
  background: var(--success-soft);
  border: 1px solid rgba(22, 121, 76, 0.25);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.result-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.result-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.result-equation {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 100%;
}

.formula-bar {
  margin: 8px 18px 16px;
  padding: 7px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.btn-small {
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.btn-small:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
}

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

.btn-small.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-small.pinned {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 4px;
  text-decoration: underline;
}

.link-btn.is-empty {
  color: var(--text-muted);
  opacity: 0.55;
  text-decoration: none;
}

/* ================= ALL UNITS PANEL ================= */
.all-units-panel {
  margin: 0 18px 18px;
  padding: 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.subpanel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.subpanel-header h3 {
  margin: 0;
  font-size: 14.5px;
}

.all-units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}

.all-unit-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 7px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease;
}

.all-unit-item:hover {
  border-color: var(--accent);
  background: var(--surface-hover);
}

.all-unit-item .u-val {
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  word-break: break-all;
}

.all-unit-item .u-name {
  font-size: 12px;
  color: var(--text-muted);
}

/* ================= CASE CONVERTER ================= */
#caseConverterArea {
  padding: 0 18px 18px;
}

.case-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.case-buttons button {
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 5px;
  cursor: pointer;
}

.case-buttons button:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.case-textarea {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.5px;
  resize: vertical;
}

.case-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

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

.case-stats {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ================= REFERENCE TABLE, POPULAR, DIRECTORY ================= */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.section-header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.muted-small {
  font-size: 12.5px;
  color: var(--text-muted);
}

.ref-table-wrap {
  overflow-x: auto;
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.ref-table th,
.ref-table td {
  padding: 7px 10px;
  border: 1px solid var(--border);
  text-align: left;
}

.ref-table th {
  background: var(--surface-alt);
  font-weight: 700;
}

.ref-table tr:nth-child(even) td {
  background: var(--surface-alt);
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 8px;
}

.popular-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s ease, border-color 0.12s ease;
}

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

.popular-link::after {
  content: "→";
  font-size: 12px;
  color: var(--text-muted);
}

.directory-header {
  flex-wrap: wrap;
}

.directory-filter {
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 13.5px;
  width: 220px;
}

.directory-sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.dir-group {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}

.dir-group h3 {
  margin: 0 0 8px;
  font-size: 14.5px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

.dir-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dir-group a {
  display: block;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 13.5px;
  color: var(--text);
}

.dir-group a:hover,
.dir-group a.active-cat {
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

/* ================= SIDEBAR ================= */
.sidebar-card h2 {
  margin: 0 0 8px;
  font-size: 15.5px;
  font-weight: 700;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.sidebar-head h2 {
  margin: 0;
}

.search-card p {
  margin: 0 0 8px;
}

.search-box-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 9px 11px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  z-index: 40;
  max-height: 320px;
  overflow-y: auto;
}

.search-item {
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover,
.search-item.active {
  background: var(--accent-soft);
}

.search-item strong {
  font-size: 13.5px;
  color: var(--accent);
}

.search-item span {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-link-list,
.sidebar-category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sidebar-link-list li a,
.sidebar-category-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 7px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-alt);
  border: 1px solid transparent;
}

.sidebar-link-list li a:hover,
.sidebar-category-list li a:hover,
.sidebar-category-list li a.active-cat {
  background: var(--accent-soft);
  border-color: var(--border);
  color: var(--accent);
  text-decoration: none;
}

.empty-note {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ================= FOOTER & TOAST ================= */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--accent);
}

/* ================= FUTURE ADSENSE SLOTS ================= */
.ad-slot {
  width: 100%;
  margin: 4px 0;
  text-align: center;
  overflow: hidden;
}

.ad-slot-leaderboard {
  min-height: 90px;
}

.ad-slot-sidebar {
  min-height: 250px;
}

.ad-slot-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
}

/* ================= PDF EXPORT MODAL & PRINT SHEET ================= */
.pdf-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pdf-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 35, 0.65);
}

.pdf-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 860px;
  max-height: 92vh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pdf-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.pdf-modal-toolbar > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pdf-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pdf-note-input {
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  width: 210px;
}

.pdf-sheet-scroll {
  overflow-y: auto;
  padding: 20px;
  background: #e9edf2;
}

[data-theme="dark"] .pdf-sheet-scroll {
  background: #0b1016;
}

.print-report {
  background: #ffffff;
  color: #14202e;
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 26px;
  border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  font-family: var(--font-sans);
  line-height: 1.4;
}

.print-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #103b66 0%, #1d5fa7 100%);
  color: #ffffff;
  border-bottom: 4px solid #4ba3ff;
  border-radius: 6px 6px 2px 2px;
  padding: 12px 16px;
  margin-bottom: 12px;
  gap: 12px;
  break-inside: avoid;
}

.print-brand-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
}

.print-logo {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: block;
}

.print-header h1 {
  margin: 0;
  font-size: 18.5px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.print-subtitle {
  font-size: 11.5px;
  color: #cde3ff;
  font-weight: 500;
}

.print-meta {
  text-align: right;
  font-size: 11px;
  color: #dcebff;
  line-height: 1.35;
}

.print-meta strong {
  display: block;
  color: #ffffff;
  font-size: 12px;
}

.print-note-box {
  background: #f0f6fc;
  border-left: 4px solid #1d5fa7;
  padding: 7px 11px;
  margin-bottom: 10px;
  font-size: 12.5px;
  border-radius: 0 4px 4px 0;
  break-inside: avoid;
}

.print-summary-box {
  background: #eaf6ef;
  border: 1px solid #9bd4b4;
  border-left: 4px solid #136f45;
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  break-inside: avoid;
}

.print-summary-main {
  font-size: 16.5px;
  font-weight: 700;
  color: #0e2c1d;
  font-variant-numeric: tabular-nums;
}

.print-summary-formula {
  margin-top: 4px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: #2f4b3c;
}

.print-section-title {
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: #103b66;
  border-bottom: 1.5px solid #c5d6e8;
  padding-bottom: 3px;
  break-after: avoid;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
  break-inside: avoid;
}

.print-table th,
.print-table td {
  border: 1px solid #d5e0ec;
  padding: 4px 7px;
  text-align: left;
}

.print-table th {
  background: #e9f1fa;
  color: #103b66;
  font-weight: 700;
}

.print-table tr:nth-child(even) td {
  background: #f8fafd;
}

.print-case-box {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid #d7e0ea;
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
  word-break: break-word;
}

.print-footer {
  margin-top: 12px;
  padding-top: 6px;
  border-top: 1px solid #d7e0ea;
  font-size: 10.5px;
  color: #4a5d73;
  display: flex;
  justify-content: space-between;
  break-inside: avoid;
}

@page {
  size: A4 portrait;
  margin: 10mm 12mm;
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html,
  body {
    background: #ffffff !important;
    color: #14202e !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body > *:not(#pdfModal) {
    display: none !important;
  }

  .no-print,
  .pdf-modal-backdrop,
  .site-header,
  .top-nav,
  .sidebar,
  .site-footer,
  .ad-slot,
  .cookie-banner,
  .toast {
    display: none !important;
  }

  #pdfModal {
    position: static !important;
    inset: auto !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    background: transparent !important;
  }

  .pdf-modal-dialog,
  .pdf-sheet-scroll,
  .print-report {
    position: static !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
  }
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--header-bg);
  color: #fff;
  padding: 9px 15px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  z-index: 100;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 960px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .top-nav {
    display: none;
  }
}

@media (max-width: 680px) {
  .header-inner {
    gap: 8px;
  }

  .brand {
    gap: 8px;
  }

  .brand-icon {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .brand-text strong {
    font-size: 15px;
  }

  .brand-text small {
    font-size: 10.5px;
  }

  .precision-control span {
    display: none;
  }

  .dual-converter-grid {
    grid-template-columns: 1fr;
  }

  .swap-column {
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .swap-btn {
    transform: rotate(90deg);
  }

  .swap-btn:hover {
    transform: rotate(90deg) scale(1.06);
  }

  .unit-listbox {
    height: 170px;
  }

  .express-title-row {
    flex-direction: column;
    align-items: stretch;
  }

  .compact-select {
    max-width: 100%;
    width: 100%;
  }

  .express-top {
    padding: 12px 12px 0;
  }

  .converter-header-bar {
    flex-wrap: wrap;
    padding: 12px 12px 8px;
  }

  .dual-converter-grid {
    padding: 4px 12px 12px;
  }

  .info-banner,
  .result-banner,
  .all-units-panel {
    margin-left: 12px;
    margin-right: 12px;
  }

  .formula-bar {
    margin: 8px 12px 14px;
  }

  #caseConverterArea {
    padding: 0 12px 14px;
  }

  .case-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .all-units-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
  }
}

/* ================= SEO LANDING PAGES & GUIDES ================= */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--accent);
  font-weight: 500;
}

.seo-hero-intro {
  margin-bottom: 4px;
}

.seo-hero-intro h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.25;
}

.seo-hero-intro p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

.seo-article h2 {
  margin: 22px 0 8px;
  font-size: 18.5px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

.seo-article h2:first-child {
  margin-top: 0;
}

.seo-article h3 {
  margin: 16px 0 6px;
  font-size: 15.5px;
  color: var(--accent);
}

.seo-article p {
  margin: 0 0 11px;
}

.seo-article ul,
.seo-article ol {
  margin: 0 0 12px;
  padding-left: 20px;
}

.seo-article li {
  margin-bottom: 5px;
}

.formula-callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  padding: 10px 14px;
  margin: 10px 0 14px;
  font-family: var(--font-mono);
  font-size: 13.5px;
}

.cta-box {
  background: var(--success-soft);
  border: 1px solid rgba(22, 121, 76, 0.28);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cta-box strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
}

.cta-box p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.jump-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  padding: 9px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 10px;
}

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

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

.faq-item h3 {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--text);
}

.faq-item p {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.related-tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.answer-summary-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 5px;
  font-size: 14px;
  color: var(--text);
}

.reverse-link-bar {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13.5px;
}

.reverse-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  font-weight: 600;
  color: var(--accent);
}

.reverse-pill:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

/* ================= COOKIE CONSENT BANNER ================= */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 150;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.cookie-banner-inner {
  pointer-events: auto;
  max-width: 980px;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(10, 25, 45, 0.22);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.cookie-banner-text {
  font-size: 13px;
  flex: 1 1 320px;
}

.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ================= CONTACT FORM & 404 ================= */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-row label {
  font-weight: 600;
  font-size: 13.5px;
}

.form-control {
  padding: 9px 11px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14.5px;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-feedback {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
}

.form-feedback.ok {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(19, 111, 69, 0.3);
}

.form-feedback.err {
  background: #fdecec;
  color: #a61b1b;
  border: 1px solid #f5bcbc;
}

[data-theme="dark"] .form-feedback.err {
  background: #3a1818;
  color: #ff9c9c;
  border-color: #6b2b2b;
}

.error-404-card {
  text-align: center;
  padding: 34px 22px;
}

.error-404-code {
  font-size: 56px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

/* ================= HOMEPAGE SEARCH, 2-COL COMMON & SITEMAP ================= */
.home-search-card h2 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
}

.home-search-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.home-search-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.home-search-pill:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  text-decoration: none;
}

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

@media (max-width: 600px) {
  .popular-grid-2col {
    grid-template-columns: 1fr;
  }
}

.seo-dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(225px, 1fr));
  gap: 14px;
}

.seo-dir-group {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
}

.seo-dir-group h3 {
  margin: 0 0 8px;
  font-size: 14.5px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

.seo-dir-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.seo-dir-group li a {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
}

.seo-dir-group li a:hover {
  color: var(--accent);
}
