* { box-sizing: border-box; }

:root {
  --bg: #020617;
  --bg-light: #020617;
  --card-bg: #0b1120;
  --primary: #2563eb;
  --primary-soft: #1d4ed8;
  --border: #1f2937;
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --radius-lg: 10px;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top, #020617 0, #020617 35%, #020617 100%);
  color: var(--text-main);
}

/* ========= LAYOUT SHELL + SIDEBAR ========= */

.app-shell {
  display: flex;
  min-height: 100vh;
}

body.sidebar-collapsed .sidebar {
  display: none;
}
body.sidebar-collapsed main {
  max-width: none;
  width: 100%;
}


.sidebar {
  width: 220px;
  background: #020617;
  border-right: 1px solid #111827;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
}

.logo-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 15px;
  font-weight: 600;
  color: #60a5fa;
}

.logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.logo-title {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
}

.logo-sub {
  font-size: 11px;
  color: #9ca3af;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  font-size: 13px;
  overflow-y: auto;
  padding-right: 4px;
  flex: 1;
}

.sidebar-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #e2e8f0;
  margin: 10px 4px 4px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid #111827;
}

.sidebar-nav .sidebar-section-title:nth-of-type(5n+1) {
  background: rgba(59, 130, 246, 0.36);
  border-color: rgba(59, 130, 246, 0.6);
}

.sidebar-nav .sidebar-section-title:nth-of-type(5n+2) {
  background: rgba(34, 197, 94, 0.34);
  border-color: rgba(34, 197, 94, 0.6);
}

.sidebar-nav .sidebar-section-title:nth-of-type(5n+3) {
  background: rgba(234, 179, 8, 0.32);
  border-color: rgba(234, 179, 8, 0.6);
}

.sidebar-nav .sidebar-section-title:nth-of-type(5n+4) {
  background: rgba(249, 115, 22, 0.32);
  border-color: rgba(249, 115, 22, 0.6);
}

.sidebar-nav .sidebar-section-title:nth-of-type(5n) {
  background: rgba(239, 68, 68, 0.32);
  border-color: rgba(239, 68, 68, 0.6);
}

.sidebar-link {
  padding: 6px 8px;
  border-radius: 6px;
  color: #9ca3af;
  text-decoration: none;
  display: block;
}

.sidebar-link:hover {
  background: #0b1120;
  color: #e5e7eb;
}

.sidebar-link-active {
  background: #0b1120;
  color: #f9fafb;
  font-weight: 500;
  border-left: 2px solid #2563eb;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#app-header-root {
  background: rgba(15,23,42,0.98);
  color: #fff;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #111827;
  position: sticky;
  top: 0;
  z-index: 20;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.brand-sub {
  font-size: 11px;
  opacity: 0.75;
}
.header-badge {
  margin-top: 0;
  font-size: 10px;
  color: #2563eb;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid rgba(37,99,235,0.35);
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(37,99,235,0.08);
  text-decoration: none;
  display: inline-flex;
}
body.light-mode .header-badge,
html.light-mode .header-badge {
  color: #2563eb;
  border-color: rgba(37,99,235,0.45);
  background: rgba(37,99,235,0.12);
}
.header-home-link { text-decoration: none; }
.header-home-link:hover { text-decoration: none; }

.nav-links {
  display: flex;
  gap: 14px;
  font-size: 13px;
  align-items: center;
}

.nav-links a {
  color: #cbd5f5;
  text-decoration: none;
  opacity: 0.9;
}

.nav-links a:hover {
  opacity: 1;
  text-decoration: underline;
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 6px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: calc(100vh - 48px);
}

/* TOOL CARD – full-height app look */

.tool-card {
  border-radius: var(--radius-lg);
  border: 1px solid #111827;
  background: radial-gradient(circle at top left, #0f172a 0, #020617 55%);
  padding: 10px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: auto;
  min-height: 0;
  position: relative;
}

/* Tool pages: keep the editor card within the viewport */
body[data-header-type="tool"] .tool-card {
  min-height: clamp(420px, calc(100vh - 120px), 900px);
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

/* When option expanders are open, allow the card to grow */
body.options-expanded[data-header-type="tool"] .tool-card,
body[data-header-type="tool"] .tool-card:has(.tool-options details[open]) {
  max-height: none;
  overflow: visible;
}

/* Tool pages with large option panels: allow the card to stretch */
body[data-header-type="tool"][data-toolcard="stretch"] .tool-card {
  max-height: none;
  overflow: visible;
}

body[data-header-type="tool"] .tool-card .editor-layout {
  flex: 1;
  min-height: 260px;
  height: auto;
  max-height: none;
}

body[data-header-type="tool"] .tool-card .editor-box {
  flex: 1;
  min-height: 0;
}

body[data-header-type="tool"] .tool-card .toolbar {
  padding: 4px 6px;
}

/* JSON Compare needs full-page flow; allow sections to expand */
body[data-header-subtitle="Compare JSON"] .tool-card {
  min-height: 0;
  max-height: none;
  overflow: visible;
}

body[data-header-subtitle="Compare JSON"] .tool-card .editor-layout {
  height: auto;
  max-height: none;
}

.tool-card.fullscreen {
  position: fixed;
  inset: 8px;
  margin: 0;
  max-width: none;
  z-index: 999;
}

body.fullscreen-active { overflow: hidden; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 2px;
  border-bottom: 1px solid #111827;
}

.tool-options {
  border: 1px solid #111827;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(2, 6, 23, 0.6);
}

.tool-options.options-collapsible {
  position: relative;
}

.tool-options.options-collapsible.options-collapsed {
  max-height: var(--collapsed-height, 140px);
  overflow: hidden;
}

.tool-options-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.tool-options-toggle {
  padding: 3px 10px;
  font-size: 12px;
}

.tool-options.compact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px 12px;
  align-items: start;
}

.tool-options.compact-grid .option-row {
  display: contents;
}

.tool-options .option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: flex-start;
}

.tool-options .option-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #cbd5f5;
  min-width: 0;
}

body[data-header-subtitle="CSV → JSON Converter"] .tool-options .csv-json-options-grid .option-field.compact {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

body[data-header-subtitle="CSV → JSON Converter"] .tool-options .csv-json-options-grid .option-field.compact label {
  margin: 0;
  line-height: 1.2;
}

body[data-header-subtitle="CSV → JSON Converter"] .tool-options .csv-json-options-grid .option-field.compact input[type="checkbox"] {
  min-width: 0;
  padding: 0;
}

.tool-options .option-field input:not([type="checkbox"]):not([type="radio"]) {
  background: #0b1220;
  border: 1px solid #1f2937;
  color: #e5e7eb;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  min-width: 150px;
  width: 100%;
}

.tool-options .option-field select {
  width: 100%;
}

.tool-options .option-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #cbd5f5;
}

