.text-tool-shell {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(20, 60, 120, 0.08);
  box-shadow: 0 18px 40px rgba(13, 45, 80, 0.08);
  padding: 32px 28px;
  margin-bottom: 32px;
}

.text-tool-shell + .text-tool-shell {
  margin-top: 28px;
}

.text-tool-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 22px;
}

.text-tool-header h1,
.text-tool-header h2 {
  font-weight: 600;
  color: #1a2e45;
  margin: 0;
}

.text-tool-subtitle {
  color: #5a7186;
  margin: 0;
  font-size: 0.98rem;
}

.text-tool-form {
  display: grid;
  gap: 20px;
}

.text-tool-editor {
  display: grid;
  gap: 12px;
}

.text-tool-editor label {
  font-weight: 500;
  color: #1f3651;
  font-size: 0.95rem;
}

.text-tool-textarea {
  min-height: 280px;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid #d9e2ef;
  padding: 16px 18px;
  font-size: 1rem;
  line-height: 1.55;
  box-shadow: inset 0 1px 3px rgba(15, 45, 80, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-tool-textarea:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.12);
  outline: none;
}

.text-dropzone {
  position: relative;
  border: 2px dashed rgba(13, 110, 253, 0.28);
  border-radius: 16px;
  background: rgba(13, 110, 253, 0.05);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.text-dropzone:focus {
  outline: none;
  border-color: #0b5ed7;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.12);
}

.text-dropzone[data-dragover="true"],
.text-dropzone:hover {
  border-color: #0b5ed7;
  background: rgba(13, 110, 253, 0.08);
}

.text-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.text-dropzone strong {
  font-size: 1rem;
  color: #0d3b70;
}

.text-dropzone span {
  color: #5a7186;
  font-size: 0.92rem;
}

.text-tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.text-tool-actions .btn {
  border-radius: 999px;
  font-weight: 600;
  padding: 10px 18px;
}

.text-tool-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.text-tool-toolbar button {
  border: 1px solid rgba(13, 110, 253, 0.25);
  border-radius: 999px;
  padding: 9px 18px;
  background: #f0f6ff;
  color: #0d3b70;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.text-tool-toolbar button:hover,
.text-tool-toolbar button:focus {
  background: #0d6efd;
  color: #fff;
  outline: none;
  border-color: #0d6efd;
}

.text-tool-toolbar button[aria-pressed="true"] {
  background: linear-gradient(135deg, #0d6efd, #6610f2);
  color: #fff;
  border-color: transparent;
}

.text-tool-result-panel {
  border-radius: 16px;
  border: 1px dashed rgba(13, 110, 253, 0.25);
  background: rgba(13, 110, 253, 0.04);
  padding: 24px;
  display: grid;
  gap: 18px;
}

.text-tool-result-panel[hidden] {
  display: none !important;
}

.text-tool-result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.text-tool-result-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a2e45;
  display: flex;
  align-items: center;
  gap: 10px;
}

.text-tool-result-header h2 i {
  color: #0d6efd;
}

.text-tool-result-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 768px) {
  .text-tool-result-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }
}

.text-tool-stat {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(13, 110, 253, 0.12);
  box-shadow: 0 12px 30px rgba(12, 66, 133, 0.08);
  padding: 14px 16px;
}

.text-tool-stat dt {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5a7186;
}

.text-tool-stat dd {
  margin: 6px 0 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #10263f;
}

.text-tool-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid rgba(13, 110, 253, 0.25);
  padding: 8px 16px;
  background: #fff;
  color: #0d3b70;
  font-weight: 600;
  transition: all 0.2s ease;
}

.text-tool-copy:hover,
.text-tool-copy:focus {
  background: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
  text-decoration: none;
}

.text-tool-output {
  width: 100%;
  min-height: 200px;
  border-radius: 14px;
  border: 1px solid rgba(13, 110, 253, 0.22);
  background: rgba(13, 110, 253, 0.05);
  padding: 16px 18px;
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.95rem;
  line-height: 1.55;
  resize: vertical;
}

.text-tool-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  background: rgba(13, 110, 253, 0.1);
  color: #0d3b70;
  font-weight: 600;
}

.text-tool-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.text-tool-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #41566f;
}

.text-tool-legend span::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: currentColor;
  opacity: 0.4;
}

.text-diff-shell {
  display: grid;
  gap: 20px;
}

@media (min-width: 992px) {
  .text-diff-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
}


.text-diff-live {
  border-radius: 18px;
  border: 1px solid rgba(13, 110, 253, 0.16);
  background: #fff;
  overflow: hidden;
  display: grid;
  gap: 0;
}

.text-diff-legend {
  display: grid;
  gap: 12px 18px;
  padding: 18px 24px;
  background: rgba(13, 110, 253, 0.05);
  border-bottom: 1px solid rgba(13, 110, 253, 0.12);
  align-items: flex-start;
}

@media (min-width: 768px) {
  .text-diff-legend {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  }
}

