/* ============================================================
   ClearMark — style.css
   Design system: ClearText Editor Suite
============================================================ */

/* ============================================================
   CSS CUSTOM PROPERTIES  (dark — default)
============================================================ */
:root {
  /* Depth palette */
  --bg-void:      #09090d;
  --bg-deep:      #0e0e14;
  --bg-panel:     #141419;
  --bg-raised:    #1c1c26;
  --bg-surface:   #22222e;

  /* Borders */
  --border-dim:   rgba(255,255,255,0.04);
  --border-mid:   rgba(255,255,255,0.07);
  --border-hi:    rgba(255,255,255,0.11);

  /* Accent: aged gold */
  --gold:         #c9a84c;
  --gold-dim:     #7d6228;
  --gold-muted:   rgba(201,168,76,0.12);
  --gold-glow:    rgba(201,168,76,0.25);

  /* Status green */
  --green:        #3ddc84;
  --green-glow:   rgba(61,220,132,0.35);

  /* Typography */
  --text-bright:  #e2ddd4;
  --text-primary: #b8b3a8;
  --text-dim:     #6a6778;
  --text-muted:   #3e3c4a;

  /* Fonts */
  --font-display: 'Cormorant Garamond', serif;
  --font-ui:      'Syne', sans-serif;
  --font-mono:    'DM Mono', monospace;

  /* Layout */
  --topbar-h: 52px;
  --gap:      10px;
  --r:        10px;
  --r-sm:     6px;

  /* Shadows */
  --shadow-raised:
    0 1px 0   rgba(255,255,255,0.07) inset,
    0 -1px 0  rgba(0,0,0,0.45)       inset,
    0 1px 0   rgba(255,255,255,0.03),
    0 4px 10px rgba(0,0,0,0.55),
    0 1px 3px  rgba(0,0,0,0.80);

  --shadow-inset:
    0 2px 6px  rgba(0,0,0,0.70) inset,
    0 1px 2px  rgba(0,0,0,0.90) inset,
    0 1px 0    rgba(255,255,255,0.03);

  --shadow-panel:
    0 1px 0   rgba(255,255,255,0.06) inset,
    0 -1px 0  rgba(0,0,0,0.35)       inset,
    0 8px 30px rgba(0,0,0,0.65),
    0 2px 8px  rgba(0,0,0,0.85),
    0 1px 0    rgba(255,255,255,0.025);

  --shadow-pressed:
    0 1px 4px  rgba(0,0,0,0.80) inset,
    0 2px 8px  rgba(0,0,0,0.60) inset,
    0 1px 0    rgba(255,255,255,0.02);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-ui);
}

/* Grain texture overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: overlay;
  opacity: 0.55;
}

/* ============================================================
   TOPBAR
============================================================ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 200;
  display: flex;
  align-items: center;
  padding: 0 18px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-dim);
  box-shadow:
    0 1px 0   rgba(255,255,255,0.05) inset,
    0 6px 24px rgba(0,0,0,0.6),
    0 1px 4px  rgba(0,0,0,0.8);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-mark {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  background: linear-gradient(145deg, #d4a843 0%, #8a6228 100%);
  box-shadow: var(--shadow-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-mark svg {
  width: 14px; height: 14px;
  fill: none;
  stroke: rgba(20,10,0,0.85);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.logo-wordmark {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-bright);
  line-height: 1;
}

.logo-wordmark em {
  font-style: normal;
  color: var(--gold);
}

/* Privacy badge — absolute center */
.privacy-badge {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px;
  background: var(--bg-deep);
  border: 1px solid var(--border-mid);
  border-radius: 20px;
  box-shadow: var(--shadow-inset);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
}

.pulse-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px rgba(61,220,132,0.2), 0 0 8px var(--green-glow);
  animation: breathe 2.8s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes breathe {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(61,220,132,0.2), 0 0 8px var(--green-glow);
  }
  50% {
    opacity: 0.35;
    box-shadow: 0 0 0 2px rgba(61,220,132,0.05), 0 0 4px transparent;
  }
}

/* Topbar nav */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

/* Theme switcher */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 4px;
  background: var(--bg-deep);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-inset);
}

.theme-btn {
  width: 26px; height: 26px;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  opacity: 0.35;
  transition: background 0.15s, opacity 0.15s, color 0.15s;
}