.tool-options .option-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5f5;
}

.tool-options .option-field.compact {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start !important;
  gap: 6px !important;
}

.tool-options .option-field.compact label {
  margin: 0;
  line-height: 1.2;
}

.tool-options input[type="checkbox"],
.tool-options input[type="radio"] {
  margin: 0;
  padding: 0;
  min-width: 0;
  width: auto;
}

.tool-options .option-title {
  font-size: 12px;
  font-weight: 600;
  color: #e2e8f0;
}

.pojo-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pojo-top {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  gap: 12px;
  align-items: stretch;
}

.pojo-input .editor-box {
  min-height: 360px;
}

.pojo-output .editor-box {
  min-height: 320px;
}

.pojo-options .tool-options {
  height: 100%;
  overflow: auto;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.is-open {
  display: flex;
}

.modal-card {
  background: #0b1220;
  color: #e2e8f0;
  width: min(1100px, 92vw);
  max-height: 85vh;
  border-radius: 12px;
  border: 1px solid #1f2937;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #1f2937;
  background: #0f172a;
}

.modal-header h2 {
  font-size: 16px;
  margin: 0;
}

.modal-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modal-body {
  padding: 12px 14px;
  overflow: auto;
}

.code-preview {
  background: #0b1220;
  color: #e2e8f0;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .pojo-top {
    grid-template-columns: 1fr;
  }
  .app-main {
    padding-right: 0;
  }
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.btn {
  border-radius: 7px;
  border: 1px solid #1f2937;
  padding: 5px 11px;
  font-size: 13px;
  background: #020617;
  color: #e5e7eb;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn.primary {
  background: linear-gradient(90deg,#2563eb,#1d4ed8);
  border-color: #1d4ed8;
  color: #ffffff;
}

.btn.small {
  padding: 3px 8px;
  font-size: 12px;
}

.btn:hover {
  filter: brightness(1.05);
}

select {
  padding: 5px 9px;
  border-radius: 8px;
  border: 1px solid #1f2937;
  font-size: 13px;
  background: #020617;
  color: #e5e7eb;
}

label {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

::selection {
  background: rgba(59, 130, 246, 0.25);
  color: inherit;
}

::-moz-selection {
  background: rgba(59, 130, 246, 0.25);
  color: inherit;
}

.editor-layout {
  display: flex;
  gap: 8px;
  flex: 1;
  min-height: 420px;
  height: calc(100vh - 240px);
  max-height: calc(100vh - 240px);
  margin-top: 4px;
}

.editor-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.editor-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.editor-pane-title {
  font-weight: 600;
  color: #e5e7eb;
}

.editor-pane-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sql-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.sql-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.45fr);
  gap: 12px;
  min-height: 0;
  flex: 1;
  align-items: stretch;
}

.sql-input,
.sql-output {
  min-height: 0;
}

.sql-options {
  min-height: 0;
  display: flex;
}

.sql-options .tool-options {
  width: 100%;
  max-height: none;
  overflow: visible;
  min-height: 100%;
}

body[data-header-subtitle="JSON to SQL"] .sql-options {
  align-self: start;
}

body[data-header-subtitle="JSON to SQL"] .sql-options .tool-options {
  min-height: 0;
  height: auto;
  padding: 6px 8px;
}

body[data-header-subtitle="JSON to SQL"] .sql-options .tool-options.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px 10px;
}

body[data-header-subtitle="JSON to SQL"] .sql-options .tool-options.compact-grid .option-group {
  grid-column: 1 / -1;
}

body[data-header-subtitle="JSON Sample Generator"] .sql-options .tool-options {
  min-height: 0;
  height: auto;
}

body[data-header-subtitle="JSON Sample Generator"] .sql-options {
  align-self: start;
}

body[data-header-subtitle="JSON Sample Generator"] .sql-top .editor-box {
  min-height: 260px;
}

.sql-bottom {
  display: flex;
  min-height: 0;
  flex: 0.8;
}

.sql-bottom .editor-box {
  min-height: 220px;
}

.option-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.size-graph-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-surface);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.size-graph-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.size-graph-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.size-graph-search {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  min-width: 220px;
}
.size-graph-sort {
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
}
.size-graph-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.size-graph-filter input {
  width: 70px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
}
.size-graph-actions {
  display: inline-flex;
  gap: 6px;
}
.size-graph-selected {
  font-size: 12px;
  color: var(--text-muted);
}

.size-graph-header h2 {
  margin: 0;
  font-size: 14px;
  color: var(--text-primary);
}

.size-graph-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.size-graph {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  max-height: 360px;
  overflow-y: auto;
}

.size-graph-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(140px, 2fr) 70px 80px;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.size-graph-row.header {
  position: static;
  background: var(--bg-surface);
  z-index: 2;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.size-graph-row.header .size-graph-bar {
  background: transparent;
}
.size-graph-row.header .size-graph-fill {
  display: none;
}
.size-graph-row.header .size-graph-toggle {
  visibility: hidden;
}
.size-graph-row:hover {
  background: rgba(37, 99, 235, 0.08);
}

.size-graph-row:first-child {
  border-top: none;
}

.size-graph-row.hidden {
  display: none;
}

.size-graph-label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding-left: calc(var(--indent, 0) * 14px);
}
.size-graph-path {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}
.size-graph-copy {
  margin-left: 6px;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.size-graph-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-primary);
}

.size-graph-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.18);
  position: relative;
  overflow: hidden;
}

.size-graph-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.size-graph-percent,
.size-graph-size {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: right;
}

