/* ============================================================
   AllToolio — style wspólne dla narzędzi (tools/*)
   ============================================================ */

.tool-main {
  padding: 2rem 0 3rem;
}

.tool-head {
  margin-bottom: 1.5rem;
}

.tool-head h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.tool-head p {
  color: var(--text-muted);
}

/* Static seasonal navigation keeps its space before scripts run. */
.seasonal-tools {
  padding-bottom: 2rem;
}

.seasonal-tools h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}

.seasonal-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.seasonal-links a {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.seasonal-links a:hover,
.seasonal-links a:focus-visible {
  background: var(--surface-hover);
  text-decoration: underline;
}

@media (max-width: 700px) {
  .seasonal-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Link powrotu w nagłówku narzędzia */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
  text-decoration: none;
}

/* ---------- PANELE ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 1.25rem;
}

.panel h2,
.panel h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

/* ---------- PRZYCISKI ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- FORMULARZE ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="search"],
input[type="file"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="email"],
input[type="url"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input[type="range"] {
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

input[type="range"]:focus {
  box-shadow: none;
}

input[type="checkbox"] {
  accent-color: var(--primary);
}

.select-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- TABY (pod-nawigacja narzędzia) ---------- */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tab-btn {
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- KARTY FISZEK ---------- */
.flashcard-box {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease;
}

.flashcard-box:hover {
  border-color: var(--primary);
}

.flashcard-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.flashcard-value {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.3;
  word-break: break-word;
}

.flashcard-value.answer {
  color: var(--primary);
}

/* ---------- QUIZ ---------- */
.quiz-question {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  line-height: 1.35;
}

.answer-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.answer-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.14s ease;
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.answer-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent);
  outline-offset: 2px;
}

.quiz-timer {
  min-width: 4.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.quiz-timer.urgent {
  color: var(--danger);
  animation: quiz-pulse 0.9s ease-in-out infinite alternate;
}

@keyframes quiz-pulse {
  from { opacity: 1; }
  to { opacity: 0.62; }
}

.quiz-feedback {
  margin: 0.85rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  font-weight: 700;
}

.quiz-feedback.correct {
  background: #dcfce7;
  color: #14532d;
}

.quiz-feedback.wrong {
  background: #fee2e2;
  color: #7f1d1d;
}

[data-theme="dark"] .quiz-feedback.correct {
  background: #052e16;
  color: #bbf7d0;
}

[data-theme="dark"] .quiz-feedback.wrong {
  background: #450a0a;
  color: #fecaca;
}

.answer-letter {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--surface-hover);
  font-weight: 800;
  font-size: 0.9rem;
}

.answer-btn.correct {
  background: #dcfce7;
  border-color: #22c55e;
  color: #14532d;
}

[data-theme="dark"] .answer-btn.correct {
  background: #052e16;
  border-color: #16a34a;
  color: #bbf7d0;
}

.answer-btn.wrong {
  background: #fee2e2;
  border-color: #ef4444;
  color: #7f1d1d;
}

[data-theme="dark"] .answer-btn.wrong {
  background: #450a0a;
  border-color: #dc2626;
  color: #fecaca;
}

/* ---------- WYNIKI ---------- */
.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.score-card {
  min-width: 0;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
}

.score-card .score-rank {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.score-card .score-name {
  margin: 0.2rem 0 0.55rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.score-card .value {
  font-size: clamp(1.2rem, 5vw, 1.7rem);
  overflow-wrap: anywhere;
  font-weight: 900;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.score-card .caption {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Phones: two cards a row leave about 110 px for the figure. Less side padding and a slightly smaller figure keep
   amounts such as "70 000,00 zł" on one line; overflow-wrap still breaks longer ones. */
@media (max-width: 480px) {
  .score-card {
    padding: 0.85rem 0.55rem;
  }

  .score-card .value {
    font-size: clamp(1.05rem, 4.5vw, 1.7rem);
  }
}

.score-card .score-details {
  margin-top: 0.35rem;
  line-height: 1.45;
}

.score-card.winner {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
}

.score-winner {
  margin-top: 0.65rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-summary {
  margin: -0.45rem 0 0;
  color: var(--text-muted);
  font-weight: 700;
}

.password-strength {
  margin-top: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(79, 70, 229, 0.04);
  color: var(--text);
  font-weight: 700;
  min-height: 2.8rem;
  display: flex;
  align-items: center;
}

.password-strength.empty {
  opacity: 0.65;
  background: transparent;
}

.password-strength.weak {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
}

.password-strength.medium {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
  color: #92400e;
}

.password-strength.good {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.08);
  color: #1d4ed8;
}

.password-strength.strong {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: #166534;
}

.frequency-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.frequency-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.frequency-rank {
  min-width: 2rem;
  color: var(--primary);
  font-weight: 800;
}

.frequency-word {
  flex: 1;
  font-weight: 700;
}

.frequency-count {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-weight: 800;
}

.frequency-empty {
  color: var(--text-muted);
  padding: 0.8rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: transparent;
}

/* ---------- OBRAZ ---------- */
.image-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.image-canvas-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  background:
    linear-gradient(45deg, var(--surface-hover) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-hover) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-hover) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-hover) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

#image-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.control-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.control-group output {
  color: var(--primary);
  font-weight: 700;
}

/* ---------- CSV / EXCEL ---------- */
.csv-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 440px;
  overflow-y: auto;
}

.csv-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
}

.csv-table th,
.csv-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.csv-table th {
  position: sticky;
  top: 0;
  background: var(--bg-alt);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.csv-table th:hover {
  color: var(--primary);
}

.csv-table tr:hover td {
  background: var(--surface-hover);
}

.stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.stat-chip {
  padding: 0.35rem 0.7rem;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.copy-area {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* ---------- WSKAZÓWKI / STATUS ---------- */
.hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.status {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-top: 0.75rem;
}

.status.ok {
  background: #dcfce7;
  color: #14532d;
}

.status.err {
  background: #fee2e2;
  color: #7f1d1d;
}

[data-theme="dark"] .status.ok {
  background: #052e16;
  color: #bbf7d0;
}

[data-theme="dark"] .status.err {
  background: #450a0a;
  color: #fecaca;
}

/* ---------- GRID UKŁADU ---------- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

/* ---------- LISTA TALII / ELEMENTÓW ---------- */
.list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.list-item .grow {
  flex-grow: 1;
}

/* PDF merge / images-to-PDF rows can be dragged to a new position (js/pdf-tools.js). */
.pdf-row {
  cursor: grab;
}

.pdf-row.pdf-dragging {
  opacity: 0.45;
}

.pdf-row.pdf-drop-target {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.hidden {
  display: none !important;
}

/* ---------- KALKULATOR ---------- */
.calculator {
  max-width: 440px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.calc-display {
  position: relative;
  padding: 1.25rem 1.5rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  min-height: 120px;
}

.calc-history {
  min-height: 1.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  overflow-y: auto;
  max-height: 60px;
}

.calc-history div {
  white-space: pre-wrap;
  word-break: break-all;
}

.calc-input {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  word-break: break-all;
  line-height: 1.2;
  text-align: right;
}

.calc-mode {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 0.06em;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
  padding: 0.75rem;
}

.calc-btn {
  height: 52px;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}

.calc-btn:hover {
  background: var(--surface-hover);
}

.calc-btn:active {
  transform: scale(0.96);
}

.calc-btn.calc-fn {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.85rem;
}

.calc-btn.calc-fn:hover {
  background: color-mix(in srgb, var(--primary-soft) 80%, var(--primary));
  color: #fff;
}

.calc-btn.calc-op {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.2rem;
}

.calc-btn.calc-op:hover {
  background: var(--accent);
  color: #fff;
}

.calc-btn.calc-eq {
  background: var(--primary);
  color: #fff;
  font-size: 1.3rem;
}

.calc-btn.calc-eq:hover {
  background: var(--primary-strong);
}

/* ---------- OCR (FISZKI) ---------- */
.ocr-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.ocr-options .field {
  margin-bottom: 0;
}

.ocr-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.75rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ocr-drop:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.ocr-drop.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.ocr-progress {
  margin: 1rem 0;
}

.ocr-progress-track {
  width: 100%;
  height: 10px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.ocr-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.ocr-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.ocr-preview {
  margin: 1rem 0;
  text-align: center;
}

.ocr-preview img {
  max-height: 260px;
  margin-inline: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* Pary rozpoznanych słówek */
.ocr-pairs {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ocr-pairs-header {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--bg-alt);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.ocr-pair {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--border);
}

.ocr-pair input {
  font-size: 0.92rem;
}

.ocr-pair .btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
}

.ocr-add-all {
  margin-top: 0.9rem;
}

/* ---------- KALKULATOR SYMBOLICZNY ---------- */
.symbolic-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 2rem;
  align-items: start;
}
.symbolic-entry, .symbolic-results { min-width: 0; }
.symbolic-entry > .hint:first-child { margin-top: 0; }
.symbolic-input {
  width: 100%;
  min-height: 6rem;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1rem;
  line-height: 1.6;
}
.symbolic-controls { display: flex; gap: 0.75rem; align-items: end; margin-top: 0.75rem; }
.symbolic-controls .field { flex: 1; min-width: 0; margin: 0; }
.symbolic-controls select { width: 100%; }
.symbolic-controls .btn { min-height: 42px; }
.symbolic-preview-panel { margin: 1rem 0; padding: 0.75rem 0; border-top: 1px solid var(--border); }
.symbolic-preview-panel .hint { margin: 0 0 0.35rem; }
.math-expression { min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding-block: 0.35rem; }
.math-expression math { font-family: "Cambria Math", "STIX Two Math", "Latin Modern Math", math; font-size: 1.15em; margin: 0; width: max-content; }
.math-fallback { display: block; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.9rem; }
.math-note { display: block; font-family: inherit; font-size: 1rem; line-height: 1.5; }
.symbolic-examples { margin: 1rem 0; border-top: 1px solid var(--border); padding-top: 0.85rem; }
.symbolic-examples summary { cursor: pointer; font-weight: 600; }
.symbolic-examples .hint { margin: 0.75rem 0; }
.symbolic-example-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.symbolic-example { display: flex; flex-direction: column; align-items: start; gap: 0.5rem; min-width: 0; padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); text-align: start; font: inherit; cursor: pointer; }
.symbolic-example:hover, .symbolic-example:focus-visible { border-color: var(--primary); }
.symbolic-example > span:first-child { font-size: 0.8rem; font-weight: 600; }
.symbolic-example-formula { display: block; width: 100%; flex-shrink: 0; overflow-x: auto; padding-block: 0.5rem; font-size: 0.9rem; }
.symbolic-example-formula math { font-size: 1em; margin: 0; width: max-content; }
.symbolic-results { border-left: 1px solid var(--border); padding-left: 2rem; }
.symbolic-result-title { font-size: 1.05rem; margin: 0 0 0.75rem; }
.symbolic-output { margin: 0.5rem 0 0.75rem; padding: 1rem 0; font-size: 1.45rem; }
#symbolic-copy { max-width: 100%; white-space: normal; }
#symbolic-format-status:empty, #symbolic-copy-status:empty { display: none; }
.symbolic-steps { margin-top: 1.25rem; }
.symbolic-steps-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; }
@media (max-width: 800px) {
  .symbolic-workspace { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .symbolic-results { border-left: 0; padding: 1rem 0 0; border-top: 1px solid var(--border); }
}
@media (max-width: 420px) {
  .symbolic-example-grid { grid-template-columns: minmax(0, 1fr); }
}

.step-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.step-item + .step-item {
  margin-top: 0.5rem;
}

.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  font-size: 0.78rem;
}

.step-body {
  min-width: 0;
}

.step-text {
  font-size: 0.9rem;
  line-height: 1.45;
}

.step-expr {
  white-space: pre-wrap;
  font-size: 1rem;
  color: var(--text);
  margin-top: 0.4rem;
}

/* Wykres */
.symbolic-plot {
  margin-top: 1.25rem;
}

.symbolic-plot canvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  touch-action: none;
  cursor: grab;
}

.symbolic-plot canvas:active {
  cursor: grabbing;
}

.symbolic-plot-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* Historia symboliczna */
.symbolic-history {
  margin-top: 1.5rem;
}

.symbolic-history-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.symbolic-history-title h3 {
  margin-bottom: 0;
}

#symbolic-history-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.symbolic-history-item { display: block; width: 100%; min-width: 0; padding: 0.85rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); text-align: start; font: inherit; cursor: pointer; }
.symbolic-history-item:hover, .symbolic-history-item:focus-visible { border-color: var(--primary); }
.symbolic-history-item .op { display: block; color: var(--text-muted); font-size: 0.8rem; margin-bottom: 0.5rem; }
.symbolic-history-item .math-expression { display: block; font-size: 0.9rem; }
.symbolic-history-item .out { color: var(--primary); border-top: 1px solid var(--border); margin-top: 0.5rem; }
@media (max-width: 800px) { #symbolic-history-list { grid-template-columns: minmax(0, 1fr); } }

.symbolic-error {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ---------- RESPONSYWNOŚĆ ---------- */
@media (max-width: 800px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .tool-main {
    padding: 1.5rem 0 2.5rem;
  }

  .flashcard-value {
    font-size: 1.3rem;
  }

  .ocr-pairs-header,
  .ocr-pair {
    grid-template-columns: 1fr 1fr auto;
    gap: 0.4rem;
  }
}
/* Diff: side-by-side + unified (MIC-953) */
.diff-sbs-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.6rem;
  align-items: start;
  padding: 0.45rem 0.6rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.06);
}

.diff-sbs-side {
  display: flex;
  gap: 0.5rem;
  min-width: 0;
}

.diff-sbs-num {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  user-select: none;
  min-width: 1.5rem;
  text-align: right;
}

.diff-sbs-content {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.2em;
}

.diff-sbs-row.added { border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.08); }
.diff-sbs-row.removed { border-color: rgba(239, 68, 68, 0.45); background: rgba(239, 68, 68, 0.08); }
.diff-sbs-row.unchanged { background: rgba(148, 163, 184, 0.03); }

.diff-unified-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.45rem 0.6rem;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.06);
}