.theme-btn svg {
  width: 11px; height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-btn:hover { opacity: 0.65; background: rgba(255,255,255,0.04); }

.theme-btn.active {
  opacity: 1;
  background: var(--bg-deep);
  color: #ffbf00;
  box-shadow:
    0 2px 6px  rgba(0,0,0,0.70) inset,
    0 1px 2px  rgba(0,0,0,0.90) inset,
    0 0 8px    rgba(255,191,0,0.18) inset,
    0 0 1px    rgba(255,191,0,0.30) inset;
}

.theme-btn.active svg {
  filter: drop-shadow(0 0 4px rgba(255,191,0,0.70));
}

/* Nav buttons */
.btn-nav {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  background: var(--bg-deep);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-inset);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-dim);
  text-decoration: none;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  user-select: none;
}

.btn-nav:hover {
  color: var(--gold);
  background: var(--bg-raised);
  border-color: var(--border-hi);
}

/* ============================================================
   MAIN LAYOUT
============================================================ */
.app-shell {
  position: fixed;
  top: var(--topbar-h);
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  grid-template-rows: 1fr 36px;
  gap: var(--gap);
  padding: var(--gap);
}

/* Sidebar columns (ad slots) */
.sidebar-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  grid-row: 1 / span 2;
}

/* Center column */
.center-col {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
  min-height: 0;
}

/* ============================================================
   AD SLOTS
============================================================ */
.ad-slot {
  flex: 1;
  background: var(--bg-deep);
  border-radius: var(--r);
  border: 1px solid var(--border-dim);
  box-shadow: var(--shadow-inset);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-label {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  user-select: none;
}

/* ============================================================
   DIRECTION BAR
============================================================ */
.direction-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 38px;
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: var(--r);
  box-shadow: var(--shadow-panel);
  padding: 4px 6px;
  position: relative;
}

.direction-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.07) 40%,
    rgba(255,255,255,0.07) 60%,
    transparent 100%
  );
  pointer-events: none;
}

.dir-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: all 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dir-btn svg {
  width: 12px; height: 12px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
  display: none;
}

.dir-btn:hover {
  color: var(--text-dim);
  background: var(--bg-raised);
}

.dir-btn.active {
  background: var(--bg-raised);
  color: var(--gold);
  border-color: var(--border-mid);
  box-shadow: var(--shadow-inset);
}

.dir-btn.active svg {
  opacity: 1;
  filter: drop-shadow(0 0 3px var(--gold-glow));
}

/* Swap button in center of direction bar */
.dir-swap-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dir-swap-btn {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-mid);
  background: var(--bg-void);
  box-shadow: var(--shadow-raised);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-dim);
  transition: all 0.15s;
}

.dir-swap-btn svg {
  width: 12px; height: 12px;
  flex-shrink: 0;
}

.dir-swap-btn:hover {
  color: var(--gold);
  border-color: var(--border-hi);
  background: var(--bg-raised);
}

.dir-swap-btn:active {
  box-shadow: var(--shadow-pressed);
  transform: scale(0.95);
}

/* ============================================================
   WORKSPACE — DUAL PANE
============================================================ */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 32px 1fr;
  gap: 0;
  min-height: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: var(--r);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  position: relative;
}

.workspace::before {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.08) 40%,
    rgba(255,255,255,0.08) 60%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}

/* ============================================================
   CONVERTER PANE
============================================================ */
.conv-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

/* Pane header */
.pane-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-dim);
  background: linear-gradient(180deg, rgba(255,255,255,0.02) 0%, transparent 100%);
  flex-shrink: 0;
}

.pane-icon {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--bg-deep);
  border: 1px solid var(--border-dim);
  box-shadow: var(--shadow-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  color: var(--gold-dim);
  letter-spacing: 0;
  flex-shrink: 0;
}

.pane-icon svg {
  width: 10px; height: 10px;
}

.pane-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.pane-counters {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.counter-sep {
  opacity: 0.4;
}

/* View tabs (Code / Preview) */
.view-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 3px;
  background: var(--bg-void);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-inset);
}

.view-tab {
  padding: 3px 9px;
  border-radius: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: all 0.15s;
}

.view-tab:hover {
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
}

