/* Label Connect – plain CSS, no framework. */
:root {
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #d1d5db;
  --bg-soft: #f3f4f6;
  --accent: #2563eb;
  --danger: #b91c1c;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .button and other display rules must not show hidden elements */

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  line-height: 1.5;
}

a { color: var(--accent); }

.topbar { background: var(--ink); padding: 0.75rem 1rem; }
.topbar .brand { color: #fff; font-weight: 700; text-decoration: none; }

.container { max-width: 64rem; margin: 0 auto; padding: 1rem; }

.page-head, .page-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.page-foot { margin-top: 2rem; }

.muted { color: var(--muted); }
.notice { background: #ecfdf5; border: 1px solid #a7f3d0; padding: 0.5rem 0.75rem; border-radius: 4px; }
.errors { background: #fef2f2; border: 1px solid #fecaca; padding: 0.5rem 0.75rem; border-radius: 4px; }
.errors h2 { font-size: 1rem; margin: 0; }

.button {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.danger { color: var(--danger); border-color: var(--danger); }
.button:disabled { opacity: 0.5; cursor: not-allowed; }

.label-list { list-style: none; padding: 0; }
.label-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.label-name { font-weight: 600; }

.editor { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 56rem) { .editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.field { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 1rem; }
.field-row { display: flex; gap: 1rem; }
.field input, .field textarea, .field select { font: inherit; padding: 0.4rem; border: 1px solid var(--line); border-radius: 4px; }

.preview h2 { margin-top: 0; }
.preview-actual, .preview-zoom { overflow-x: auto; padding: 0.5rem; background: var(--bg-soft); margin-bottom: 1rem; }
.preview canvas { display: block; outline: 1px solid var(--line); }
.preview-zoom canvas { image-rendering: pixelated; }

.details dt { font-weight: 600; }
.details dd { margin: 0 0 0.75rem; }
.pre { white-space: pre-wrap; }

.topbar { display: flex; align-items: center; gap: 1.5rem; }
.nav { display: flex; gap: 1rem; }
.nav a { color: #e5e7eb; text-decoration: none; }
.nav a:hover { color: #fff; text-decoration: underline; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.field-row.wrap { flex-wrap: wrap; }
.field-error { color: var(--danger); margin: 0; }
.check { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 1rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }

.panel { border: 1px solid var(--line); border-radius: 4px; padding: 0 1rem 1rem; margin-bottom: 1rem; }
.panel h2 { font-size: 1.1rem; }
.diagnostics .field textarea { width: 100%; }
.log { width: 100%; padding: 0.5rem; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-soft); white-space: pre; }
.panel > .actions { margin-bottom: 1rem; }

/* Tape settings, usage counters and printing (editor and batch print). */
.tape-panel { border: 1px solid var(--line); border-radius: 4px; padding: 0.5rem 1rem 0; margin: 0 0 1rem; }
.tape-panel legend { font-weight: 600; padding: 0 0.25rem; }
.tape-panel .field input { width: 8rem; }
.usage { font-size: 1.15rem; font-weight: 600; margin: 0.5rem 0 0; }
.legend { display: flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.85rem; }
.swatch { display: inline-block; width: 1rem; height: 0.75rem; border: 1px solid var(--line); }
.swatch.margin { background: rgba(37, 99, 235, 0.18); }
.swatch.cut { border: 0; border-left: 2px dashed #dc2626; width: 0.5rem; margin-left: 0.6rem; }
.preview > .actions { margin: 1rem 0; }
.printer-controls { border-top: 1px solid var(--line); margin-top: 1rem; }
.print-message { min-height: 1.5em; }
.print-message.ok { color: #047857; }
.print-message.error { color: var(--danger); }
.printer-controls .log { max-height: 16rem; overflow: auto; }
.label-list li { align-items: center; }
.label-list .label-name { flex: 1; }
.label-list .check { margin: 0; }
.copies { display: flex; align-items: center; gap: 0.3rem; font-size: 0.9rem; }
.copies input { width: 4rem; font: inherit; padding: 0.2rem; border: 1px solid var(--line); border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.calibration ol { padding-left: 1.25rem; }
