/**
 * 123TinyTools Text Case Converter — Styles
 * All selectors scoped under .tia-tc-wrap or .tia-gate-overlay.
 * Brand tokens as CSS custom properties — never override theme globals.
 *
 * Dark mode architecture:
 *   Light tokens are always the default. Dark mode ONLY activates when the
 *   WordPress theme adds a class to <body>: .kt-dark-mode (Kadence),
 *   .dark-mode (generic), body[data-theme="dark"], or .is-dark (Divi/Astra).
 *   NO @media (prefers-color-scheme: dark) — OS preference alone would make
 *   plugin surfaces dark while the WP page stays light = broken mixed look.
 *   Wrap background is TRANSPARENT so the page background shows through.
 *
 * WCAG AA compliance:
 *   Muted text uses #64748B (5.9:1 on white) not #94A3B8 (2.92:1 fails).
 *
 * Version: 2.1.2
 */

/* ──────────────────────────────────────────────────────────
   LIGHT TOKENS  (scoped, never pollute global :root)
────────────────────────────────────────────────────────── */
.tia-tc-wrap,
.tia-gate-overlay {
  isolation: isolate;

  /* Blue palette */
  --tia-blue-50:  #EFF4FF;
  --tia-blue-100: #DBE8FF;
  --tia-blue-200: #B8D0FF;
  --tia-blue-400: #5B8DEF;
  --tia-blue-500: #4B7CF3;
  --tia-blue-600: #3461E8;

  /* Slate palette */
  --tia-slate-50:  #F8FAFD;
  --tia-slate-100: #F1F5F9;
  --tia-slate-200: #E4EAF4;
  --tia-slate-300: #CBD5E1;
  --tia-slate-400: #94A3B8;
  --tia-slate-500: #64748B;
  --tia-slate-600: #475569;
  --tia-slate-700: #334155;
  --tia-slate-800: #1E293B;
  --tia-slate-900: #0F172A;

  /* Status */
  --tia-success:       #22C55E;
  --tia-success-light: #DCFCE7;
  --tia-success-text:  #16A34A;
  --tia-warning:       #F59E0B;
  --tia-warning-light: #FEF3C7;
  --tia-warning-text:  #92400E;
  --tia-error:         #EF4444;
  --tia-error-light:   #FEE2E2;
  --tia-error-text:    #7F1D1D;
  --tia-info:          #0EA5E9;
  --tia-info-light:    #E0F2FE;
  --tia-info-text:     #0C4A6E;

  /* Semantic surface tokens */
  --tia-surface:      #FFFFFF;
  --tia-surface-2:    #F8FAFD;
  --tia-border:       #E4EAF4;
  --tia-border-s:     #CBD5E1;

  /* Semantic text tokens — WCAG AA compliant */
  --tia-text:         #1E293B;
  --tia-text-body:    #475569;
  --tia-text-muted:   #64748B;  /* 5.9:1 on white — AA pass */

  /* Shadows — blue-tinted */
  --tia-shadow-sm: 0 1px 2px rgba(74,124,243,.04), 0 1px 3px rgba(0,0,0,.06);
  --tia-shadow-md: 0 4px 6px rgba(74,124,243,.06), 0 2px 4px rgba(0,0,0,.06);
  --tia-shadow-lg: 0 10px 20px rgba(74,124,243,.08), 0 4px 6px rgba(0,0,0,.05);

  /* Radius */
  --tia-r-sm:   6px;
  --tia-r-md:   10px;
  --tia-r-lg:   16px;
  --tia-r-xl:   24px;
  --tia-r-full: 9999px;

  /* Typography */
  --tia-font-h: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --tia-font-b: 'Inter', system-ui, -apple-system, sans-serif;
  --tia-font-m: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  box-sizing: border-box;
  font-family: var(--tia-font-b);
  color: var(--tia-text);
  line-height: 1.6;
}

/* Box-sizing inheritance */
.tia-tc-wrap *,
.tia-tc-wrap *::before,
.tia-tc-wrap *::after,
.tia-gate-overlay *,
.tia-gate-overlay *::before,
.tia-gate-overlay *::after {
  box-sizing: border-box;
}

/* ──────────────────────────────────────────────────────────
   WRAP — transparent so page background shows through
────────────────────────────────────────────────────────── */
.tia-tc-wrap {
  background: transparent;
  color: var(--tia-text);
  padding: 0;
  width: 100%;
}

/* ──────────────────────────────────────────────────────────
   DARK MODE — THEME-CLASS ONLY
────────────────────────────────────────────────────────── */