.size-graph-toggle {
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.size-graph-toggle.spacer {
  cursor: default;
}

.size-graph-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.size-graph-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.size-graph-modal-body > .size-graph-card {
  margin-bottom: 4px;
}

.size-graph-modal-body > .size-graph-card + .diff-card {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.size-graph-modal-body > .diff-card {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.size-graph-modal-body > .diff-card + .diff-card {
  margin-top: -4px;
}

.size-graph-modal .size-graph {
  max-height: 360px;
}

@media (max-width: 720px) {
  .sql-top {
    grid-template-columns: 1fr;
  }

  .sql-bottom .editor-box {
    min-height: 200px;
  }

  .size-graph-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .size-graph-percent,
  .size-graph-size {
    text-align: left;
  }
}

.editor-menu {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
}

.editor-box {
  flex: 1 1 auto;
  border-radius: 8px;
  border: 1px solid #111827;
  overflow: hidden;
  min-height: 220px;
  background: #020617;
}

#editor-left,
#editor-right {
  width: 100%;
  height: 100%;
}

.resize-handle {
  height: 10px;
  cursor: row-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  color: var(--text-muted);
  -webkit-user-select: none;
  user-select: none;
  margin-top: 4px;
}

.resize-bar {
  width: 44px;
  height: 3px;
  border-radius: 999px;
  background: #1f2937;
}

.status {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.status.error { color: #ef4444; }

/* Compact hero/info below tool */

.hero {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px solid #0f172a;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
  background: rgba(37,99,235,0.12);
  color: #60a5fa;
  font-weight: 500;
  width: fit-content;
}

h1 {
  font-size: 20px;
  margin: 0;
  line-height: 1.25;
}

.hero-sub {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 720px;
  margin-top: 0;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.hero-meta span::before { content: "• "; }
.hero-meta span:first-child::before { content: ""; }

.info-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.5fr);
  gap: 10px;
  margin-top: 8px;
}

.info-card {
  border-radius: var(--radius-lg);
  border: 1px solid #111827;
  background: #020617;
  padding: 9px 11px;
  font-size: 12px;
  color: var(--text-muted);
}

.info-card h2 {
  font-size: 14px;
  margin: 0 0 4px;
  color: var(--text-main);
}

.info-card h3 {
  font-size: 13px;
  margin-top: 8px;
  margin-bottom: 3px;
  color: var(--text-main);
}

.form-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  width: min(820px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.form-field input,
.form-field textarea {
  background: #0b1220;
  border: 1px solid #1f2937;
  color: #e5e7eb;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  width: 100%;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.info-card ul {
  padding-left: 18px;
  margin: 3px 0 6px;
}

footer {
  border-top: 1px solid #111827;
  margin-top: 12px;
  padding: 9px 12px 12px;
  font-size: 11px;
  color: #6b7280;
  text-align: center;
}

footer a {
  color: #9ca3af;
  text-decoration: none;
}

footer a:hover { text-decoration: underline; }

/* Responsive sidebar collapse */
@media (max-width: 900px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-right: none;
    border-bottom: 1px solid #111827;
    position: static;
  }

  .sidebar-nav {
    flex-direction: row;
    gap: 6px;
  }

  .sidebar-link {
    padding: 4px 6px;
    font-size: 12px;
  }

  .tool-card {
    height: auto;
    min-height: 25%;
  }

  .editor-layout {
    flex-direction: column;
    min-height: 1420px;
    height: calc(100vh - 300px);
    max-height: calc(100vh - 300px);
  }

  .editor-box {
    min-height: 560px;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  main {
    padding: 6px 8px 18px;
  }

  h1 { font-size: 18px; }

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


/* CSV table preview on JSON → CSV page */
.csv-table-container {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.csv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.csv-table th,
.csv-table td {
  border-bottom: 1px solid #111827;
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
}

.csv-table th {
  color: #e5e7eb;
  background: #020617;
}

.csv-table tr:nth-child(even) td {
  background: rgba(15,23,42,0.5);
}


/* Fix toolbar to full width */
.tool-card {
  width: 100%;
  height: 90%;
}

.tool-card .toolbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 6px;
  box-sizing: border-box;
}



.app-main,
main {
  width: 100%;
}

/* Prevent inner elements from shrinking */
.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}


/* Make toolbar always full-width and prevent uneven wrapping */
.tool-card .toolbar {
  flex-wrap: nowrap !important;
  justify-content: space-between !important;
  width: 100%;
}

.tool-card .toolbar-group {
  flex-wrap: nowrap !important;
}


/* JWT Decoder right side layout */
.jwt-columns {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
}

.jwt-panel {
  flex: 1;
  min-height: 0;
  border-radius: 6px;
  border: 1px solid #111827;
  padding: 4px 6px;
  background: #020617;
  display: flex;
  flex-direction: column;
}

.jwt-panel-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 2px;
}

#editor-header,
#editor-payload {
  flex: 1;
  min-height: 0;
}


/* Blog layout */

.blog-body {
  background: #020617;
  color: #e5e7eb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.blog-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.blog-header {
  margin-bottom: 24px;
}

.blog-brand-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #38bdf8;
  text-decoration: none;
}

.blog-brand-title:hover {
  text-decoration: underline;
}

.blog-brand-sub {
  display: block;
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 2px;
}

.blog-breadcrumb {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #94a3b8;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.blog-breadcrumb a {
  color: #38bdf8;
  text-decoration: none;
}

.blog-breadcrumb a:hover {
  text-decoration: underline;
}

.blog-breadcrumb-current {
  color: #e5e7eb;
  font-weight: 500;
}

.blog-hero {
  margin-top: 24px;
}

.blog-hero h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
  color: #e5e7eb;
}

.blog-hero p {
  font-size: 0.95rem;
  color: #cbd5e1;
}

/* Blog list & cards */

.blog-main {
  margin-top: 24px;
}

.blog-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.blog-card {
  background: #020617;
  border-radius: 10px;
  border: 1px solid #1e293b;
  padding: 16px 18px;
  transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.blog-card h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.blog-card h2 a {
  color: #e5e7eb;
  text-decoration: none;
}

.blog-card h2 a:hover {
  color: #38bdf8;
}

.blog-card p {
  margin: 0;
  font-size: 0.95rem;
  color: #cbd5e1;
}

.blog-card:hover {
  background: #0f172a;
  border-color: #38bdf8;
  transform: translateY(-2px);
}

.blog-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid #1e293b;
  font-size: 0.85rem;
  color: #94a3b8;
}

/* Mobile tweaks */
@media (max-width: 640px) {
  .blog-container {
    padding: 16px 12px 32px;
  }

  .blog-hero h1 {
    font-size: 1.4rem;
  }
}


/* Article navigation links on blog posts */
.article-nav {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #1e293b;
}

.article-nav-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.article-nav-link {
  font-size: 0.9rem;
  color: #38bdf8;
  text-decoration: none;
}

.article-nav-link:hover {
  text-decoration: underline;
}


/* Blog article related links */
.article-related {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #1e293b;
}

.article-related h2 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: #e5e7eb;
}

.article-related ul {
  list-style: disc;
  margin-left: 18px;
  color: #cbd5e1;
}

.article-related a {
  color: #38bdf8;
  text-decoration: none;
}

.article-related a:hover {
  text-decoration: underline;
}

/* Blog search on index page */
.blog-search-box {
  margin-top: 16px;
  margin-bottom: 16px;
}

.blog-search-input {
  width: 100%;
  max-width: 420px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #1e293b;
  background: #020617;
  color: #e5e7eb;
  font-size: 0.9rem;
}

.blog-search-input::placeholder {
  color: #64748b;
}


/* Home page blog teaser */
.home-blog-teaser {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #1e293b;
}

.home-blog-header h2 {
  font-size: 1.15rem;
  margin: 0 0 4px;
  color: #e5e7eb;
}