.diff-unified-sign {
  width: 1em;
  flex: 0 0 auto;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  user-select: none;
}

.diff-unified-content {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.2em;
}

.diff-unified-row.added { border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.08); }
.diff-unified-row.removed { border-color: rgba(239, 68, 68, 0.45); background: rgba(239, 68, 68, 0.08); }
.diff-unified-row.unchanged { background: rgba(148, 163, 184, 0.03); }
.diff-unified-row.added .diff-unified-sign { color: #22c55e; }
.diff-unified-row.removed .diff-unified-sign { color: #ef4444; }

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* ============ Wayfinding redesign (2026-09-25) ============ */
.back-link {
  display: none;
}

.tool-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 1.1rem;
  align-items: center;
}

.tool-head > :not(.tool-tile) {
  grid-column: 2;
}

.tool-head .tool-tile {
  grid-row: 1 / span 2;
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.tool-head h1 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.035em;
}

@media (max-width: 560px) {
  .tool-head .tool-tile {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    /* Next to a long subtitle a centred tile hung below the title; on phones it sits at the title. */
    align-self: start;
    margin-top: 0.15rem;
  }
}

/* ============ XML / KSeF e-invoice / HTML viewer (xml-tools) ============ */
.xml-code {
  max-height: 520px;
  margin: 0;
  overflow: auto;
  padding: 0.9rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: 500 0.84rem/1.55 var(--font-mono);
  white-space: pre;
  tab-size: 2;
}

.x-tag { color: var(--primary); }
.x-attr { color: #b45309; }
.x-val { color: #0c7f5e; }
.x-text { color: var(--text); }
.x-com,
.x-pi,
.x-cdata { color: var(--text-muted); font-style: italic; }

[data-theme="dark"] .x-attr { color: #f5b454; }
[data-theme="dark"] .x-val { color: #5fd3a8; }

.xml-tree {
  max-height: 560px;
  overflow: auto;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: 500 0.84rem/1.6 var(--font-mono);
}

.xml-tree details {
  margin-left: 1rem;
}

.xml-tree > details {
  margin-left: 0;
}

.xml-tree summary {
  cursor: pointer;
}

.xml-leaf {
  margin-left: 1rem;
  padding-left: 1.05rem;
  overflow-wrap: anywhere;
}

.x-count {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.72rem;
  text-align: center;
}

.xml-tree-tools {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 0.6rem;
}

.xml-invoice-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.9rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--primary-soft);
  font-weight: 700;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.9rem 0 0.4rem;
  font-weight: 600;
  cursor: pointer;
}

.panel-title {
  margin-bottom: 0.75rem;
  font-size: 1.05rem;
}

.html-preview {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

/* ============ KSeF e-invoice view (shared by xml-tools and ksef-invoice-viewer, MIC-TOOLS8) ============ */
.ksv-tool,
.ksv-tool * {
  box-sizing: border-box;
}

.ksv-tool {
  min-width: 0;
}

.ksv-tool [hidden] {
  display: none !important;
}

.ksv-drop {
  padding: clamp(1rem, 4vw, 2rem);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
}

.ksv-drop.ksv-dragging {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.ksv-drop-label {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.ksv-drop .btn-group {
  justify-content: center;
  margin-top: 1rem;
}

.ksv-tool .btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.ksv-tool .btn {
  min-height: 44px;
  white-space: normal;
}

.ksv-tool .field input {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.ksv-privacy {
  margin-bottom: 0;
}

.ksv-actions {
  margin-top: 1rem;
}

/* MIC-KSEF2: summary of many invoices (js/ksef-invoice-viewer.js, js/ksef-batch.js). */
.ksv-batch {
  margin-top: 1rem;
}

.ksv-batch-title {
  margin: 0 0 0.3rem;
  font-size: 1.15rem;
}

.ksv-batch .table-wrap {
  margin: 0.6rem 0 1rem;
  overflow-x: auto;
}

.ksv-batch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.ksv-batch-table caption {
  margin-bottom: 0.35rem;
  font-weight: 600;
  text-align: left;
}

.ksv-batch-table th,
.ksv-batch-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.ksv-batch-table thead th {
  font-weight: 600;
  white-space: nowrap;
}

.ksv-batch-table .num {
  text-align: right;
  white-space: nowrap;
}

.ksv-batch-id {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.ksv-batch-sums {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 0 1.4rem;
}

.ksv-batch-errors {
  margin-top: 0.8rem;
}

.ksv-batch-errors summary {
  cursor: pointer;
  font-weight: 600;
}

.ksv-xml-details {
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.ksv-xml-details > summary {
  padding: 0.8rem 1rem;
  cursor: pointer;
  font-weight: 600;
}

.ksv-xml {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  max-height: 36rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface-2);
  tab-size: 2;
}

.ksv-tool :focus-visible,
.invoice-view summary:focus-visible,
.inv-table-wrap:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.invoice-view {
  box-sizing: border-box;
  width: 100%;
  max-width: 1100px;
  min-width: 0;
  margin: 1.25rem auto;
  padding: clamp(1rem, 3vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.invoice-view *,
.invoice-view *::before,
.invoice-view *::after {
  box-sizing: border-box;
}

.invoice-view h2,
.invoice-view h3,
.invoice-view h4 {
  color: var(--text);
  letter-spacing: normal;
}

.invoice-view h3 {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.invoice-view p {
  white-space: pre-wrap;
}

.invoice-view dl {
  display: grid;
  grid-template-columns: minmax(7rem, 0.85fr) minmax(0, 1.4fr);
  gap: 0.3rem 0.9rem;
  margin: 0;
}

.invoice-view dt {
  color: var(--text-muted);
  font-weight: 400;
}

.invoice-view dd {
  margin: 0;
  min-width: 0;
  font-weight: 500;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.inv-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-bottom: 1.15rem;
  border-bottom: 2px solid var(--primary);
}

.inv-head > * {
  min-width: 0;
  max-width: 100%;
}

.inv-type {
  margin: 0;
  color: var(--primary);
  font-weight: 700;
}

.invoice-view .inv-number {
  margin: 0.35rem 0 0;
  font-size: clamp(1.15rem, 3vw, 1.65rem);
  line-height: 1.3;
}

.inv-number span {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.invoice-view .inv-schema {
  margin-top: 0.8rem;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.inv-parties {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.invoice-view .inv-party {
  margin-top: 0;
  padding: 0;
  border-top: 0;
  min-width: 0;
}

.invoice-view .inv-address {
  margin: 0;
  white-space: normal;
}

.inv-party-name {
  margin: 0 0 0.6rem;
  font-size: 1.04rem;
  font-weight: 700;
}

.invoice-view .inv-block {
  margin-top: 1.25rem;
}

.inv-party .inv-block {
  margin-top: 0.8rem;
}

.inv-party .inv-block h3 {
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.inv-table-wrap {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  margin: 1rem 0;
  overscroll-behavior-x: contain;
}

.invoice-view .inv-table,
.invoice-view .inv-vat {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.84rem;
}

.inv-table caption,
.inv-vat caption {
  padding: 0 0 0.55rem;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.invoice-view .inv-table th,
.invoice-view .inv-table td,
.invoice-view .inv-vat th,
.invoice-view .inv-vat td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.5rem;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  white-space: normal;
}

.invoice-view .inv-table thead th,
.invoice-view .inv-vat thead th {
  color: var(--text-muted);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 0.76rem;
  white-space: normal;
}

.invoice-view .inv-table th[scope="row"] {
  font-weight: 500;
}

.invoice-view .num,
.invoice-view .inv-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.invoice-view .inv-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--border);
}

.inv-before {
  color: var(--text-muted);
  background: var(--surface-2);
}

.inv-badge {
  display: inline-block;
  margin: 0.3rem 0;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--primary-soft);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: normal;
}

.inv-before .inv-badge {
  display: block;
  min-width: 5rem;
}

.inv-line-description .inv-table-wrap {
  margin: 0;
}

.inv-line-description table caption {
  font-size: 0.74rem;
}

.inv-totals {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  break-inside: avoid;
  page-break-inside: avoid;
}

.invoice-view .inv-total {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.inv-total strong {
  font-size: 1.4rem;
}

.inv-note,
.invoice-view .inv-note {
  margin: 0.75rem 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.inv-reference {
  margin: 0.85rem 0;
  padding-left: 0.85rem;
  border-left: 2px solid var(--border);
}

.inv-warning {
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-2);
  font-size: 0.84rem;
}

.inv-warning p {
  margin: 0 0 0.4rem;
}

.inv-warning ul,
.inv-block ul {
  margin: 0;
  padding-left: 1.2rem;
}

.inv-warning summary {
  cursor: pointer;
  padding: 0.35rem 0;
  font-weight: 600;
}

.inv-omitted-list {
  margin-top: 0.5rem !important;
  font-size: 0.75rem;
}

.inv-omitted code {
  white-space: normal;
  overflow-wrap: anywhere;
}

.inv-ksef {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.inv-qr {
  margin: 1rem 0;
  max-width: 25rem;
  break-inside: avoid;
  page-break-inside: avoid;
}

.inv-qr figcaption {
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.inv-qr svg {
  display: block;
  width: 46mm;
  max-width: 100%;
  height: auto;
  background: #fff;
  shape-rendering: crispEdges;
}

.invoice-view .inv-qr-number {
  margin: 0.2rem 0 0;
  font-family: monospace;
  font-size: 0.8rem;
}

.inv-verification-url {
  overflow-wrap: anywhere;
  font-family: monospace;
  font-size: 0.72rem;
}

.inv-validation-note {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

#print-root {
  display: none;
}

@media (max-width: 639px) {
  .inv-parties {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
  }

  .inv-head {
    display: block;
  }

  .inv-head > dl {
    margin-top: 1rem;
  }

  .invoice-view dl {
    grid-template-columns: minmax(5.5rem, 0.8fr) minmax(0, 1.2fr);
    gap: 0.35rem 0.65rem;
  }

  .invoice-view .inv-table {
    font-size: 0.78rem;
  }

  .ksv-drop .btn-group > .btn {
    flex: 1 1 100%;
  }
}

@media print {
  /* Named page: these settings apply only when the invoice copy is printed. */
  @page ksef-invoice {
    size: A4 portrait;
    margin: 12mm;
  }

  body.print-ksef > *:not(#print-root),
  body.print-invoice > *:not(#print-root) {
    display: none !important;
  }

  body.print-ksef,
  body.print-invoice {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body.print-ksef #print-root,
  body.print-invoice #print-root {
    display: block !important;
    width: 100%;
    page: ksef-invoice;
  }

  #print-root .invoice-view {
    --text: #111;
    --text-muted: #444;
    --primary: #111;
    --primary-soft: #f2f2f2;
    --surface: #fff;
    --surface-2: #f5f5f5;
    --border: #bbb;
    margin: 0 !important;
    padding: 0 !important;
    max-width: none;
    border: 0;
    border-radius: 0;
    font-size: 9pt;
    color: #111;
    background: #fff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  #print-root .inv-no-print,
  #print-root .ksv-controls {
    display: none !important;
  }

  #print-root .inv-head {
    display: flex;
  }

  #print-root .inv-parties {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #print-root .inv-table-wrap {
    overflow: visible !important;
    max-height: none !important;
    outline: 0;
  }

  #print-root .inv-table,
  #print-root .inv-vat {
    width: 100%;
    table-layout: fixed;
    font-size: 7.5pt;
  }

  #print-root .inv-table th,
  #print-root .inv-table td,
  #print-root .inv-vat th,
  #print-root .inv-vat td {
    padding: 1.6mm 1.2mm;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }

  #print-root thead {
    display: table-header-group;
  }

  #print-root tfoot {
    display: table-row-group;
  }

  #print-root tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #print-root h2,
  #print-root h3,
  #print-root caption {
    break-after: avoid;
    page-break-after: avoid;
  }

  #print-root .inv-totals,
  #print-root .inv-qr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #print-root .inv-omitted details > * {
    display: block;
  }

  #print-root .inv-note,
  #print-root .inv-schema {
    font-size: 7.5pt;
  }

  #print-root a {
    color: inherit;
    text-decoration: none;
  }

  #print-root a::after {
    content: none !important;
  }
}

.invoice-note {
  margin-top: 0.75rem;
}

/* ============ VAT calculator / amount in words / ID validator ============ */
fieldset.field {
  min-width: 0;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

fieldset.field legend,
.field-label {
  margin-bottom: 0.4rem;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.rate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.rate-chip {
  min-width: 3.4rem;
  padding: 0.42rem 0.6rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 700 0.9rem/1 var(--font-sans);
  cursor: pointer;
}

.rate-chip:hover {
  border-color: var(--text);
}

.rate-chip[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.vat-results .value {
  font-size: clamp(1.05rem, 3vw, 1.55rem);
  overflow-wrap: anywhere;
}

/* MIC-SEO3: on wide screens the result sits next to the inputs; stacked, it started about 800 px down. */
.vat-result-panel {
  margin-top: 1.25rem;
}

@media (min-width: 900px) {
  .vat-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
  }

  /* Two classes, so it beats ".panel + .panel { margin-top }" and both panels start at the same height. */
  .vat-layout > .vat-result-panel {
    position: sticky;
    top: 5rem;
    margin-top: 0;
  }

  .vat-layout .vat-results {
    grid-template-columns: minmax(0, 1fr);
    margin-top: 0;
  }
}

/* js/vat-calculator.js builds the chips: two rows on wide screens, three on narrower ones (measured with
   tools/browser-check.js). Reserving that height keeps the fields below from moving when they appear. */
#vat-rates {
  min-height: 6.9rem;
}

@media (min-width: 1200px) {
  #vat-rates {
    min-height: 4.6rem;
  }
}

/* Phones: the result line under the rate chips (the result panel is further down). */
.vat-summary {
  margin: 0.25rem 0 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

@media (min-width: 900px) {
  .vat-summary {
    display: none;
  }
}

/* The rates of the page's country come first; the rest follow after a gap. */
.rate-chip.rate-chip--more {
  border-style: dashed;
}

.rate-chips .rate-chips-gap {
  flex-basis: 100%;
  height: 0;
}

.words-row {
  margin: 1rem 0 0;
  overflow-wrap: anywhere;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  background: var(--primary-soft);
  font-weight: 600;
}

.words-label {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.ids-wrap {
  overflow-x: auto;
}

.ids-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.ids-table th,
.ids-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.ids-table th {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.ids-value {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

.ids-badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.ids-badge.is-ok {
  background: #d8f3e8;
  color: #0a6b4f;
}

.ids-badge.is-bad {
  background: #fde3de;
  color: #b42318;
}

[data-theme="dark"] .ids-badge.is-ok {
  background: #12392e;
  color: #7ee2bd;
}

[data-theme="dark"] .ids-badge.is-bad {
  background: #3d1d19;
  color: #ffab9d;
}

/* ---------- STATUS (shared by status-box tools) ---------- */
.status-box {
  margin-top: 0.9rem;
  padding: 0.55rem 0.85rem;
  border-left: 3px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.status-box:empty {
  display: none;
}

.status-box.error {
  border-left-color: #b42318;
  background: #fde3de;
  color: #7a1a10;
}

[data-theme="dark"] .status-box.error {
  border-left-color: #ffab9d;
  background: #3d1d19;
  color: #ffd2ca;
}

/* ---------- FILE DROP (compressor, PDF tools) ---------- */
.file-drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem 1rem;
  padding: 1.6rem 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-drop .hint {
  margin: 0;
}

.file-drop:hover,
.file-drop.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

/* ---------- QR GENERATOR ---------- */
.qr-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.qr-preview {
  position: sticky;
  top: 1rem;
  text-align: center;
}

.qr-canvas {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  margin: 0 auto 1rem;
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--border);
  image-rendering: pixelated;
}

.qr-canvas[hidden] {
  display: none;
}

.qr-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
  margin: 0 auto 1rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  opacity: 0.7;
}

.qr-placeholder[hidden] {
  display: none;
}

.qr-preview .btn-group {
  justify-content: center;
}

.qr-preview .status-box {
  text-align: left;
}

.qr-colors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 1rem;
}

input[type="color"] {
  width: 100%;
  height: 2.6rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
}

@media (max-width: 820px) {
  .qr-layout {
    grid-template-columns: 1fr;
  }

  .qr-preview {
    position: static;
  }
}

/* ---------- IMAGE COMPRESSOR ---------- */
.comp-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 1.25rem;
  margin-top: 1.1rem;
}

.comp-settings output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.comp-file-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 12rem;
  overflow-wrap: anywhere;
}

.comp-thumb {
  flex: none;
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-2);
}

.comp-table td {
  vertical-align: middle;
}

/* ---------- PDF TOOLS ---------- */
.pdf-list {
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.pdf-list .pdf-name {
  overflow-wrap: anywhere;
}

/* First page of a PDF or the image itself (js/pdf-tools.js queueThumb); the box keeps its size while it loads. */
.pdf-list {
  --pdf-thumb: 2.6rem;
}

.pdf-thumb {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: var(--pdf-thumb);
  height: var(--pdf-thumb);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface, var(--bg));
}

.pdf-thumb img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  pointer-events: none;
}

/* Phones: the name beside the thumbnail on the first line, pages and buttons on the second, so a name is not split
   after a few letters. */
@media (max-width: 480px) {
  .pdf-list {
    --pdf-thumb: 2.1rem;
  }

  .pdf-row {
    flex-wrap: wrap;
    row-gap: 0.2rem;
  }

  .pdf-row .pdf-name {
    flex: 1 1 calc(100% - var(--pdf-thumb) - 0.6rem);
  }

  .pdf-row .pdf-meta {
    margin-right: auto;
  }

  .pdf-row .pdf-thumb ~ .pdf-meta {
    margin-left: calc(var(--pdf-thumb) + 0.6rem);
  }

  .pdf-row .pdf-name + .btn {
    margin-left: auto;
  }
}

.pdf-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.pdf-empty {
  padding: 0.3rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pdf-totals {
  margin: -0.4rem 0 0.9rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pdf-totals:empty {
  display: none;
}

.pdf-split-info {
  margin: 1rem 0;
}

.pdf-split-info .pdf-name {
  font-weight: 600;
}
/* ---------- MORTGAGE CALCULATOR ---------- */
.loan-score-grid {
  margin-bottom: 1rem;
}

.loan-chart {
  margin: 1rem 0;
}

.loan-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.loan-table-wrap {
  overflow-x: auto;
}

.loan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.loan-table th,
.loan-table td {
  padding: 0.4rem 0.5rem;
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.loan-table th:first-child,
.loan-table td:first-child {
  text-align: left;
}

.loan-table thead th {
  background: var(--surface-2);
  position: sticky;
  top: 0;
}

[data-theme="dark"] .loan-table thead th {
  background: var(--surface);
}

@media (max-width: 480px) {
  .loan-score-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- COMPOUND INTEREST CALCULATOR ---------- */
/* ============================================================
   AllToolio — compound interest calculator (.cmp- prefix)
   ============================================================ */

.cmp-tool[hidden] {
  display: none !important;
}

.cmp-goal-out {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}

.cmp-goal-out[hidden] {
  display: none;
}

.cmp-goal-out p {
  flex: 1 1 18rem;
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.cmp-heading {
  margin: 1.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* ---------- chart ---------- */

.cmp-chart {
  --cmp-bar-contrib: var(--primary);
  --cmp-bar-interest: #e39b2e;
  --cmp-net: var(--text-muted);
  display: block;
  width: 100%;
  height: auto;
}

[data-theme="dark"] .cmp-chart {
  --cmp-bar-interest: #f0b558;
}

.cmp-bar-contrib {
  fill: var(--cmp-bar-contrib);
}

.cmp-bar-interest {
  fill: var(--cmp-bar-interest);
}

.cmp-axis {
  stroke: var(--border);
  stroke-width: 1;
}

.cmp-net-line {
  stroke: var(--cmp-net);
  stroke-width: 1.6;
  stroke-dasharray: 6 5;
}

.cmp-chart-label {
  fill: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
}

.cmp-chart-tick {
  fill: var(--text-muted);
  font-size: 15px;
}

/* ---------- legend ---------- */

.cmp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.cmp-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cmp-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--text-muted);
  flex: none;
}

.cmp-swatch-contrib {
  background: var(--primary);
}

.cmp-swatch-interest {
  background: #e39b2e;
}

.cmp-swatch-net {
  height: 0;
  border-top: 2px dashed var(--text-muted);
  border-radius: 0;
  background: none;
}

[data-theme="dark"] .cmp-swatch-interest {
  background: #f0b558;
}

/* ---------- table ---------- */

.cmp-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 0.25rem;
}

.cmp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.cmp-table th,
.cmp-table td {
  padding: 0.4rem 0.5rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.cmp-table th:first-child,
.cmp-table td:first-child {
  text-align: left;
}

.cmp-table thead th {
  color: var(--text-muted);
  font-weight: 600;
}

.cmp-table tbody tr:last-child td {
  border-bottom: 0;
  font-weight: 600;
}

@media (max-width: 480px) {
  .cmp-table {
    font-size: 0.8125rem;
  }

  .cmp-table th,
  .cmp-table td {
    padding: 0.35rem 0.4rem;
  }

  .cmp-chart-label,
  .cmp-chart-tick {
    font-size: 17px;
  }
}

/* ---------- PASSWORD GENERATOR ---------- */
/* --- Password generator (AllToolio) --- */

/* Examples by length in the guide (js/password-generator.js fillExamples). */
.pw-examples-wrap {
  margin: 0.5rem 0 1.5rem;
}

.pw-examples .pw-example {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
  word-break: break-all;
}

.pw-examples th {
  overflow-wrap: normal;
  word-break: normal;
}

.pw-examples td:first-child,
.pw-examples td:nth-child(3) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pw-length-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pw-length-row input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.pw-length-row .pw-length-num {
  flex: 0 0 auto;
  width: 5.5rem;
  text-align: center;
}

.pw-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.pw-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.4rem 1rem;
}

.pw-checks label {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-weight: 400;
}

.pw-checks input[type="checkbox"] {
  flex: 0 0 auto;
  margin: 0.15rem 0 0;
}

.pw-checks-extra {
  margin-top: 0.75rem;
}

.pw-count-field select {
  width: auto;
  min-width: 7rem;
}

.pw-strength {
  margin-top: 0.5rem;
}

.pw-meter {
  --pw-l0: #d64545;
  --pw-l1: #d9822b;
  --pw-l2: #c9a227;
  --pw-l3: #3f8f4a;
  --pw-l4: #226b39;
  display: flex;
  gap: 4px;
  margin: 0.4rem 0 0.8rem;
}

[data-theme="dark"] .pw-meter {
  --pw-l0: #f0726f;
  --pw-l1: #f0a04b;
  --pw-l2: #e2c14a;
  --pw-l3: #6dc47a;
  --pw-l4: #4aa96c;
}

.pw-meter span {
  flex: 1 1 0;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.pw-meter[data-level="0"] span:nth-child(-n+1),
.pw-meter[data-level="1"] span:nth-child(-n+2),
.pw-meter[data-level="2"] span:nth-child(-n+3),
.pw-meter[data-level="3"] span:nth-child(-n+4),
.pw-meter[data-level="4"] span:nth-child(-n+5) {
  border-color: transparent;
}

.pw-meter[data-level="0"] span:nth-child(-n+1) { background: var(--pw-l0); }
.pw-meter[data-level="1"] span:nth-child(-n+2) { background: var(--pw-l1); }
.pw-meter[data-level="2"] span:nth-child(-n+3) { background: var(--pw-l2); }
.pw-meter[data-level="3"] span:nth-child(-n+4) { background: var(--pw-l3); }
.pw-meter[data-level="4"] span:nth-child(-n+5) { background: var(--pw-l4); }

.pw-stats {
  margin-bottom: 0.25rem;
}

.pw-crack-line {
  margin: 0.25rem 0 0;
}

.pw-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0 0;
}

.pw-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.pw-value {
  flex: 1 1 auto;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.95rem;
  line-height: 1.4;
  word-break: break-all;
}

.pw-row .btn {
  flex: 0 0 auto;
}

.pw-check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pw-check-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.pw-check-row .btn {
  flex: 0 0 auto;
}

@media (max-width: 420px) {
  .pw-length-row .pw-length-num {
    width: 4.5rem;
  }
}

/* ---------- IMAGE CONVERTER ---------- */
/* image-converter — tool-specific styles (.ic- prefix) */

.ic-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.5rem 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ic-drop:hover,
.ic-drop.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.ic-drop .hint {
  margin: 0;
}

.ic-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.ic-settings .field {
  margin: 0;
}

.ic-settings input[type="color"] {
  width: 100%;
  max-width: 6rem;
  height: 2.25rem;
  padding: 0.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.ic-settings input[type="color"]:disabled,
.ic-settings input[type="range"]:disabled {
  opacity: 0.45;
}

.ic-results .ids-wrap {
  overflow-x: auto;
}

.ic-table {
  width: 100%;
  border-collapse: collapse;
}

.ic-table th,
.ic-table td {
  padding: 0.5rem 0.6rem;
  vertical-align: middle;
  text-align: left;
}

.ic-file-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.ic-file-cell span {
  overflow-wrap: anywhere;
}

.ic-dim {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.ic-thumb {
  flex: none;
  width: 40px;
  height: 40px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.ic-results .hint {
  margin-top: 0.75rem;
}

.ic-popular-title {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.ic-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ic-links a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.ic-links a:hover,
.ic-links a:focus {
  text-decoration: underline;
}

@media (max-width: 480px) {
  .ic-table th,
  .ic-table td {
    padding: 0.4rem 0.35rem;
    font-size: 0.85rem;
  }

  .ic-thumb {
    width: 32px;
    height: 32px;
  }

  .ic-settings {
    grid-template-columns: 1fr;
  }
}

/* ---------- PDF TO JPG / PNG ---------- */
/* PDF to JPG / PNG — tool styles (prefix .pi-) */

.pi-drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
}

.pi-drop.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.pi-filebar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin: 1rem 0 0;
}

.pi-filebar[hidden] {
  display: none;
}

.pi-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.pi-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pi-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.pi-results-panel {
  margin-top: 1.25rem;
}

.pi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.pi-grid:empty {
  display: none;
}

.pi-tile {
  display: flex;
  flex-direction: column;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}

.pi-thumb {
  display: block;
  width: 100%;
  height: auto;
  background: #ffffff;
}

.pi-caption {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem 0.6rem;
  font-size: 0.8rem;
}

.pi-tile-name {
  color: var(--text-muted);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.pi-tile .btn {
  width: 100%;
}

.pi-note {
  margin: 1rem 0 0;
}

@media (max-width: 420px) {
  .pi-options {
    grid-template-columns: 1fr;
  }

  .pi-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
  }
}

/* ---------- FAVICON GENERATOR ---------- */
/* Favicon generator — prefix .fv- */

.fv-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.fv-options {
  margin-top: 1rem;
}

.fv-options .field {
  min-width: 0;
}

.fv-h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.fv-previews {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.fv-preview-item {
  margin: 0;
  max-width: 128px;
  text-align: center;
}

.fv-preview-item canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.fv-preview-item figcaption {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.fv-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  margin-top: 1rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface-2);
}

.fv-tab-icon {
  display: block;
  flex: none;
  width: 16px;
  height: 16px;
}

.fv-tab-icon canvas {
  display: block;
  width: 16px;
  height: 16px;
}

.fv-tab-title {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fv-sub {
  margin: 1rem 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.fv-files {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.fv-file {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.fv-file-name {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.fv-file-size {
  flex: none;
  color: var(--text-muted);
}

.fv-snippet {
  width: 100%;
  padding: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
}

@media (max-width: 420px) {
  .fv-preview-item {
    max-width: 96px;
  }
}

/* MIC-TOOLS7 calculator upgrade (.calc-) */
.calc-tool {
  min-width: 0;
}

.calc-tool [hidden] {
  display: none !important;
}

.calc-tool .field,
.calc-tool .grid-2 > *,
.calc-tool .grid-3 > *,
.calc-tool .score-card {
  min-width: 0;
}

.calc-tool input,
.calc-tool select {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.calc-tool input[type="checkbox"],
.calc-tool input[type="radio"] {
  width: auto;
  flex: 0 0 auto;
}

/* BMI: adult or child (MIC-SEO3); the choice sits on one line where it fits. */
.calc-bmi-person {
  margin: 0 0 0.75rem;
  padding: 0;
  border: 0;
}

.calc-bmi-person label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.calc-tool button,
.calc-tool summary,
.calc-tool input,
.calc-tool select {
  scroll-margin-block: 5rem;
}

.calc-tool button:focus-visible,
.calc-tool summary:focus-visible,
.calc-tool input:focus-visible,
.calc-tool select:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.calc-tool button:disabled {
  cursor: default;
  opacity: 0.55;
}

.calc-tool .status-box:empty {
  display: none;
}

.calc-tool .value,
.calc-tool .caption,
.calc-tool .status-box,
.calc-tool .hint {
  overflow-wrap: anywhere;
}

.calc-field-label {
  color: var(--text);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.calc-unit-chips,
.calc-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.calc-unit-chips .rate-chip,
.calc-preset-chips .rate-chip {
  min-height: 2.75rem;
  white-space: normal;
}

.calc-unit-chips .rate-chip[aria-pressed="true"],
.calc-preset-chips .rate-chip[aria-pressed="true"] {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
  color: var(--text);
}

.calc-date-row {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.calc-date-row input {
  flex: 1 1 0;
}

.calc-date-row button {
  flex: 0 0 auto;
  min-height: 2.75rem;
}

.calc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.calc-results {
  margin-top: 1rem;
}

.calc-age-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.calc-age-grid .value {
  font-size: clamp(1.25rem, 5vw, 2rem);
  font-variant-numeric: tabular-nums;
}

.calc-age-details {
  margin-top: 1rem;
}

.calc-age-details p {
  margin-block: 0.5rem;
}

.calc-totals {
  display: grid;
  gap: 0.5rem 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  list-style: none;
  margin: 0.75rem 0 1rem;
  padding: 0;
}

.calc-totals li {
  overflow-wrap: anywhere;
}

.calc-height-pair {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calc-bmi-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calc-bmi-grid .calc-range-card {
  grid-column: 1 / -1;
}

.calc-bmi-grid .calc-text-value {
  font-size: 1.1rem;
  line-height: 1.5;
}

.calc-bmi-scale {
  margin-top: 0.75rem;
}

.calc-bmi-scale svg {
  display: block;
  height: auto;
}

.calc-scale-band {
  fill: var(--surface-2);
  stroke: var(--border);
  stroke-width: 1;
}

.calc-scale-band.calc-current {
  fill: var(--primary);
}

.calc-scale-marker {
  fill: var(--text);
}

.calc-scale-label {
  fill: var(--text-muted);
  font-family: inherit;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.calc-prime-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-block: 1rem;
  padding: 0.75rem 1rem;
}

.calc-prime-details summary {
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.calc-prime-value {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  margin-block: 0.75rem 0.25rem;
}

.calc-table-wrap {
  margin-top: 1rem;
  max-width: 100%;
}

.calc-bmi-table {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.calc-bmi-table caption {
  color: var(--text);
  font-weight: 600;
  padding: 0 0 0.75rem;
  text-align: start;
}

.calc-bmi-table th,
.calc-bmi-table td {
  overflow-wrap: anywhere;
  padding: 0.65rem 0.75rem;
  text-align: start;
  white-space: normal;
}

.calc-bmi-table tbody th {
  font-weight: 400;
}

.calc-bmi-table .calc-current > * {
  background: var(--primary-soft);
  color: var(--text);
  font-weight: 700;
}

.calc-bmi-table .calc-current > :first-child {
  box-shadow: inset 4px 0 0 var(--primary);
}

.calc-bmi-note {
  line-height: 1.6;
  margin-top: 1rem;
}

.calc-check {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  min-height: 2.75rem;
}

.calc-random-actions {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.calc-copy-format {
  flex: 1 1 11rem;
  margin-bottom: 0;
}

.calc-random-results {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.calc-random-set {
  min-width: 0;
}

.calc-set-label {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
}

.calc-random-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 6rem), 1fr));
}

.calc-random-grid .value {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.calc-number-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
  line-height: 1.8;
  margin: 0;
  overflow-wrap: anywhere;
  padding: 0.75rem;
  user-select: text;
}

.calc-precision {
  max-width: 16rem;
}

.calc-percent-card {
  border: 1px solid var(--border);
  box-shadow: none;
  min-width: 0;
}

.calc-result-card {
  margin-top: 0.5rem;
}

.calc-percent-card .value {
  font-size: 1.25rem;
  line-height: 1.5;
}

.calc-formula {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0.5rem 0 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.calc-formula:empty {
  display: none;
}

@media (max-width: 600px) {
  .calc-tool .grid-2,
  .calc-tool .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .calc-totals {
    grid-template-columns: minmax(0, 1fr);
  }

  .calc-bmi-table th,
  .calc-bmi-table td {
    padding: 0.6rem 0.5rem;
  }

  .calc-random-actions > button {
    min-height: 2.75rem;
  }
}

/* MIC-TOOLS7 text tools upgrade (.tx-) */
.tx-panel {
  --tx-danger: #b42318;
  min-width: 0;
}
.tx-panel:where([data-theme="dark"] *) {
  --tx-danger: #ffab9d;
}
.tx-panel [hidden] {
  display: none !important;
}
.tx-panel .field,
.tx-panel .btn-group,
.tx-panel .check-row {
  min-width: 0;
}
.tx-panel .check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.tx-panel .check-row input {
  flex: 0 0 auto;
  margin-top: 0.25rem;
}
.tx-panel .check-row span,
.tx-panel .hint,
.tx-panel .caption {
  overflow-wrap: anywhere;
}
.tx-panel input,
.tx-panel select,
.tx-panel textarea {
  max-width: 100%;
  box-sizing: border-box;
}
.tx-panel .btn,
.tx-panel .tab-btn {
  min-height: 44px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.tx-panel :is(button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}
.tx-input {
  width: 100%;
  min-height: 12rem;
  resize: vertical;
  line-height: 1.6;
}
.tx-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-block: 1rem;
}
.tx-case-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tx-heading {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.1rem;
  line-height: 1.4;
}
.tx-language {
  max-width: 28rem;
  margin-top: 1.25rem;
}
.tx-stats {
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}
.tx-stats .value {
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.tx-details {
  margin-block: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.tx-details summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  min-height: 28px;
  line-height: 1.7;
}
.tx-rate-grid,
.tx-cleanup-fields {
  margin-top: 1rem;
}
.tx-limit-settings {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.tx-limit {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.tx-limit p {
  margin: 0 0 0.5rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.tx-limit progress {
  display: block;
  appearance: none;
  width: 100%;
  height: 0.7rem;
  border: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  color: var(--primary);
  background: var(--border);
  accent-color: var(--primary);
}
.tx-limit progress::-webkit-progress-bar {
  background: var(--border);
}
.tx-limit progress::-webkit-progress-value {
  background: var(--primary);
}
.tx-limit progress::-moz-progress-bar {
  background: var(--primary);
}
.tx-limit.tx-over {
  border-color: var(--tx-danger);
}
.tx-limit.tx-over p {
  color: var(--tx-danger);
}
.tx-limit.tx-over progress {
  color: var(--tx-danger);
  accent-color: var(--tx-danger);
}
.tx-limit.tx-over progress::-webkit-progress-value {
  background: var(--tx-danger);
}
.tx-limit.tx-over progress::-moz-progress-bar {
  background: var(--tx-danger);
}
.tx-term-tabs {
  margin-top: 1rem;
  margin-bottom: 0.75rem;
}
.tx-density-head,
.tx-frequency li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(3rem, auto) minmax(4rem, auto);
  align-items: start;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
}
.tx-density-head {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.tx-frequency {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tx-frequency li {
  border-top: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.tx-frequency li > :only-child {
  grid-column: 1 / -1;
}
.tx-density-head > :not(:first-child),
.tx-frequency li > :not(:first-child) {
  text-align: end;
}
.tx-term {
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 540px) {
  .tx-panel {
    padding: 1rem;
  }
  .tx-panel .grid-2,
  .tx-limit-settings {
    grid-template-columns: minmax(0, 1fr);
  }
  .tx-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tx-stats .score-card {
    padding: 0.75rem 0.5rem;
  }
  .tx-stats .value {
    font-size: 1.4rem;
  }
  .tx-case-modes .btn {
    flex: 1 1 8rem;
  }
  .tx-details {
    padding: 0.75rem;
  }
  .tx-density-head,
  .tx-frequency li {
    gap: 0.5rem;
    padding-inline: 0;
  }
}

/* MIC-TOOLS7 image converter upgrade (.ic-) */
.ic-panel,
.ic-results,
.ic-popular {
  min-width: 0;
}
.ic-results,
.ic-popular {
  margin-top: 1.25rem;
}
.ic-panel [hidden],
.ic-results [hidden] {
  display: none !important;
}
.ic-settings {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
}
.ic-settings .field {
  min-width: 0;
}
.ic-settings input,
.ic-settings select {
  box-sizing: border-box;
  max-width: 100%;
}
.ic-settings select,
.ic-settings input[type="text"] {
  width: 100%;
}
.ic-settings input:disabled {
  opacity: 0.5;
}
.ic-drop:focus-within {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.ic-resize {
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  background: var(--surface);
}
.ic-resize summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}
.ic-resize summary:focus-visible,
.ic-panel button:focus-visible,
.ic-results button:focus-visible,
.ic-scroll:focus-visible,
.ic-links a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.ic-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
}
.ic-check input {
  flex: 0 0 auto;
  margin-top: 0.25rem;
}
.ic-rename {
  margin: 1rem 0;
  border-left: 3px solid var(--primary);
  padding: 0.25rem 0.85rem;
  background: var(--primary-soft);
}
.ic-scroll {
  max-width: 100%;
  overflow-x: auto;
}
.ic-table {
  min-width: 440px;
}
.ic-file-cell {
  align-items: flex-start;
}
.ic-file-cell > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.ic-dim,
.ic-file-note {
  display: block;
  margin-top: 0.2rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.ic-warning {
  color: var(--text);
  font-weight: 600;
}
.ic-next {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.ic-links a {
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 480px) {
  .ic-settings {
    grid-template-columns: minmax(0, 1fr);
  }
  .ic-panel .btn-group {
    display: flex;
    flex-wrap: wrap;
  }
  .ic-panel .btn-group .btn {
    flex: 1 1 auto;
    white-space: normal;
  }
  .ic-resize {
    padding: 0.75rem;
  }
}

/* MIC-TOOLS7 PDF compressor (.pc-) */
.pc-tool {
  min-width: 0;
}

.pc-tool [hidden] {
  display: none !important;
}

.pc-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 10rem;
  padding: 1.5rem 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
}

.pc-drop:hover,
.pc-drop:focus-within,
.pc-drop.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.pc-drop.pc-disabled {
  cursor: wait;
  opacity: 0.65;
}

.pc-private {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.pc-filebar {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.pc-name {
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.pc-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.pc-options {
  min-width: 0;
  padding: 0;
  margin: 1.4rem 0;
  border: 0;
}

.pc-legend {
  padding: 0;
  margin-bottom: 0.65rem;
  color: var(--text);
  font-weight: 600;
}

.pc-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pc-levels .rate-chip {
  min-height: 44px;
  max-width: 100%;
  padding: 0.65rem 0.9rem;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.pc-levels .rate-chip[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--primary);
  font-weight: 700;
}

.pc-level-hint {
  margin: 0.7rem 0;
}

.pc-warning {
  padding: 0.85rem 1rem;
  margin: 0.85rem 0;
  border-inline-start: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--primary-soft);
  font-size: 0.95rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.pc-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.pc-option-grid .field {
  min-width: 0;
}

.pc-option-grid input,
.pc-option-grid select {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  font: inherit;
}

.pc-option-grid input[aria-invalid="true"] {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.pc-check-option {
  margin: 1rem 0;
}

.pc-check-option .check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.55rem 0;
  color: var(--text);
  cursor: pointer;
}

.pc-check-option input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0.2rem 0 0;
  accent-color: var(--primary);
}

.pc-check-option .hint {
  margin: 0;
  line-height: 1.55;
}

.pc-fallback {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.pc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.pc-actions .btn {
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.pc-tool button:focus-visible,
.pc-tool a:focus-visible,
.pc-tool input:focus-visible,
.pc-tool select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.pc-tool button:disabled,
.pc-options:disabled {
  cursor: not-allowed;
}

.pc-attempt {
  margin: 1rem 0 0.25rem;
}

.pc-status {
  margin-top: 0.75rem;
  overflow-wrap: anywhere;
}

.pc-status:empty,
.pc-target-status:empty {
  display: none;
}

.pc-results {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.pc-result-title {
  margin: 0 0 0.85rem;
  color: var(--text);
  font-size: 1.1rem;
}

.pc-scores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.pc-scores .score-card {
  min-width: 0;
  padding: 0.85rem 0.5rem;
}

.pc-scores .value {
  font-size: clamp(1.05rem, 3vw, 1.65rem);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.pc-scores .caption {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.pc-target-status {
  color: var(--text);
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.pc-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}

.pc-next-label {
  color: var(--text-muted);
  font-weight: 600;
}

.pc-next a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.pc-note {
  margin: 1rem 0;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

@media (max-width: 480px) {
  .pc-drop {
    padding: 1.2rem 0.75rem;
  }

  .pc-levels .rate-chip {
    flex: 1 1 auto;
  }

  .pc-actions .btn {
    flex: 1 1 auto;
  }

  .pc-scores {
    gap: 0.4rem;
  }

  .pc-scores .score-card {
    padding: 0.75rem 0.35rem;
  }

  .pc-next-label {
    flex-basis: 100%;
  }
}

/* MIC-TOOLS7 PDF organizer (.po-) */
.po-shell {
  min-width: 0;
}

.po-shell *,
.po-shell *::before,
.po-shell *::after {
  box-sizing: border-box;
}

.po-shell [hidden] {
  display: none !important;
}

.po-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 144px;
  padding: 1.25rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
}

.po-drop.po-dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.po-filebar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.po-file-details {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.po-name {
  color: var(--text);
  overflow-wrap: anywhere;
}

.po-controls {
  min-width: 0;
  margin-top: 1rem;
}

.po-hint {
  margin: 0 0 0.9rem;
}

.po-selection {
  min-width: 0;
  margin: 0;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.po-selection legend {
  padding: 0 0.35rem;
  color: var(--text);
  font-weight: 600;
}

.po-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.po-shell .btn {
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.po-range-row,
.po-blank-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.po-range-field,
.po-size-field {
  flex: 1 1 180px;
  min-width: 0;
  margin: 0;
}

.po-range-field input,
.po-size-field select {
  width: 100%;
  max-width: 100%;
  min-height: 44px;
}

.po-range-field input[aria-invalid="true"] {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.po-selection .hint,
.po-edit-section .hint {
  margin: 0.65rem 0;
}

.po-selection-count {
  margin: 0.6rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.po-edit-section {
  margin-top: 1rem;
}

.po-document-actions {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.po-result-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 1.1rem;
}

.po-summary {
  flex: 1 1 220px;
  margin: 0;
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.po-status:empty {
  display: none;
}

.po-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.7rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.po-grid:empty {
  display: none;
}

.po-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.po-card[draggable="true"] {
  cursor: grab;
}

.po-card.po-selected {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
  background: var(--primary-soft);
}

.po-card.po-drop-target {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.po-card.po-dragging {
  opacity: 0.55;
}

.po-card-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 65px;
  gap: 0.2rem;
}

.po-card-selection {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 44px;
  width: 100%;
  cursor: pointer;
}

.po-card-selection input {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: var(--primary);
}

.po-caption {
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.po-badge {
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: var(--surface-2);
  font-size: 0.75rem;
  line-height: 1.2;
}

.po-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 166px;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.po-sheet {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(150px, 100%);
  aspect-ratio: 1;
  flex: 0 1 150px;
}

.po-sheet img,
.po-blank-sheet {
  display: block;
  flex: 0 0 auto;
  max-width: none;
  max-height: none;
  object-fit: contain;
  transform-origin: center;
  background: #fff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 18%);
}

.po-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.po-removed .po-preview {
  opacity: 0.4;
}

.po-removed .po-caption {
  text-decoration: line-through;
  color: var(--text-muted);
}

.po-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.2rem;
  margin-top: 0.45rem;
}

.po-shell .po-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0.2rem;
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.po-icon:last-child {
  grid-column: 1 / -1;
}

.po-icon[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
}

.po-shell button:disabled,
.po-shell input:disabled,
.po-shell select:disabled {
  cursor: not-allowed;
}

.po-shell button:focus-visible,
.po-shell input:focus-visible,
.po-shell select:focus-visible,
.po-shell a:focus-visible,
.po-card:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.po-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.po-next-label {
  color: var(--text);
  font-weight: 600;
}

.po-note {
  margin-top: 1rem;
  line-height: 1.5;
}

@media (max-width: 420px) {
  .po-shell {
    padding: 0.65rem;
  }

  .po-grid {
    gap: 0.45rem;
  }

  .po-selection {
    padding: 0.6rem;
  }

  .po-result-bar > .btn {
    width: 100%;
  }

  .po-blank-row > .btn {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .po-shell *,
  .po-shell *::before,
  .po-shell *::after {
    scroll-behavior: auto;
    transition: none;
  }
}

/* MIC-TOOLS7 PDF to text (.pt-) */
.pt-drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 7rem;
  padding: 1rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  background: var(--surface-2);
}

.pt-drop.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.pt-filebar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  margin: 1rem 0 0;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow-wrap: anywhere;
}

.pt-meta {
  color: var(--text-muted);
}

.pt-password-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.pt-password-wrap[hidden],
.pt-filebar[hidden],
.pt-result-panel[hidden] {
  display: none;
}

.pt-password-wrap .field {
  flex: 1 1 13rem;
  margin: 0;
}

.pt-password-wrap .btn {
  flex: 0 0 auto;
}

.pt-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(10rem, 0.7fr);
  gap: 1rem;
  align-items: end;
  margin-top: 1.25rem;
}

.pt-options .field {
  min-width: 0;
  margin: 0;
}

.pt-options input[type="text"],
.pt-password-wrap input[type="password"] {
  width: 100%;
  box-sizing: border-box;
}

.pt-separator-field {
  padding-bottom: 0.4rem;
}

.pt-mode {
  margin-top: 1.25rem;
}

.pt-mode-label {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.pt-mode .rate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pt-mode .rate-chip {
  cursor: pointer;
}

.pt-mode .hint {
  display: block;
  margin-top: 0.5rem;
}

.pt-actions {
  margin-top: 1.25rem;
}

.pt-note {
  margin: 0.75rem 0 0;
}

.pt-stats {
  margin-bottom: 1.25rem;
}

.pt-output-field {
  margin: 0;
}

.pt-output-field textarea {
  display: block;
  width: 100%;
  min-height: 19rem;
  box-sizing: border-box;
  resize: vertical;
  font: 0.95rem/1.5 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  tab-size: 4;
}

.pt-output-field textarea:focus-visible,
.pt-panel button:focus-visible,
.pt-result-panel button:focus-visible,
.pt-next a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.pt-output-field .hint {
  display: block;
  margin-top: 0.5rem;
}

.pt-result-actions {
  margin-top: 1rem;
}

.pt-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.pt-next-title {
  color: var(--text-muted);
  font-weight: 600;
}

.pt-next a {
  color: var(--primary);
}

@media (max-width: 480px) {
  .pt-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .pt-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pt-output-field textarea {
    font-size: 16px;
  }
}

/* MIC-TOOLS7 Pomodoro timer (.pm-) */
.pm-tool {
  max-width: 850px;
  margin-inline: auto;
}

.pm-tool,
.pm-tool * {
  box-sizing: border-box;
}

.pm-tool [hidden] {
  display: none !important;
}

.pm-tool button,
.pm-tool input,
.pm-tool select {
  font: inherit;
}

.pm-tool button {
  white-space: normal;
  overflow-wrap: anywhere;
  touch-action: manipulation;
}

.pm-tool button:focus-visible,
.pm-tool input:focus-visible,
.pm-tool select:focus-visible,
.pm-tool summary:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.pm-intro {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.pm-presets {
  margin-bottom: 1.5rem;
}

.pm-field-label {
  display: block;
  margin-bottom: 0.6rem;
  font-weight: 600;
}

.pm-presets .rate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pm-presets .rate-chip {
  min-height: 44px;
  font-variant-numeric: tabular-nums;
}

.pm-stage {
  width: 100%;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.pm-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  width: 100%;
}

.pm-tabs .tab-btn {
  min-width: 0;
  min-height: 46px;
  padding: 0.65rem 0.35rem;
  text-align: center;
  line-height: 1.3;
  border-radius: var(--radius-sm);
}

.pm-tabs .tab-btn[aria-selected="true"] {
  background: var(--primary-soft);
  color: var(--text);
  box-shadow: inset 0 -3px 0 var(--primary);
}

.pm-timer-panel {
  display: block;
  padding: 0;
  text-align: center;
}

.pm-dial {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 290px);
  aspect-ratio: 1;
  margin: 1rem auto 0;
}

.pm-ring {
  position: absolute;
  inset: 0;
}

.pm-ring svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pm-time {
  z-index: 1;
  font-size: clamp(3.5rem, 12vw, 4rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pm-mode {
  margin: 0.25rem 0 0.6rem;
  font-size: 1.25rem;
  font-weight: 650;
}

.pm-session-info {
  color: var(--text-muted);
  line-height: 1.5;
}

.pm-session-info p {
  margin: 0.25rem 0;
}

.pm-controls,
.pm-view-controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.pm-controls {
  margin-top: 1.25rem;
}

.pm-controls .btn {
  min-height: 48px;
  min-width: 5rem;
  flex: 1 1 5rem;
  max-width: 12rem;
}

.pm-view-controls {
  margin-top: 0.75rem;
}

.pm-view-controls .btn {
  min-height: 44px;
}

.pm-status {
  margin-top: 1rem;
  text-align: start;
  overflow-wrap: anywhere;
}

.pm-status:empty {
  display: none;
}

.pm-key-hint {
  margin-top: 1rem;
}

.pm-tool .hint {
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.pm-details {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.pm-details > summary {
  cursor: pointer;
  min-height: 48px;
  padding: 0.9rem 1rem;
  font-weight: 650;
  color: var(--text);
}

.pm-details-content {
  padding: 0 1rem 1rem;
}

.pm-details-content > .hint:first-child {
  margin-top: 0;
}

.pm-task-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(7rem, 10rem);
  gap: 0.75rem;
  align-items: start;
}

.pm-task-form .field {
  min-width: 0;
  margin: 0;
}

.pm-task-form input,
.pm-duration-grid input,
.pm-cycle-field input,
.pm-sound-grid select {
  width: 100%;
  min-height: 44px;
  min-width: 0;
}

.pm-task-estimate-field .hint {
  display: block;
  margin-top: 0.25rem;
}

.pm-add-task {
  grid-column: 1 / -1;
  justify-self: start;
  min-height: 44px;
}

.pm-task-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.pm-task {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.5rem;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.pm-task-active {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.pm-task-check {
  display: grid;
  align-items: center;
  justify-items: center;
  min-height: 44px;
  cursor: pointer;
}

.pm-task-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

.pm-task-content {
  min-width: 0;
}

.pm-task-name {
  display: block;
  width: 100%;
  padding: 0.4rem 0;
  text-align: start;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600 !important;
  line-height: 1.4;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.pm-task-name:disabled {
  opacity: 1;
  cursor: default;
}

.pm-task-done .pm-task-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.pm-task-count,
.pm-active-label {
  display: block;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.pm-active-label {
  font-weight: 650;
  color: var(--text);
}

.pm-task-delete {
  min-height: 44px;
  max-width: 7rem;
}

.pm-estimate {
  margin: 1rem 0 0.5rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.pm-duration-grid,
.pm-sound-grid {
  display: grid;
  gap: 0.85rem;
}

.pm-duration-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pm-sound-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pm-cycle-field {
  max-width: 22rem;
  margin-top: 1rem;
}

.pm-checks {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0;
}

.pm-checks .check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  line-height: 1.5;
  cursor: pointer;
}

.pm-checks input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 0.2rem;
  accent-color: var(--primary);
}

.pm-sound-settings {
  min-width: 0;
  margin: 1.25rem 0 0;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.pm-sound-settings legend {
  padding-inline: 0.4rem;
  font-weight: 600;
}

.pm-volume-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.pm-volume-row input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  accent-color: var(--primary);
}

.pm-volume-row output {
  flex: 0 0 3ch;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

.pm-notifications {
  margin-top: 1rem;
}

.pm-statistics {
  margin-top: 1.5rem;
}

.pm-statistics h2 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
}

.pm-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.pm-score-grid .score-card {
  min-width: 0;
  padding: 0.85rem 0.5rem;
}

.pm-score-grid .value {
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.pm-score-grid .caption {
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.pm-chart svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}

.pm-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.pm-stage:fullscreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 100%;
  padding: 1.25rem;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: var(--surface);
}

.pm-stage:fullscreen .pm-tabs,
.pm-stage:fullscreen .pm-controls,
.pm-stage:fullscreen .pm-status {
  width: min(100%, 650px);
}

.pm-stage:fullscreen .pm-timer-panel {
  width: 100%;
}

.pm-stage:fullscreen .pm-dial {
  width: min(76vw, 42vh, 430px);
}

.pm-stage:fullscreen .pm-time {
  font-size: clamp(3.5rem, 11vw, 6rem);
}

@media (max-width: 480px) {
  .pm-stage {
    padding: 0.65rem;
  }

  .pm-tabs .tab-btn {
    font-size: 0.85rem;
  }

  .pm-details-content {
    padding-inline: 0.75rem;
  }

  .pm-task-form,
  .pm-duration-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .pm-task-estimate-field {
    max-width: 13rem;
  }

  .pm-task {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .pm-task-delete {
    grid-column: 2;
    justify-self: start;
  }

  .pm-score-grid {
    gap: 0.35rem;
  }

  .pm-score-grid .caption {
    font-size: 0.8rem;
  }
}

@media (max-height: 620px) {
  .pm-stage:fullscreen {
    justify-content: flex-start;
  }
}

/* ============ Financial statement viewer (MIC-TOOLS8) ============ */
.fsv-tool {
  max-width: 1040px;
  margin-inline: auto;
  min-width: 0;
  color: var(--text);
}

.fsv-tool *,
#print-root .fsv-report * {
  box-sizing: border-box;
}

.fsv-tool [hidden] {
  display: none !important;
}

.fsv-input-panel {
  margin-bottom: 1.25rem;
}

.fsv-drop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.fsv-drop-copy {
  flex: 1 1 20rem;
  min-width: 0;
}

.fsv-drop h2 {
  margin: 0 0 0.45rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.fsv-drop p {
  margin: 0;
  max-width: 41.5em; /* 62ch of Albert Sans, without the jump when the font loads */
  color: var(--text-muted);
  line-height: 1.65;
}

.fsv-drop .btn-group {
  flex-wrap: wrap;
}

.fsv-dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.fsv-tool :is(button, a, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.fsv-tool button,
.fsv-tool select {
  font: inherit;
}

.fsv-tool button,
.fsv-tool select,
.fsv-tool summary {
  min-height: 2.75rem;
}

.fsv-tool button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.fsv-tool .status-box {
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.fsv-clear {
  margin-top: 0.9rem;
}

/* What's new (MIC-NEWS, tools/whats-new.html): a timeline, newest entry first */
.news-list {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  border-left: 2px solid var(--border);
}

.news-item {
  position: relative;
  padding: 0 0 1.9rem 1.5rem;
}

.news-item:last-child {
  padding-bottom: 0.5rem;
}

.news-item::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.3rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--bg);
}

.news-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.news-body h2 {
  margin: 0.2rem 0 0.4rem;
  font-size: 1.2rem;
}

.news-body p {
  max-width: 68ch;
  margin: 0 0 0.75rem;
  line-height: 1.6;
}

.news-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.news-link {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.news-link:hover,
.news-link:focus-visible {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.news-link:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Company search in official registers (MIC-COMPANY, js/company-search.js) */
.cs-form {
  display: grid;
  grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr) auto;
  gap: 0 0.75rem;
  align-items: end;
}

.cs-form .field {
  margin-bottom: 0;
}

.cs-form .btn {
  min-height: 2.6rem;
}

.cs-tool .hint {
  margin-top: 0.6rem;
}

.cs-tool .status-box {
  margin-top: 0.9rem;
}

.cs-tool .status-box[hidden],
.cs-result[hidden] {
  display: none;
}

.cs-result {
  margin-top: 1.25rem;
}

.cs-card {
  margin-bottom: 1rem;
  padding: 1.1rem 1.25rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface, var(--bg));
}

.cs-name {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.cs-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.9rem;
}

.cs-badge {
  padding: 0.12rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.cs-badge.cs-ok {
  border-color: var(--success);
  color: var(--success);
}

.cs-badge.cs-warn {
  border-color: var(--danger);
  color: var(--danger);
}

.cs-accounts {
  margin-top: 0.9rem;
  font-size: 0.9rem;
}

.cs-accounts summary {
  cursor: pointer;
  font-weight: 600;
}

.cs-accounts ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  max-height: 16rem;
  overflow-y: auto;
  font-variant-numeric: tabular-nums;
}

.cs-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
}

.cs-source {
  margin-top: 0.25rem;
}

@media (max-width: 640px) {
  .cs-form {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .cs-form .btn {
    width: 100%;
  }
}

/* KRS lookup (MIC-KRS, js/krs-lookup.js) */
.fsv-krs {
  margin-top: 1.25rem;
}

.fsv-krs h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

.fsv-krs .select-row input {
  width: auto;
  min-width: 11ch;
  max-width: 100%;
}

.fsv-krs .status-box[hidden],
.fsv-krs-result[hidden] {
  display: none;
}

.fsv-krs-name {
  margin: 1rem 0 0.5rem;
  overflow-wrap: anywhere;
}

.fsv-krs-table td,
.fsv-krs-table th[scope="row"] {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.fsv-loaded {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1.25rem 0;
}

.fsv-file-chip {
  display: flex;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.fsv-file-chip .rate-chip {
  min-width: 0;
  border: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

.fsv-file-chip .rate-chip[aria-pressed="true"] {
  background: var(--primary-soft);
  color: var(--primary);
}

.fsv-remove {
  flex: 0 0 2.75rem;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.3rem !important;
}

.fsv-remove:hover {
  background: var(--surface-2);
  color: var(--text);
}

.fsv-report {
  min-width: 0;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  line-height: 1.6;
  font-variant-numeric: tabular-nums lining-nums;
}

.fsv-report-header {
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border);
}

.fsv-entity {
  margin: 0;
  font-size: clamp(1.45rem, 4.8vw, 1.75rem);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.fsv-period {
  margin: 0.6rem 0 1.5rem;
  font-size: 1.1rem;
  font-weight: 500;
}

.fsv-example-badge {
  display: inline-block;
  margin: 0 0 0.85rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.fsv-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.1rem 1.4rem;
  margin: 0;
}

.fsv-facts > div,
.fsv-intro > div,
.fsv-generic > div {
  min-width: 0;
}

.fsv-facts dt,
.fsv-intro dt,
.fsv-generic dt {
  margin-bottom: 0.25rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.fsv-facts dd,
.fsv-intro dd,
.fsv-generic dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.fsv-facts dd {
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.fsv-muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.fsv-notice {
  display: block;
  margin: 0.85rem 0;
  padding: 0.7rem 0.85rem;
  border-left: 3px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.fsv-notice p {
  margin: 0.4rem 0 0;
}

.fsv-summary,
.fsv-checks {
  margin-top: 1.65rem;
}

.fsv-summary h3,
.fsv-checks h3 {
  margin: 0 0 0.9rem;
  font-size: 1rem;
  font-weight: 600;
}

.fsv-figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem 1.5rem;
}

.fsv-figure {
  min-width: 0;
  padding: 0.8rem 0 0.6rem;
  border-top: 1px solid var(--border);
}

.fsv-figure-label {
  font-size: 0.85rem;
  line-height: 1.5;
}

.fsv-figure-value {
  margin: 0.45rem 0 0.3rem;
  font-size: 1.3rem;
  line-height: 1.35;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Trends over the years (MIC-KRS): one small column chart per key figure; bar colour checked with the dataviz
   validator (light #1e5bd6 on #fbfcfd, dark #6a8ff2 on #16213a). */
.fsv-trends {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem 1.5rem;
  margin: 0.9rem 0 1.2rem;
  --fsv-bar: #1e5bd6;
}

[data-theme="dark"] .fsv-trends {
  --fsv-bar: #6a8ff2;
}

.fsv-trend {
  min-width: 0;
  margin: 0;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.fsv-trend figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.85rem;
}

.fsv-trend-value {
  font-size: 1.15rem;
  font-weight: 600;
}

.fsv-trend-chart {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 0.5rem;
  overflow: visible;
}

.fsv-trend-base {
  stroke: var(--border);
  stroke-width: 1;
}

.fsv-trend-year {
  fill: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.fsv-trend-bar path {
  fill: var(--fsv-bar);
}

.fsv-trend-hit {
  fill: transparent;
}

.fsv-trend-bar:hover path,
.fsv-trend-bar:focus path {
  opacity: 0.72;
}

.fsv-trend-bar:focus {
  outline: none;
}

.fsv-trend-bar:focus-visible .fsv-trend-hit {
  stroke: var(--primary);
  stroke-width: 2;
}

.fsv-ratios th[scope="col"],
.fsv-ratios td {
  white-space: nowrap;
}

@media (max-width: 850px) {
  .fsv-trends {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .fsv-trends {
    grid-template-columns: 1fr;
  }
}

@media print {
  .fsv-trends {
    --fsv-bar: #1e5bd6;
    break-inside: avoid;
  }
}

.fsv-indicators {
  margin-top: 1.1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.fsv-indicators p {
  margin: 0 0 0.45rem;
}

.fsv-indicators dl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin: 0;
}

.fsv-indicators dl > div {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
}

.fsv-indicators dd {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.fsv-checks {
  font-size: 0.86rem;
}

.fsv-checks ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.fsv-checks li {
  margin: 0.5rem 0;
}

.fsv-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.6rem 0 1rem;
}

.fsv-nav .rate-chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.6rem;
  font-size: 0.83rem;
  text-decoration: none;
  white-space: normal;
}

.fsv-nav .rate-chip:hover,
.fsv-nav .rate-chip:focus-visible {
  color: var(--primary);
  border-color: var(--primary);
}

.fsv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.85rem 1.5rem;
  padding: 1rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
}

.fsv-toolbar .btn-group {
  flex-wrap: wrap;
}

.fsv-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem 1.15rem;
  font-size: 0.84rem;
}

.fsv-settings .check-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  min-height: 2.75rem;
  cursor: pointer;
}

.fsv-settings input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--primary);
}

.fsv-language {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.fsv-language select {
  max-width: 100%;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
}

.fsv-section {
  min-width: 0;
  margin-top: 2.3rem;
  scroll-margin-top: 1.5rem;
}

.fsv-section > h3 {
  position: relative;
  margin: 0 0 1.2rem;
  padding-top: 0.8rem;
  font-size: 1.15rem;
  line-height: 1.35;
  font-weight: 600;
}

.fsv-section > h3::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 2.5rem;
  height: 2px;
  background: var(--primary);
}

.fsv-section h4,
.fsv-section h3:not(:first-child) {
  font-size: 1rem;
}

.fsv-intro,
.fsv-generic {
  margin: 0;
}

.fsv-intro > div,
.fsv-generic > div {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.fsv-intro dt {
  font-weight: 600;
}

.fsv-intro dd {
  max-width: 55em; /* 82ch of Albert Sans */
  font-size: 0.94rem;
}

.fsv-field-value {
  display: block;
}

.fsv-prose {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 82ch;
}

.fsv-prose p,
p.fsv-prose {
  margin: 0.35rem 0;
}

.fsv-variant {
  margin: 0 0 0.8rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.fsv-table-wrap {
  max-width: 100%;
  overflow: auto;
  margin: 0 0 1.25rem;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.fsv-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums lining-nums;
}

.fsv-table caption {
  padding: 0.5rem 0 0.65rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
}

.fsv-table th,
.fsv-table td {
  padding: 0.6rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.fsv-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 600;
  text-align: right;
  vertical-align: bottom;
  min-width: 7rem;
}

.fsv-table thead th:first-child,
.fsv-table tbody th {
  text-align: left;
  min-width: 14em;
  width: 44%;
}

.fsv-table tbody th {
  font-weight: 400;
  overflow-wrap: anywhere;
}

.fsv-table .fsv-number {
  white-space: nowrap;
  text-align: right;
}

.fsv-row-label {
  padding-left: calc(var(--fsv-depth, 0) * 1.1em);
}

.fsv-table .fsv-row-top > * {
  background: var(--surface-2);
}

.fsv-table .fsv-row-strong > * {
  font-weight: 600;
}

.fsv-table .fsv-row-top > * {
  border-top: 1px solid var(--border);
}

.fsv-row-custom .fsv-row-label {
  font-style: italic;
}

.fsv-detail-marker,
.fsv-official,
.fsv-tax-detail,
.fsv-comparison-label {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.76rem;
  line-height: 1.45;
  font-weight: 400;
}

.fsv-official,
.fsv-tax-detail,
.fsv-comparison-label {
  white-space: normal;
}

.fsv-detail-marker {
  font-style: normal;
}

.fsv-comparison-label {
  min-width: 9rem;
  max-width: 19rem;
  text-align: left;
}

.fsv-hidden-note {
  margin: -0.35rem 0 0;
}

.fsv-note {
  padding: 0.35rem 0 1.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.fsv-attachment {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.fsv-attachment-inline {
  margin-top: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.fsv-attachment-info {
  flex: 1 1 14rem;
  min-width: 0;
}

.fsv-attachment-info strong,
.fsv-attachment-info span {
  display: block;
  overflow-wrap: anywhere;
}

.fsv-attachment .btn-group {
  flex-wrap: wrap;
}

.fsv-technical {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}

.fsv-technical summary,
.fsv-archives summary {
  padding: 0.9rem 0;
  cursor: pointer;
  font-weight: 600;
}

.fsv-technical .fsv-facts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-top: 0.75rem;
}

.fsv-code-list,
.fsv-generic code,
.fsv-technical code {
  overflow-wrap: anywhere;
}

.fsv-technical ul {
  padding-left: 1.25rem;
}

.fsv-report-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.fsv-archives {
  margin-top: 1.25rem;
  padding: 0.4rem 1.25rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.fsv-archive-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.fsv-archive-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.87rem;
}

.fsv-archive-list li > div {
  min-width: 0;
  flex: 1 1 14rem;
  overflow-wrap: anywhere;
}

.fsv-archive-list strong,
.fsv-archive-list small,
.fsv-archive-list span {
  display: block;
}

#print-root {
  display: none;
}

@media (max-width: 850px) {
  .fsv-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fsv-figures {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .fsv-report {
    padding: 16px;
  }

  .fsv-drop {
    padding: 1rem;
  }

  .fsv-facts,
  .fsv-figures,
  .fsv-technical .fsv-facts {
    grid-template-columns: 1fr;
  }

  .fsv-settings,
  .fsv-language {
    align-items: flex-start;
  }

  .fsv-language {
    flex-direction: column;
  }

  .fsv-table {
    font-size: 0.82rem;
  }

  .fsv-table th,
  .fsv-table td {
    padding: 0.55rem 0.45rem;
  }

  .fsv-figure {
    padding-bottom: 0.8rem;
  }

  .fsv-indicators dl {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fsv-tool *,
  .fsv-tool *::before,
  .fsv-tool *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Named page: these settings apply only when the report copy is printed. */
@page fsv-report {
  size: A4 portrait;
  margin: 12mm;

  @bottom-right {
    content: counter(page);
    font-size: 8pt;
  }
}

@media print {
  body.print-fsv {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    color: #000 !important;
  }

  body.print-fsv > :not(#print-root) {
    display: none !important;
  }

  body.print-fsv > #print-root {
    display: block !important;
    margin: 0;
    padding: 0;
    page: fsv-report;
  }

  body.print-fsv #print-root .fsv-report {
    --text: #000;
    --text-muted: #333;
    --surface: #fff;
    --surface-2: #f2f2f2;
    --border: #bbb;
    --primary: #000;
    display: block !important;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: #fff;
    color: #000;
    font-size: 10pt;
    line-height: 1.4;
  }

  #print-root .fsv-toolbar,
  #print-root .fsv-nav,
  #print-root button,
  #print-root .btn-group,
  #print-root .fsv-loaded,
  #print-root .fsv-technical {
    display: none !important;
  }

  #print-root .fsv-entity {
    font-size: 18pt;
  }

  #print-root .fsv-period {
    font-size: 12pt;
    margin-bottom: 5mm;
  }

  #print-root .fsv-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3mm 5mm;
  }

  #print-root .fsv-facts dt,
  #print-root .fsv-facts dd,
  #print-root .fsv-muted,
  #print-root .fsv-indicators,
  #print-root .fsv-checks {
    font-size: 8.5pt;
  }

  #print-root .fsv-figures {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3mm 5mm;
  }

  #print-root .fsv-figure-value {
    font-size: 13pt;
  }

  #print-root .fsv-figure-label {
    font-size: 8.5pt;
  }

  #print-root .fsv-section {
    break-before: page;
    page-break-before: always;
    margin-top: 0;
  }

  #print-root .fsv-section-first {
    break-before: auto;
    page-break-before: auto;
    margin-top: 6mm;
  }

  #print-root .fsv-section > h3 {
    font-size: 12pt;
    margin-bottom: 4mm;
  }

  #print-root h2,
  #print-root h3,
  #print-root h4,
  #print-root caption {
    break-after: avoid;
    page-break-after: avoid;
  }

  #print-root .fsv-table-wrap {
    overflow: visible;
    margin-bottom: 5mm;
    scrollbar-gutter: auto;
  }

  #print-root .fsv-table {
    width: 100%;
    font-size: 9pt;
    border-collapse: collapse;
  }

  #print-root .fsv-table thead {
    display: table-header-group;
  }

  #print-root .fsv-table thead th {
    position: static;
    min-width: 0;
    font-size: 8pt;
  }

  #print-root .fsv-table th,
  #print-root .fsv-table td {
    padding: 1.8mm 1.3mm;
  }

  #print-root .fsv-table tbody th,
  #print-root .fsv-table thead th:first-child {
    min-width: 0;
    width: 40%;
  }

  #print-root .fsv-table tr,
  #print-root .fsv-attachment,
  #print-root .fsv-facts > div,
  #print-root .fsv-figure {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #print-root .fsv-row-label {
    padding-left: calc(min(var(--fsv-depth, 0), 6) * 0.8em);
  }

  #print-root .fsv-official,
  #print-root .fsv-detail-marker,
  #print-root .fsv-tax-detail,
  #print-root .fsv-comparison-label {
    font-size: 7.5pt;
  }

  #print-root .fsv-comparison {
    table-layout: fixed;
    font-size: 8pt;
  }

  #print-root .fsv-comparison .fsv-number {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #print-root .fsv-comparison-label {
    min-width: 0;
    max-width: none;
  }

  #print-root .fsv-intro dd,
  #print-root .fsv-prose {
    max-width: none;
    font-size: 10pt;
  }

  #print-root .fsv-attachment {
    display: block;
    padding: 2mm 0;
    border: 0;
    border-bottom: 1px solid #bbb;
    border-radius: 0;
  }

  #print-root .fsv-attachment-inline {
    margin: 2mm 0 0;
  }

  #print-root .fsv-notice {
    padding: 2mm 3mm;
    font-size: 8.5pt;
  }

  #print-root .fsv-report-footer {
    font-size: 8pt;
    margin-top: 5mm;
    padding-top: 3mm;
  }

  #print-root a {
    color: #000;
    text-decoration: none;
  }
}

/* ============ MIC-GROW1: category pages (tools/category-*.html) ============ */
.category-tools {
  margin: 1.5rem 0 2.25rem;
}

.category-tools h2 {
  margin: 0 0 0.85rem;
  font-size: 1.2rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.category-card {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.16s ease;
}

.category-card:hover,
.category-card:focus-visible {
  border-color: var(--text);
}

.category-card .tile {
  width: 40px;
  height: 40px;
}

.category-card-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.category-card-text strong {
  font-size: 1rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.category-card-text span {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

@media (max-width: 420px) {
  .category-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ MIC-TOOLS10: image to text (OCR) and PDF OCR ============ */
.i2t-tool {
  min-width: 0;
}

.i2t-tool [hidden] {
  display: none !important;
}

.i2t-drop {
  cursor: default;
}

.i2t-drop > strong,
.i2t-drop > .hint {
  flex-basis: 100%;
}

.i2t-tool .hint {
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.i2t-settings {
  border: 0;
  padding: 0;
  margin: 1.5rem 0 0;
  min-width: 0;
}

.i2t-settings legend {
  font-weight: 700;
  padding: 0;
  margin-bottom: 1rem;
}

.i2t-settings .check-row {
  margin-top: .85rem;
  align-items: flex-start;
}

.i2t-settings input[type="checkbox"] {
  flex: 0 0 auto;
  margin-top: .25em;
}

.i2t-settings select,
.i2t-settings input:not([type="checkbox"]) {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.i2t-settings select {
  text-overflow: ellipsis;
}

.i2t-pdf-options {
  margin-top: 1.25rem;
}

.i2t-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1rem;
}

.i2t-actions .btn {
  white-space: normal;
  min-height: 44px;
}

.i2t-tool button:focus-visible,
.i2t-tool a:focus-visible,
.i2t-tool select:focus-visible,
.i2t-tool input:focus-visible,
.i2t-tool textarea:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.i2t-tool button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.i2t-queue {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
}

.i2t-item {
  margin: 0;
  min-width: 0;
}

.i2t-item-title {
  margin: 0 0 .35rem;
  overflow-wrap: anywhere;
}

.i2t-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.i2t-visual,
.i2t-edit {
  min-width: 0;
}

.i2t-preview {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  touch-action: none;
  user-select: none;
  cursor: crosshair;
  background: var(--surface-2);
}

.i2t-preview-image {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  pointer-events: none;
}

.i2t-crop {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--primary);
  background: var(--primary-soft);
  opacity: .65;
  pointer-events: none;
}

.i2t-text-label {
  display: block;
  font-weight: 600;
  margin-bottom: .5rem;
}

.i2t-text {
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 12rem;
  resize: vertical;
  padding: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.65;
}

.i2t-confidence {
  font-weight: 600;
  margin-top: 0;
}

.i2t-warning,
.i2t-error,
.i2t-callout {
  padding: .75rem 1rem;
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  color: var(--text);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.i2t-callout a {
  color: var(--primary);
  text-decoration: underline;
}

@media (max-width: 680px) {
  .i2t-columns,
  .i2t-settings .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }

  .i2t-tool .panel {
    padding: 1rem;
  }

  .i2t-actions .btn {
    flex: 1 1 130px;
  }

  .i2t-settings select,
  .i2t-settings input,
  .i2t-text {
    font-size: 16px;
  }
}

/* ---------- AI background removal (MIC-BG, js/bg-remove-worker.js) ---------- */
.bg-ai {
  margin: 0.75rem 0 1.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

#tab-bg h4 {
  margin: 0 0 0.5rem;
}

.bg-ai .select-row select {
  width: auto;
}

.bg-ai .status-box[hidden] {
  display: none;
}

.bg-fill {
  margin-top: 0.75rem;
}

.bg-fill input[type="color"] {
  width: 2.6rem;
  height: 2.2rem;
  padding: 0.1rem;
}

/* image-tools.js: a picture dragged over the upload panel. */
.panel.dragover {
  outline: 2px dashed var(--primary);
  outline-offset: 4px;
}

/* PDF documents in the statement viewer and the KRS drop target (MIC-KRS) */
.fsv-documents {
  margin-top: 1.25rem;
}

.fsv-documents[hidden] {
  display: none;
}

.fsv-documents-title {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.fsv-doc {
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
}

.fsv-doc .btn-group {
  margin-top: 0.55rem;
}

.fsv-doc-pages {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 0.8rem;
}

.fsv-doc-pages[hidden] {
  display: none;
}

.fsv-doc-page {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.fsv-krs.fsv-krs-dragging {
  outline: 2px dashed var(--primary);
  outline-offset: 4px;
}

/* ---------- MIC-FIN: financial analysis on a Polish company card (js/company-finance.js) ----------
   Series colours are the validated categorical palette (dataviz, slots 1-4; light on #fbfcfd, dark on #16213a,
   adjacent CVD ΔE ≥ 8.4). Two light slots are below 3:1, so legends, direct labels and the data tables carry the
   values; status chips pair an icon and a word with their colour. */
.cs-fin,
.cs-fin-print {
  --cfin-1: #2a78d6;
  --cfin-2: #eb6834;
  --cfin-3: #1baf7a;
  --cfin-4: #eda100;
  --cfin-good: #0ca30c;
  --cfin-watch: #fab219;
  --cfin-weak: #d03b3b;
}

[data-theme="dark"] .cs-fin,
[data-theme="dark"] .cs-fin-print {
  --cfin-1: #3987e5;
  --cfin-2: #d95926;
  --cfin-3: #199e70;
  --cfin-4: #c98500;
}

.cs-fin {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.cs-fin-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.cs-fin-intro {
  margin: 0 0 0.4rem;
}

.cs-fin-steps {
  margin: 0.5rem 0 0.8rem;
  padding-left: 1.3rem;
}

.cs-fin-steps li {
  margin: 0.4rem 0;
}

.cs-fin-drop {
  padding: 1rem;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
}

.cs-fin-drop.is-over,
.cs-fin-drop:hover,
.cs-fin-drop:focus-visible {
  border-color: var(--primary);
  color: var(--text);
}

.cs-fin-status {
  margin: 0.6rem 0 0;
}

.cs-fin-status.error {
  color: var(--danger);
}

.cs-fin-report {
  position: relative;
}

.cs-fin-scope {
  margin: 1.1rem 0 0.4rem;
  font-size: 1rem;
}

.cs-fin-note {
  margin: 0.2rem 0;
}

.cs-fin-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.6rem;
  margin: 0.8rem 0 1rem;
}

.cs-fin-tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cs-fin-tile-label,
.cs-fin-delta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.cs-fin-tile strong {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.cs-fin-findings h5,
.cs-fin-table caption,
.cs-fin-chart figcaption,
.cs-fin-data summary {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
}

.cs-fin-findings ul {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.cs-fin-finding {
  position: relative;
  padding: 0.3rem 0 0.3rem 1.6rem;
}

.cs-fin-finding::before {
  position: absolute;
  top: 0.3rem;
  left: 0;
  width: 1.1rem;
  font-weight: 700;
  text-align: center;
}

.cs-fin-finding--good::before { content: "✓"; color: var(--cfin-good); }
.cs-fin-finding--watch::before { content: "!"; color: var(--cfin-watch); }
.cs-fin-finding--weak::before { content: "✕"; color: var(--cfin-weak); }
.cs-fin-finding--neutral::before { content: "•"; color: var(--text-muted); }

.cs-fin-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1rem 1.4rem;
  margin: 1rem 0;
}

.cs-fin-chart {
  min-width: 0;
  margin: 0;
}

.cs-fin-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.cs-fin-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.9rem;
  margin: 0 0 0.35rem;
  padding: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  list-style: none;
}

.cs-fin-legend li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cs-fin-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
}

.cs-fin-swatch--band {
  background: color-mix(in srgb, var(--cfin-3) 22%, transparent);
  outline: 1px solid color-mix(in srgb, var(--cfin-3) 45%, transparent);
}

.cs-fin-grid { stroke: var(--border); stroke-width: 1; }
.cs-fin-zero { stroke: var(--border-strong); }
.cs-fin-axis { fill: var(--text-muted); font-size: 11px; }
.cs-fin-label { fill: var(--text); font-size: 11px; font-weight: 600; }
.cs-fin-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cs-fin-dot { stroke: var(--surface); stroke-width: 2; }
.cs-fin-band { fill: var(--cfin-3); opacity: 0.12; }
.cs-fin-mark { cursor: default; }
.cs-fin-mark:focus { outline: none; }
.cs-fin-mark:focus-visible { stroke: var(--text); stroke-width: 2; }

.cs-fin-tip {
  position: absolute;
  z-index: 5;
  max-width: 90%;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  background: var(--text);
  color: var(--surface);
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
}

.cs-fin-table-wrap,
.cs-fin-data .table-wrap {
  margin: 0.5rem 0 1rem;
  overflow-x: auto;
}

.cs-fin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.cs-fin-table th,
.cs-fin-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
  vertical-align: top;
}

.cs-fin-table th[scope="row"],
.cs-fin-table thead th:first-child {
  font-weight: 500;
  text-align: left;
}

.cs-fin-group th {
  background: var(--bg-alt);
  font-weight: 600;
  text-align: left;
}

.cs-fin-fx {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 400;
}

.cs-fin-tone {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0 0.4rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.cs-fin-tone > span { font-weight: 700; }
.cs-fin-tone--good > span { color: var(--cfin-good); }
.cs-fin-tone--watch > span { color: var(--cfin-watch); }
.cs-fin-tone--weak > span { color: var(--cfin-weak); }

.cs-fin-data summary {
  cursor: pointer;
}

.cs-fin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

@media (max-width: 520px) {
  .cs-fin-table th,
  .cs-fin-table td {
    padding: 0.35rem 0.3rem;
  }
}

@media print {
  .cs-fin-print h2 { margin: 0 0 0.6rem; font-size: 14pt; }
  .cs-fin-print .cs-fin-charts { grid-template-columns: 1fr 1fr; }
  .cs-fin-print .cs-fin-chart,
  .cs-fin-print .cs-fin-table,
  .cs-fin-print .cs-fin-tiles { break-inside: avoid; }
  .cs-fin-print .cs-fin-tip { display: none; }
}

/* Charades */
.charades-app { overflow-wrap: anywhere; }
.charades-app [hidden] { display: none !important; }
.charades-app fieldset { min-width: 0; margin: 1rem 0; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
.charades-app legend { padding: 0 0.4rem; font-weight: 600; }
.charades-app .field { min-width: 0; }
.charades-app input:not([type="checkbox"]), .charades-app select, .charades-app textarea { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; }
.charades-app textarea { resize: vertical; }
.charades-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: 0.35rem 1rem; }
.charades-check { display: flex; align-items: center; gap: 0.65rem; min-height: 48px; cursor: pointer; }
.charades-check input { flex: 0 0 auto; width: 1.25rem; height: 1.25rem; }
.charades-app .btn { min-height: 48px; max-width: 100%; white-space: normal; }
.charades-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.8rem 0; }
.charades-actions .btn { flex: 1 1 8rem; font-size: 1.1rem; }
.charades-stats { display: flex; justify-content: space-between; gap: 1rem; font-variant-numeric: tabular-nums; }
.charades-card { display: grid; place-items: center; min-height: 12rem; margin: 0.8rem 0; padding: 1.2rem; text-align: center; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
#ch-word { margin: 0; font-size: clamp(1.8rem, 5vw, 3.6rem); line-height: 1.2; font-weight: 700; }
#ch-feedback { min-height: 1.5em; margin: 0; font-weight: 700; text-align: center; }
#ch-status:not(:empty) { padding: 0.8rem; background: var(--surface-2); border-radius: var(--radius); }
#ch-sensor:empty, #ch-wake:empty, #ch-screen:empty, #ch-status:empty, #ch-rules:empty { display: none; }
.charades-card.charades-correct { background: #166534; color: #fff; border-color: #166534; }
.charades-card.charades-skip { background: #9a3412; color: #fff; border-color: #9a3412; }
.charades-app:fullscreen { box-sizing: border-box; overflow: auto; width: 100%; height: 100%; padding: 1rem; background: var(--bg); color: var(--text); }
.charades-immersive { position: fixed; inset: 0; z-index: 10000; margin: 0; border-radius: 0; box-sizing: border-box; overflow: auto; padding: max(0.7rem, env(safe-area-inset-top)) max(0.7rem, env(safe-area-inset-right)) max(0.7rem, env(safe-area-inset-bottom)) max(0.7rem, env(safe-area-inset-left)); background: var(--bg); color: var(--text); }
.charades-immersive > .hint { display: none; }
.charades-immersive h2 { font-size: 1rem; margin: 0 0 0.3rem; }
.charades-immersive .charades-card { min-height: 7rem; margin: 0.4rem 0; }
.charades-immersive #ch-word { font-size: clamp(2rem, 6vw, 4.8rem); }
.charades-immersive .charades-actions { margin: 0.35rem 0; }
.charades-immersive .hint { font-size: 0.8rem; margin: 0.3rem 0; }
@media (max-width: 520px) {
  .charades-app .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .charades-app fieldset { padding: 0.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .charades-card.charades-correct, .charades-card.charades-skip { background: var(--surface-2); color: var(--text); border-color: var(--border); }
}

/* Team picker */
.tp-app { min-width: 0; overflow-wrap: anywhere; }
.tp-app [hidden] { display: none !important; }
.tp-app .field { min-width: 0; }
.tp-app input:not([type="checkbox"]), .tp-app textarea, .tp-app select { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; }
.tp-app textarea { resize: vertical; }
.tp-app button { white-space: normal; max-width: 100%; }
.tp-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0; }
.tp-tabs button { flex: 1 1 8rem; min-height: 44px; padding: 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.tp-tabs [aria-selected="true"] { background: var(--primary); color: #fff; }
.tp-app :focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
.tp-check { display: flex; align-items: center; gap: 0.6rem; margin: 1rem 0; }
.tp-check input { flex-shrink: 0; }
.tp-teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 1rem; margin: 1rem 0; }
.tp-team, .tp-match { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.tp-team h3, .tp-match h4 { margin: 0 0 0.6rem; }
.tp-team li { margin: 0.35rem 0; }
#tp-wheel { display: block; width: min(100%, 32rem); height: auto; margin: 1rem auto; }
.tp-result { font-weight: 700; font-size: clamp(1.4rem, 4vw, 2.2rem); }
.tp-bracket { display: flex; gap: 1rem; max-width: 100%; overflow-x: auto; padding: 0.5rem 0.5rem 1rem; }
.tp-round { flex: 0 0 15rem; min-width: 0; }
.tp-match { display: grid; gap: 0.5rem; margin-bottom: 0.8rem; }
.tp-match button { width: 100%; min-height: 44px; }
.tp-match [aria-pressed="true"] { border: 2px solid var(--primary); font-weight: 700; }
.tp-match [aria-pressed="true"]::before { content: "✓ "; }
.tp-match button:disabled { opacity: 0.7; }
.tp-actions { margin: 1rem 0; }
#tp-status:not(:empty) { padding: 0.8rem; border-radius: var(--radius); background: var(--surface-2); }
#tp-status:empty, .tp-result:empty { display: none; }
/* Named page keeps landscape settings out of unrelated tools. */
@page team-picker { size: A4 landscape; margin: 12mm; }
@media print {
  body.tp-page { background: #fff; color: #000; }
  .tp-page > :not(main), .tp-page .back-link, .tp-page .tool-guide,
  .tp-page [data-ad-slot], .tp-page .breadcrumbs, .tp-page .tp-inputs,
  .tp-page .tp-settings, .tp-page .tp-tabs, .tp-page .tp-actions,
  .tp-page #tp-copy-field, .tp-page #tp-status, .tp-page .tp-privacy,
  .tp-page #tp-copy, .tp-page #tp-share, .tp-page .tp-share-hint { display: none !important; }
  .tp-page .tool-main { page: team-picker; margin: 0; padding: 0; }
  .tp-page .container, .tp-page .tp-app { width: 100%; max-width: none; padding: 0; margin: 0; border: 0; box-shadow: none; }
  .tp-page .tp-bracket { display: block; overflow: visible; }
  .tp-page .tp-round { break-before: page; }
  .tp-page .tp-round:first-child { break-before: auto; }
  .tp-page .tp-round .tp-match { display: inline-grid; vertical-align: top; width: 29%; margin: 0 1% 0.6rem 0; break-inside: avoid; }
  .tp-page .tp-team, .tp-page .tp-match { background: #fff; color: #000; border-color: #555; break-inside: avoid; }
  .tp-page .tp-match button { background: #fff; color: #000; opacity: 1; border-color: #555; }
  .tp-page .tp-undo { display: none; }
  .tp-page #tp-wheel { max-width: 110mm; }
}

/* Countdown */
.cd-app { overflow-wrap: anywhere; }
.cd-app [hidden] { display: none !important; }
.cd-app .field { min-width: 0; }
.cd-app input, .cd-app select, .cd-app textarea { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.cd-app .btn { white-space: normal; max-width: 100%; }
.cd-display { padding: clamp(1rem, 3vw, 2.5rem); text-align: center; background: var(--surface-2); border-radius: var(--radius); }
.cd-display h2 { font-size: clamp(1.5rem, 4vw, 3rem); margin-top: 0; }
.cd-message { white-space: pre-wrap; font-size: 1.15rem; }
.cd-message:empty { display: none; }
.cd-digits { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: clamp(0.4rem, 2vw, 1.5rem); margin: 1.5rem 0; }
.cd-digits strong { display: block; font-size: clamp(1.5rem, 5vw, 4.5rem); line-height: 1.2; font-variant-numeric: tabular-nums; }
.cd-digits span { display: block; font-size: 0.9rem; }
.cd-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.cd-wide { grid-column: 1 / -1; }
.cd-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0; }
.cd-display:fullscreen { box-sizing: border-box; width: 100%; height: 100%; overflow: auto; border-radius: 0; background: var(--bg); color: var(--text); display: flex; flex-direction: column; justify-content: center; }
.cd-display:fullscreen .cd-digits strong { font-size: clamp(2rem, 8vw, 10rem); }
.cd-display:fullscreen .btn { align-self: center; }
@media (max-width: 520px) {
  .cd-form { grid-template-columns: minmax(0, 1fr); }
  .cd-digits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cd-digits strong { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .cd-app *, .cd-display:fullscreen * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Secret Santa */
.santa-app { overflow-wrap: anywhere; }
.santa-app [hidden] { display: none !important; }
.santa-app fieldset { min-width: 0; margin: 1rem 0; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); }
.santa-app legend { padding: 0 0.4rem; font-weight: 600; }
.santa-app .field { min-width: 0; }
.santa-app input:not([type="checkbox"]),
.santa-app textarea,
.santa-app select { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; }
.santa-app textarea { resize: vertical; }
.santa-check { display: flex; align-items: center; gap: 0.6rem; margin: 1rem 0; }
.santa-list { list-style: none; padding: 0; margin: 1rem 0; }
.santa-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border); }
.santa-list li > :first-child { flex: 1 1 10rem; min-width: 0; }
.santa-app .btn { white-space: normal; max-width: 100%; }
.santa-result { font-size: clamp(1.7rem, 5vw, 2.6rem); font-weight: 700; color: var(--primary); }
.santa-result:empty, #santa-status:empty { display: none; }
#santa-status { margin-top: 1rem; padding: 0.8rem; background: var(--surface-2); border-radius: var(--radius); }
.santa-restart { margin-top: 1rem; }
@media (max-width: 520px) {
  .santa-app .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
/* Countdown: the display is visible before the script fills it, so reserve the text lines (no layout shift). */
.cd-display h2:empty, .cd-display #cd-target:empty { min-height: 1.3em; }
.cd-display #cd-message:empty, .cd-display #cd-phase:empty { margin: 0; }

/* Quiz scores stay readable on a shared screen and narrow phones. */
.quiz-scoreboard { display:flex; flex-wrap:wrap; gap:.5rem 1.5rem; padding-left:1.25rem; }
.quiz-scoreboard[hidden] { display:none; }
.quiz-scoreboard li, #quiz-results .score-name { overflow-wrap:anywhere; }
.quiz-comparison { white-space:pre-line; overflow-wrap:anywhere; }
#quiz-share-link { width:100%; box-sizing:border-box; overflow-wrap:anywhere; }
#quiz-share-link[hidden] { display:none; }