/* Kadence dark mode */
.kt-dark-mode .tia-tc-wrap,
.kt-dark-mode .tia-gate-overlay {
  --tia-blue-50:   #172340;
  --tia-blue-100:  #1E2F55;
  --tia-blue-200:  #2A4480;
  --tia-surface:   #1E293B;
  --tia-surface-2: #162032;
  --tia-border:    #334155;
  --tia-border-s:  #475569;
  --tia-text:      #F1F5F9;
  --tia-text-body: #94A3B8;
  --tia-text-muted:#94A3B8;  /* #64748B fails ~2.6:1 on dark surface — use #94A3B8 (~5.5:1) */
  --tia-shadow-sm: 0 1px 2px rgba(0,0,0,.2), 0 1px 3px rgba(0,0,0,.3);
  --tia-shadow-md: 0 4px 6px rgba(0,0,0,.25), 0 2px 4px rgba(0,0,0,.2);
  --tia-shadow-lg: 0 10px 20px rgba(0,0,0,.3), 0 4px 6px rgba(0,0,0,.2);
  --tia-warning-light: #451a03;
  --tia-warning-text:  #FCD34D;
  --tia-error-light:   #450a0a;
  --tia-error-text:    #FCA5A5;
  --tia-info-light:    #082f49;
  --tia-info-text:     #7DD3FC;
  --tia-success-light: #052e16;
  --tia-success-text:  #86EFAC;
}

/* WPPOOL WP Dark Mode plugin */
html.wp-dark-mode-active .tia-tc-wrap,
html.wp-dark-mode-active .tia-gate-overlay,
body.wp-dark-mode-active .tia-tc-wrap,
body.wp-dark-mode-active .tia-gate-overlay {
  --tia-blue-50:   #172340;
  --tia-blue-100:  #1E2F55;
  --tia-blue-200:  #2A4480;
  --tia-surface:   #1E293B;
  --tia-surface-2: #162032;
  --tia-border:    #334155;
  --tia-border-s:  #475569;
  --tia-text:      #F1F5F9;
  --tia-text-body: #94A3B8;
  --tia-text-muted:#94A3B8;
  --tia-shadow-sm: 0 1px 2px rgba(0,0,0,.2), 0 1px 3px rgba(0,0,0,.3);
  --tia-shadow-md: 0 4px 6px rgba(0,0,0,.25), 0 2px 4px rgba(0,0,0,.2);
  --tia-shadow-lg: 0 10px 20px rgba(0,0,0,.3), 0 4px 6px rgba(0,0,0,.2);
  --tia-warning-light: #451a03;
  --tia-warning-text:  #FCD34D;
  --tia-error-light:   #450a0a;
  --tia-error-text:    #FCA5A5;
  --tia-info-light:    #082f49;
  --tia-info-text:     #7DD3FC;
  --tia-success-light: #052e16;
  --tia-success-text:  #86EFAC;
}

/* Generic dark-mode class + data attribute (html[data-theme] = Kadence primary signal) */
html[data-theme="dark"] .tia-tc-wrap,
html[data-theme="dark"] .tia-gate-overlay,
.dark-mode .tia-tc-wrap,
.dark-mode .tia-gate-overlay,
body[data-theme="dark"] .tia-tc-wrap,
body[data-theme="dark"] .tia-gate-overlay,
.is-dark .tia-tc-wrap,
.is-dark .tia-gate-overlay {
  --tia-blue-50:   #172340;
  --tia-blue-100:  #1E2F55;
  --tia-blue-200:  #2A4480;
  --tia-surface:   #1E293B;
  --tia-surface-2: #162032;
  --tia-border:    #334155;
  --tia-border-s:  #475569;
  --tia-text:      #F1F5F9;
  --tia-text-body: #94A3B8;
  --tia-text-muted:#94A3B8;
  --tia-shadow-sm: 0 1px 2px rgba(0,0,0,.2), 0 1px 3px rgba(0,0,0,.3);
  --tia-shadow-md: 0 4px 6px rgba(0,0,0,.25), 0 2px 4px rgba(0,0,0,.2);
  --tia-shadow-lg: 0 10px 20px rgba(0,0,0,.3), 0 4px 6px rgba(0,0,0,.2);
  --tia-warning-light: #451a03;
  --tia-warning-text:  #FCD34D;
  --tia-error-light:   #450a0a;
  --tia-error-text:    #FCA5A5;
  --tia-info-light:    #082f49;
  --tia-info-text:     #7DD3FC;
  --tia-success-light: #052e16;
  --tia-success-text:  #86EFAC;
}

