#sentenceEditor {
  --se-green: var(--sentence-editor-green);
  --se-green-soft: var(--sentence-editor-green-soft);
  --se-fix: var(--sentence-editor-fix);
  --se-fix-soft: var(--sentence-editor-fix-soft);
  --se-style: var(--sentence-editor-style);
  --se-style-soft: var(--sentence-editor-style-soft);
  --se-edge: var(--line);
  color: var(--ink);
  width: 100%;
  max-width: none;
  margin: 0 auto;
  height: calc(100dvh - 120px);
  min-height: 580px;
}
#sentenceEditor [hidden] { display: none !important; }
#sentenceEditor .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#sentenceEditor .sentence-editor-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
#sentenceEditor .sentence-columns {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px 64px;
  min-height: 0;
  height: 100%;
  position: relative;
}

#sentenceEditor .sentence-sheet {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--palette-white);
  position: relative;
}
#sentenceEditor .sentence-writing {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
#sentenceEditor textarea,
#sentenceEditor .sentence-mirror {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 32px 40px 20px !important;
  margin: 0 !important;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  border-radius: var(--radius-none) !important;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans", sans-serif;
  font-size: 1.35rem;
  line-height: 1.85;
  letter-spacing: 0.015em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-y: auto;
  scrollbar-width: thin;
}
#sentenceEditor textarea {
  resize: none;
  background: var(--palette-clear) !important;
  color: var(--ink) !important;
  caret-color: var(--se-green);
  z-index: 2;
}
#sentenceEditor textarea::placeholder {
  color: var(--muted);
  opacity: 0.65;
  font-size: 1.25rem;
}
#sentenceEditor .sentence-mirror {
  color: var(--palette-clear) !important;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}
#sentenceEditor mark {
  background: var(--palette-clear);
  color: var(--palette-clear);
  text-decoration: underline 3px var(--se-fix);
  text-underline-offset: 6px;
  text-decoration-skip-ink: none;
}
#sentenceEditor mark[data-kind="style"] {
  text-decoration-color: var(--se-style);
}

#sentenceEditor .sentence-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 32px;
  border-top: 1px solid var(--se-edge);
  background: var(--palette-white);
  flex-shrink: 0;
  z-index: 3;
}
#sentenceEditor .sentence-footer-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
#sentenceEditor .sentence-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
#sentenceEditor .sentence-example {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--palette-clear);
  border: 1px dashed var(--se-edge);
  border-radius: var(--radius-pill);
  color: var(--accent-dark);
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
#sentenceEditor .sentence-example:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
#sentenceEditor .sentence-ai-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

#sentenceEditor .sentence-ai-actions label {
  font-size: .82rem;
  color: var(--muted);
}

#sentenceEditor .sentence-ai-actions select {
  max-width: 100%;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

#sentenceEditor .sentence-check-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--se-green);
  color: var(--palette-white);
  border: 0;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 8px 22px;
  min-height: 38px;
  cursor: pointer;
  box-shadow: var(--shadow-sentence-editor-submit);
  transition: all 0.15s ease;
}
#sentenceEditor .sentence-check-btn:hover {
  filter: brightness(1.08);
  box-shadow: var(--shadow-sentence-editor-submit-hover);
}
#sentenceEditor .sentence-check-btn:disabled {
  opacity: 0.55;
  cursor: wait;
  box-shadow: none;
}

#sentenceEditor .sentence-review {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--se-edge);
  background: var(--surface);
  min-width: 0;
  min-height: 0;
  height: 100%;
}
#sentenceEditor .sentence-review-head {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--se-edge);
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}
#sentenceEditor .sentence-review-title h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 750;
  color: var(--ink-strong);
  letter-spacing: -0.01em;
}
#sentenceEditor .sentence-filters {
  display: flex;
  gap: 6px;
  margin: 0;
}
#sentenceEditor .sentence-filters button {
  flex: 1;
  background: var(--palette-white);
  color: var(--muted);
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-pill);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  min-height: 32px;
}
#sentenceEditor .sentence-filters button:hover {
  color: var(--ink);
  border-color: var(--line-dark);
}
#sentenceEditor .sentence-filters button[aria-pressed="true"] {
  background: var(--se-green-soft);
  border-color: var(--se-green);
  color: var(--se-green);
  font-weight: 750;
}
#sentenceEditor .sentence-review-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}
#sentenceEditor .sentence-status {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--radius-btn);
  background: color-mix(in srgb, var(--ink) 4%, var(--palette-clear));
  border: 1px dashed var(--se-edge);
}
#sentenceEditor .sentence-suggestions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#sentenceEditor .sentence-card {
  background: var(--palette-white);
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  box-shadow: var(--shadow-sentence-editor-card);
  transition: all 0.15s ease;
  cursor: pointer;
}
#sentenceEditor .sentence-card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--se-edge));
  box-shadow: var(--shadow-sentence-editor-card-hover);
}
#sentenceEditor .sentence-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}
#sentenceEditor .sentence-card-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-round);
  background: var(--se-fix);
  flex-shrink: 0;
}
#sentenceEditor .sentence-card[data-kind="style"] .sentence-card-dot {
  background: var(--se-style);
}
#sentenceEditor .sentence-card h4 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 750;
  color: var(--se-fix);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