.home-blog-header p {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.home-blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.home-blog-card {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #1e293b;
  background: #020617;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.home-blog-card h3 {
  margin: 0 0 4px;
  font-size: 0.98rem;
}

.home-blog-card h3 a {
  color: #e5e7eb;
  text-decoration: none;
}

.home-blog-card h3 a:hover {
  color: #38bdf8;
}

.home-blog-card p {
  margin: 0;
  font-size: 0.86rem;
  color: #cbd5e1;
}

.home-blog-card:hover {
  background: #0f172a;
  border-color: #38bdf8;
  transform: translateY(-2px);
}


/* Blog teaser button */
.home-blog-viewall {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.home-blog-button {
  display: inline-block;
  padding: 10px 22px;
  background: #2563eb;
  color: #ffffff;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: 0.2s ease;
}

.home-blog-button:hover {
  background: #1e40af;
  transform: translateY(-2px);
}


/* Blog article meta */
.article-meta {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-bottom: 12px;
}


/* Editor stats (chars/size/lines/nodes) */
.editor-stats{
  display:flex;
  flex-wrap:nowrap;
  gap:10px 14px;
  align-items:flex-start;
  justify-content:space-between;
  font-size:12px;
  color:#cbd5e1;
  padding:6px 10px;
  border:1px solid #1e293b;
  border-radius:8px;
  background:#020617;
  margin:6px 0 10px;
}

.editor-stats .stats-left,
.editor-stats .stats-right{
  display:flex;
  flex-wrap:wrap;
  gap:10px 14px;
  align-items:center;
}

.editor-stats .stats-left{
  flex:1 1 auto;
  min-width:0;
}

.editor-stats .stats-right{
  flex:0 0 auto;
  margin-left:auto;
  flex-wrap:nowrap;
  align-self:flex-start;
}

.editor-stats b{
  color:#94a3b8;
  font-weight:600;
}

.editor-stats .stats-pill{
  display:inline-flex;
  gap:6px;
  align-items:center;
}

.editor-stats .stats-warn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid #7c2d12;
  background:rgba(124,45,18,0.25);
  color:#fdba74;
  font-weight:600;
}

.editor-stats .stats-bad{
  border-color:#7f1d1d;
  background:rgba(127,29,29,0.25);
  color:#fecaca;
}

.editor-stats button.stats-copy{
  appearance:none;
  border:1px solid #1e293b;
  background:#0f172a;
  color:#e5e7eb;
  padding:5px 10px;
  border-radius:8px;
  font-size:12px;
  cursor:pointer;
  transition:0.2s ease;
}

.editor-stats button.stats-copy:hover{
  border-color:#38bdf8;
  transform:translateY(-1px);
}

/* Header theme toggle button */
.nav-links .nav-btn {
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 6px 10px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text-main);
  cursor: pointer;
}
.nav-links .nav-btn:hover {
  filter: brightness(1.08);
}

/* Light mode theme */
body.light-mode, html.light-mode {
  --bg: #f8fafc;
  --bg-light: #ffffff;
  --card-bg: #ffffff;
  --primary: #2563eb;
  --primary-soft: #1d4ed8;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #475569;
}

body.light-mode, html.light-mode {
  background: var(--bg);
  color: var(--text-main);
}

body.light-mode, html.light-mode .sidebar {
  background: var(--card-bg);
}

body.light-mode, html.light-mode header {
  background: rgba(241,245,249,0.98);
  border-bottom: 1px solid var(--border);
}

body.light-mode, html.light-mode .tool-card {
  background: var(--card-bg);
  border-color: var(--border);
}

body.light-mode, html.light-mode .tool-options {
  background: #f8fafc;
  border-color: var(--border);
}

body.light-mode, html.light-mode .tool-options .option-field,
body.light-mode, html.light-mode .tool-options .option-group label {
  color: #334155;
}

body.light-mode, html.light-mode .tool-options .option-title {
  color: #0f172a;
}

body.light-mode, html.light-mode .tool-options .option-field input:not([type="checkbox"]):not([type="radio"]) {
  background: #ffffff;
  border-color: var(--border);
  color: #0f172a;
}

body.light-mode, html.light-mode .pojo-options .tool-options {
  background: #f8fafc;
}

body.light-mode, html.light-mode .modal-card {
  background: #ffffff;
  color: #0f172a;
  border-color: var(--border);
}

body.light-mode, html.light-mode .modal-header {
  background: #f1f5f9;
  border-color: var(--border);
}

body.light-mode, html.light-mode .code-preview {
  background: #ffffff;
  color: #0f172a;
  border-color: var(--border);
}

body.light-mode, html.light-mode .editor-box {
  border-color: var(--border);
  background: #ffffff;
}

body.light-mode, html.light-mode .editor-stats {
  background: #ffffff;
  border-color: var(--border);
  color: #0f172a;
}

body.light-mode, html.light-mode .editor-stats b {
  color: #334155;
}

body.light-mode, html.light-mode .editor-stats .stats-warn {
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
}

body.light-mode, html.light-mode .editor-stats .stats-bad {
  border-color: #f87171;
  background: #fef2f2;
  color: #991b1b;
}

body.light-mode, html.light-mode .editor-stats button.stats-copy {
  background: #ffffff;
  border-color: var(--border);
  color: #0f172a;
  font-weight: 600;
}

body.light-mode, html.light-mode .editor-stats button.stats-copy:hover {
  background: #f8fafc;
  color: #0f172a;
}

body.light-mode, html.light-mode .btn:not(.primary) {
  background: #ffffff;
  border-color: var(--border);
  color: var(--text-main);
}

body.light-mode, html.light-mode .btn.primary {
  background: linear-gradient(90deg,#2563eb,#1d4ed8);
  border-color: #1d4ed8;
  color: #ffffff;
}

body.light-mode, html.light-mode .btn.primary {
  color: #ffffff;
}

body.light-mode, html.light-mode .sidebar-link:hover,
body.light-mode, html.light-mode .sidebar-link-active {
  background: #f1f5f9;
  color: var(--text-main);
}



/* =========================================================
   GLOBAL LIGHT MODE – Diff / Code / Result Readability FIX
   Applies to ALL pages (Compare, JSON Viewer, Tools)
   ========================================================= */
body.light-mode, html.light-mode {
  --text-main: #0f172a;
  --text-muted: #64748b;
}

/* Diff result containers */
body.light-mode, html.light-mode .diff-output {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #e5e7eb !important;
}

/* Diff rows & text */
body.light-mode, html.light-mode .diff-row {
  color: #0f172a !important;
}

body.light-mode, html.light-mode .diff-line {
  color: #0f172a !important;
}

/* Line number gutter */
body.light-mode, html.light-mode .diff-lineno {
  color: #64748b !important;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
}

/* Modern highlight colors (DiffNow-like) */
body.light-mode, html.light-mode .diff-row.changed {
  background: #fff7cc;
}

body.light-mode, html.light-mode .diff-row.added {
  background: #e6fbe8;
}

body.light-mode, html.light-mode .diff-row.removed {
  background: #ffecec;
}

/* Inline character highlights */
body.light-mode, html.light-mode .diff-char-added {
  background: #bbf7d0;
  color: #065f46;
}

body.light-mode, html.light-mode .diff-char-removed {
  background: #fecaca;
  color: #7f1d1d;
}

/* Active diff row */
body.light-mode, html.light-mode .diff-row.active {
  outline: none;
}

/* Ace editor light consistency */
body.light-mode, html.light-mode .ace_editor {
  background: #ffffff !important;
  color: #0f172a !important;
}

body.light-mode, html.light-mode .ace_gutter {
  background: #f8fafc !important;
  color: #64748b !important;
  border-right: 1px solid #e2e8f0;
}


/* =========================================================
   LIGHT MODE – Header/Sidebar text color fixes
   ========================================================= */
body.light-mode, html.light-mode header,
body.light-mode, html.light-mode .app-header,
body.light-mode, html.light-mode #app-header-root {
  color: var(--text-main);
}