/* ──────────────────────────────────────────────────────────
   SCREEN READER ONLY
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ──────────────────────────────────────────────────────────
   INTRO TEXT
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-intro {
  margin-bottom: 20px;
  color: var(--tia-text-body);
  font-size: 15px;
  line-height: 1.65;
}

/* ──────────────────────────────────────────────────────────
   HEADER
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.tia-tc-wrap .tia-tc-title {
  font-family: var(--tia-font-h);
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 800;
  color: var(--tia-text);
  line-height: 1.2;
  letter-spacing: -0.4px;
  margin: 0 0 4px;
  padding: 0;
  border: none;
}

.tia-tc-wrap .tia-tc-title span { color: var(--tia-blue-400); }

.tia-tc-wrap .tia-tc-subtitle {
  color: var(--tia-text-body);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.tia-tc-wrap .tia-tc-badge {
  flex-shrink: 0;
  background: var(--tia-blue-50);
  border: 1px solid var(--tia-blue-200);
  color: var(--tia-blue-600);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--tia-font-h);
  padding: 4px 10px;
  border-radius: var(--tia-r-full);
  letter-spacing: .5px;
  text-transform: uppercase;
  white-space: nowrap;
  margin-top: 4px;
  line-height: 1;
}

/* ──────────────────────────────────────────────────────────
   SVG ICONS
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-ic,
.tia-gate-overlay .tia-ic {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────────
   BUTTONS
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-btn,
.tia-gate-overlay .tia-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--tia-font-b);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--tia-r-md);
  border: 1px solid var(--tia-border);
  background: var(--tia-surface);
  color: var(--tia-text-body);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
}

.tia-tc-wrap .tia-btn:hover,
.tia-gate-overlay .tia-btn:hover {
  background: var(--tia-blue-50);
  border-color: var(--tia-blue-200);
  color: var(--tia-blue-500);
}

.tia-tc-wrap .tia-btn:focus-visible,
.tia-gate-overlay .tia-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(91,141,239,.3);
  border-color: var(--tia-blue-400);
}

.tia-tc-wrap .tia-btn-primary {
  background: var(--tia-blue-400);
  border-color: var(--tia-blue-400);
  color: #fff;
  font-weight: 600;
  border-radius: var(--tia-r-full);
  padding: 9px 22px;
  font-size: 13.5px;
  box-shadow: 0 2px 12px rgba(91,141,239,.35);
}
.tia-tc-wrap .tia-btn-primary:hover {
  background: var(--tia-blue-500);
  border-color: var(--tia-blue-500);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(91,141,239,.45);
}
.tia-tc-wrap .tia-btn-primary:focus-visible {
  box-shadow: 0 0 0 3px rgba(91,141,239,.4);
}

.tia-tc-wrap .tia-btn-danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--tia-text-muted);
}
.tia-tc-wrap .tia-btn-danger-ghost:hover {
  background: var(--tia-error-light);
  border-color: transparent;
  color: var(--tia-error);
}

.tia-tc-wrap .tia-btn-success {
  background: var(--tia-success-light) !important;
  border-color: transparent !important;
  color: var(--tia-success-text) !important;
  font-weight: 600;
}


/* ──────────────────────────────────────────────────────────
   MAIN GRID
   Desktop: input | output  then  selector (full width)
   Mobile:  input / selector / output  (stacked)
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "input  output"
    "selector selector";
  gap: 16px;
  margin-bottom: 20px;
}

.tia-tc-wrap .tia-tc-input-card  { grid-area: input; }
.tia-tc-wrap .tia-tc-output-card { grid-area: output; }
.tia-tc-wrap .tia-tc-selector    { grid-area: selector; }

/* CSS Grid items default to min-width:auto — they refuse to shrink below
   min-content width. Setting min-width:0 lets them shrink with the column. */
.tia-tc-wrap .tia-tc-input-card,
.tia-tc-wrap .tia-tc-output-card,
.tia-tc-wrap .tia-tc-selector { min-width: 0; }

/* ──────────────────────────────────────────────────────────
   CARDS — elevation via shadow only, no border
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-card {
  background: var(--tia-surface);
  border: none;
  border-radius: var(--tia-r-xl);
  box-shadow: 0 2px 20px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Card label */
.tia-tc-wrap .tia-tc-card-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--tia-text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 12px 16px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Dot indicators */
.tia-tc-wrap .tia-tc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tia-blue-400);
  flex-shrink: 0;
}
.tia-tc-wrap .tia-tc-dot-green { background: var(--tia-success); }

/* Card active badge */
.tia-tc-wrap .tia-tc-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--tia-font-h);
  padding: 3px 10px;
  border-radius: var(--tia-r-full);
  background: var(--tia-blue-400);
  border: none;
  color: #fff;
  letter-spacing: .2px;
}

/* ──────────────────────────────────────────────────────────
   TAB BAR (inside input card)
   4 controls: Text Input | Paste | Upload File | Load Sample
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-tab-bar {
  display: flex;
  flex-wrap: wrap;
  background: var(--tia-slate-50);
  padding: 0;
  gap: 0;
  border-bottom: 1px solid var(--tia-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.tia-tc-wrap .tia-tc-tab-bar::-webkit-scrollbar { display: none; }

.tia-tc-wrap .tia-tc-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  font-family: var(--tia-font-b);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--tia-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 0;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  white-space: nowrap;
}

.tia-tc-wrap .tia-tc-tab:hover {
  background: var(--tia-slate-100);
  color: var(--tia-text-body);
  border-bottom-color: var(--tia-blue-200);
}

/* Active panel tab */
.tia-tc-wrap .tia-tc-tab-active,
.tia-tc-wrap .tia-tc-tab[aria-selected="true"] {
  background: var(--tia-surface);
  color: var(--tia-blue-400);
  font-weight: 600;
  border-bottom-color: var(--tia-blue-400);
  box-shadow: none;
}

/* Action tabs (Paste, Load Sample) — never get active underline state */
.tia-tc-wrap .tia-tc-tab-action {
  color: var(--tia-text-muted);
}
.tia-tc-wrap .tia-tc-tab-action:hover {
  color: var(--tia-blue-500);
  background: var(--tia-slate-100);
  border-bottom-color: var(--tia-blue-200);
}

.tia-tc-wrap .tia-tc-tab:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(91,141,239,.3);
}