.view-tab.active {
  background: var(--bg-raised);
  color: var(--gold);
  box-shadow: var(--shadow-raised);
}

/* Textarea */
.conv-textarea {
  flex: 1;
  width: 100%;
  padding: 16px 18px;
  background: var(--bg-deep);
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-primary);
  caret-color: var(--gold);
  box-shadow: var(--shadow-inset);
  transition: color 0.15s;
  min-height: 0;
}

.conv-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.55;
  font-style: italic;
}

.conv-textarea:focus {
  color: var(--text-bright);
}

/* Output textarea — slightly different bg to distinguish */
.conv-textarea--output {
  background: var(--bg-void);
  color: var(--text-dim);
}

.conv-textarea--output:focus {
  color: var(--text-primary);
}

/* Scrollbars */
.conv-textarea::-webkit-scrollbar             { width: 5px; }
.conv-textarea::-webkit-scrollbar-track       { background: transparent; }
.conv-textarea::-webkit-scrollbar-thumb       { background: var(--bg-raised); border-radius: 3px; }
.conv-textarea::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ============================================================
   LIVE PREVIEW PANE
============================================================ */
.conv-preview {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-void);
  box-shadow: var(--shadow-inset);
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-raised) transparent;
}

.conv-preview::-webkit-scrollbar             { width: 5px; }
.conv-preview::-webkit-scrollbar-track       { background: transparent; }
.conv-preview::-webkit-scrollbar-thumb       { background: var(--bg-raised); border-radius: 3px; }

.preview-content {
  padding: 24px 28px;
  max-width: 680px;
  margin: 0 auto;
}

.preview-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.6;
  text-align: center;
  margin-top: 40px;
}

/* Preview typography — rendered Markdown/HTML */
.preview-content h1,
.preview-content h2,
.preview-content h3,
.preview-content h4,
.preview-content h5,
.preview-content h6 {
  font-family: var(--font-display);
  color: var(--text-bright);
  line-height: 1.3;
  margin: 1.4em 0 0.5em;
  font-weight: 600;
}

.preview-content h1 { font-size: 28px; }
.preview-content h2 { font-size: 22px; border-bottom: 1px solid var(--border-dim); padding-bottom: 6px; }
.preview-content h3 { font-size: 18px; }
.preview-content h4 { font-size: 15px; color: var(--text-primary); }

.preview-content p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-primary);
  margin: 0.75em 0;
}

.preview-content strong {
  color: var(--text-bright);
  font-weight: 600;
}

.preview-content em {
  color: var(--text-dim);
  font-style: italic;
}

.preview-content a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-muted);
  transition: border-color 0.15s;
}

.preview-content a:hover {
  border-color: var(--gold);
}

.preview-content code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-raised);
  color: var(--gold);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-mid);
}

.preview-content pre {
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 1em 0;
  box-shadow: var(--shadow-inset);
}

.preview-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 12.5px;
  color: var(--text-primary);
  line-height: 1.65;
}

.preview-content ul,
.preview-content ol {
  padding-left: 20px;
  margin: 0.75em 0;
}

.preview-content li {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-primary);
  margin: 0.25em 0;
}

.preview-content blockquote {
  border-left: 2px solid var(--gold-dim);
  margin: 1em 0;
  padding: 8px 16px;
  background: var(--gold-muted);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.preview-content blockquote p {
  color: var(--text-dim);
  font-style: italic;
  margin: 0;
}

.preview-content hr {
  border: none;
  border-top: 1px solid var(--border-mid);
  margin: 1.5em 0;
}

.preview-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 1em 0;
}

.preview-content th {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-hi);
  text-align: left;
}

.preview-content td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-dim);
  color: var(--text-primary);
}

/* ============================================================
   PANE DIVIDER
============================================================ */
.pane-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--bg-void);
  border-left: 1px solid var(--border-dim);
  border-right: 1px solid var(--border-dim);
  position: relative;
}

.divider-line {
  flex: 1;
  width: 1px;
  background: var(--border-dim);
}

.divider-arrow {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  box-shadow: var(--shadow-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-dim);
  flex-shrink: 0;
}

.divider-arrow svg {
  width: 10px; height: 10px;
}