body.light-mode, html.light-mode header .brand,
body.light-mode, html.light-mode header .brand a,
body.light-mode, html.light-mode header .brand-title,
body.light-mode, html.light-mode header .brand-subtitle,
body.light-mode, html.light-mode .header-title,
body.light-mode, html.light-mode .header-subtitle {
  color: var(--text-main) !important;
}

body.light-mode, html.light-mode header .brand-subtitle,
body.light-mode, html.light-mode .header-subtitle {
  color: var(--text-muted) !important;
}

body.light-mode, html.light-mode .nav-links a {
  color: var(--text-main) !important;
  opacity: 0.9;
}

body.light-mode, html.light-mode .nav-links a:hover {
  opacity: 1;
}

/* Sidebar text */
body.light-mode, html.light-mode .sidebar {
  background: var(--card-bg) !important;
  color: var(--text-main) !important;
  border-right: 1px solid var(--border);
}

body.light-mode, html.light-mode .sidebar .sidebar-title,
body.light-mode, html.light-mode .sidebar .sidebar-section-title {
  color: var(--text-muted) !important;
  background: #f1f5f9;
  border-color: var(--border);
}

body.light-mode, html.light-mode .sidebar .sidebar-section-title:nth-of-type(5n+1) {
  background: #dbeafe;
  border-color: #bfdbfe;
}

body.light-mode, html.light-mode .sidebar .sidebar-section-title:nth-of-type(5n+2) {
  background: #dcfce7;
  border-color: #bbf7d0;
}

body.light-mode, html.light-mode .sidebar .sidebar-section-title:nth-of-type(5n+3) {
  background: #fef9c3;
  border-color: #fde68a;
}

body.light-mode, html.light-mode .sidebar .sidebar-section-title:nth-of-type(5n+4) {
  background: #ffedd5;
  border-color: #fed7aa;
}

body.light-mode, html.light-mode .sidebar .sidebar-section-title:nth-of-type(5n) {
  background: #fee2e2;
  border-color: #fecaca;
}

body.light-mode, html.light-mode .form-field input,
body.light-mode, html.light-mode .form-field textarea {
  background: #ffffff;
  border-color: var(--border);
  color: #0f172a;
}

body.light-mode, html.light-mode .sidebar a,
body.light-mode, html.light-mode .sidebar .sidebar-link {
  color: var(--text-main) !important;
  opacity: 0.92;
}

body.light-mode, html.light-mode .sidebar a:hover,
body.light-mode, html.light-mode .sidebar .sidebar-link:hover {
  opacity: 1;
  background: #f1f5f9;
}

body.light-mode, html.light-mode .sidebar .sidebar-link-active {
  background: #eaf2ff; /* subtle blue */
  color: #1d4ed8 !important;
}

/* If logo icon is SVG using currentColor */
body.light-mode, html.light-mode .sidebar .brand-logo,
body.light-mode, html.light-mode header .brand-logo {
  color: var(--text-main) !important;
}


/* =========================================================
   LIGHT MODE – Tool page content text visibility (GLOBAL)
   Fixes faded instructions/labels across all tools/pages
   ========================================================= */
body.light-mode, html.light-mode main,
body.light-mode, html.light-mode .app-main,
body.light-mode, html.light-mode .tool-card {
  color: var(--text-main) !important;
}

body.light-mode, html.light-mode .tool-card p,
body.light-mode, html.light-mode .tool-card li,
body.light-mode, html.light-mode .tool-card span,
body.light-mode, html.light-mode .tool-card label,
body.light-mode, html.light-mode .tool-card small,
body.light-mode, html.light-mode .tool-card .compare-subtitle,
body.light-mode, html.light-mode .tool-card .compare-status {
  color: var(--text-main) !important;
  opacity: 1 !important;
}