/* Tab panels */
.tia-tc-wrap .tia-tc-tabpanel {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.tia-tc-wrap .tia-tc-tabpanel[hidden] { display: none; }

/* ──────────────────────────────────────────────────────────
   TOOLBAR
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: none;
  background: var(--tia-surface-2);
  flex-wrap: wrap;
}

.tia-tc-wrap .tia-tc-toolbar-left  { display: flex; gap: 16px; flex: 1; flex-wrap: wrap; align-items: center; }
.tia-tc-wrap .tia-tc-toolbar-right { display: flex; gap: 6px; align-items: center; }
/* When Sample/Paste live in tab bar, toolbar-right is the only child → push it right */
.tia-tc-wrap .tia-tc-toolbar-right:only-child { margin-left: auto; }

/* ──────────────────────────────────────────────────────────
   TEXTAREA (input)
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-textarea {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 220px;
  max-height: 480px;
  padding: 16px 18px;
  resize: none;
  border: none;
  outline: none;
  font-family: var(--tia-font-b);
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--tia-text);
  background: var(--tia-surface-2);
  -webkit-font-smoothing: antialiased;
}

.tia-tc-wrap .tia-tc-textarea::placeholder { color: var(--tia-text-muted); }

.tia-tc-wrap .tia-tc-textarea:focus-visible {
  outline: 2px solid var(--tia-blue-400);
  outline-offset: -2px;
}

/* ──────────────────────────────────────────────────────────
   OUTPUT AREA
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-output {
  flex: 1;
  min-height: 220px;
  padding: 16px 18px;
  font-family: var(--tia-font-b);
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--tia-text);
  background: var(--tia-surface);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  cursor: default;
}

.tia-tc-wrap .tia-tc-output:focus-visible {
  outline: 2px solid var(--tia-blue-400);
  outline-offset: -2px;
}

.tia-tc-wrap .tia-tc-output.tia-tc-output-empty {
  color: var(--tia-text-muted);
  font-style: italic;
}

/* ──────────────────────────────────────────────────────────
   CARD FOOTER
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: none;
  background: var(--tia-surface-2);
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.tia-tc-wrap .tia-tc-stats {
  font-size: 12px;
  font-family: var(--tia-font-m);
  color: var(--tia-text-muted);
  display: flex;
  gap: 14px;
}
.tia-tc-wrap .tia-tc-stats strong { color: var(--tia-text-body); }

/* Live indicator */
.tia-tc-wrap .tia-tc-live-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tia-tc-wrap .tia-tc-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tia-success);
  flex-shrink: 0;
  animation: tia-tc-pulse 2s ease infinite;
}

.tia-tc-wrap .tia-tc-live-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tia-success);
}

@keyframes tia-tc-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,.4); }
  50%       { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

/* ──────────────────────────────────────────────────────────
   UPLOAD ZONE (inside tab panel)
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-upload-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 36px 24px;
  border: 1.5px dashed var(--tia-border-s);
  border-radius: 0;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--tia-surface);
  position: relative;
  min-height: 200px;
}

.tia-tc-wrap .tia-tc-upload-zone:hover,
.tia-tc-wrap .tia-tc-upload-zone.drag {
  border-color: var(--tia-blue-400);
  background: var(--tia-blue-50);
}

.tia-tc-wrap .tia-tc-upload-zone:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 3px rgba(91,141,239,.3);
  border-color: var(--tia-blue-400);
}

.tia-tc-wrap .tia-tc-upload-icon { color: var(--tia-text-muted); }

.tia-tc-wrap .tia-tc-upload-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--tia-text-body);
  margin: 0;
}
.tia-tc-wrap .tia-tc-upload-text strong { color: var(--tia-blue-400); }

.tia-tc-wrap .tia-tc-upload-sub {
  font-size: 12px;
  color: var(--tia-text-muted);
  margin: 0;
}

.tia-tc-wrap .tia-tc-upload-types {
  display: flex;
  justify-content: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.tia-tc-wrap .tia-type-badge {
  font-family: var(--tia-font-m);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--tia-r-sm);
  background: var(--tia-slate-100);
  color: var(--tia-text-muted);
  border: 1px solid var(--tia-border);
}

.tia-tc-wrap .tia-tc-upload-zone.loading {
  pointer-events: none;
  opacity: .7;
}

/* ──────────────────────────────────────────────────────────
   CASE SELECTOR DROPDOWN
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-selector {
  position: relative;
}

/* Trigger button */
.tia-tc-wrap .tia-selector-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  background: var(--tia-surface);
  border: none;
  border-radius: var(--tia-r-xl);
  box-shadow: 0 2px 20px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  cursor: pointer;
  text-align: left;
  transition: background .15s, box-shadow .15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.tia-tc-wrap .tia-selector-trigger:hover {
  background: var(--tia-blue-50);
  box-shadow: 0 4px 24px rgba(91,141,239,.14), 0 1px 4px rgba(0,0,0,.04);
}

.tia-tc-wrap .tia-selector-trigger:focus-visible {
  box-shadow: 0 0 0 3px rgba(91,141,239,.35), 0 2px 20px rgba(0,0,0,.07);
}

.tia-tc-wrap .tia-selector-trigger[aria-expanded="true"] {
  border-radius: var(--tia-r-xl) var(--tia-r-xl) 0 0;
  background: var(--tia-blue-50);
  box-shadow: 0 4px 0 var(--tia-blue-200);
}

/* Trigger icon */
.tia-tc-wrap .tia-selector-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--tia-r-md);
  background: var(--tia-blue-50);
  border: 1.5px solid var(--tia-blue-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tia-blue-400);
  flex-shrink: 0;
  transition: background .2s, border-color .2s, color .2s;
}

