/*
  Label Maker. Loaded after the PDF tools' stylesheet (../pdf_tools/app.css),
  whose cards, steps, segmented switch and checkbox rows it shares. Plain CSS,
  not built by Tailwind; colours come from the site's theme tokens, except the
  sheet itself, which stays white like paper in dark mode too.
*/

.lm-app {
  --pdft-line: var(--color-base-300);
  --pdft-accent: var(--color-primary);
}
.lm-app [hidden] { display: none !important; }
.lm-loading { padding: 3rem 1rem; text-align: center; color: var(--muted); }

.lm { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
/* On phones the sheet and its download button come first; the settings follow. */
@media (max-width: 59.99rem) { .lm-view { order: -1; } }
@media (min-width: 60rem) {
  .lm { grid-template-columns: minmax(20rem, 25rem) minmax(0, 1fr); }
  .lm-view { position: sticky; top: 5.5rem; }
}

.lm-panel {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--pdft-line);
  border-radius: 0.875rem;
  background: var(--color-base-100);
}
@media (min-width: 40rem) { .lm-panel { padding: 1.25rem; } }

.lm-form { display: flex; flex-direction: column; gap: 1.1rem; }
.lm-head { display: flex; align-items: center; gap: 0.6rem; }
.lm-title { font-size: 1.0625rem; font-weight: 650; }
.lm-reset { margin-left: auto; }

.lm-section { display: flex; flex-direction: column; gap: 0.85rem; min-width: 0; margin: 0; padding: 1rem 0 0; border: 0; border-top: 1px solid var(--pdft-line); }
.lm-section-title { float: left; width: 100%; padding: 0; font-size: 0.9375rem; font-weight: 650; }
.lm-section-title + * { clear: both; }

.lm-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.lm-label { font-size: 0.875rem; font-weight: 600; }
.lm-hint { font-size: 0.8125rem; line-height: 1.45; color: var(--muted); }
.lm-hint:empty { display: none; }
.lm-check { align-items: center; font-size: 0.875rem; }
.lm-check input { margin-top: 0; }
.lm-number { width: 6.5rem; }
.lm-seg span { display: flex; align-items: center; justify-content: center; padding-inline: 0.5rem; white-space: nowrap; }
.lm-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; align-items: start; }
.lm-buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.lm-custom, .lm-code { display: flex; flex-direction: column; gap: 0.75rem; }

.lm-drop { position: relative; }
.lm-data { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.78rem; line-height: 1.45; tab-size: 12; min-height: 9rem; resize: vertical; }
.lm-drop-hint { display: none; }
.lm-drop.is-over .lm-data { outline: 2px dashed var(--pdft-accent); outline-offset: 2px; }
.lm-drop.is-over .lm-drop-hint {
  display: grid; position: absolute; inset: 0; place-items: center; border-radius: 0.5rem;
  background: color-mix(in oklab, var(--color-base-100) 85%, transparent); font-weight: 600; pointer-events: none;
}
.lm-template { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; line-height: 1.5; resize: vertical; }

.lm-table-wrap { max-height: 12rem; overflow: auto; border: 1px solid var(--pdft-line); border-radius: 0.5rem; }
.lm-table-wrap:focus-visible { outline: 2px solid var(--pdft-accent); outline-offset: 2px; }
.lm-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; line-height: 1.35; }
.lm-table th, .lm-table td { padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--pdft-line); text-align: left; white-space: nowrap; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.lm-table thead th { position: sticky; top: 0; background: var(--color-base-200); font-weight: 650; }
.lm-col-letter { color: var(--muted); font-weight: 500; }
.lm-rownum { color: var(--muted); font-weight: 500; width: 1%; }
.lm-more { color: var(--muted); font-style: italic; }

.lm-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.lm-chips:empty { display: none; }
.lm-chip {
  padding: 0.2rem 0.6rem; border: 1px solid var(--pdft-line); border-radius: 999px;
  background: var(--color-base-200); font-size: 0.8125rem; cursor: pointer;
}
.lm-chip::before { content: "+ "; color: var(--muted); }
.lm-chip:hover { border-color: var(--color-base-content); }
.lm-chip:focus-visible { outline: 2px solid var(--pdft-accent); outline-offset: 1px; }

.lm-warn { font-size: 0.8125rem; color: var(--color-warning-content, inherit); background: color-mix(in oklab, var(--color-warning) 22%, transparent); padding: 0.45rem 0.6rem; border-radius: 0.4rem; }
.lm-error { font-size: 0.875rem; color: var(--color-error); }

/* ---- Preview ---- */

.lm-view { display: flex; flex-direction: column; gap: 0.8rem; min-width: 0; }
.lm-stage {
  display: flex;
  justify-content: center;
  padding: clamp(0.75rem, 3.5vw, 2rem);
  border-radius: 0.875rem;
  background: color-mix(in oklab, var(--color-base-content) 7%, var(--color-base-200));
}
/* app.js sets the width and aspect ratio for the sheet. */
.lm-sheet {
  width: 100%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 10px 28px rgb(0 0 0 / 0.14);
}
.lm-sheet svg { display: block; width: 100%; height: 100%; }
.lm-sheet-error { padding: 2rem 1.25rem; text-align: center; }
.lm-svg-label { fill: none; stroke: #c3c9d3; stroke-width: 0.6; }
.lm-svg-warn { stroke: #d97706; stroke-width: 1.4; }
.lm-hit { fill: transparent; cursor: pointer; }
.lm-hit:hover { fill: rgb(37 99 235 / 0.08); stroke: rgb(37 99 235 / 0.6); stroke-width: 1; }

.lm-pager { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.lm-page { min-width: 7rem; text-align: center; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.lm-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.lm-download { min-width: 11rem; }
.lm-info { font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.lm-status { font-size: 0.875rem; }
.lm-status:empty, .lm-problems:empty { display: none; }
.lm-problems { display: flex; flex-direction: column; gap: 0.35rem; padding: 0.6rem 0.75rem 0.6rem 1.9rem; list-style: disc; border-radius: 0.5rem; background: color-mix(in oklab, var(--color-warning) 16%, transparent); font-size: 0.8125rem; line-height: 1.45; }
.lm-tip { font-size: 0.8125rem; color: var(--muted); }

/* ---- Page sections ---- */

.lm-sheets { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); align-items: start; }
.lm-sheet-table { overflow-x: auto; }
.lm-sheet-table caption { padding-bottom: 0.4rem; text-align: left; font-weight: 650; }
.lm-sheet-table th[scope="row"] { white-space: nowrap; font-weight: 600; }
.lm-sheet-table td { font-size: 0.875rem; }
.lm-index { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.lm-details summary { cursor: pointer; }