#sentenceEditor .sentence-card[data-kind="style"] h4 {
  color: var(--se-style);
}
#sentenceEditor .sentence-diff {
  margin: 6px 0 8px;
  font-size: 1.05rem;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  padding: 6px 10px;
  background: color-mix(in srgb, var(--ink) 3%, var(--palette-clear));
  border-radius: var(--radius-btn);
}
#sentenceEditor .sentence-del {
  text-decoration: line-through;
  color: var(--muted);
  margin-right: 6px;
}
#sentenceEditor .sentence-arrow {
  color: var(--muted);
  margin: 0 4px;
}
#sentenceEditor .sentence-ins {
  text-decoration: none;
  color: var(--se-green);
  font-weight: 700;
}
#sentenceEditor .sentence-card-detail {
  margin: 6px 0 12px;
  font-size: 0.86rem;
  color: var(--ink);
  line-height: 1.55;
}
#sentenceEditor .sentence-card footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--se-edge);
}
#sentenceEditor .sentence-apply {
  background: var(--se-green);
  color: var(--palette-white);
  border: 0;
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 32px;
  transition: filter 0.15s ease;
}
#sentenceEditor .sentence-apply:hover {
  filter: brightness(1.1);
}
#sentenceEditor .sentence-dismiss,
#sentenceEditor .sentence-locate {
  background: var(--palette-clear);
  color: var(--muted);
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 32px;
  transition: all 0.15s ease;
}
#sentenceEditor .sentence-dismiss:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 5%, var(--palette-clear));
}
#sentenceEditor .sentence-locate:hover {
  color: var(--se-style);
  border-color: var(--se-style);
}

@media (min-width: 721px) {
  body.studio-enabled[data-studio-hub="sentence-editor"] main.workspace {
    width: 100% !important;
    max-width: 1440px !important;
    margin: 0 auto !important;
    padding: 16px 24px 24px !important;
    box-sizing: border-box !important;
  }
}

html[data-theme="dark"] #sentenceEditor .sentence-sheet,
html[data-theme="dark"] #sentenceEditor .sentence-footer {
  background: var(--palette-dark-surface) !important;
}
html[data-theme="dark"] #sentenceEditor .sentence-review {
  background: var(--palette-dark-surface) !important;
}
html[data-theme="dark"] #sentenceEditor .sentence-card {
  background: color-mix(in srgb, var(--palette-dark-surface) 82%, var(--palette-white) 8%) !important;
  border-color: var(--palette-dark-line-strong) !important;
}
html[data-theme="dark"] #sentenceEditor .sentence-filters button {
  background: var(--palette-dark-surface) !important;
  color: var(--palette-dark-muted) !important;
}
html[data-theme="dark"] #sentenceEditor .sentence-diff {
  background: color-mix(in srgb, var(--palette-white) 5%, var(--palette-clear)) !important;
}
html[data-theme="dark"] #sentenceEditor textarea {
  color: var(--palette-dark-ink) !important;
}
html[data-theme="dark"] #sentenceEditor.is-ai-highlight textarea {
  color: var(--palette-clear) !important;
  -webkit-text-fill-color: var(--palette-clear);
}
html[data-theme="dark"] #sentenceEditor.is-ai-highlight .sentence-mirror {
  color: var(--palette-dark-ink) !important;
}

@media (max-width: 720px) {
  #sentenceEditor {
    height: auto;
    min-height: 0;
    margin: 8px 0;
  }
  #sentenceEditor .sentence-columns {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 0;
  }
  #sentenceEditor .sentence-writing {
    min-height: 240px;
    height: 280px;
  }
  #sentenceEditor textarea,
  #sentenceEditor .sentence-mirror {
    padding: 16px !important;
    font-size: 1.18rem;
  }
  #sentenceEditor .sentence-footer {
    padding: 10px 16px;
  }
  #sentenceEditor .sentence-review {
    order: 3;
    border-left: 0;
    border-top: 1px solid var(--se-edge);
    height: auto;
  }
  #sentenceEditor .sentence-review-head {
    padding: 14px 16px;
  }
  #sentenceEditor .sentence-review-body {
    padding: 14px 16px;
    max-height: 420px;
  }
}

/* Review actions stay accessible in the suggestion column, including mobile. */
#sentenceEditor .sentence-help { margin: 0; font-size: .82rem; color: var(--muted); line-height: 1.55; }
#sentenceEditor .sentence-footer, #sentenceEditor .sentence-footer-meta, #sentenceEditor .sentence-card footer { flex-wrap: wrap; }
#sentenceEditor .sentence-undo { border: 1px solid var(--se-edge); border-radius: var(--radius-pill); padding: 6px 12px; background: var(--surface); color: var(--ink); }
#sentenceEditor .sentence-undo:disabled { opacity: .5; }
#sentenceEditor .sentence-card, #sentenceEditor .sentence-status { overflow-wrap: anywhere; }

/* Insertion anchors occupy zero net width so later highlights stay aligned. */
#sentenceEditor mark[data-insertion="true"] {
  display: inline-block;
  width: 0;
  border-left: 2px solid var(--se-style);
  margin-right: -2px;
  text-decoration: none;
}


#sentenceEditor .ai-qa-thinking-card {
  width: 100%;
  box-sizing: border-box;
  align-self: stretch;
}