.tia-tc-wrap .tia-selector-trigger[aria-expanded="true"] .tia-selector-icon,
.tia-tc-wrap .tia-selector-trigger.has-selection .tia-selector-icon {
  background: var(--tia-blue-400);
  border-color: var(--tia-blue-400);
  color: #fff;
}

/* ── No-selection state: amber icon + pulsing ring draws attention ── */
@keyframes tia-selector-pulse {
  0%, 100% { box-shadow: 0 2px 20px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04),
                          0 0 0 1.5px rgba(245,158,11,.30); }
  50%       { box-shadow: 0 4px 24px rgba(245,158,11,.16), 0 1px 4px rgba(0,0,0,.04),
                          0 0 0 2.5px rgba(245,158,11,.50); }
}

.tia-tc-wrap .tia-selector-trigger:not(.has-selection) {
  animation: tia-selector-pulse 2.8s ease-in-out infinite;
}
.tia-tc-wrap .tia-selector-trigger:not(.has-selection) .tia-selector-icon {
  background: var(--tia-warning-light);
  border-color: var(--tia-warning);
  color: var(--tia-warning-text);
}
/* Stop animation once a case is chosen */
.tia-tc-wrap .tia-selector-trigger.has-selection {
  animation: none;
}

/* Trigger info */
.tia-tc-wrap .tia-selector-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tia-tc-wrap .tia-selector-label {
  font-family: var(--tia-font-h);
  font-size: 14px;
  font-weight: 700;
  color: var(--tia-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.tia-tc-wrap .tia-selector-preview {
  font-family: var(--tia-font-m);
  font-size: 11px;
  color: var(--tia-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Count badge */
.tia-tc-wrap .tia-selector-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--tia-blue-400);
  background: var(--tia-blue-50);
  border: 1px solid var(--tia-blue-200);
  padding: 3px 8px;
  border-radius: var(--tia-r-full);
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity .15s;
}

/* Chevron */
.tia-tc-wrap .tia-selector-chevron {
  flex-shrink: 0;
  color: var(--tia-text-muted);
  transition: transform .2s ease;
}

.tia-tc-wrap .tia-selector-trigger[aria-expanded="true"] .tia-selector-chevron {
  transform: rotate(180deg);
}

/* Dropdown panel */
.tia-tc-wrap .tia-selector-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--tia-surface);
  border-radius: 0 0 var(--tia-r-xl) var(--tia-r-xl);
  box-shadow: 0 16px 48px rgba(0,0,0,.15), 0 4px 12px rgba(0,0,0,.08);
  z-index: 200;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 8px;
  max-height: 320px;
  overflow-y: auto;
  animation: tia-selector-open .16s ease;
}

.tia-tc-wrap .tia-selector-panel[hidden] { display: none; }

@keyframes tia-selector-open {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Option */
.tia-tc-wrap .tia-selector-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: var(--tia-r-lg);
  background: var(--tia-surface-2);
  cursor: pointer;
  transition: background .12s, transform .12s;
  outline: none;
  position: relative;
}

.tia-tc-wrap .tia-selector-option:hover {
  background: var(--tia-blue-50);
  transform: translateY(-1px);
}

.tia-tc-wrap .tia-selector-option:focus-visible {
  box-shadow: 0 0 0 2px var(--tia-blue-400);
}

/* Selected option */
.tia-tc-wrap .tia-selector-option[aria-selected="true"] {
  background: var(--tia-blue-400);
  transform: none;
}

.tia-tc-wrap .tia-selector-option[aria-selected="true"] .tia-opt-name    { color: #fff; }
.tia-tc-wrap .tia-selector-option[aria-selected="true"] .tia-opt-preview  { color: rgba(255,255,255,.75); }
.tia-tc-wrap .tia-selector-option[aria-selected="true"] .tia-opt-desc     { color: rgba(255,255,255,.65); }

.tia-tc-wrap .tia-selector-option[aria-selected="true"]::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
}

/* Keyboard focus highlight (not selected) */
.tia-tc-wrap .tia-selector-option.tia-opt-focused:not([aria-selected="true"]) {
  background: var(--tia-blue-100);
  outline: 2px solid var(--tia-blue-400);
  outline-offset: -2px;
}

.tia-tc-wrap .tia-opt-name {
  font-family: var(--tia-font-h);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--tia-text);
  line-height: 1.2;
}

.tia-tc-wrap .tia-opt-preview {
  font-family: var(--tia-font-m);
  font-size: 12px;
  color: var(--tia-text-muted);
  background: none;
  padding: 0;
  border: none;
  line-height: 1.3;
}

.tia-tc-wrap .tia-opt-desc {
  font-size: 11.5px;
  color: var(--tia-text-muted);
  line-height: 1.3;
}

