/* Markdown Table Generator & Editor — content styles.
   Prefix: --mdt-  /  .mdt-

   Reference point: a small spreadsheet — an editable grid of real <input>
   cells with inline per-column alignment controls and row/column remove
   buttons, not a form with separate "add field" rows. Tenth distinct
   developer-cluster layout this build loop: an actual editable grid, not
   a table of read-only results.

   THIS FILE STYLES THE CONTENT AREA ONLY. Chrome is owned by chrome.css. */

:root {
  --mdt-surface: #ffffff;
  --mdt-panel:   #f5f6f4;
  --mdt-line:    #dadedb;
  --mdt-text:    #14181a;
  --mdt-muted:   #5e6862;
  --mdt-bad:     #b3261e;
  --mdt-mono:    ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

.mdt-wrap {
  width: 100%;
  max-width: 52rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ── Grid editor ─────────────────────────────────────────────────────────── */

.mdt-grid-panel {
  margin-bottom: 1rem;
}

.mdt-grid-wrap {
  overflow-x: auto;
  border: 1px solid var(--mdt-line);
  border-radius: 2px;
}

.mdt-grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--mdt-surface);
}

.mdt-grid th,
.mdt-grid td {
  padding: 0.375rem;
  border-bottom: 1px solid var(--mdt-line);
  border-right: 1px solid var(--mdt-line);
}

.mdt-grid th:last-child,
.mdt-grid td:last-child {
  border-right: none;
}

.mdt-grid thead th {
  background: var(--mdt-panel);
  vertical-align: top;
}

.mdt-cell-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.375rem 0.5rem;
  font-family: var(--mdt-mono);
  font-size: 0.8125rem;
  color: var(--mdt-text);
  background: var(--mdt-surface);
  border: 1px solid transparent;
  border-radius: 1px;
}

.mdt-header-input {
  font-weight: 700;
  background: var(--mdt-surface);
  margin-bottom: 0.25rem;
}

.mdt-cell-input:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: -1px;
  border-color: var(--tf-accent);
}

.mdt-th-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
}

.mdt-align-btn {
  padding: 0.1875rem 0.5rem;
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--mdt-muted);
  background: var(--mdt-surface);
  border: 1px solid var(--mdt-line);
  border-radius: 2px;
  cursor: pointer;
}

.mdt-align-btn:hover {
  border-color: var(--tf-accent);
  color: var(--tf-accent);
}

.mdt-remove-col-btn,
.mdt-remove-row-btn {
  padding: 0.1875rem 0.4375rem;
  font-family: inherit;
  font-size: 0.6875rem;
  color: var(--mdt-muted);
  background: var(--mdt-surface);
  border: 1px solid var(--mdt-line);
  border-radius: 2px;
  cursor: pointer;
  line-height: 1;
}

.mdt-remove-col-btn:hover,
.mdt-remove-row-btn:hover {
  color: var(--mdt-bad);
  border-color: var(--mdt-bad);
}

.mdt-remove-row-cell {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
  text-align: center;
}

.mdt-remove-header-cell {
  width: 1%;
  white-space: nowrap;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mdt-muted);
  text-align: center;
}

.mdt-grid-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.mdt-add-btn {
  padding: 0.4375rem 0.875rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--tf-accent);
  background: var(--tf-accent-wash);
  border: 1px solid var(--tf-accent-soft);
  border-radius: 2px;
  cursor: pointer;
}

/* ── Primary action button ──────────────────────────────────────────────── */

.mdt-btn {
  display: block;
  width: 100%;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--tf-accent-ink);
  background: var(--tf-accent);
  border: 1px solid var(--tf-accent);
  border-radius: 2px;
  cursor: pointer;
  margin-bottom: 1.5rem;
}

.mdt-btn:hover  { background: var(--tf-accent-hover);  border-color: var(--tf-accent-hover); }
.mdt-btn:active { background: var(--tf-accent-active); border-color: var(--tf-accent-active); }

.mdt-btn:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: 2px;
}

/* ── Output panel ────────────────────────────────────────────────────────── */

.mdt-output-panel {
  margin-bottom: 1.5rem;
}

.mdt-panel-title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mdt-muted);
}

.mdt-output-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.mdt-copy-btn {
  padding: 0.25rem 0.75rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--mdt-text);
  background: var(--mdt-panel);
  border: 1px solid var(--mdt-line);
  border-radius: 2px;
  cursor: pointer;
}

.mdt-copy-btn:hover {
  border-color: var(--tf-accent);
  color: var(--tf-accent);
}

.mdt-output {
  margin: 0.5rem 0 0;
  padding: 0.875rem 1rem;
  min-height: 6rem;
  max-height: 18rem;
  overflow: auto;
  font-family: var(--mdt-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  white-space: pre;
  color: var(--mdt-text);
  background: var(--mdt-panel);
  border: 1px solid var(--mdt-line);
  border-radius: 2px;
}

/* ── Import panel ────────────────────────────────────────────────────────── */

.mdt-import-panel {
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--mdt-line);
  border-radius: 2px;
  background: var(--mdt-panel);
}

.mdt-import-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 6rem;
  padding: 0.75rem 0.875rem;
  font-family: var(--mdt-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--mdt-text);
  background: var(--mdt-surface);
  border: 1px solid var(--mdt-line);
  border-radius: 2px;
  resize: vertical;
  margin-bottom: 0.75rem;
}

.mdt-import-input:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: -1px;
}

.mdt-error {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--mdt-bad);
}

.mdt-import-btn {
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--mdt-text);
  background: var(--mdt-surface);
  border: 1px solid var(--mdt-line);
  border-radius: 2px;
  cursor: pointer;
}

.mdt-import-btn:hover {
  border-color: var(--tf-accent);
  color: var(--tf-accent);
}

/* ── Ad slots ───────────────────────────────────────────────────────────── */

.mdt-ad {
  min-height: 280px;
  margin: 2rem auto 0;
  max-width: 52rem;
  padding-inline: 1.5rem;
}

@media (max-width: 26rem) {
  .mdt-wrap,
  .mdt-ad { padding-inline: 1rem; }
  .mdt-import-panel { padding: 1rem; }
}

/* tf:dark-palette — generated by migrate_chrome.py */
/* Neutrals inherit the shared chrome tokens so all tools share one
   ground; brand hues are kept and lightened, never inverted. */
[data-theme="dark"] {
  --mdt-surface: var(--tf-surface);
  --mdt-panel: var(--tf-surface);
  --mdt-line: var(--tf-rule);
  --mdt-text: var(--tf-ink);
  --mdt-muted: var(--tf-ink-soft);
  --mdt-bad: #da8581;
}