.text-diff-legend__item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  column-gap: 12px;
  row-gap: 2px;
  font-size: 0.9rem;
  color: #1f3651;
}

.text-diff-legend__item strong {
  font-size: 0.92rem;
  font-weight: 600;
}

.text-diff-legend__item span[aria-hidden="true"] {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  margin-top: 3px;
}

.text-diff-legend__item--equal span[aria-hidden="true"] {
  background: rgba(108, 117, 125, 0.35);
}

.text-diff-legend__item--delete span[aria-hidden="true"] {
  background: rgba(220, 53, 69, 0.35);
}

.text-diff-legend__item--insert span[aria-hidden="true"] {
  background: rgba(25, 135, 84, 0.35);
}

.text-diff-legend__item--replace span[aria-hidden="true"] {
  background: rgba(255, 193, 7, 0.45);
}

.text-diff-legend > .text-tool-badge {
  justify-self: end;
  align-self: center;
}

.text-diff-progress {
  padding: 14px 24px;
  font-size: 0.92rem;
  color: #1f3651;
  background: rgba(13, 110, 253, 0.08);
  border-bottom: 1px solid rgba(13, 110, 253, 0.12);
}

.text-tool-inline-error {
  margin: 0;
  padding: 12px 24px;
  font-size: 0.9rem;
  color: #842029;
  background: rgba(220, 53, 69, 0.12);
  border-top: 1px solid rgba(220, 53, 69, 0.24);
  border-bottom: 1px solid rgba(220, 53, 69, 0.24);
}

.text-diff-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid rgba(13, 110, 253, 0.12);
}

@media (min-width: 992px) {
  .text-diff-panels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.text-diff-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}

@media (min-width: 992px) {
  .text-diff-panel:first-child {
    border-right: 1px solid rgba(13, 110, 253, 0.12);
  }
}

.text-diff-panel:not(:first-child) {
  border-top: 1px solid rgba(13, 110, 253, 0.12);
}

@media (min-width: 992px) {
  .text-diff-panel:not(:first-child) {
    border-top: none;
  }
}

.text-diff-panel__header {
  padding: 14px 24px;
  font-size: 0.94rem;
  font-weight: 600;
  color: #1f2f47;
  background: rgba(13, 110, 253, 0.06);
  border-bottom: 1px solid rgba(13, 110, 253, 0.12);
}

.text-diff-lines {
  flex: 1;
  max-height: 420px;
  overflow: auto;
}

.text-diff-line {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  border-bottom: 1px solid rgba(13, 110, 253, 0.08);
}

.text-diff-line__number {
  padding: 10px 16px;
  text-align: right;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  color: #3d5670;
  background: rgba(12, 66, 133, 0.06);
}

.text-diff-panel[data-side="b"] .text-diff-line__number {
  background: rgba(25, 135, 84, 0.08);
  color: #205143;
}

.text-diff-line__content {
  padding: 10px 16px;
  font-family: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  transition: background-color 0.2s ease;
}

.text-diff-line[data-state="replace"] .text-diff-line__content {
  background: rgba(255, 193, 7, 0.2);
}

.text-diff-panel[data-side="a"] .text-diff-line[data-state="delete"] .text-diff-line__content {
  background: rgba(220, 53, 69, 0.18);
  color: #5f1a21;
}

.text-diff-panel[data-side="b"] .text-diff-line[data-state="delete"] .text-diff-line__content,
.text-diff-panel[data-side="a"] .text-diff-line[data-state="insert"] .text-diff-line__content {
  background: rgba(12, 66, 133, 0.035);
}

.text-diff-panel[data-side="b"] .text-diff-line[data-state="insert"] .text-diff-line__content {
  background: rgba(25, 135, 84, 0.2);
  color: #1d4639;
}

.text-diff-line:last-child {
  border-bottom: none;
}

.text-diff__highlight {
  background: rgba(255, 255, 255, 0.55);
  padding: 0 2px;
  border-radius: 3px;
}

.text-diff__highlight--replace {
  background: rgba(255, 193, 7, 0.55);
}

.text-diff__highlight--delete {
  background: rgba(220, 53, 69, 0.45);
  color: #fff;
}

.text-diff__highlight--insert {
  background: rgba(25, 135, 84, 0.35);
}

.text-tool-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  color: #1f3651;
}

.text-tool-toggle input[type="checkbox"] {
  accent-color: #0d6efd;
  width: 18px;
  height: 18px;
}

.text-tool-hint {
  color: #5a7186;
  font-size: 0.88rem;
  margin: 0;
}

.text-tool-error {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid rgba(220, 53, 69, 0.2);
  color: #821622;
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 500;
}

.text-tool-empty-state {
  padding: 16px 18px;
  background: rgba(12, 66, 133, 0.04);
  border-radius: 12px;
  color: #41566f;
  font-size: 0.95rem;
}

.text-tool-h-scroll {
  overflow-x: auto;
}

.text-tool-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.text-tool-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(13, 110, 253, 0.12);
  color: #0d3b70;
  font-weight: 600;
  font-size: 0.85rem;
}