/* muted helper text */
body.light-mode, html.light-mode .tool-card .help-text,
body.light-mode, html.light-mode .tool-card .subtitle,
body.light-mode, html.light-mode .tool-card .muted,
body.light-mode, html.light-mode .tool-card .diff-summary,
body.light-mode, html.light-mode .compare-status,
body.light-mode, html.light-mode footer {
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

/* Editor pane headers / titles / mode labels */
body.light-mode, html.light-mode .editor-pane-title,
body.light-mode, html.light-mode .editor-pane-header,
body.light-mode, html.light-mode .editor-menu,
body.light-mode, html.light-mode .editor-pane-header-stats,
body.light-mode, html.light-mode .mode-label,
body.light-mode, html.light-mode .toolbar,
body.light-mode, html.light-mode .toolbar-group {
  color: var(--text-main) !important;
}

/* If any page uses very low opacity for captions */
body.light-mode, html.light-mode [style*="opacity: 0"],
body.light-mode, html.light-mode [style*="opacity:0"] {
  opacity: 1 !important;
}


/* =========================================================
   LIGHT MODE – Blog pages (index + posts)
   ========================================================= */
body.light-mode, html.light-mode .blog-hero {
  border-bottom: 1px solid var(--border) !important;
}
body.light-mode, html.light-mode .blog-hero h1 {
  color: var(--text-main) !important;
}
body.light-mode, html.light-mode .blog-hero p {
  color: var(--text-muted) !important;
}

/* Blog cards / lists: force light surfaces */
body.light-mode, html.light-mode .blog-card,
body.light-mode, html.light-mode .blog-post-card,
body.light-mode, html.light-mode .post-card,
body.light-mode, html.light-mode .blog-list a.blog-card {
  background: #ffffff !important;
  border: 1px solid var(--border) !important;
  color: var(--text-main) !important;
}

/* Titles + excerpts inside cards */
body.light-mode, html.light-mode .blog-card h2,
body.light-mode, html.light-mode .blog-card h3,
body.light-mode, html.light-mode .blog-card .title,
body.light-mode, html.light-mode .blog-post-card h1,
body.light-mode, html.light-mode .blog-post-card h2,
body.light-mode, html.light-mode .blog-post-card h3 {
  color: var(--text-main) !important;
}
body.light-mode, html.light-mode .blog-card p,
body.light-mode, html.light-mode .blog-card .excerpt,
body.light-mode, html.light-mode .blog-card .desc {
  color: var(--text-muted) !important;
}

/* Blog footer */
body.light-mode, html.light-mode .blog-footer {
  border-top: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
}

/* If any blog page uses hardcoded dark "card" class */
body.light-mode, html.light-mode .card {
  background: #ffffff !important;
  border-color: var(--border) !important;
  color: var(--text-main) !important;
}


/* =========================================================
   LIGHT MODE – Logo text visibility (header + sidebar)
   ========================================================= */
body.light-mode, html.light-mode .brand,
body.light-mode, html.light-mode .brand *,
body.light-mode, html.light-mode .sidebar-brand,
body.light-mode, html.light-mode .sidebar-brand *,
body.light-mode, html.light-mode .brand-text,
body.light-mode, html.light-mode .brand-name,
body.light-mode, html.light-mode .brand-desc {
  color: var(--text-main) !important;
}

body.light-mode, html.light-mode .brand-desc,
body.light-mode, html.light-mode .sidebar-brand small,
body.light-mode, html.light-mode .sidebar-brand .muted {
  color: var(--text-muted) !important;
}


/* =========================================================
   LIGHT MODE – Sidebar logo + top bar stats visibility
   ========================================================= */
body.light-mode, html.light-mode .sidebar-logo .logo-title {
  color: var(--text-main) !important;
  font-weight: 700;
}
body.light-mode, html.light-mode .sidebar-logo .logo-sub {
  color: var(--text-muted) !important;
}

/* Top stats/header bars in tools (keep readable) */
body.light-mode, html.light-mode .pane-meta,
body.light-mode, html.light-mode .meta,
body.light-mode, html.light-mode .editor-pane .meta,
body.light-mode, html.light-mode .editor-pane .meta * {
  color: #e5e7eb !important; /* these bars stay dark */
  opacity: 1 !important;
}


/* =========================================================
   LIGHT MODE – Status text + Ace active-line highlight fixes
   ========================================================= */

/* Tool status lines (e.g., "Auto-updated right panel ✓") */
body.light-mode, html.light-mode .status,
body.light-mode, html.light-mode .status-bar,
body.light-mode, html.light-mode .tool-status,
body.light-mode, html.light-mode .status-text,
body.light-mode, html.light-mode #status,
body.light-mode, html.light-mode #status-left,
body.light-mode, html.light-mode #status-right,
body.light-mode, html.light-mode .bottom-status,
body.light-mode, html.light-mode .footer-status {
  color: var(--text-muted) !important;
  opacity: 1 !important;
}

/* If status sits on dark background, ensure contrast */
body.light-mode, html.light-mode .status.dark,
body.light-mode, html.light-mode .status-bar.dark,
body.light-mode, html.light-mode .tool-status.dark {
  color: #e2e8f0 !important;
}

/* Ace editor: active row highlight should be light (not black) */
body.light-mode, html.light-mode .ace_marker-layer .ace_active-line {
  background: rgba(250, 204, 21, 0.22) !important; /* soft amber */
}
body.light-mode, html.light-mode .ace_gutter-active-line {
  background: rgba(250, 204, 21, 0.22) !important;
}
body.light-mode, html.light-mode .ace_editor .ace_selected-word {
  border: 1px solid rgba(37, 99, 235, 0.35) !important;
}

/* Keep text readable in highlighted line */
body.light-mode, html.light-mode .ace_editor,
body.light-mode, html.light-mode .ace_editor * {
  color: #0f172a;
}


/* =========================================================
   LIGHT MODE – Dark stat/copy bars text visibility fix
   (e.g., "Left Chars / Size / Lines / Copy stats" bars)
   ========================================================= */
body.light-mode, html.light-mode .stats-bar,
body.light-mode, html.light-mode .stats,
body.light-mode, html.light-mode .stats-row,
body.light-mode, html.light-mode .editor-stats,
body.light-mode, html.light-mode .pane-stats,
body.light-mode, html.light-mode .panel-stats {
  color: #e2e8f0 !important; /* readable on dark bars */
}

body.light-mode, html.light-mode .stats-bar *,
body.light-mode, html.light-mode .stats *,
body.light-mode, html.light-mode .stats-row *,
body.light-mode, html.light-mode .editor-stats *,
body.light-mode, html.light-mode .pane-stats *,
body.light-mode, html.light-mode .panel-stats * {
  color: #e2e8f0 !important;
  opacity: 1 !important;
}

/* Ensure the "Copy stats" button text is visible */
body.light-mode, html.light-mode .stats-bar .btn,
body.light-mode, html.light-mode .stats .btn,
body.light-mode, html.light-mode .editor-stats .btn,
body.light-mode, html.light-mode .pane-stats .btn,
body.light-mode, html.light-mode .panel-stats .btn,
body.light-mode, html.light-mode button.copy-stats,
body.light-mode, html.light-mode #btn-copy-stats,
body.light-mode, html.light-mode .btn-copy-stats {
  color: #e2e8f0 !important;
}


/* =========================================================
   LIGHT MODE – Stats bar auto-updated metric values visibility
   Forces values/numbers inside dark stat bars to be readable
   ========================================================= */
body.light-mode, html.light-mode .stats-bar .value,
body.light-mode, html.light-mode .stats-bar .stat-value,
body.light-mode, html.light-mode .stats-bar .metric-value,
body.light-mode, html.light-mode .stats-bar .count,
body.light-mode, html.light-mode .stats-bar .num,
body.light-mode, html.light-mode .stats-bar strong,
body.light-mode, html.light-mode .stats-bar b,
body.light-mode, html.light-mode .stats .value,
body.light-mode, html.light-mode .stats .stat-value,
body.light-mode, html.light-mode .stats .metric-value,
body.light-mode, html.light-mode .editor-stats .value,
body.light-mode, html.light-mode .editor-stats .stat-value,
body.light-mode, html.light-mode .pane-stats .value,
body.light-mode, html.light-mode .pane-stats .stat-value,
body.light-mode, html.light-mode .panel-stats .value,
body.light-mode, html.light-mode .panel-stats .stat-value {
  color: #e2e8f0 !important;
  opacity: 1 !important;
}

/* If any metric numbers use inline styles, override them */
body.light-mode, html.light-mode .stats-bar span[style*="color"],
body.light-mode, html.light-mode .stats span[style*="color"],
body.light-mode, html.light-mode .editor-stats span[style*="color"],
body.light-mode, html.light-mode .pane-stats span[style*="color"],
body.light-mode, html.light-mode .panel-stats span[style*="color"] {
  color: #e2e8f0 !important;
}

/* Labels can remain slightly muted, but still readable */
body.light-mode, html.light-mode .stats-bar .label,
body.light-mode, html.light-mode .stats-bar .stat-label,
body.light-mode, html.light-mode .stats-bar .metric-label {
  color: #cbd5e1 !important;
  opacity: 1 !important;
}


/* =========================================================
   LIGHT MODE – Override earlier generic text rules inside editor stats bars
   (Prevents black text in dark stats bars due to .tool-card span overrides)
   ========================================================= */
body.light-mode, html.light-mode .editor-stats,
body.light-mode, html.light-mode .editor-stats * {
  color: #e2e8f0 !important;
  opacity: 1 !important;
}

body.light-mode, html.light-mode .editor-stats b {
  color: #cbd5e1 !important; /* labels slightly muted */
}

body.light-mode, html.light-mode .editor-stats .stats-copy {
  color: #e2e8f0 !important;
}

body.light-mode, html.light-mode .editor-stats button.stats-copy {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

body.light-mode, html.light-mode .editor-stats button.stats-copy:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
}


/* =========================================================
   LIGHT MODE – Blog post page (main.article) should be white
   ========================================================= */
body.light-mode, html.light-mode main.article,
body.light-mode, html.light-mode main.article > article,
body.light-mode, html.light-mode main.article article {
  background: #ffffff !important;
  color: #0f172a !important;
}

body.light-mode, html.light-mode main.article header h1,
body.light-mode, html.light-mode main.article h1,
body.light-mode, html.light-mode main.article h2,
body.light-mode, html.light-mode main.article h3 {
  color: #0f172a !important;
}

body.light-mode, html.light-mode main.article p,
body.light-mode, html.light-mode main.article li,
body.light-mode, html.light-mode main.article .hero-sub,
body.light-mode, html.light-mode main.article .article-meta {
  color: #334155 !important;
  opacity: 1 !important;
}

body.light-mode, html.light-mode main.article a {
  color: #2563eb !important;
}
body.light-mode, html.light-mode main.article a:hover {
  color: #1d4ed8 !important;
}

/* Code blocks on blog posts */
body.light-mode, html.light-mode main.article pre,
body.light-mode, html.light-mode main.article code {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid #e2e8f0 !important;
}

/* Related/nav sections inside posts */
body.light-mode, html.light-mode .article-nav,
body.light-mode, html.light-mode .article-related,
body.light-mode, html.light-mode .article-nav-inner {
  border-top-color: #e2e8f0 !important;
}
body.light-mode, html.light-mode .article-related h2 {
  color: #0f172a !important;
}
body.light-mode, html.light-mode .article-related a {
  color: #2563eb !important;
}

/* =========================================================
   LIGHT MODE – FORCE stats values visibility (absolute)
   ========================================================= */
body.light-mode, html.light-mode .editor-stats,
body.light-mode, html.light-mode .editor-stats *,
body.light-mode, html.light-mode .stats-bar,
body.light-mode, html.light-mode .stats-bar *,
body.light-mode, html.light-mode .pane-stats,
body.light-mode, html.light-mode .pane-stats *,
body.light-mode, html.light-mode .panel-stats,
body.light-mode, html.light-mode .panel-stats * {
  color: #e5e7eb !important;
  opacity: 1 !important;
}

body.light-mode, html.light-mode #leftChars,
body.light-mode, html.light-mode #leftSize,
body.light-mode, html.light-mode #leftLines,
body.light-mode, html.light-mode #leftNodes,
body.light-mode, html.light-mode #rightChars,
body.light-mode, html.light-mode #rightSize,
body.light-mode, html.light-mode #rightLines,
body.light-mode, html.light-mode #rightNodes {
  color: #e5e7eb !important;
  font-weight: 500 !important;
}