#sentenceEditor .sentence-wait:not([hidden]) {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}

#sentenceEditor .sentence-ai-actions {
  flex-wrap: wrap;
  gap: 8px;
}

#sentenceEditor .sentence-ai-actions select.qa-thinking {
  position: absolute;
  width: 1px;
  min-width: 0;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

#sentenceEditor .qa-provider {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
}

#sentenceEditor .qa-provider-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  min-width: 0;
  min-height: 32px;
  height: 32px;
  max-width: 150px;
  padding: 0 10px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

#sentenceEditor .qa-provider-btn:hover {
  background: var(--qa-hover);
  border-color: var(--line-dark);
}

#sentenceEditor .qa-provider-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sentenceEditor .qa-provider :is(.qa-provider-chip, .qa-provider-caret, .qa-provider-lock, .qa-provider-check) {
  flex: none;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#sentenceEditor .qa-provider-menu {
  position: fixed;
  z-index: 80;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 6px;
  border: 1px solid var(--qa-input-border);
  border-radius: var(--radius-card);
  background: var(--qa-surface);
  color: var(--qa-text);
  box-shadow: var(--shadow);
}

#sentenceEditor .qa-provider-menu[hidden] {
  display: none;
}

#sentenceEditor .qa-provider-group {
  padding: 8px 10px 4px;
  color: var(--qa-subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
}

#sentenceEditor .qa-provider-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--palette-clear);
  color: var(--qa-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#sentenceEditor .qa-provider-item:hover,
#sentenceEditor .qa-provider-item:focus-visible {
  background: var(--qa-input-border);
}

#sentenceEditor .qa-provider-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#sentenceEditor .qa-provider-text b {
  font-size: 13px;
  font-weight: 600;
}

#sentenceEditor .qa-provider-text small {
  color: var(--qa-subtle);
  font-size: 11px;
  overflow-wrap: anywhere;
}

#sentenceEditor .qa-provider-item[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
}

#sentenceEditor .qa-provider-item[aria-disabled="true"]:hover {
  background: var(--palette-clear);
}

#sentenceEditor .qa-effort {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
}

#sentenceEditor .qa-effort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  min-width: 0;
  min-height: 32px;
  height: 32px;
  max-width: clamp(88px, 28vw, 180px);
  padding: 0 10px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

#sentenceEditor .qa-effort-btn:hover:not(:disabled) {
  background: var(--qa-hover);
  border-color: var(--line-dark);
}

#sentenceEditor .qa-effort-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

#sentenceEditor .qa-effort-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sentenceEditor .qa-effort-btn .qa-provider-caret {
  flex: none;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#sentenceEditor .qa-effort-popover {
  position: fixed;
  z-index: 82;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 12px 14px;
  border: 1px solid var(--qa-input-border);
  border-radius: var(--radius-16px);
  background: var(--qa-surface);
  color: var(--qa-text);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#sentenceEditor .qa-effort-popover[hidden] {
  display: none;
}

#sentenceEditor .qa-effort-field,
#sentenceEditor .qa-effort-strength-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#sentenceEditor .qa-effort-caption {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--qa-subtle);
}

#sentenceEditor .qa-effort-strength-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--qa-text);
}

#sentenceEditor .qa-effort-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  max-width: 196px;
  padding: 4px 10px;
  border: 1px solid var(--qa-input-border);
  border-radius: var(--radius-pill);
  background: var(--palette-clear);
  color: var(--qa-text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

#sentenceEditor .qa-effort-current {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sentenceEditor .qa-effort-ticks {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

#sentenceEditor .qa-effort-tick {
  border: 0;
  padding: 2px 4px;
  border-radius: var(--radius-6px);
  background: var(--palette-clear);
  color: var(--qa-subtle);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

#sentenceEditor .qa-effort-tick[data-active="true"] {
  color: var(--qa-text);
  font-weight: 700;
}

#sentenceEditor .qa-effort-header-btn:hover,
#sentenceEditor .qa-effort-header-btn:focus-visible {
  background: var(--qa-input-border);
}

#sentenceEditor .qa-effort-chevron {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .72;
}

#sentenceEditor .qa-effort-slider-wrap {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  border-radius: var(--radius-pill);
}

#sentenceEditor .qa-effort-slider-wrap:focus-visible {
  outline: 2px solid var(--qa-effort-accent);
  outline-offset: 2px;
}

#sentenceEditor .qa-effort-slider-wrap[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
}

#sentenceEditor .qa-effort-track {
  position: relative;
  width: 100%;
  height: 28px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--qa-text) 14%, var(--palette-clear));
  overflow: hidden;
}

#sentenceEditor .qa-effort-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(28px + (100% - 28px) * var(--qa-effort-pos, 0));
  border-radius: var(--radius-pill);
  background: var(--qa-effort-accent);
  transition: width .22s cubic-bezier(.22, 1, .36, 1);
}

#sentenceEditor .qa-effort-dots {
  position: absolute;
  inset: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 2;
}

#sentenceEditor .qa-effort-dot {
  width: 4px;
  height: 4px;
  border-radius: var(--radius-round);
  background: color-mix(in srgb, var(--palette-white) 55%, var(--palette-clear));
  transition: background .15s ease;
}

