/* CSV ↔ JSON — leans on ../css/protium-ui.css tokens. Layout classes mirror calculators. */

.page { flex: 1; min-height: 0; padding: 24px 32px; overflow: hidden; }
.layout {
  height: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 28px;
  align-items: stretch;
}

/* Sidebar */
.sidebar { height: 100%; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; }
.side-section { font-size: 12.5px; font-weight: 700; color: var(--text); padding: 12px 8px 6px; margin-top: 8px; border-top: 1px solid var(--border-faint); text-transform: uppercase; letter-spacing: 0.03em; }
.side-section:first-child { margin-top: 0; border-top: 0; padding-top: 2px; }
.side-group { margin-bottom: 12px; }
.side-label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); padding: 4px 8px; margin-bottom: 2px; }
.side-item { display: block; width: 100%; text-align: left; font: inherit; font-size: 13.5px; color: var(--text-muted); background: transparent; border: 0; border-radius: var(--r-sm); padding: 8px 10px; cursor: pointer; transition: background var(--t), color var(--t); }
.side-item:hover { background: var(--surface-2); color: var(--text); }
.side-item.is-active { background: var(--accent-soft); color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }

/* Content */
.content { min-width: 0; height: 100%; overflow-y: auto; }
.tool-head { margin-bottom: 18px; }
.tool-head h1 { font-family: var(--font-display); font-size: 27px; letter-spacing: -0.01em; margin-bottom: 5px; }
.tool-head p { color: var(--text-muted); font-size: 15px; }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 22px 24px; }
.card + .card { margin-top: 16px; }
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; }

/* Two-pane editor grid for converters */
.io-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
.io-pane { display: flex; flex-direction: column; min-width: 0; }
.io-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 10px; }
.io-head .io-title { font-size: 13px; font-weight: 600; color: var(--text); }
.io-head .io-meta { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); }

.ta {
  width: 100%; box-sizing: border-box; resize: vertical;
  min-height: 320px; height: 320px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.55;
  color: var(--text); background: var(--field);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 12px 14px; tab-size: 2; white-space: pre;
}
.ta:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.ta.is-out { background: var(--surface-2); }

/* Field rows */
.field { display: block; }
.field > span { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.field select, .field input { color-scheme: dark; }
html.theme-light .field select, html.theme-light .field input { color-scheme: light; }

.opts { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 20px; margin-bottom: 16px; }
.opts .field { min-width: 0; }
.opts .field select { min-width: 150px; }

.chk { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); cursor: pointer; user-select: none; }
.chk input { width: 15px; height: 15px; margin: 0; }

.row-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }

/* Inline error / status */
.err { display: none; margin-top: 12px; font-size: 13px; color: var(--bad, #ef4444); background: color-mix(in srgb, var(--bad, #ef4444) 12%, transparent); border: 1px solid color-mix(in srgb, var(--bad, #ef4444) 35%, transparent); border-radius: var(--r-md); padding: 10px 12px; font-family: var(--font-mono); white-space: pre-wrap; }
.err.show { display: block; }
.note { color: var(--text-muted); font-size: 13px; margin-top: 14px; }
.note b { color: var(--text); }

/* Table viewer */
.tv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.tv-count { font-size: 13px; font-family: var(--font-mono); color: var(--accent); font-weight: 600; }
.tv-spacer { flex: 1; }

.tbl-wrap { max-height: 460px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--field); }
.tbl-wrap:empty { display: none; }
table.tv {
  border-collapse: collapse; width: 100%; font-size: 13px; font-family: var(--font-mono);
}
table.tv th, table.tv td {
  padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--border-faint);
  border-right: 1px solid var(--border-faint); white-space: nowrap; max-width: 360px;
  overflow: hidden; text-overflow: ellipsis;
}
table.tv th:last-child, table.tv td:last-child { border-right: 0; }
table.tv thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--text); font-weight: 600;
  border-bottom: 1px solid var(--border);
}
table.tv thead th .col-i { color: var(--text-faint); font-weight: 400; margin-right: 6px; }
table.tv tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
table.tv tbody tr:hover td { background: var(--accent-soft); }
table.tv td.rownum, table.tv th.rownum { color: var(--text-faint); text-align: right; background: var(--surface-2); position: sticky; left: 0; }

.tv-empty { color: var(--text-faint); font-size: 13.5px; padding: 20px 2px; }

@media (max-width: 860px) {
  .page { padding: 16px; }
  .layout { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .content, .sidebar { height: auto; }
  .io-grid { grid-template-columns: 1fr; }
}