/* ============================================================
   PANE FOOTER
============================================================ */
.pane-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-dim);
  background: linear-gradient(0deg, rgba(0,0,0,0.15) 0%, transparent 100%);
  flex-shrink: 0;
}

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: background 0.1s, box-shadow 0.1s, transform 0.08s, color 0.1s;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  white-space: nowrap;
}

.btn svg {
  width: 11px; height: 11px;
  flex-shrink: 0;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 9px;
}

.btn-default {
  background: var(--bg-raised);
  color: var(--text-dim);
  border-color: var(--border-mid);
  box-shadow: var(--shadow-raised);
}

.btn-default:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-hi);
}

.btn-default:active {
  box-shadow: var(--shadow-pressed);
  transform: translateY(1px);
}

.btn-gold {
  background: linear-gradient(180deg, #d4a843 0%, #9a6e28 100%);
  color: #1c0f00;
  border-color: rgba(0,0,0,0.4);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.28) inset,
    0 -1px 0 rgba(0,0,0,0.4) inset,
    0 4px 10px rgba(0,0,0,0.6),
    0 1px 3px rgba(0,0,0,0.8);
  font-weight: 500;
}

.btn-gold:hover {
  background: linear-gradient(180deg, #ddb850 0%, #a87830 100%);
}

.btn-gold:active {
  background: linear-gradient(180deg, #9a6e28 0%, #c9a84c 100%);
  box-shadow: var(--shadow-pressed);
  transform: translateY(1px);
}

.btn-danger {
  background: var(--bg-raised);
  color: #8a3a30;
  border-color: rgba(192,57,43,0.15);
  box-shadow: var(--shadow-raised);
}

.btn-danger:hover {
  background: rgba(192,57,43,0.10);
  color: #c0392b;
  border-color: rgba(192,57,43,0.28);
}

.btn-danger:active {
  box-shadow: var(--shadow-pressed);
  transform: translateY(1px);
}

/* ============================================================
   STATUS BAR
============================================================ */
.status-bar {
  grid-column: 2;
  grid-row: 2;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: var(--bg-panel);
  border: 1px solid var(--border-dim);
  border-radius: var(--r);
  box-shadow: var(--shadow-panel);
  flex-shrink: 0;
}

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

.legal-link {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.legal-link:hover { color: var(--text-dim); }

.status-cluster {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.status-sep { opacity: 0.4; }

.status-item { color: var(--text-muted); }

.status-local {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.status-local svg {
  color: var(--green);
  opacity: 0.7;
}

/* ============================================================
   TOAST NOTIFICATION
============================================================ */
.toast {
  position: fixed;
  bottom: 56px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border-hi);
  border-radius: 20px;
  box-shadow: var(--shadow-panel);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--green);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 500;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast svg { flex-shrink: 0; }

/* ============================================================
   LIGHT THEME  [data-theme="light"]
============================================================ */
[data-theme="light"] {
  --bg-void:    #F2F0E9;
  --bg-deep:    #ECEAE4;
  --bg-panel:   rgba(255,255,255,0.55);
  --bg-raised:  rgba(255,255,255,0.75);
  --bg-surface: rgba(255,255,255,0.92);

  --border-dim: rgba(44,62,80,0.07);
  --border-mid: rgba(44,62,80,0.12);
  --border-hi:  rgba(44,62,80,0.20);

  --gold:       #2C3E50;
  --gold-dim:   #546e7a;
  --gold-muted: rgba(44,62,80,0.08);
  --gold-glow:  rgba(44,62,80,0.18);

  --green:      #27ae60;
  --green-glow: rgba(39,174,96,0.30);

  --text-bright:  #1a252f;
  --text-primary: #2C3E50;
  --text-dim:     #4a6680;
  --text-muted:   #8fa9b8;

  --shadow-raised:
    0 1px 0   rgba(255,255,255,0.90) inset,
    0 -1px 0  rgba(44,62,80,0.06)   inset,
    0 1px 0   rgba(255,255,255,0.50),
    0 2px 8px rgba(44,62,80,0.10),
    0 1px 3px rgba(44,62,80,0.07);

  --shadow-inset:
    0 2px 5px rgba(44,62,80,0.07) inset,
    0 1px 2px rgba(44,62,80,0.05) inset,
    0 1px 0   rgba(255,255,255,0.70);

  --shadow-panel:
    0 1px 0    rgba(255,255,255,0.90) inset,
    0 -1px 0   rgba(44,62,80,0.04)   inset,
    0 6px 24px rgba(44,62,80,0.10),
    0 2px 6px  rgba(44,62,80,0.07),
    0 1px 0    rgba(255,255,255,0.50);

  --shadow-pressed:
    0 1px 4px rgba(44,62,80,0.10) inset,
    0 2px 8px rgba(44,62,80,0.07) inset,
    0 1px 0   rgba(255,255,255,0.40);
}

[data-theme="light"] body {
  background: var(--bg-void);
}

[data-theme="light"] body::after {
  opacity: 0.18;
  mix-blend-mode: multiply;
}

[data-theme="light"] .topbar {
  background: rgba(242,240,233,0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--border-mid);
  box-shadow:
    0 1px 0   rgba(255,255,255,0.80) inset,
    0 4px 16px rgba(44,62,80,0.08),
    0 1px 4px  rgba(44,62,80,0.06);
}

[data-theme="light"] .theme-btn.active {
  color: #2C3E50;
  box-shadow:
    0 2px 5px rgba(44,62,80,0.07) inset,
    0 1px 2px rgba(44,62,80,0.05) inset,
    0 0 6px rgba(44,62,80,0.10) inset;
}

[data-theme="light"] .theme-btn.active svg {
  filter: none;
}

[data-theme="light"] .btn-gold {
  background: linear-gradient(180deg, #2d4a63 0%, #1a2f3f 100%);
  color: #f0ede6;
  border-color: rgba(0,0,0,0.2);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.18) inset,
    0 -1px 0 rgba(0,0,0,0.25) inset,
    0 3px 8px rgba(44,62,80,0.25),
    0 1px 3px rgba(44,62,80,0.35);
}

[data-theme="light"] .btn-gold:hover {
  background: linear-gradient(180deg, #3a5a78 0%, #243d52 100%);
}

[data-theme="light"] .conv-textarea {
  background: rgba(236,234,228,0.6);
  color: var(--text-primary);
}

[data-theme="light"] .conv-textarea--output {
  background: rgba(242,240,233,0.8);
}

[data-theme="light"] .conv-preview {
  background: rgba(242,240,233,0.8);
}

[data-theme="light"] .preview-content code {
  background: rgba(44,62,80,0.07);
  color: var(--text-primary);
  border-color: var(--border-mid);
}

[data-theme="light"] .preview-content pre {
  background: rgba(44,62,80,0.04);
  border-color: var(--border-mid);
}

[data-theme="light"] .preview-content a {
  color: #1a4d7a;
  border-bottom-color: rgba(26,77,122,0.25);
}

[data-theme="light"] .preview-content blockquote {
  border-left-color: #546e7a;
  background: rgba(44,62,80,0.05);
}

[data-theme="light"] .divider-arrow {
  background: rgba(255,255,255,0.75);
}

[data-theme="light"] .pane-divider {
  background: rgba(236,234,228,0.8);
}

/* ============================================================
   MODALS
============================================================ */
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.9) translateY(6px); }
  to   { opacity: 1; transform: scale(1)   translateY(0);   }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px) brightness(0.4);
  -webkit-backdrop-filter: blur(10px) brightness(0.4);
  animation: backdrop-in 0.2s ease forwards;
}

.modal-backdrop[aria-hidden="true"] { display: none; }

.modal {
  position: relative;
  width: 380px;
  max-width: calc(100vw - 40px);
  background: rgba(20,20,28,0.92);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 12px;
  padding: 32px 28px 26px;
  box-shadow:
    0 0 0 1px   rgba(201,168,76,0.08),
    0 24px 60px rgba(0,0,0,0.85),
    0 8px  20px rgba(0,0,0,0.70),
    0 1px  0    rgba(255,255,255,0.06) inset;
  animation: modal-in 0.22s cubic-bezier(0.34,1.28,0.64,1) forwards;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.modal-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(192,57,43,0.12);
  border: 1px solid rgba(192,57,43,0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e74c3c;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.modal-icon svg { width: 20px; height: 20px; }

.modal-heading {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: 0.02em;
  margin: 0;
}

.modal-body {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--text-dim);
  letter-spacing: 0.03em;
  margin: 0;
  max-width: 300px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  width: 100%;
}

.modal-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.modal-btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border-mid);
}