#sentenceEditor .qa-effort-dot[data-active="true"] {
  background: color-mix(in srgb, var(--palette-white) 90%, var(--palette-clear));
}

#sentenceEditor .qa-effort-thumb {
  position: absolute;
  top: 2px;
  left: calc(2px + (100% - 28px) * var(--qa-effort-pos, 0));
  z-index: 3;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-round);
  background: var(--palette-white);
  border: 2.5px solid var(--qa-effort-thumb-border);
  box-shadow: var(--qa-effort-thumb-shadow);
  transition: left .22s cubic-bezier(.22, 1, .36, 1), transform .15s ease;
}

#sentenceEditor .qa-effort-slider-wrap:hover:not([aria-disabled="true"]) .qa-effort-thumb {
  transform: scale(1.06);
}

#sentenceEditor .qa-effort-slider-wrap.is-dragging .qa-effort-fill,
#sentenceEditor .qa-effort-slider-wrap.is-dragging .qa-effort-thumb {
  transition: none;
}

#sentenceEditor .qa-effort-slider-wrap.is-dragging .qa-effort-thumb {
  transform: scale(1.1);
}

#sentenceEditor .qa-effort-model-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#sentenceEditor .qa-effort-model-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--palette-clear);
  color: var(--qa-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#sentenceEditor .qa-effort-model-item:hover,
#sentenceEditor .qa-effort-model-item:focus-visible,
#sentenceEditor .qa-effort-model-item[aria-checked="true"] {
  background: var(--qa-input-border);
}

#sentenceEditor .qa-effort-model-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#sentenceEditor .qa-effort-model-text b {
  font-size: 13px;
  font-weight: 600;
}

#sentenceEditor .qa-effort-model-text small {
  color: var(--qa-subtle);
  font-size: 11px;
  overflow-wrap: anywhere;
}

#sentenceEditor .qa-effort-model-item .qa-provider-check {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#sentenceEditor .sentence-detect-btn {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}

#sentenceEditor .sentence-detect-btn:hover:not(:disabled) {
  border-color: var(--se-style);
  color: var(--se-style);
  background: var(--se-style-soft);
}

#sentenceEditor .sentence-detect-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

#sentenceEditor.is-ai-highlight textarea {
  color: var(--palette-clear) !important;
  -webkit-text-fill-color: var(--palette-clear);
}
#sentenceEditor.is-ai-highlight .sentence-mirror {
  color: var(--ink) !important;
}
#sentenceEditor.is-ai-highlight .sentence-mirror mark[data-ai-flag="true"] {
  color: var(--se-fix) !important;
}
#sentenceEditor .sentence-mirror mark[data-kind="ai-flag"] {
  background: var(--se-fix-soft);
  border-bottom: 2px solid var(--se-fix);
  color: var(--se-fix);
  border-radius: var(--radius-2px);
  text-decoration: none;
}

#sentenceEditor .sentence-detector[hidden] {
  display: none;
}

#sentenceEditor .sentence-detector {
  box-sizing: border-box;
  max-width: 100%;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-16px);
  background: var(--surface);
  box-shadow: var(--shadow-sentence-editor-shell);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#sentenceEditor .sentence-detector.is-collapsed {
  padding: 10px 12px;
  gap: 8px;
}

#sentenceEditor .sentence-detector-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  min-width: 0;
  width: 100%;
}

#sentenceEditor .sentence-detector-compact-pct {
  font-size: .74rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

#sentenceEditor .sentence-detector-verdict {
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: .75rem;
  font-weight: 700;
  background: var(--se-style-soft);
  color: var(--se-style);
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sentenceEditor .sentence-detector-verdict[data-verdict="human"] {
  background: var(--se-green-soft);
  color: var(--se-green);
}

#sentenceEditor .sentence-detector-verdict[data-verdict="ai"] {
  background: var(--se-fix-soft);
  color: var(--se-fix);
}

#sentenceEditor .sentence-detector-close {
  margin-left: auto;
  flex: none;
  max-width: 100%;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  background: var(--palette-clear);
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

#sentenceEditor .sentence-detector-close:hover {
  color: var(--ink);
  border-color: var(--line-dark);
}

#sentenceEditor .sentence-detector-meter {
  display: flex;
  height: 10px;
  width: 100%;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}

#sentenceEditor .sentence-detector-meter-human,
#sentenceEditor .sentence-detector-meter-ai {
  display: block;
  height: 100%;
  transition: width .25s ease;
}

#sentenceEditor .sentence-detector-meter-human {
  background: var(--se-green);
}

#sentenceEditor .sentence-detector-meter-ai {
  background: var(--se-fix);
}

#sentenceEditor .sentence-detector-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: .78rem;
  font-weight: 700;
}

#sentenceEditor .sentence-detector-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#sentenceEditor .sentence-detector-legend-item::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-round);
  flex: none;
}

#sentenceEditor .sentence-detector-legend-item.is-human {
  color: var(--se-green);
}

#sentenceEditor .sentence-detector-legend-item.is-human::before {
  background: var(--se-green);
}

#sentenceEditor .sentence-detector-legend-item.is-ai {
  color: var(--se-fix);
}

#sentenceEditor .sentence-detector-legend-item.is-ai::before {
  background: var(--se-fix);
}

