:root {
  --primary: #ee4d2d;
  --primary-dark: #d33d20;
  --primary-light: #fff5f3;
  --accent: #f69113;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface-soft: #f8f8f8;
  --text: #1f2937;
  --text-soft: #6b7280;
  --muted: #9ca3af;
  --border: #e5e7eb;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow: 0 12px 32px rgba(31, 41, 55, .07);
  --radius-lg: 18px;
  --radius-md: 12px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell {
  width: 100%;
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar {
  min-height: 70px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
}

.brand-block { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(238, 77, 45, .22);
}
.brand-mark svg { width: 23px; height: 23px; }
.brand-block h1 {
  margin: 0;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -.3px;
}
.brand-block p { margin: 3px 0 0; color: var(--text-soft); font-size: 12px; }
.top-actions { display: flex; gap: 8px; }

.workspace {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, .82fr) minmax(520px, 1.18fr);
  gap: 16px;
}

.panel {
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}

.input-panel { display: flex; flex-direction: column; gap: 14px; }
.output-panel { display: flex; flex-direction: column; gap: 12px; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 {
  margin: 2px 0 0;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 18px;
  letter-spacing: -.25px;
}
.eyebrow { color: var(--primary); font-size: 11px; font-weight: 700; letter-spacing: .9px; }
.counter {
  padding: 5px 9px;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

textarea {
  width: 100%;
  flex: 1;
  min-height: 180px;
  padding: 14px;
  resize: none;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: .2s ease;
}
textarea:focus, select:focus, input:focus {
  border-color: rgba(238, 77, 45, .65);
  box-shadow: 0 0 0 4px rgba(238, 77, 45, .08);
  background: var(--surface);
}
textarea::placeholder { color: var(--muted); }

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field span { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.field select, .field input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}
.custom-field { grid-column: 1 / -1; }
.is-hidden { display: none !important; }

.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.check-option {
  min-height: 36px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 12px;
  user-select: none;
}
.check-option input { accent-color: var(--primary); }

.btn {
  height: 40px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
  white-space: nowrap;
}
.icon-btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
  flex: 0 0 40px;
}
.icon-btn svg { width: 19px; height: 19px; }

.tooltip { position: relative; }
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  z-index: 100;
  max-width: 220px;
  padding: 6px 9px;
  color: #fff;
  background: #1f2937;
  border-radius: 7px;
  box-shadow: 0 7px 20px rgba(31, 41, 55, .2);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.tooltip:hover::after,
.tooltip:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.tooltip[data-tooltip-position="bottom"]::after {
  top: calc(100% + 7px);
  bottom: auto;
  transform: translate(-50%, -4px);
}
.tooltip[data-tooltip-position="bottom"]:hover::after,
.tooltip[data-tooltip-position="bottom"]:focus-visible::after {
  transform: translate(-50%, 0);
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { cursor: not-allowed; opacity: .46; }
.btn-primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 7px 16px rgba(238, 77, 45, .18);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { color: var(--text); background: var(--surface); border-color: var(--border); }
.btn-secondary:hover:not(:disabled), .btn-ghost:hover:not(:disabled) { background: var(--surface-soft); border-color: #d7dbe1; }
.btn-ghost { color: var(--text-soft); background: transparent; border-color: var(--border); }
.danger-soft { color: var(--danger); }
.btn-large { width: auto; min-width: 150px; height: 44px; padding: 0 18px; margin-top: auto; align-self: flex-end; flex: 0 0 44px; border-radius: 12px; }

.result-meta { display: flex; align-items: center; gap: 7px; color: var(--text-soft); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status-dot.active { background: var(--success); box-shadow: 0 0 0 4px rgba(34,197,94,.12); }

.table-wrap {
  position: relative;
  flex: 1;
  min-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: #d7dbe1; border-radius: 999px; border: 2px solid var(--surface); }
.table-wrap::-webkit-scrollbar-track { background: transparent; }

.empty-state {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 30px;
  text-align: center;
  color: var(--text-soft);
}
.empty-icon {
  width: 52px;
  height: 52px;
  margin-bottom: 10px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 16px;
}
.empty-icon svg { width: 27px; height: 27px; }
.empty-state h3 { margin: 0; color: var(--text); font-family: "Plus Jakarta Sans", Arial, sans-serif; font-size: 15px; }
.empty-state p { margin: 6px 0 0; max-width: 320px; font-size: 12px; }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
thead { position: sticky; top: 0; z-index: 2; }
th {
  min-width: 150px;
  padding: 9px;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: left;
}
th:first-child { min-width: 58px; width: 58px; }
th:last-child, td:last-child { border-right: 0; }
.column-header { position: relative; }
th input {
  width: 100%;
  min-width: 100px;
  height: 32px;
  padding: 0 38px 0 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  outline: none;
}
th input:hover, th input:focus { background: #fff; border-color: var(--border); }
.column-copy-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  z-index: 4;
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(31, 41, 55, .08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) scale(.92);
  transition: opacity .15s ease, transform .15s ease, background .15s ease, visibility .15s ease;
}
.column-copy-btn svg { width: 15px; height: 15px; }
.column-copy-btn:hover,
.column-copy-btn:focus-visible {
  color: var(--primary);
  background: var(--primary-light);
  border-color: #ffd4ca;
  outline: none;
}
.column-header:hover .column-copy-btn,
.column-header:focus-within .column-copy-btn {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
  white-space: pre-wrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fffaf8; }
.row-num { width: 58px; min-width: 58px; text-align: center; color: var(--muted); background: #fcfcfc; }

.output-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 16px);
  padding: 10px 14px;
  color: #fff;
  background: #1f2937;
  border-radius: 10px;
  box-shadow: 0 12px 26px rgba(0,0,0,.18);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  body { overflow: auto; }
  .app-shell { min-height: 100%; height: auto; padding: 10px; gap: 10px; }
  .topbar { min-height: 62px; border-radius: 14px; padding: 10px 12px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-block h1 { font-size: 17px; }
  .brand-block p { display: none; }
  .top-actions .btn { width: 40px; padding: 0; }
  .top-actions .btn svg { margin: 0; }
  .workspace { display: flex; flex-direction: column; }
  .panel { padding: 14px; border-radius: 14px; }
  textarea { min-height: 250px; }
  .table-wrap { min-height: 340px; max-height: 55vh; }
}

@media (max-width: 560px) {
  .settings-grid { grid-template-columns: 1fr; }
  .custom-field { grid-column: auto; }
  .option-row { display: grid; grid-template-columns: 1fr 1fr; }
  .check-option:last-child { grid-column: 1 / -1; }
  .output-head { align-items: flex-start; }
  .result-meta { padding-top: 3px; }
  .output-actions { justify-content: flex-end; }
  .btn-large { width: 100%; align-self: stretch; }
}


@media (hover: none) {
  .column-copy-btn {
    opacity: .82;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(-50%) scale(1);
  }
  .tooltip::after { display: none; }
}

/* v2.0 modular parser + Change Case */
.module-badge {
  min-height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.case-toolbar {
  min-height: 54px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
}
.case-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.case-title > div { min-width: 0; }
.case-title strong { display: block; font-size: 12px; color: var(--text); }
.case-title small { display: block; margin-top: 1px; color: var(--text-soft); font-size: 10px; white-space: nowrap; }
.case-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid #ffdcd4;
  border-radius: 9px;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
}
.case-controls { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: 0; }
.case-controls select {
  height: 36px;
  max-width: 150px;
  padding: 0 30px 0 9px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  font-size: 12px;
}
.compact-btn { width: 36px; min-width: 36px; height: 36px; flex-basis: 36px; }

@media (max-width: 900px) {
  .module-badge { display: none; }
  .case-toolbar { align-items: flex-start; flex-direction: column; }
  .case-controls { width: 100%; justify-content: stretch; }
  .case-controls select { flex: 1; max-width: none; min-width: 0; }
}

@media (max-width: 560px) {
  .case-title small { white-space: normal; }
  .case-controls { display: grid; grid-template-columns: 1fr 1fr 36px; }
}

/* v2.1 file-path parser + Find & Replace + sorting */
.data-tools {
  padding: 9px 10px;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 1px minmax(250px, .72fr);
  align-items: center;
  gap: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
}
.tool-block { min-width: 0; display: flex; align-items: center; gap: 10px; }
.tool-heading { min-width: 118px; display: flex; align-items: center; gap: 8px; }
.tool-heading > div { min-width: 0; }
.tool-heading strong { display: block; color: var(--text); font-size: 11px; white-space: nowrap; }
.tool-heading small { display: block; margin-top: 1px; color: var(--text-soft); font-size: 9px; white-space: nowrap; }
.tool-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid #ffdcd4;
  border-radius: 9px;
}
.tool-icon svg { width: 16px; height: 16px; }
.tools-divider { width: 1px; height: 34px; background: var(--border); }
.replace-controls {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(100px, .8fr) minmax(105px, 1fr) minmax(105px, 1fr) 36px 36px;
  gap: 6px;
}
.replace-controls select,
.replace-controls input,
.sort-controls select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 9px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  font-size: 11px;
}
.replace-controls select { padding-right: 28px; }
.replace-controls input::placeholder { color: var(--muted); }
.sort-block { justify-content: space-between; }
.sort-block .tool-heading { min-width: 96px; }
.sort-controls { min-width: 0; display: flex; align-items: center; gap: 6px; }
.sort-controls select { min-width: 100px; max-width: 125px; padding-right: 28px; }
.sort-btn {
  width: 42px;
  min-width: 42px;
  height: 36px;
  padding: 0 5px;
  gap: 2px;
  font-size: 9px;
  flex: 0 0 42px;
}
.sort-btn svg { width: 13px; height: 13px; }
.cell-match {
  background: #fff1b8 !important;
  box-shadow: inset 0 0 0 1px #f2c94c;
}

@media (max-width: 1180px) {
  .data-tools { grid-template-columns: 1fr; }
  .tools-divider { width: 100%; height: 1px; }
  .sort-block { justify-content: flex-start; }
  .sort-controls { flex: 1; justify-content: flex-end; }
}

@media (max-width: 900px) {
  .data-tools { padding: 9px; }
  .tool-block { align-items: flex-start; flex-direction: column; }
  .tool-heading { min-width: 0; }
  .replace-controls, .sort-controls { width: 100%; }
  .sort-controls { justify-content: stretch; }
  .sort-controls select { flex: 1; max-width: none; }
}

@media (max-width: 560px) {
  .replace-controls {
    grid-template-columns: 1fr 1fr 36px 36px;
  }
  .replace-controls select { grid-column: 1 / -1; }
  .sort-controls { display: grid; grid-template-columns: 1fr 42px 42px; }
  .tool-heading small { white-space: normal; }
}

/* v2.2 compact popup tools */
.output-panel { position: relative; }
.tool-launcher {
  min-height: 40px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
}
.tool-launch-btn {
  position: relative;
  background: var(--surface-soft);
}
.tool-launch-btn.is-active {
  color: var(--primary);
  background: var(--primary-light);
  border-color: #ffd4ca;
  box-shadow: 0 0 0 3px rgba(238, 77, 45, .06);
}
.tool-aa {
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1;
}
.tool-popover-layer {
  position: relative;
  height: 0;
  z-index: 30;
}
.tool-popover {
  position: absolute;
  top: 0;
  right: 0;
  width: min(430px, 100%);
  padding: 13px;
  background: rgba(255, 255, 255, .98);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(31, 41, 55, .16);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: toolPopupIn .16s ease-out;
}
#replacePopup { width: min(500px, 100%); }
@keyframes toolPopupIn {
  from { opacity: 0; transform: translateY(-5px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.popup-title { min-width: 0; display: flex; align-items: center; gap: 9px; }
.popup-title > div { min-width: 0; }
.popup-title strong { display: block; font-size: 12px; color: var(--text); }
.popup-title small { display: block; margin-top: 1px; color: var(--text-soft); font-size: 10px; }
.popup-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid #ffdcd4;
  border-radius: 9px;
}
.popup-icon svg { width: 16px; height: 16px; }
.popup-close {
  width: 32px;
  height: 32px;
  padding: 0;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
}
.popup-close:hover,
.popup-close:focus-visible {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--border);
  outline: none;
}
.popup-close svg { width: 17px; height: 17px; }
.popup-controls { width: 100%; }
.case-toolbar { min-height: 0; }
.case-controls.popup-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px;
  justify-content: stretch;
}
.case-controls.popup-controls select { width: 100%; max-width: none; }
.replace-controls.popup-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.replace-controls.popup-controls select { grid-column: 1 / -1; }
.replace-controls.popup-controls input { height: 38px; font-size: 12px; }
.popup-action-pair {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}
.sort-controls.popup-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px 42px;
  gap: 7px;
}
.sort-controls.popup-controls select { width: 100%; min-width: 0; max-width: none; }

@media (max-width: 560px) {
  .tool-launcher { min-height: 38px; }
  .tool-popover-layer { position: static; height: 0; }
  .tool-popover {
    position: fixed;
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    width: auto !important;
    max-height: min(70vh, 520px);
    overflow: auto;
    z-index: 120;
    border-radius: 16px;
    box-shadow: 0 22px 55px rgba(31, 41, 55, .24);
  }
  .popup-title small { white-space: normal; }
  .case-controls.popup-controls { grid-template-columns: 1fr 1fr 36px; }
}
.tool-popover.case-toolbar {
  display: block;
  align-items: initial;
  justify-content: initial;
  gap: 0;
  background: rgba(255, 255, 255, .98);
}

/* =========================================================
   v3.0 DATA CLEANING WORKBENCH
   ========================================================= */
.settings-grid-v3 { grid-template-columns: 1fr 1fr; }
.settings-grid-v3 .custom-field { grid-column: 1 / -1; }
.btn-danger-soft {
  color: var(--danger);
  background: #fff7f7;
  border-color: #ffd7d7;
}
.btn-danger-soft:hover { background: #fff0f0; border-color: #ffc3c3; }
.tool-divider { width: 1px; height: 28px; background: var(--border); margin: 0 1px; }
.tool-launcher { flex-wrap: wrap; }
.tool-launcher .icon-btn { width: 36px; min-width: 36px; height: 36px; flex-basis: 36px; }

/* Header actions remain overlay-only: they never alter column width. */
th.column-header { padding: 7px 8px; }
th.column-header input { padding-left: 29px; padding-right: 68px; }
.column-drag-handle {
  position: absolute;
  left: 8px;
  top: 50%;
  width: 22px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--muted);
  transform: translateY(-50%);
  cursor: grab;
  opacity: .25;
  transition: opacity .15s ease, color .15s ease;
  z-index: 4;
}
.column-drag-handle:active { cursor: grabbing; }
.column-drag-handle svg { width: 15px; height: 15px; }
.column-header:hover .column-drag-handle { opacity: 1; color: var(--text-soft); }
.column-copy-btn { right: 37px; }
.column-tool-btn {
  position: absolute;
  top: 50%;
  right: 7px;
  z-index: 4;
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  background: rgba(255,255,255,.94);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(31,41,55,.08);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) scale(.92);
  transition: opacity .15s ease, transform .15s ease, background .15s ease, visibility .15s ease;
}
.column-tool-btn svg { width: 15px; height: 15px; }
.column-tool-btn:hover,
.column-tool-btn:focus-visible { color: var(--primary); background: var(--primary-light); border-color: #ffd4ca; outline: none; }
.column-header:hover .column-tool-btn,
.column-header:focus-within .column-tool-btn { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(-50%) scale(1); }
.column-header.is-dragging { opacity: .55; }
.column-header.drag-over { box-shadow: inset 3px 0 0 var(--primary); }

/* Inline cell editor */
.data-cell { min-width: 130px; }
.data-cell.is-editing {
  outline: 2px solid rgba(238,77,45,.35);
  outline-offset: -2px;
  background: #fff !important;
  cursor: text;
}
.cell-warning { background: #fff9e7 !important; box-shadow: inset 0 0 0 1px #f8d56b; }

/* Row actions float above cells and do not consume table width. */
.row-num { position: relative; overflow: visible; }
.row-hover-actions {
  position: absolute;
  left: 48px;
  top: 50%;
  z-index: 12;
  display: flex;
  gap: 3px;
  padding: 3px;
  background: rgba(255,255,255,.97);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(31,41,55,.14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) translateX(-4px);
  transition: .15s ease;
}
tbody tr:hover .row-hover-actions { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(-50%) translateX(0); }
.row-hover-actions button {
  width: 25px;
  height: 25px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--text-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}
.row-hover-actions button:hover { color: var(--primary); background: var(--primary-light); }
.row-hover-actions button:last-child:hover { color: var(--danger); background: #fff1f1; }

/* Larger toolbox popup */
.toolbox-popover {
  width: min(790px, 100%);
  max-height: min(74vh, 720px);
  overflow: auto;
}
.history-popover { width: min(500px, 100%); max-height: min(72vh, 620px); overflow: auto; }
.toolbox-popover::-webkit-scrollbar,
.history-popover::-webkit-scrollbar,
.result-scroll::-webkit-scrollbar { width: 7px; }
.toolbox-popover::-webkit-scrollbar-thumb,
.history-popover::-webkit-scrollbar-thumb,
.result-scroll::-webkit-scrollbar-thumb { background: #d8dce2; border-radius: 999px; }

.tool-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 3px 0 10px;
  margin-bottom: 3px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}
.tool-tab {
  min-height: 32px;
  padding: 0 10px;
  flex: 0 0 auto;
  color: var(--text-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
}
.tool-tab:hover { background: var(--surface-soft); }
.tool-tab.is-active { color: var(--primary); background: var(--primary-light); border-color: #ffd9d0; }
.tool-tab-panel { display: none; padding-top: 12px; }
.tool-tab-panel.is-active { display: block; }
.section-title { margin-bottom: 12px; }
.section-title strong { display: block; font-family: "Plus Jakarta Sans", Arial, sans-serif; font-size: 13px; }
.section-title small { display: block; margin-top: 2px; color: var(--text-soft); font-size: 10px; }

.form-grid { display: grid; gap: 9px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-span-2 { grid-column: 1 / -1; }
.field-check { justify-content: center; align-self: end; min-height: 40px; }
.form-grid .field select,
.form-grid .field input,
.toolbox-popover .field select,
.toolbox-popover .field input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
}
.top-gap { margin-top: 12px; }
.top-gap-sm { margin-top: 8px; }
.inline-options { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.checkbox-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.checkbox-grid .check-option { min-height: 34px; }

.subcard {
  padding: 11px;
  margin-bottom: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
}
.subcard > strong { font-size: 11px; color: var(--text); }

.result-box {
  min-height: 54px;
  padding: 10px;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 11px;
}
.result-scroll { max-height: 260px; overflow: auto; }
.result-stat { margin-bottom: 8px; color: var(--text); font-weight: 700; }
.list-empty { padding: 8px 4px; color: var(--muted); font-size: 11px; }
.mini-section { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); }
.mini-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.mini-section-head strong { font-size: 11px; }
.mini-section-head > div { display: flex; gap: 8px; }
.text-btn { padding: 0; color: var(--primary); background: transparent; border: 0; font-size: 10px; font-weight: 700; }
.danger-text { color: var(--danger); }
.rule-list { display: grid; gap: 6px; }
.rule-item {
  min-height: 44px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: minmax(0,1fr) 28px;
  gap: 8px;
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.rule-item:has(.rule-toggle) { grid-template-columns: 32px minmax(0,1fr) 28px; }
.rule-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.rule-item small { display: block; margin-top: 2px; overflow: hidden; color: var(--text-soft); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.rule-item > button { width: 26px; height: 26px; padding: 0; color: var(--danger); background: transparent; border: 0; border-radius: 7px; font-size: 16px; }
.rule-item > button:hover { background: #fff0f0; }
.rule-toggle input { accent-color: var(--primary); }

.value-row,
.similarity-row,
.validation-row,
.diagnostic-row,
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.value-row:last-child,
.similarity-row:last-child,
.validation-row:last-child,
.diagnostic-row:last-child,
.history-item:last-child { border-bottom: 0; }
.value-row span,
.similarity-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.value-row b { flex: 0 0 auto; color: var(--text); }
.similarity-title { margin: 12px 0 4px; color: var(--text); font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; }
.similarity-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; }
.similarity-row small { color: var(--muted); }
.similarity-row button { height: 26px; padding: 0 8px; color: var(--primary); background: var(--primary-light); border: 1px solid #ffd9d0; border-radius: 7px; font-size: 9px; font-weight: 700; }
.validation-row { justify-content: flex-start; align-items: flex-start; }
.validation-kind { min-width: 58px; padding: 2px 5px; color: #8a5b00; background: #fff2c2; border-radius: 5px; font-size: 8px; font-weight: 800; text-transform: uppercase; text-align: center; }

.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.compare-grid textarea { min-height: 300px; max-height: 42vh; resize: vertical; font-family: Consolas, "Courier New", monospace; font-size: 11px; }

.history-list { display: grid; gap: 6px; }
.history-item {
  padding: 9px 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.history-item > div:first-child { min-width: 0; }
.history-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.history-item small { display: block; margin-top: 2px; color: var(--text-soft); font-size: 9px; }
.history-item > div:last-child { display: flex; gap: 5px; }
.history-item button { height: 28px; padding: 0 8px; color: var(--text-soft); background: var(--surface); border: 1px solid var(--border); border-radius: 7px; font-size: 9px; font-weight: 700; }
.history-item button:last-child { width: 28px; padding: 0; color: var(--danger); }

.diagnostics-list { display: grid; gap: 3px; }
.diagnostic-row { padding: 8px 2px; }
.diagnostic-row > div { min-width: 0; }
.diagnostic-row strong { display: block; font-size: 11px; }
.diagnostic-row small { display: block; margin-top: 2px; color: var(--text-soft); font-size: 9px; }
.confidence { min-width: 48px; padding: 4px 7px; border-radius: 999px; font-size: 9px; font-weight: 800; text-align: center; }
.confidence.high { color: #137a3b; background: #eafaf0; }
.confidence.medium { color: #8a5b00; background: #fff3cf; }
.confidence.low { color: var(--text-soft); background: var(--surface-soft); }

/* active filter gets a subtle table indication */
.cell-match { background: #fff1b8 !important; box-shadow: inset 0 0 0 1px #f2c94c; }

@media (max-width: 1120px) {
  .tool-launcher { justify-content: flex-end; }
  .toolbox-popover { width: min(720px, 100%); }
}

@media (max-width: 760px) {
  .settings-grid-v3 { grid-template-columns: 1fr; }
  .settings-grid-v3 .custom-field { grid-column: auto; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .form-grid-3 .field:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .compare-grid { grid-template-columns: 1fr; }
  .compare-grid textarea { min-height: 180px; }
  .tool-divider { display: none; }
}

@media (max-width: 560px) {
  .tool-launcher { gap: 5px; }
  .tool-launcher .icon-btn { width: 34px; min-width: 34px; height: 34px; flex-basis: 34px; }
  .toolbox-popover { max-height: 78vh; }
  .tool-tabs { margin-left: -3px; margin-right: -3px; }
  .form-grid-2,
  .form-grid-3 { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: auto; }
  .subcard { padding: 10px; }
  .checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .row-hover-actions { left: 44px; }
  .column-drag-handle { display: none; }
  th.column-header input { padding-left: 8px; padding-right: 68px; }
  .similarity-row { grid-template-columns: minmax(0,1fr) auto; }
  .similarity-row button { grid-column: 1 / -1; justify-self: end; }
}

@media (hover: none) {
  .column-tool-btn,
  .column-copy-btn { opacity: .78; visibility: visible; pointer-events: auto; transform: translateY(-50%) scale(1); }
  .row-hover-actions { display: none; }
}

/* =========================================================
   v3.1 MODERN OIS DROPDOWN
   Native <select> tetap menjadi sumber data, UI diganti custom popover.
   ========================================================= */
.ois-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.ois-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
}

.ois-select-trigger {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 10px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  text-align: left;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}

.ois-select-trigger:hover:not(:disabled) {
  background: var(--surface);
  border-color: #d4d8de;
}

.ois-select-trigger:focus-visible,
.ois-select-trigger.is-open {
  background: var(--surface);
  border-color: rgba(238, 77, 45, .58);
  box-shadow: 0 0 0 4px rgba(238, 77, 45, .08);
}

.ois-select-trigger:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.ois-select-value {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
}

.ois-select-chevron {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(229, 231, 235, .9);
  border-radius: 7px;
  transition: transform .18s ease, color .18s ease, background .18s ease;
}

.ois-select-chevron svg { width: 14px; height: 14px; }
.ois-select-trigger.is-open .ois-select-chevron {
  color: var(--primary);
  background: var(--primary-light);
  border-color: #ffd8cf;
  transform: rotate(180deg);
}

.ois-select-menu {
  position: fixed;
  z-index: 1000;
  max-height: min(360px, calc(100vh - 20px));
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, .985);
  border: 1px solid rgba(229, 231, 235, .95);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(31, 41, 55, .17), 0 3px 10px rgba(31, 41, 55, .07);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(-5px) scale(.985);
  transform-origin: top center;
  transition: opacity .14s ease, transform .14s ease;
  overflow: hidden;
}

.ois-select-menu.opens-up {
  transform: translateY(5px) scale(.985);
  transform-origin: bottom center;
}

.ois-select-menu.is-visible { opacity: 1; transform: translateY(0) scale(1); }

.ois-select-search {
  position: relative;
  flex: 0 0 auto;
  margin-bottom: 2px;
}

.ois-select-search > svg {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 15px;
  height: 15px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.ois-select-search input {
  width: 100%;
  height: 36px;
  padding: 0 10px 0 32px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  font-size: 11px;
}

.ois-select-search input:focus {
  background: var(--surface);
  border-color: rgba(238, 77, 45, .52);
  box-shadow: 0 0 0 3px rgba(238, 77, 45, .07);
}

.ois-select-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #d6dae0 transparent;
}

.ois-select-list::-webkit-scrollbar { width: 6px; }
.ois-select-list::-webkit-scrollbar-thumb { background: #d6dae0; border-radius: 999px; }

.ois-select-option {
  width: 100%;
  min-height: 36px;
  padding: 7px 8px 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-soft);
  background: transparent;
  border: 0;
  border-radius: 8px;
  outline: none;
  text-align: left;
  transition: background .12s ease, color .12s ease;
}

.ois-select-option:hover:not(:disabled),
.ois-select-option:focus-visible:not(:disabled) {
  color: var(--text);
  background: var(--surface-soft);
}

.ois-select-option.is-selected {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.ois-select-option:disabled { cursor: not-allowed; opacity: .42; }
.ois-select-option-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.ois-select-option-check {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  color: transparent;
  border-radius: 7px;
}
.ois-select-option-check svg { width: 14px; height: 14px; }
.ois-select-option.is-selected .ois-select-option-check {
  color: var(--primary);
  background: rgba(238, 77, 45, .08);
}

.ois-select-empty {
  padding: 18px 10px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}

/* Compact dropdowns inside tool popups keep the old 36/38px rhythm. */
.case-controls .ois-select-trigger,
.replace-controls .ois-select-trigger,
.sort-controls .ois-select-trigger,
.form-grid .ois-select-trigger,
.toolbox-popover .ois-select-trigger {
  height: 38px;
  border-radius: 9px;
}

.case-controls .ois-select-trigger,
.replace-controls .ois-select-trigger,
.sort-controls .ois-select-trigger { font-size: 11px; }

@media (max-width: 560px) {
  .ois-select-menu {
    max-height: min(46vh, 330px);
    border-radius: 13px;
    box-shadow: 0 20px 52px rgba(31, 41, 55, .22);
  }
  .ois-select-option { min-height: 40px; }
  .ois-select-option-label { font-size: 12px; }
}

.replace-controls.popup-controls > .ois-select { grid-column: 1 / -1; }
.replace-controls > .ois-select,
.sort-controls > .ois-select,
.case-controls > .ois-select { min-width: 0; }

/* =========================================================
   OIS Parser v3.1.1 — Clean scroll areas
   Hide every visual scrollbar without disabling scrolling.
   Wheel, touchpad, touch drag, keyboard and programmatic scroll
   continue to work normally.
   ========================================================= */
html,
body,
* {
  scrollbar-width: none !important;      /* Firefox */
  -ms-overflow-style: none !important;   /* Legacy Edge / IE */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
  background: transparent !important;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb,
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
  background: transparent !important;
  border: 0 !important;
}

/* =========================================================
   OIS Parser v3.2 — Productivity Pack
   ========================================================= */
.productivity-popover {
  position: fixed;
  top: 94px;
  right: 18px;
  z-index: 120;
  width: min(520px, calc(100vw - 36px));
  max-height: calc(100vh - 116px);
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,.985);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(31,41,55,.2);
  backdrop-filter: blur(18px);
}
.productivity-head { padding: 14px 15px 10px; }
.productivity-scroll { min-height: 0; overflow: auto; padding: 0 15px 15px; }
.prod-section { padding: 13px 0; border-top: 1px solid var(--border); }
.prod-section:first-of-type { border-top: 0; }
.prod-section-title { display:flex; flex-direction:column; gap:2px; margin-bottom:10px; }
.prod-section-title strong { font-family:"Plus Jakarta Sans",Arial,sans-serif; font-size:13px; }
.prod-section-title small, .prod-hint { color:var(--text-soft); font-size:11px; }
.prod-toggle-grid { display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.prod-toggle-grid .check-option { min-height:34px; }
.prod-inline-status { display:flex; justify-content:space-between; gap:10px; margin-top:8px; color:var(--muted); font-size:10px; }
.prod-button-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; }
.prod-button-grid .btn { width:100%; }
.prod-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; align-items:center; }
.prod-row > input { min-width:0; width:100%; height:40px; padding:0 11px; border:1px solid var(--border); border-radius:10px; outline:none; background:var(--surface-soft); }
.prod-row > input:focus { border-color:rgba(238,77,45,.65); box-shadow:0 0 0 4px rgba(238,77,45,.08); background:#fff; }
.prod-summary { margin:10px 0 2px; padding:8px 10px; color:var(--text-soft); background:var(--surface-soft); border:1px solid var(--border); border-radius:10px; font-size:11px; }
.quick-search-box { position:relative; display:flex; align-items:center; gap:8px; margin-top:4px; padding:0 9px; height:42px; border:1px solid var(--border); border-radius:11px; background:var(--surface-soft); }
.quick-search-box:focus-within { border-color:rgba(238,77,45,.55); box-shadow:0 0 0 4px rgba(238,77,45,.07); background:#fff; }
.quick-search-box > svg { width:17px; height:17px; color:var(--text-soft); }
.quick-search-box input { flex:1; min-width:0; height:100%; border:0; outline:0; background:transparent; color:var(--text); }
.quick-search-box button { width:27px; height:27px; border:0; border-radius:8px; background:transparent; color:var(--muted); font-size:19px; line-height:1; }
.quick-search-box button:hover { color:var(--text); background:#eee; }

.density-switch { display:grid; grid-template-columns:1fr 1fr; padding:3px; background:var(--surface-soft); border:1px solid var(--border); border-radius:10px; }
.density-switch button { height:31px; border:0; border-radius:7px; background:transparent; color:var(--text-soft); font-size:11px; font-weight:600; }
.density-switch button.is-active { color:var(--primary); background:#fff; box-shadow:0 2px 8px rgba(31,41,55,.08); }

.prod-drop-card { display:grid; grid-template-columns:34px minmax(0,1fr) auto; gap:10px; align-items:center; min-height:66px; padding:10px; border:1px dashed #d6d9df; border-radius:12px; background:var(--surface-soft); transition:.15s ease; }
.prod-drop-card > svg { width:22px; height:22px; color:var(--primary); justify-self:center; }
.prod-drop-card strong,.prod-drop-card small { display:block; }
.prod-drop-card strong { font-size:12px; }
.prod-drop-card small { margin-top:2px; color:var(--text-soft); font-size:10px; }
.prod-drop-card.drop-active, #rawInput.drop-active { border-color:var(--primary) !important; background:var(--primary-light) !important; box-shadow:inset 0 0 0 1px rgba(238,77,45,.14); }
.selection-status { padding:7px 9px; color:var(--text-soft); background:var(--surface-soft); border:1px solid var(--border); border-radius:9px; font-size:11px; }

.export-preview-wrap { padding:9px; border:1px solid var(--border); border-radius:10px; background:var(--surface-soft); }
.export-preview,.hidden-chars-preview { margin:7px 0 0; max-height:140px; overflow:auto; white-space:pre-wrap; word-break:break-word; color:#4b5563; font:11px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace; }
.hidden-chars-preview { padding:9px; background:#20242b; color:#d8dee9; border-radius:9px; }
.recent-export-list { display:flex; flex-direction:column; gap:6px; }
.recent-export-item { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 9px; border:1px solid var(--border); border-radius:9px; background:var(--surface-soft); }
.recent-export-item strong,.recent-export-item small { display:block; }
.recent-export-item strong { max-width:310px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; }
.recent-export-item small { color:var(--muted); font-size:9px; margin-top:2px; }
.recent-export-item button { height:29px; padding:0 9px; border:1px solid var(--border); border-radius:7px; background:#fff; color:var(--text-soft); font-size:10px; font-weight:600; }
.recent-export-item button:hover:not(:disabled) { color:var(--primary); border-color:#ffd1c7; background:var(--primary-light); }

.export-count-badge { position:absolute; top:-5px; right:-5px; min-width:17px; height:17px; padding:0 4px; display:grid; place-items:center; border:2px solid var(--surface); border-radius:999px; background:var(--text); color:#fff; font-size:8px; font-weight:700; line-height:1; pointer-events:none; }
.output-actions .icon-btn { position:relative; overflow:visible; }
.copy-success { color:var(--success) !important; border-color:#bfe8cc !important; background:#f1fbf4 !important; }

.row-num { min-width:68px; width:68px; padding-left:28px; }
.row-select-check { position:absolute; left:7px; top:50%; transform:translateY(-50%); width:14px; height:14px; margin:0; accent-color:var(--primary); cursor:pointer; }
.row-select-head { display:flex; align-items:center; justify-content:center; gap:6px; user-select:none; }
.row-select-head input { width:14px; height:14px; margin:0; accent-color:var(--primary); }
tr.is-selected-row td { background:#fff5f2 !important; }
tr.is-selected-row .row-num { box-shadow:inset 3px 0 0 var(--primary); }

.data-cell { position:relative; }
.data-cell.issue-empty::after,.data-cell.issue-duplicate::after,.data-cell.issue-hidden::after,.data-cell.issue-long::after { content:""; position:absolute; top:6px; right:6px; width:6px; height:6px; border-radius:50%; box-shadow:0 0 0 2px rgba(255,255,255,.9); }
.data-cell.issue-empty::after { background:#ef4444; }
.data-cell.issue-duplicate::after { background:#8b5cf6; }
.data-cell.issue-hidden::after { background:#0ea5e9; }
.data-cell.issue-long::after { background:#f59e0b; }
.data-cell[data-issue]:hover::before { content:attr(data-issue); position:absolute; left:10px; bottom:calc(100% + 5px); z-index:45; padding:5px 7px; border-radius:7px; background:#1f2937; color:#fff; font-size:9px; white-space:nowrap; box-shadow:0 8px 18px rgba(0,0,0,.14); pointer-events:none; }

.is-pinned-column { position:sticky !important; left:68px; z-index:3; background:#fff !important; box-shadow:5px 0 12px rgba(31,41,55,.05); }
thead .is-pinned-column { z-index:6; background:#fafafa !important; }

.ois-context-menu { position:fixed; z-index:180; width:190px; padding:5px; border:1px solid var(--border); border-radius:11px; background:rgba(255,255,255,.99); box-shadow:0 18px 46px rgba(31,41,55,.2); backdrop-filter:blur(12px); }
.ois-context-menu button { width:100%; min-height:32px; padding:6px 9px; border:0; border-radius:7px; background:transparent; color:var(--text-soft); text-align:left; font-size:10px; }
.ois-context-menu button:hover:not(:disabled) { color:var(--text); background:var(--surface-soft); }
.ois-context-menu button.is-danger:hover:not(:disabled) { color:var(--danger); background:#fff1f1; }
.ois-context-menu button:disabled { opacity:.38; }
.context-separator { height:1px; margin:4px 5px; background:var(--border); }

.mini-dialog-overlay,.confirm-overlay { position:fixed; inset:0; z-index:220; display:grid; place-items:center; padding:16px; background:rgba(17,24,39,.32); backdrop-filter:blur(4px); }
.mini-dialog { width:min(390px,100%); padding:15px; background:#fff; border:1px solid var(--border); border-radius:16px; box-shadow:0 24px 70px rgba(31,41,55,.24); }
.confirm-dialog { display:grid; gap:12px; }
.confirm-icon { width:42px; height:42px; display:grid; place-items:center; color:var(--danger); background:#fff1f1; border-radius:12px; }
.confirm-dialog strong,.confirm-dialog small { display:block; }
.confirm-dialog small { margin-top:3px; color:var(--text-soft); font-size:11px; }
.btn-danger { color:#fff; background:var(--danger); border-color:var(--danger); }
.btn-danger:hover { filter:brightness(.95); }

.focus-exit-btn { position:fixed; top:12px; right:12px; z-index:160; height:38px; padding:0 11px; display:flex; align-items:center; gap:6px; border:1px solid var(--border); border-radius:10px; background:rgba(255,255,255,.96); color:var(--text-soft); box-shadow:0 8px 24px rgba(31,41,55,.12); font:600 11px "DM Sans",Arial,sans-serif; }
.focus-exit-btn svg { width:15px; height:15px; }
body.focus-mode .topbar { display:none; }
body.focus-mode .app-shell { padding-top:12px; }
body.focus-mode .settings-grid, body.focus-mode .option-row { display:none; }
body.focus-mode .workspace { grid-template-columns:minmax(300px,.7fr) minmax(520px,1.3fr); }
body.focus-mode .input-panel { gap:10px; }

body.density-compact td { padding-top:5px; padding-bottom:5px; font-size:11px; line-height:1.35; }
body.density-compact th { padding-top:5px; padding-bottom:5px; }
body.density-compact th input { height:28px; font-size:11px; }
body.density-compact .row-hover-actions { transform:translateY(-50%) scale(.92); transform-origin:left center; }
body.density-comfortable td { padding-top:9px; padding-bottom:9px; }

@media (max-width:700px) {
  .productivity-popover { top:auto; left:8px; right:8px; bottom:8px; width:auto; max-height:min(82vh,700px); border-radius:17px; }
  .prod-toggle-grid,.prod-button-grid { grid-template-columns:1fr 1fr; }
  .prod-drop-card { grid-template-columns:32px minmax(0,1fr); }
  .prod-drop-card .btn { grid-column:1 / -1; width:100%; }
  .prod-inline-status { flex-direction:column; gap:2px; }
  .recent-export-item strong { max-width:200px; }
  body.focus-mode .workspace { display:flex; }
}
.table-wrap th:first-child { position:sticky; left:0; z-index:7; background:#fafafa; }
.table-wrap .row-num { position:sticky; left:0; z-index:4; background:#fcfcfc; }
.table-wrap th:first-child { min-width:68px; width:68px; }

/* =========================================================
   OIS Parser v3.2.1 — Invisible Guard / Corel-safe text
   ========================================================= */
.invisible-guard-btn { position:relative; overflow:visible !important; }
.invisible-guard-btn.is-safe { color:#16a34a; }
.invisible-guard-btn.has-warning { color:#d97706; border-color:#f4c780; background:#fff9ed; }
.guard-count {
  position:absolute;
  top:-5px;
  right:-5px;
  min-width:17px;
  height:17px;
  padding:0 4px;
  display:grid;
  place-items:center;
  border:2px solid var(--surface);
  border-radius:999px;
  background:#d97706;
  color:#fff;
  font-size:8px;
  font-weight:800;
  line-height:1;
  pointer-events:none;
}
.invisible-guard-popover {
  position:fixed;
  top:94px;
  right:18px;
  z-index:124;
  width:min(440px,calc(100vw - 36px));
  max-height:calc(100vh - 116px);
  display:flex;
  flex-direction:column;
  background:rgba(255,255,255,.988);
  border:1px solid var(--border);
  border-radius:18px;
  box-shadow:0 24px 70px rgba(31,41,55,.2);
  backdrop-filter:blur(18px);
}
.guard-scroll { min-height:0; overflow:auto; padding:0 15px 15px; }
.guard-status-card {
  display:grid;
  grid-template-columns:42px minmax(0,1fr);
  gap:10px;
  align-items:center;
  padding:11px;
  margin:4px 0 10px;
  border:1px solid #cdebd6;
  border-radius:12px;
  background:#f4fbf6;
}
.guard-status-card.has-warning { border-color:#f2d39c; background:#fff9ed; }
.guard-status-icon { width:42px; height:42px; display:grid; place-items:center; border-radius:11px; color:#16a34a; background:#e7f7ec; }
.guard-status-card.has-warning .guard-status-icon { color:#d97706; background:#ffefd2; }
.guard-status-icon svg { width:20px; height:20px; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.guard-status-card strong,.guard-status-card small { display:block; }
.guard-status-card strong { font-family:"Plus Jakarta Sans",Arial,sans-serif; font-size:12px; }
.guard-status-card small { margin-top:2px; color:var(--text-soft); font-size:10px; line-height:1.45; }
.guard-auto-option { min-height:36px; }
.guard-note { margin-top:7px; color:var(--muted); font-size:10px; line-height:1.5; }
.guard-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:7px; margin:11px 0; }
.guard-stats > div { padding:9px; border:1px solid var(--border); border-radius:10px; background:var(--surface-soft); }
.guard-stats span,.guard-stats strong { display:block; }
.guard-stats span { color:var(--muted); font-size:9px; }
.guard-stats strong { margin-top:2px; font:700 15px "Plus Jakarta Sans",Arial,sans-serif; }
.guard-list-head { margin:4px 0 7px; }
.guard-list-head > span { color:var(--muted); font-size:9px; }
.guard-char-list { display:flex; flex-direction:column; gap:5px; max-height:220px; overflow:auto; }
.guard-char-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 9px; border:1px solid var(--border); border-radius:9px; background:var(--surface-soft); }
.guard-char-row strong,.guard-char-row small { display:block; }
.guard-char-row strong { font:700 10px ui-monospace,SFMono-Regular,Consolas,monospace; }
.guard-char-row small { margin-top:2px; color:var(--text-soft); font-size:9px; }
.guard-char-row > span { min-width:28px; height:22px; display:grid; place-items:center; padding:0 6px; border-radius:999px; font-size:9px; font-weight:700; background:#fff; border:1px solid var(--border); }
.guard-char-row.is-safe { border-left:3px solid #22c55e; }
.guard-char-row.needs-review { border-left:3px solid #f59e0b; }

@media (max-width:700px) {
  .invisible-guard-popover { top:auto; left:8px; right:8px; bottom:8px; width:auto; max-height:min(82vh,700px); border-radius:17px; }
}