/* Light mode: keep inline editor menu buttons readable inside stats bar */
body.light-mode, html.light-mode .editor-stats .stats-inline-menu .btn,
body.light-mode, html.light-mode .editor-stats .editor-menu .btn {
  color: #0f172a !important;
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

body.light-mode, html.light-mode .editor-stats .stats-inline-menu .btn:hover,
body.light-mode, html.light-mode .editor-stats .editor-menu .btn:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
}


/* UI polish: keep stats under pane title */
.editor-stats{margin:8px 0 0 0;}

/* UI polish: keep Mode selector in the stats row (compact header) */
.editor-pane-header .editor-menu { display:none !important; }
.editor-stats .stats-right { display:flex; align-items:center; gap:10px; }
.editor-stats .stats-inline-menu { display:flex !important; align-items:center; gap:6px; }
.editor-stats .stats-inline-menu label { display:flex; align-items:center; gap:6px; margin:0; }
.editor-stats .stats-inline-menu select { height:30px; padding:4px 10px; border-radius:10px; }



/* === Compact UI: hide Left/Right editor titles (stats already indicate side) === */
.editor-pane-header .editor-pane-title,
.editor-pane-header span,
.editor-pane-header h3,
.editor-pane-header h4 {
  display: none !important;
}

.editor-pane-header {
  min-height: 6px;
  padding: 0;
  border-bottom: none;
}



/* === Tight UI: remove gap between toolbar and stats === */
.editor-stats {
  margin-top: 0 !important;
}



/* === Ultra-tight: remove any remaining gap above stats === */
.toolbar { margin-bottom: 0 !important; }
.tool-card .toolbar + .editor-layout { margin-top: 0 !important; }
.editor-layout { margin-top: 0 !important; }