#sentenceEditor .sentence-detector.is-collapsed .sentence-detector-meter {
  height: 6px;
}

#sentenceEditor .sentence-detector-why {
  padding: 10px 12px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-10px);
  background: var(--paper);
}

#sentenceEditor .sentence-detector-why-summary,
#sentenceEditor .sentence-detector-spans-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

#sentenceEditor .sentence-detector-why-summary::-webkit-details-marker,
#sentenceEditor .sentence-detector-spans-summary::-webkit-details-marker {
  display: none;
}

#sentenceEditor .sentence-detector-accordion-chevron {
  flex: none;
  font-size: .82rem;
  color: var(--muted);
  transition: transform .18s ease;
}

#sentenceEditor .sentence-detector-why:not([open]) .sentence-detector-accordion-chevron,
#sentenceEditor .sentence-detector-spans:not([open]) .sentence-detector-accordion-chevron {
  transform: rotate(-90deg);
}

#sentenceEditor .sentence-detector-why-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

#sentenceEditor .sentence-detector-why-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink);
}

#sentenceEditor .sentence-detector-meta,
#sentenceEditor .sentence-detector-summary {
  margin: 0;
  font-size: .84rem;
  line-height: 1.5;
}

#sentenceEditor .sentence-detector-meta {
  color: var(--muted);
  font-size: .78rem;
}

#sentenceEditor .sentence-detector-summary {
  color: var(--ink);
  font-weight: 600;
}

#sentenceEditor .sentence-detector-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#sentenceEditor .sentence-detector-metric {
  padding: 4px 9px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-8px);
  background: var(--paper);
  font-size: .78rem;
  color: var(--muted);
}

#sentenceEditor .sentence-detector-metric strong {
  color: var(--ink);
}

#sentenceEditor .sentence-detector-signals {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .82rem;
  color: var(--sub);
  line-height: 1.5;
}

#sentenceEditor .sentence-detector-spans {
  padding-top: 8px;
  border-top: 1px dashed var(--se-edge);
}

#sentenceEditor .sentence-detector-spans-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

#sentenceEditor .sentence-detector-spans-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink);
}

#sentenceEditor .sentence-detector-span {
  padding: 9px 10px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-10px);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#sentenceEditor .sentence-detector-quote {
  margin: 0;
  font-size: .92rem;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

#sentenceEditor .sentence-detector-reason {
  margin: 0;
  font-size: .8rem;
  color: var(--sub);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#sentenceEditor .sentence-detector-span .sentence-locate {
  align-self: flex-start;
}

html[data-theme="dark"] #sentenceEditor .qa-provider-btn,
html[data-theme="dark"] #sentenceEditor .qa-effort-btn,
html[data-theme="dark"] #sentenceEditor .sentence-detect-btn {
  background: var(--qa-surface);
  border-color: var(--qa-input-border);
  color: var(--qa-text);
}

html[data-theme="dark"] #sentenceEditor .qa-provider-btn:hover,
html[data-theme="dark"] #sentenceEditor .qa-effort-btn:hover:not(:disabled) {
  background: var(--qa-hover-strong);
  border-color: var(--qa-input-border);
}

html[data-theme="dark"] #sentenceEditor .sentence-detect-btn:hover:not(:disabled) {
  border-color: var(--se-style);
  color: var(--qa-text);
  background: var(--se-style-soft);
}

html[data-theme="dark"] #sentenceEditor .sentence-detector {
  background: var(--qa-surface);
  border-color: var(--qa-input-border);
}

html[data-theme="dark"] #sentenceEditor .sentence-detector-metric,
html[data-theme="dark"] #sentenceEditor .sentence-detector-why,
html[data-theme="dark"] #sentenceEditor .sentence-detector-span {
  background: var(--qa-bg);
  border-color: var(--qa-line);
}

html[data-theme="dark"] #sentenceEditor .sentence-detector-score,
html[data-theme="dark"] #sentenceEditor .sentence-detector-why-title,
html[data-theme="dark"] #sentenceEditor .sentence-detector-summary,
html[data-theme="dark"] #sentenceEditor .sentence-detector-metric strong,
html[data-theme="dark"] #sentenceEditor .sentence-detector-spans-title,
html[data-theme="dark"] #sentenceEditor .sentence-detector-quote {
  color: var(--qa-text);
}

html[data-theme="dark"] #sentenceEditor .sentence-detector-signals,
html[data-theme="dark"] #sentenceEditor .sentence-detector-reason,
html[data-theme="dark"] #sentenceEditor .sentence-detector-meta,
html[data-theme="dark"] #sentenceEditor .sentence-detector-metric {
  color: var(--qa-muted);
}

html[data-theme="dark"] #sentenceEditor .sentence-detector-meter {
  background: var(--qa-line);
}

@media (min-width: 721px) and (max-width: 1080px) {
  #sentenceEditor .sentence-columns {
    grid-template-columns: minmax(0, 1fr) 310px 60px;
  }
}

#sentenceEditor .sentence-tool-subtitle {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

#sentenceEditor .sentence-tool-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

#sentenceEditor .sentence-pane-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#sentenceEditor .sentence-pane-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