/* ──────────────────────────────────────────────────────────
   QUICK COPY ROW
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-quick-row {
  background: var(--tia-surface);
  border: none;
  border-radius: var(--tia-r-lg);
  padding: 14px 18px;
  box-shadow: 0 2px 16px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tia-tc-wrap .tia-tc-quick-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--tia-text-body);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.tia-tc-wrap .tia-tc-quick-label .tia-ic { color: var(--tia-blue-400); }

.tia-tc-wrap .tia-tc-quick-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-end;
}

.tia-tc-wrap .tia-quick-copy-btn {
  font-size: 11.5px;
  padding: 4px 10px;
}

/* ──────────────────────────────────────────────────────────
   EXPORT ROW
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-export-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--tia-surface);
  border: none;
  border-radius: var(--tia-r-lg);
  box-shadow: 0 2px 16px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tia-tc-wrap .tia-export-row-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tia-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.tia-tc-wrap .tia-export-row-label .tia-ic { color: var(--tia-blue-400); }

.tia-tc-wrap .tia-export-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ──────────────────────────────────────────────────────────
   ALERT BANNERS
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--tia-r-md);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
  border: 1px solid transparent;
}
.tia-tc-wrap .tia-tc-alert-warn  { background: var(--tia-warning-light); border-color: var(--tia-warning); color: var(--tia-warning-text); }
.tia-tc-wrap .tia-tc-alert-error { background: var(--tia-error-light);   border-color: var(--tia-error);   color: var(--tia-error-text); }
.tia-tc-wrap .tia-tc-alert-info  { background: var(--tia-info-light);    border-color: var(--tia-info);    color: var(--tia-info-text); }

/* ──────────────────────────────────────────────────────────
   SEO CONTENT SECTION
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-seo-content {
  margin-top: 32px;
  padding: 32px;
  background: var(--tia-surface);
  border-radius: var(--tia-r-xl);
  box-shadow: 0 2px 20px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  color: var(--tia-text-body);
  font-size: 15px;
  line-height: 1.7;
}

.tia-tc-wrap .tia-tc-seo-content h2 {
  font-family: var(--tia-font-h);
  font-size: clamp(18px, 2.5vw, 22px);
  font-weight: 800;
  color: var(--tia-text);
  margin: 0 0 16px;
  padding: 0;
  line-height: 1.25;
  letter-spacing: -0.3px;
  border: none;
}

.tia-tc-wrap .tia-tc-seo-content h3 {
  font-family: var(--tia-font-h);
  font-size: 16px;
  font-weight: 700;
  color: var(--tia-text);
  margin: 28px 0 10px;
  padding: 0;
  line-height: 1.3;
  border: none;
}

.tia-tc-wrap .tia-tc-seo-content h3:first-of-type { margin-top: 24px; }

.tia-tc-wrap .tia-tc-seo-content p {
  margin: 0 0 14px;
  color: var(--tia-text-body);
}

.tia-tc-wrap .tia-tc-seo-content strong { color: var(--tia-text); font-weight: 600; }

.tia-tc-wrap .tia-tc-seo-content ol,
.tia-tc-wrap .tia-tc-seo-content ul {
  padding-left: 24px;
  margin: 0 0 14px;
}

.tia-tc-wrap .tia-tc-seo-content li { margin-bottom: 6px; color: var(--tia-text-body); }

.tia-tc-wrap .tia-tc-seo-content a {
  color: var(--tia-blue-500);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tia-tc-wrap .tia-tc-seo-content a:hover { color: var(--tia-blue-600); }

/* ──────────────────────────────────────────────────────────
   FAQ ACCORDION
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-faq-section {
  margin-top: 28px;
}

.tia-tc-wrap .tia-tc-faq-heading {
  font-family: var(--tia-font-h);
  font-size: 18px;
  font-weight: 800;
  color: var(--tia-text);
  margin: 0 0 14px;
  padding: 0;
  border: none;
}

.tia-tc-wrap .tia-tc-faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tia-tc-wrap .tia-tc-faq-item {
  background: var(--tia-surface);
  border: none;
  border-radius: var(--tia-r-lg);
  box-shadow: 0 2px 12px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  overflow: hidden;
  transition: box-shadow .2s;
}

.tia-tc-wrap .tia-tc-faq-item[open] {
  box-shadow: 0 4px 20px rgba(91,141,239,.12), 0 1px 4px rgba(0,0,0,.04);
}

.tia-tc-wrap .tia-tc-faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  font-family: var(--tia-font-h);
  font-size: 15px;
  font-weight: 700;
  color: var(--tia-text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-user-select: none;
  gap: 12px;
  transition: color .15s, background .15s;
}

/* Remove default triangle marker */
.tia-tc-wrap .tia-tc-faq-q::-webkit-details-marker { display: none; }
.tia-tc-wrap .tia-tc-faq-q::marker { display: none; }

/* Chevron via pseudo-element */
.tia-tc-wrap .tia-tc-faq-q::after {
  content: '';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: transform .2s ease;
}

.tia-tc-wrap .tia-tc-faq-item[open] .tia-tc-faq-q::after {
  transform: rotate(180deg);
}

.tia-tc-wrap .tia-tc-faq-q:hover {
  color: var(--tia-blue-500);
  background: var(--tia-blue-50);
}

.tia-tc-wrap .tia-tc-faq-item[open] .tia-tc-faq-q {
  color: var(--tia-blue-500);
  border-bottom: 1px solid var(--tia-border);
}