.modal-btn-ghost:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
  border-color: var(--border-hi);
}

.modal-btn-danger {
  background: rgba(192,57,43,0.15);
  color: #e05a4a;
  border-color: rgba(192,57,43,0.30);
}

.modal-btn-danger:hover {
  background: rgba(192,57,43,0.28);
  border-color: rgba(192,57,43,0.50);
  color: #ff6b5b;
}

/* About modal — left-aligned, wider */
.modal--about {
  width: 480px;
  align-items: flex-start;
  text-align: left;
  gap: 0;
  padding: 36px 32px 28px;
}

.modal--about .modal-heading {
  text-align: center;
  width: 100%;
  font-size: 16px;
  letter-spacing: 0.04em;
  margin-bottom: 22px;
}

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: none;
  border: none;
  padding: 5px;
  cursor: pointer;
  color: var(--text-dim);
  line-height: 0;
  border-radius: 4px;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--text-primary); }

.about-section {
  width: 100%;
  margin-bottom: 18px;
}

.about-section-title {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin: 0 0 6px;
  font-weight: 500;
}

.modal--about .modal-body {
  text-align: left;
  max-width: none;
}

.about-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  width: 100%;
  margin-top: 10px;
  line-height: 1.75;
}

/* Modal — light ivory glass */
[data-theme="light"] .modal-backdrop {
  background: rgba(180,178,172,0.35);
  backdrop-filter: blur(10px) brightness(0.88);
  -webkit-backdrop-filter: blur(10px) brightness(0.88);
}