html body.studio-enabled #sentenceEditor .sentence-tool-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  min-height: 36px;
  border: 0 !important;
  border-radius: var(--radius-pill);
  background: var(--se-green) !important;
  color: var(--palette-white) !important;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sentence-editor-submit);
  transition: filter 0.15s ease, opacity 0.15s ease;
}

html body.studio-enabled #sentenceEditor .sentence-tool-cta:hover:not(:disabled) {
  filter: brightness(1.08);
}

html body.studio-enabled #sentenceEditor .sentence-tool-cta:disabled {
  opacity: 0.55;
  cursor: wait;
  box-shadow: none;
}

#sentenceEditor .sentence-bulk-bar {
  display: flex;
  justify-content: flex-end;
}

html body.studio-enabled #sentenceEditor .sentence-apply-all {
  background: var(--se-green-soft) !important;
  color: var(--se-green) !important;
  border: 1px solid color-mix(in srgb, var(--se-green) 35%, var(--palette-clear)) !important;
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

html body.studio-enabled #sentenceEditor .sentence-apply-all:hover {
  background: color-mix(in srgb, var(--se-green) 20%, var(--palette-clear)) !important;
}

/* Grammarly-style vertical tool rail on right edge */
#sentenceEditor .sentence-rail {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px 8px;
  border-left: 1px solid var(--se-edge);
  background: var(--paper);
  z-index: 12;
  min-width: 0;
}

#sentenceEditor .sentence-rail-dock {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 6px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--se-edge);
  box-shadow: var(--shadow-sentence-editor-shell);
}

html body.studio-enabled #sentenceEditor .sentence-rail-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0 !important;
  border-radius: var(--radius-pill);
  background: var(--palette-clear) !important;
  color: var(--se-green) !important;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.15s ease;
}

html body.studio-enabled #sentenceEditor .sentence-rail-item:hover {
  background: var(--se-green-soft) !important;
  color: var(--se-green) !important;
}

html body.studio-enabled #sentenceEditor .sentence-rail-item[aria-pressed="true"] {
  background: var(--se-green) !important;
  color: var(--palette-white) !important;
  box-shadow: var(--shadow-sentence-editor-submit);
}

html body.studio-enabled #sentenceEditor .sentence-rail-item .sentence-rail-icon,
html body.studio-enabled #sentenceEditor .sentence-rail-item .sentence-rail-icon svg {
  color: inherit !important;
}

#sentenceEditor .sentence-rail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: none;
}

#sentenceEditor .sentence-rail-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

html body.studio-enabled #sentenceEditor .sentence-rail-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--se-fix) !important;
  color: var(--palette-white) !important;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 15px;
  text-align: center;
  pointer-events: none;
}

html body.studio-enabled #sentenceEditor .sentence-rail-item[aria-pressed="true"] .sentence-rail-badge {
  background: var(--palette-dark-surface) !important;
  color: var(--palette-white) !important;
}

@media (min-width: 721px) {
  html body.studio-enabled #sentenceEditor .sentence-rail-label {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    min-width: 148px;
    text-align: right;
    padding: 7px 14px;
    border-radius: var(--radius-btn);
    background: var(--palette-dark-surface) !important;
    color: var(--palette-dark-ink) !important;
    border: 1px solid var(--palette-dark-line-strong) !important;
    box-shadow: var(--shadow);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease, color 0.16s ease, border-color 0.16s ease, background 0.16s ease;
    z-index: 25;
  }

  html body.studio-enabled #sentenceEditor .sentence-rail-dock:hover .sentence-rail-label,
  html body.studio-enabled #sentenceEditor .sentence-rail-dock:focus-within .sentence-rail-label {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }

  html body.studio-enabled #sentenceEditor .sentence-rail-item:hover .sentence-rail-label,
  html body.studio-enabled #sentenceEditor .sentence-rail-item:focus-visible .sentence-rail-label,
  html body.studio-enabled #sentenceEditor .sentence-rail-item[aria-pressed="true"] .sentence-rail-label {
    background: var(--palette-dark-paper) !important;
    color: var(--palette-white) !important;
    font-weight: 700;
    border-color: var(--se-green) !important;
  }
}