.tia-tc-wrap .tia-tc-faq-q:focus-visible {
  outline: 2px solid var(--tia-blue-400);
  outline-offset: -2px;
}

.tia-tc-wrap .tia-tc-faq-a {
  padding: 16px 20px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--tia-text-body);
  background: var(--tia-surface-2);
  animation: tia-faq-open .18s ease;
}

@keyframes tia-faq-open {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────────────────────
   RELATED TOOLS
────────────────────────────────────────────────────────── */
.tia-tc-wrap .tia-tc-related {
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--tia-surface);
  border: 1px solid var(--tia-border);
  border-radius: var(--tia-r-lg);
}

.tia-tc-wrap .tia-related-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--tia-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}

.tia-tc-wrap .tia-related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tia-tc-wrap .tia-related-tool {
  font-size: 13px;
  color: var(--tia-blue-500);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--tia-r-full);
  border: 1px solid var(--tia-blue-200);
  background: var(--tia-blue-50);
  transition: background .15s, color .15s;
}
.tia-tc-wrap .tia-related-tool:hover {
  background: var(--tia-blue-400);
  color: #fff;
  border-color: var(--tia-blue-400);
}
.tia-tc-wrap .tia-related-tool:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(91,141,239,.3);
}

/* ──────────────────────────────────────────────────────────
   BLURRED STATE (when gate fires)
────────────────────────────────────────────────────────── */
.tia-tc-wrap.tia-tc-blurred {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

/* ──────────────────────────────────────────────────────────
   GATE OVERLAY
────────────────────────────────────────────────────────── */
.tia-gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.tia-gate-modal {
  background: var(--tia-surface);
  border-radius: var(--tia-r-xl);
  box-shadow: var(--tia-shadow-lg);
  max-width: 420px;
  width: 100%;
  position: relative;
  overflow: hidden;
  animation: tia-gate-in .22s ease;
}

@keyframes tia-gate-in {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}

.tia-gate-header {
  padding: 28px 28px 20px;
  text-align: center;
  border-bottom: 1px solid var(--tia-border);
}

.tia-gate-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--tia-blue-50);
  border: 1px solid var(--tia-blue-200);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: var(--tia-blue-400);
}

.tia-gate-title {
  font-family: var(--tia-font-h);
  font-size: 19px;
  font-weight: 800;
  color: var(--tia-text);
  margin-bottom: 6px;
}

.tia-gate-sub {
  font-size: 14px;
  color: var(--tia-text-body);
  line-height: 1.5;
}

.tia-gate-body {
  padding: 22px 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tia-gate-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--tia-slate-100);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--tia-text-muted);
  transition: background .15s, color .15s;
  padding: 0;
  outline: none;
}
.tia-gate-close:hover { background: var(--tia-slate-200); color: var(--tia-text-body); }
.tia-gate-close:focus-visible { box-shadow: 0 0 0 3px rgba(91,141,239,.3); }

.tia-gate-btn {
  width: 100%;
  padding: 12px 20px;
  border-radius: var(--tia-r-md);
  font-family: var(--tia-font-h);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background .15s, color .15s, box-shadow .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.tia-gate-btn-primary { background: var(--tia-blue-400); color: #fff; }
.tia-gate-btn-primary:hover { background: var(--tia-blue-500); }
.tia-gate-btn-primary:focus-visible { box-shadow: 0 0 0 3px rgba(91,141,239,.4); }

.tia-gate-btn-outline {
  background: transparent;
  color: var(--tia-text-body);
  border: 1.5px solid var(--tia-border-s);
}
.tia-gate-btn-outline:hover { background: var(--tia-surface-2); color: var(--tia-text); }
.tia-gate-btn-outline:focus-visible { box-shadow: 0 0 0 3px rgba(91,141,239,.25); }

.tia-gate-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--tia-text-muted);
  font-size: 12px;
  margin: 2px 0;
}
.tia-gate-divider::before,
.tia-gate-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--tia-border);
}

.tia-gate-social { margin-bottom: 2px; }
.tia-gate-social > * { max-width: 100%; }

/* ──────────────────────────────────────────────────────────
   DARK MODE ELEMENT OVERRIDES
   (badge + FAQ — token-flip alone is insufficient)
────────────────────────────────────────────────────────── */

/* Badge: --tia-blue-600 not flipped → medium blue on dark navy fails WCAG AA */
.kt-dark-mode .tia-tc-wrap .tia-tc-badge,
html.wp-dark-mode-active .tia-tc-wrap .tia-tc-badge,
body.wp-dark-mode-active .tia-tc-wrap .tia-tc-badge,
html[data-theme="dark"] .tia-tc-wrap .tia-tc-badge,
.dark-mode .tia-tc-wrap .tia-tc-badge,
body[data-theme="dark"] .tia-tc-wrap .tia-tc-badge,
.is-dark .tia-tc-wrap .tia-tc-badge {
  background: rgba(91,141,239,.15);
  border-color: rgba(91,141,239,.30);
  color: #93BBFD;
}