[data-theme="light"] .modal {
  background: rgba(245,243,238,0.97);
  border-color: rgba(44,62,80,0.12);
  box-shadow:
    0 0 0 1px rgba(44,62,80,0.05),
    0 24px 60px rgba(44,62,80,0.18),
    0 8px  20px rgba(44,62,80,0.10),
    0 1px  0   rgba(255,255,255,0.90) inset;
}

[data-theme="light"] .modal-heading { color: #1a252f; }
[data-theme="light"] .modal-body    { color: #4a6680; }

[data-theme="light"] .modal-btn-ghost {
  color: #4a6680;
  border-color: rgba(44,62,80,0.15);
}

[data-theme="light"] .modal-btn-ghost:hover {
  background: rgba(44,62,80,0.06);
  color: #2C3E50;
  border-color: rgba(44,62,80,0.25);
}

/* ============================================================
   RESPONSIVE
============================================================ */

/* Tablet ≤ 900px */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr 36px;
  }

  .sidebar-col { display: none; }

  .privacy-badge { display: none; }

  .status-cluster { display: none; }
}

/* Mobile ≤ 767px */
@media (max-width: 767px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  :root { --topbar-h: 48px; }

  .app-shell {
    position: static;
    display: flex;
    flex-direction: column;
    margin-top: var(--topbar-h);
    padding: 10px 10px 80px;
    height: auto;
    gap: 10px;
  }

  .center-col { min-height: 0; }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
    min-height: 70vh;
  }

  .pane-divider {
    flex-direction: row;
    height: 28px;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border-dim);
    border-bottom: 1px solid var(--border-dim);
  }

  .divider-line {
    flex: 1;
    width: auto;
    height: 1px;
  }

  .divider-arrow {
    transform: rotate(90deg);
  }

  .status-bar {
    grid-column: unset;
    grid-row: unset;
  }

  .nav-label { display: none; }

  .btn-nav { padding: 7px 9px; }
}

/* ============================================================
   LINE NUMBERS
============================================================ */
.textarea-wrap {
  flex: 1;
  display: flex;
  min-height: 0;
  position: relative;
}

.line-numbers {
  flex-shrink: 0;
  width: 42px;
  padding: 16px 0 16px 0;
  background: var(--bg-void);
  border-right: 1px solid var(--border-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.75;
  color: var(--text-muted);
  text-align: right;
  user-select: none;
  overflow: hidden;
}

.line-numbers span {
  display: block;
  padding-right: 8px;
  line-height: 1.75;
}

.textarea-wrap .conv-textarea {
  flex: 1;
  min-width: 0;
  border-radius: 0;
}