@media (max-width: 720px) {
  #sentenceEditor .sentence-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }

  #sentenceEditor .sentence-footer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
  }

  #sentenceEditor .sentence-undo,
  #sentenceEditor .sentence-example {
    min-height: 38px;
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
    border-style: solid;
  }

  #sentenceEditor .sentence-ai-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  #sentenceEditor .sentence-ai-actions .qa-provider-btn,
  #sentenceEditor .sentence-ai-actions .qa-effort-btn {
    min-height: 38px;
    height: 38px;
    padding: 0 12px;
  }

  html body.studio-enabled #sentenceEditor button.sentence-check-btn {
    flex: 1 0 100%;
    width: 100%;
    min-height: 44px;
    background: var(--button-active-bg) !important;
    color: var(--button-active-text) !important;
    border-color: var(--button-active-bg) !important;
    box-shadow: none !important;
    font-weight: 700;
  }

  #sentenceEditor .sentence-filters button {
    min-height: 40px;
    border-radius:var(--radius-btn) !important;
  }

  html[data-theme="dark"] body.studio-enabled #sentenceEditor .sentence-filters button[aria-pressed="true"] {
    background: var(--button-active-bg) !important;
    color: var(--button-active-text) !important;
    border-color: var(--button-active-bg) !important;
  }

  #sentenceEditor .sentence-rail {
    order: 2;
    border-left: 0;
    border-top: 1px solid var(--se-edge);
    padding: 8px 12px;
    justify-content: flex-start;
  }

  #sentenceEditor .sentence-rail-dock {
    flex-direction: row;
    width: 100%;
    overflow-x: auto;
    padding: 4px 20px 4px 4px;
    gap: 6px;
    justify-content: flex-start;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, var(--ink) 88%, var(--palette-clear) 100%);
    mask-image: linear-gradient(to right, var(--ink) 88%, var(--palette-clear) 100%);
  }

  #sentenceEditor .sentence-rail-dock::-webkit-scrollbar {
    display: none;
  }

  html body.studio-enabled #sentenceEditor .sentence-rail-item {
    width: auto;
    min-height: 40px;
    height: 40px;
    padding: 0 12px;
    gap: 6px;
    flex: none;
  }

  html body.studio-enabled #sentenceEditor .sentence-rail-label {
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    background: var(--palette-clear);
    box-shadow: none;
    border: 0;
    padding: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
  }

  html body.studio-enabled #sentenceEditor .sentence-rail-badge {
    position: static;
    margin-left: 2px;
  }
}

/* Rewrite / Paraphrase pane */
#sentenceEditor .sentence-rewrite-styles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#sentenceEditor .sentence-rewrite-styles button {
  flex: 1 1 auto;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-pill);
  background: var(--palette-white);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

#sentenceEditor .sentence-rewrite-styles button[aria-pressed="true"] {
  background: var(--se-green-soft);
  border-color: var(--se-green);
  color: var(--se-green);
  font-weight: 700;
}

#sentenceEditor .sentence-rewrite-card {
  padding: 12px 14px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-16px);
  background: var(--palette-white);
  box-shadow: var(--shadow-sentence-editor-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#sentenceEditor .sentence-rewrite-meta {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
}

#sentenceEditor .sentence-rewrite-text {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-10px);
  background: var(--paper);
  border: 1px solid var(--se-edge);
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#sentenceEditor .sentence-rewrite-notes {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--sub);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#sentenceEditor .sentence-rewrite-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Quick AI Chat pane */
#sentenceEditor .sentence-qa-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#sentenceEditor .sentence-qa-chips button {
  padding: 5px 10px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

#sentenceEditor .sentence-qa-chips button:hover {
  border-color: var(--se-green);
  color: var(--se-green);
}

#sentenceEditor .sentence-qa-compose {
  display: flex;
  gap: 8px;
  align-items: center;
}

#sentenceEditor .sentence-qa-compose input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-pill);
  background: var(--palette-white);
  color: var(--ink);
  font-size: 0.84rem;
}

#sentenceEditor .sentence-qa-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#sentenceEditor .sentence-qa-msg {
  padding: 10px 12px;
  border-radius: var(--radius-10px);
  border: 1px solid var(--se-edge);
  background: var(--palette-white);
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#sentenceEditor .sentence-qa-msg[data-role="user"] {
  background: var(--se-green-soft);
  border-color: color-mix(in srgb, var(--se-green) 30%, var(--palette-clear));
  font-weight: 600;
}

#sentenceEditor .sentence-qa-msg-meta {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
}

/* Word / Hanzi stats pane */
#sentenceEditor .sentence-stats-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#sentenceEditor .sentence-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#sentenceEditor .sentence-stat-card {
  padding: 10px 12px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-10px);
  background: var(--palette-white);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#sentenceEditor .sentence-stat-card strong {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}

#sentenceEditor .sentence-stat-card span {
  font-size: 0.76rem;
  color: var(--muted);
}

#sentenceEditor .sentence-stats-progress {
  height: 7px;
  width: 100%;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}

#sentenceEditor .sentence-stats-progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--se-green);
  transition: width 0.2s ease;
}

/* Dark theme overrides for right rail and panes */
html[data-theme="dark"] #sentenceEditor .sentence-rail {
  background: var(--qa-bg);
  border-color: var(--palette-dark-line-strong);
}

html[data-theme="dark"] #sentenceEditor .sentence-rail-dock {
  background: var(--palette-dark-surface);
  border-color: var(--palette-dark-line-strong);
}

html[data-theme="dark"] #sentenceEditor .sentence-rewrite-styles button,
html[data-theme="dark"] #sentenceEditor .sentence-rewrite-card,
html[data-theme="dark"] #sentenceEditor .sentence-qa-chips button,
html[data-theme="dark"] #sentenceEditor .sentence-qa-compose input,
html[data-theme="dark"] #sentenceEditor .sentence-qa-msg,
html[data-theme="dark"] #sentenceEditor .sentence-stat-card {
  background: var(--palette-dark-surface);
  border-color: var(--palette-dark-line-strong);
  color: var(--palette-dark-ink);
}

html[data-theme="dark"] #sentenceEditor .sentence-rewrite-styles button[aria-pressed="true"] {
  background: var(--se-green-soft);
  border-color: var(--se-green);
  color: var(--se-green);
}