/* Header container kept for stats anchoring, but visually collapsed */
.editor-pane-header {
  min-height: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

/* Stats bar flush */
.editor-stats { margin-top: 0 !important; }



/* === SEO content blocks (AdSense-friendly) === */
.tool-seo-content{
  margin-top: 18px;
  padding: 16px 16px;
  border: 1px solid rgba(148,163,184,.25);
  border-radius: 16px;
  background: rgba(2,6,23,.35);
}
body:not(.dark) .tool-seo-content{ background: #fff; }

.tool-seo-content h2{ margin: 0 0 10px 0; font-size: 20px; }
.tool-seo-content h3{ margin: 14px 0 8px 0; font-size: 16px; }
.tool-seo-content p{ margin: 8px 0; line-height: 1.6; }
.tool-seo-content ul, .tool-seo-content ol{ margin: 8px 0 8px 18px; }
.tool-seo-content a{ text-decoration: underline; }
.tool-seo-content .tool-figure{
  margin: 12px 0 16px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(15,23,42,.18);
}
.tool-seo-content .tool-figure img{
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.25);
}
.tool-seo-content .tool-figure figcaption{
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
body:not(.dark) .tool-seo-content .tool-figure{
  background: #f8fafc;
}
body:not(.dark) .tool-seo-content .tool-figure img{
  border-color: #e2e8f0;
}
.tool-seo-note{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(99,102,241,.25);
  background: rgba(99,102,241,.10);
}
.tool-seo-note a + a::before{
  content: ", ";
}
.tool-seo-note a + a{
  margin-left: 4px;
}

.related-tools ul{
  list-style: disc;
  padding-left: 20px;
  margin: 8px 0;
}
.related-tools li{
  margin: 6px 0;
}


/* === SEO content blocks: dark-mode text visibility fix === */
.tool-seo-content{ color: rgba(226,232,240,0.92); }
.tool-seo-content h2, .tool-seo-content h3{ color: rgba(241,245,249,0.96); }
.tool-seo-content p, .tool-seo-content li{ color: rgba(226,232,240,0.92); }
.tool-seo-content code{ color: rgba(248,250,252,0.96); background: rgba(148,163,184,0.12); padding: 0 6px; border-radius: 6px; }
.tool-seo-content a{ color: rgba(147,197,253,0.98); }
body:not(.dark) .tool-seo-content,
body:not(.dark) .tool-seo-content p,
body:not(.dark) .tool-seo-content li{ color: #0f172a; }
body:not(.dark) .tool-seo-content h2, body:not(.dark) .tool-seo-content h3{ color: #0b1220; }
body:not(.dark) .tool-seo-content code{ color: #0f172a; background: #e2e8f0; }

.tool-seo-content pre{
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.25);
  background: rgba(2,6,23,.45);
  color: rgba(226,232,240,0.98);
  overflow: auto;
  width: 100%;
  box-sizing: border-box;
}
.tool-seo-content pre code{
  background: transparent;
  color: inherit;
  padding: 0;
}
body:not(.dark) .tool-seo-content pre{
  background: #f8fafc;
  color: #0f172a;
  border-color: #e2e8f0;
}


/* === Align SEO content to left (fix center offset) === */
.tool-seo-content{
  margin-left: 0 !important;
  margin-right: 0 !important;
  max-width: none !important;
  text-align: left !important;
}
.tool-seo-content h2,
.tool-seo-content h3,
.tool-seo-content p,
.tool-seo-content ul,
.tool-seo-content ol{
  text-align: left !important;
}


/* SEO blocks: sub-question headings */
.tool-seo-content h4{ margin: 10px 0 6px 0; font-size: 14px; font-weight: 700; color: rgba(241,245,249,0.96); }
body:not(.dark) .tool-seo-content h4{ color: #0b1220; }

/* JSON to CSV guide: readability and layout polish */
#json-to-csv-guide{
  scroll-margin-top: 88px;
}
#json-to-csv-guide h1{
  margin: 0 0 10px 0;
  font-size: 35px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: rgba(248,250,252,0.98);
}
#json-to-csv-guide .guide-lead{
  font-size: 19px;
  line-height: 1.68;
  font-weight: 500;
}
#json-to-csv-guide h2{
  position: relative;
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid rgba(148,163,184,.25);
}
#json-to-csv-guide h2::before{
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: 82px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(56,189,248,.95), rgba(99,102,241,.75));
}
#json-to-csv-guide h2:first-of-type{
  margin-top: 20px;
}
#json-to-csv-guide .guide-kicker-grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 12px;
}
#json-to-csv-guide .guide-kicker{
  padding: 12px;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 12px;
  background: rgba(15,23,42,.22);
}
#json-to-csv-guide .guide-kicker h3{
  margin: 0 0 6px 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: rgba(186,230,253,0.95);
}
#json-to-csv-guide .guide-kicker p{
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}
#json-to-csv-guide .guide-toc{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 18px;
}
#json-to-csv-guide .guide-toc a{
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,.35);
  background: rgba(15,23,42,.18);
  color: rgba(226,232,240,0.95);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
#json-to-csv-guide .guide-toc a:hover{
  background: rgba(30,41,59,.35);
  border-color: rgba(125,211,252,.55);
  color: rgba(248,250,252,0.98);
}
#json-to-csv-guide .guide-table-wrap{
  margin: 10px 0 14px;
  border: 1px solid rgba(148,163,184,.28);
  border-radius: 12px;
  overflow-x: auto;
  background: rgba(15,23,42,.14);
}
#json-to-csv-guide table{
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
}
#json-to-csv-guide th,
#json-to-csv-guide td{
  padding: 11px 12px;
  border-bottom: 1px solid rgba(148,163,184,.22);
  text-align: left;
  vertical-align: top;
}
#json-to-csv-guide thead th{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: rgba(30,41,59,.35);
}
#json-to-csv-guide tbody tr:last-child td{
  border-bottom: none;
}
#json-to-csv-guide .faq-item{
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.28);
  background: rgba(15,23,42,.18);
}
#json-to-csv-guide .faq-item h3{
  margin: 0 0 6px 0;
}
#json-to-csv-guide .faq-item p{
  margin: 0;
}
body:not(.dark) #json-to-csv-guide h1{
  color: #0b1220;
}
body:not(.dark) #json-to-csv-guide h2{
  border-top-color: #e2e8f0;
}
body:not(.dark) #json-to-csv-guide h2::before{
  background: linear-gradient(90deg, #0284c7, #4f46e5);
}
body:not(.dark) #json-to-csv-guide .guide-kicker{
  background: #f8fafc;
  border-color: #dbe3ef;
}
body:not(.dark) #json-to-csv-guide .guide-kicker h3{
  color: #0f766e;
}
body:not(.dark) #json-to-csv-guide .guide-toc a{
  color: #1e293b;
  background: #f8fafc;
  border-color: #d7dfeb;
}
body:not(.dark) #json-to-csv-guide .guide-toc a:hover{
  color: #0f172a;
  background: #eff6ff;
  border-color: #93c5fd;
}
body:not(.dark) #json-to-csv-guide .guide-table-wrap{
  background: #ffffff;
  border-color: #dbe3ef;
}
body:not(.dark) #json-to-csv-guide thead th{
  background: #f8fafc;
}
body:not(.dark) #json-to-csv-guide th,
body:not(.dark) #json-to-csv-guide td{
  border-bottom-color: #e2e8f0;
}
body:not(.dark) #json-to-csv-guide .faq-item{
  background: #f8fafc;
  border-color: #dbe3ef;
}
@media (max-width: 980px){
  #json-to-csv-guide h1{ font-size: 30px; }
  #json-to-csv-guide .guide-kicker-grid{
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px){
  #json-to-csv-guide .guide-lead{
    font-size: 17px;
  }
  #json-to-csv-guide .guide-toc a{
    font-size: 12px;
    padding: 6px 9px;
  }
}

/* === Unified layout spacing (after removing hero sections) === */
main{ padding-top: 12px; }

/* Content text color guard (readability) */
.tool-content, .home-content, .seo-block-home, .info-card, main.article{
  color: var(--content-body, var(--text-secondary));
}
