/* ============================================================
   Toolbox — 文本处理页面
   ============================================================ */

html[data-theme="light"] {
  --accent: #4f46e5;
  --accent-ink: #4338ca;
  --accent-solid: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-border: #c9cdfb;
  --on-accent: #ffffff;
}

html[data-theme="dark"] {
  --accent: #a5b4fc;
  --accent-ink: #c7d2fe;
  --accent-solid: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(129, 140, 248, .14);
  --accent-border: rgba(129, 140, 248, .38);
  --on-accent: #ffffff;
}

body::before {
  background:
    radial-gradient(48% 60% at 18% 10%, rgba(99, 102, 241, .17), transparent 70%),
    radial-gradient(42% 55% at 82% 0%, rgba(14, 165, 233, .12), transparent 72%);
}

html[data-theme="dark"] body::before {
  background:
    radial-gradient(48% 60% at 18% 10%, rgba(99, 102, 241, .2), transparent 70%),
    radial-gradient(42% 55% at 82% 0%, rgba(14, 165, 233, .14), transparent 72%);
}

.brand-mark {
  background: linear-gradient(140deg, #818cf8, #4f46e5 70%);
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .8);
}
html[data-theme="dark"] .brand-mark {
  background: linear-gradient(140deg, #a5b4fc, #6366f1 75%);
  color: #111827;
}

.text-hero { padding-bottom: 20px; }
.text-workspace { padding-bottom: 2px; }
.text-workspace .panel { padding: 22px; }

.workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.workspace-head h2 { margin: 0; font-size: 16px; letter-spacing: -.015em; }
.workspace-head p { margin: 5px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.65; }

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--success) 25%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--success) 7%, var(--surface));
  color: var(--muted);
  font-size: 11px;
}
.local-badge span { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

.operation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.operation-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface-2) 48%, var(--surface));
}
.operation-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}
.operation-number {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 10px;
}

.space-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}
.check-option {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.check-option:hover { border-color: var(--accent-border); color: var(--text); }
.check-option input {
  flex: none;
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent-solid);
}
.check-option input:checked + span { color: var(--accent-ink); font-weight: 600; }

.field-label { color: var(--muted); font-size: 11px; font-weight: 600; }
.operation-row { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.operation-row .select { flex: 1 1 auto; min-width: 0; max-width: none; }
.operation-card .btn { flex: none; height: 35px; padding: 0 12px; font-size: 12px; }

.field-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
  width: 100%;
}
.field-pair .text-input { height: 35px; font-family: var(--sans); font-size: 12px; }
.operation-card > .btn { align-self: flex-end; }
.operation-actions { justify-content: flex-end; margin-top: auto; }
.operation-actions .btn { min-width: 0; }

.indent-settings {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr) auto minmax(82px, .8fr);
  align-items: center;
  gap: 8px;
  width: 100%;
}
.indent-settings .select { width: 100%; max-width: none; }

.text-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.text-pane { display: flex; flex-direction: column; min-width: 0; }
.pane-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pane-heading label { font-size: 13px; font-weight: 700; }
.text-count { color: var(--muted-2); font-family: var(--mono); font-size: 10.5px; white-space: nowrap; }

.text-area {
  display: block;
  width: 100%;
  min-height: 280px;
  resize: vertical;
  padding: 13px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  tab-size: 4;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.text-area:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.text-area::placeholder { color: var(--muted-2); font-family: var(--sans); }

.pane-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding-top: 7px;
  color: var(--muted-2);
  font-size: 10.5px;
}
.pane-footer .link-btn { flex: none; font-size: 11.5px; }
.result-actions { flex-wrap: wrap; }
.pane-buttons { display: flex; justify-content: flex-end; gap: 7px; margin-left: auto; }
.pane-buttons .btn,
.pane-buttons #copyBtn,
.pane-buttons #downloadBtn {
  height: 34px;
  min-width: 76px;
  padding: 0 11px;
  font-size: 11.5px;
}
.pane-buttons .btn:disabled { cursor: not-allowed; opacity: .48; }

.text-workspace + .article-wrap { padding-top: 24px; }
.text-workspace + .article-wrap .article { padding-top: 23px; padding-bottom: 24px; }
.text-workspace + .article-wrap .article h2 { font-size: 17px; }
.text-workspace + .article-wrap .prose-list { margin-bottom: 0; }
.text-workspace + .article-wrap .prose-list li { font-size: 12.5px; }

@media (max-width: 820px) {
  .indent-settings { grid-template-columns: auto minmax(80px, 1fr); }
}

@media (max-width: 720px) {
  .text-hero { padding-top: 34px; }
  .text-workspace .panel { padding: 16px; }
  .operation-grid { grid-template-columns: 1fr; }
  .text-panels { grid-template-columns: 1fr; }
  .text-area { min-height: 220px; }
  .workspace-head { flex-direction: column; }
}

@media (max-width: 420px) {
  .operation-row { align-items: stretch; }
  .operation-card .btn { padding: 0 9px; font-size: 11.5px; }
  .pane-footer { align-items: flex-start; }
  .result-actions { flex-direction: column; }
  .pane-buttons { align-self: flex-end; width: auto; }
  .pane-buttons .btn { flex: none; }
}