html[data-theme="dark"] #sentenceEditor .sentence-qa-msg[data-role="user"] {
  background: var(--se-green-soft);
  border-color: color-mix(in srgb, var(--se-green) 35%, var(--palette-clear));
}

html[data-theme="dark"] #sentenceEditor .sentence-rewrite-text {
  background: var(--qa-bg);
  border-color: var(--qa-line);
  color: var(--qa-text);
}

html[data-theme="dark"] #sentenceEditor .sentence-stat-card strong {
  color: var(--qa-text);
}

html[data-theme="dark"] #sentenceEditor .sentence-tool-subtitle,
html[data-theme="dark"] #sentenceEditor .sentence-pane-hint,
html[data-theme="dark"] #sentenceEditor .sentence-rewrite-notes,
html[data-theme="dark"] #sentenceEditor .sentence-stat-card span {
  color: var(--qa-muted);
}

/* AI Grader pane */
#sentenceEditor .sentence-grader-rubrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#sentenceEditor .sentence-grader-rubrics button {
  flex: 1 1 auto;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-pill);
  background: var(--palette-white);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

#sentenceEditor .sentence-grader-rubrics button[aria-pressed="true"] {
  background: var(--se-green-soft);
  border-color: var(--se-green);
  color: var(--se-green);
  font-weight: 700;
}

#sentenceEditor .sentence-grader-topic-wrap input {
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-pill);
  background: var(--palette-white);
  color: var(--ink);
  font-size: 0.82rem;
}

#sentenceEditor .sentence-grader-card {
  padding: 14px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-16px);
  background: var(--palette-white);
  box-shadow: var(--shadow-sentence-editor-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#sentenceEditor .sentence-grader-hero {
  display: flex;
  align-items: center;
  gap: 12px;
}

#sentenceEditor .sentence-grader-score-badge {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: none;
  background: var(--se-green-soft);
  color: var(--se-green);
  border: 1px solid color-mix(in srgb, var(--se-green) 35%, var(--palette-clear));
}

#sentenceEditor .sentence-grader-score-badge[data-tier="mid"] {
  background: var(--se-style-soft);
  color: var(--se-style);
  border-color: color-mix(in srgb, var(--se-style) 35%, var(--palette-clear));
}

#sentenceEditor .sentence-grader-score-badge[data-tier="low"] {
  background: var(--se-fix-soft);
  color: var(--se-fix);
  border-color: color-mix(in srgb, var(--se-fix) 35%, var(--palette-clear));
}

#sentenceEditor .sentence-grader-score-badge strong {
  font-size: 1.32rem;
  font-weight: 850;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

#sentenceEditor .sentence-grader-score-badge small {
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.85;
}

#sentenceEditor .sentence-grader-hero-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

#sentenceEditor .sentence-grader-grade {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--ink-strong);
}

#sentenceEditor .sentence-grader-hsk {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--paper);
  border: 1px solid var(--se-edge);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink);
}

#sentenceEditor .sentence-grader-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

#sentenceEditor .sentence-grader-summary {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--ink);
}

#sentenceEditor .sentence-grader-criteria {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

#sentenceEditor .sentence-grader-criterion {
  padding: 9px 10px;
  border: 1px solid var(--se-edge);
  border-radius: var(--radius-10px);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#sentenceEditor .sentence-grader-criterion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
}

#sentenceEditor .sentence-grader-bar {
  height: 6px;
  width: 100%;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}

#sentenceEditor .sentence-grader-bar > span {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--se-green);
}

#sentenceEditor .sentence-grader-criterion-note {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--sub);
}

#sentenceEditor .sentence-grader-section-title {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 750;
  color: var(--ink-strong);
}

#sentenceEditor .sentence-grader-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--sub);
}

html[data-theme="dark"] #sentenceEditor .sentence-grader-rubrics button,
html[data-theme="dark"] #sentenceEditor .sentence-grader-topic-wrap input,
html[data-theme="dark"] #sentenceEditor .sentence-grader-card {
  background: var(--palette-dark-surface);
  border-color: var(--palette-dark-line-strong);
  color: var(--palette-dark-ink);
}

html[data-theme="dark"] #sentenceEditor .sentence-grader-rubrics button[aria-pressed="true"] {
  background: var(--se-green-soft);
  border-color: var(--se-green);
  color: var(--se-green);
}

html[data-theme="dark"] #sentenceEditor .sentence-grader-criterion,
html[data-theme="dark"] #sentenceEditor .sentence-grader-hsk {
  background: var(--qa-bg);
  border-color: var(--qa-line);
  color: var(--qa-text);
}

html[data-theme="dark"] #sentenceEditor .sentence-grader-grade,
html[data-theme="dark"] #sentenceEditor .sentence-grader-summary,
html[data-theme="dark"] #sentenceEditor .sentence-grader-criterion-head,
html[data-theme="dark"] #sentenceEditor .sentence-grader-section-title {
  color: var(--qa-text);
}

html[data-theme="dark"] #sentenceEditor .sentence-grader-meta,
html[data-theme="dark"] #sentenceEditor .sentence-grader-criterion-note,
html[data-theme="dark"] #sentenceEditor .sentence-grader-list {
  color: var(--qa-muted);
}

html[data-theme="dark"] #sentenceEditor .sentence-grader-bar {
  background: var(--qa-line);
}