/* FAQ hover/open: dark blue text on dark navy bg fails AA */
.kt-dark-mode .tia-tc-wrap .tia-tc-faq-q:hover,
html.wp-dark-mode-active .tia-tc-wrap .tia-tc-faq-q:hover,
body.wp-dark-mode-active .tia-tc-wrap .tia-tc-faq-q:hover,
html[data-theme="dark"] .tia-tc-wrap .tia-tc-faq-q:hover,
.dark-mode .tia-tc-wrap .tia-tc-faq-q:hover,
body[data-theme="dark"] .tia-tc-wrap .tia-tc-faq-q:hover,
.is-dark .tia-tc-wrap .tia-tc-faq-q:hover,
.kt-dark-mode .tia-tc-wrap .tia-tc-faq-item[open] .tia-tc-faq-q,
html.wp-dark-mode-active .tia-tc-wrap .tia-tc-faq-item[open] .tia-tc-faq-q,
body.wp-dark-mode-active .tia-tc-wrap .tia-tc-faq-item[open] .tia-tc-faq-q,
html[data-theme="dark"] .tia-tc-wrap .tia-tc-faq-item[open] .tia-tc-faq-q,
.dark-mode .tia-tc-wrap .tia-tc-faq-item[open] .tia-tc-faq-q,
body[data-theme="dark"] .tia-tc-wrap .tia-tc-faq-item[open] .tia-tc-faq-q,
.is-dark .tia-tc-wrap .tia-tc-faq-item[open] .tia-tc-faq-q { background: rgba(91,141,239,.20) !important; color: #93BBFD !important; }

/* ──────────────────────────────────────────────────────────
   RESPONSIVE
────────────────────────────────────────────────────────── */

/* ── tablet: center heading, stack grid, 3-col selector ── */
@media (max-width: 768px) {
  .tia-tc-wrap .tia-tc-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
  }
  .tia-tc-wrap .tia-tc-badge { align-self: center; }
  .tia-tc-wrap .tia-tc-subtitle { text-align: center; }

  .tia-tc-wrap .tia-tc-main-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "input"
      "selector"
      "output";
  }
  /* 3-col dropdown options on tablet */
  .tia-tc-wrap .tia-selector-panel {
    grid-template-columns: repeat(3, 1fr);
  }
  .tia-tc-wrap .tia-tc-export-row { flex-wrap: wrap; }
  /* Hide count badge — saves space on narrower layouts */
  .tia-tc-wrap .tia-selector-count { display: none; }
}

/* ── large phone ── */
@media (max-width: 540px) {
  .tia-tc-wrap { overflow-x: hidden; }
  /* overflow-x only — overflow: hidden clips textarea vertical resize */
  .tia-tc-wrap .tia-tc-card { min-width: 0; overflow-x: hidden; }
  .tia-tc-wrap .tia-tc-quick-row  { flex-direction: column; align-items: flex-start; }
  .tia-tc-wrap .tia-tc-quick-btns { justify-content: flex-start; flex-wrap: wrap; }
  .tia-gate-modal                  { max-width: 100%; }
  .tia-gate-header                 { padding: 22px 20px 16px; }
  .tia-gate-body                   { padding: 18px 20px 22px; }
  /* 1-col dropdown options on phone — full width, easy tap target */
  .tia-tc-wrap .tia-selector-panel { grid-template-columns: repeat(1, 1fr); }
  .tia-tc-wrap .tia-tc-seo-content { padding: 20px 18px; }
  .tia-tc-wrap .tia-tc-faq-q       { font-size: 14px; padding: 14px 16px; }
  .tia-tc-wrap .tia-tc-faq-a       { padding: 14px 16px; }
  .tia-tc-wrap .tia-tc-toolbar     { padding: 8px 10px; gap: 4px; flex-wrap: wrap; }
  .tia-tc-wrap .tia-btn            { font-size: 12px; padding: 5px 10px; }
  .tia-tc-wrap .tia-tc-toolbar-left { gap: 12px; }
  .tia-tc-wrap .tia-selector-trigger { min-width: 0; }
  /* 4-tab bar: compact, wrap to 2×2 */
  .tia-tc-wrap .tia-tc-tab { padding: 10px 10px; font-size: 12px; flex: 1 1 calc(50% - 4px); justify-content: center; }
  .tia-tc-wrap .tia-tc-textarea,
  .tia-tc-wrap .tia-tc-output      { min-height: 160px; }
}

/* ── small phone ── */
@media (max-width: 360px) {
  .tia-tc-wrap .tia-tc-toolbar    { padding: 8px 10px; gap: 4px; }
  .tia-tc-wrap .tia-btn           { font-size: 12px; padding: 5px 10px; }
  .tia-tc-wrap .tia-selector-trigger { padding: 12px 14px; gap: 10px; }
  .tia-tc-wrap .tia-tc-tab        { padding: 9px 8px; font-size: 11.5px; flex: 1 1 calc(50% - 3px); }
}

/* ──────────────────────────────────────────────────────────
   PRINT
────────────────────────────────────────────────────────── */
@media print {
  .tia-tc-wrap .tia-tc-toolbar,
  .tia-tc-wrap .tia-tc-selector,
  .tia-tc-wrap .tia-tc-quick-row,
  .tia-tc-wrap .tia-tc-export-row,
  .tia-gate-overlay {
    display: none !important;
  }
  .tia-tc-wrap .tia-tc-main-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "input" "output";
  }
  .tia-tc-wrap .tia-tc-card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
