@font-face {
  font-family: "DejaVu Sans";
  src: url("/fonts/DejaVuSans.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DejaVu Sans";
  src: url("/fonts/DejaVuSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DejaVu Serif";
  src: url("/fonts/DejaVuSerif.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DejaVu Serif";
  src: url("/fonts/DejaVuSerif-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DejaVu Sans Mono";
  src: url("/fonts/DejaVuSansMono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DejaVu Sans Mono";
  src: url("/fonts/DejaVuSansMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f4f6f9;
  --ink: #141f29;
  --muted: #5d7183;
  --accent: #176997;
  --accent-strong: #0f567e;
  --accent-soft: #e8f2f9;
  --line: #e2e8ef;
  --card: #ffffff;
  --radius: 16px;
  --radius-small: 10px;
  --shadow-card: 0 1px 2px rgba(16, 42, 67, .04), 0 10px 32px -12px rgba(16, 42, 67, .10);
  --font-ui: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select, summary { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 0 max(28px, calc((100vw - 1140px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  text-decoration: none;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.4px;
  display: flex;
  align-items: center;
  color: var(--ink);
}
.brand-domain {
  font-weight: 600;
  color: var(--muted);
  margin-left: 1px;
}
.brand-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-right: 10px;
}
.badge, .tiny-badge {
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
  color: var(--muted);
  background: #fff;
}
.tiny-badge { font-size: 10px; padding: 4px 9px; background: var(--bg); }

main {
  max-width: 1196px;
  margin: auto;
  padding: 28px 28px 48px;
}

/* ---------- Tabs ---------- */
.tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 22px;
  background: #e8edf2;
  border-radius: 12px;
  padding: 4px;
}
.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  transition: color .15s, background .15s, box-shadow .15s;
}
.menu-intro { margin: 0 0 18px; }
.menu-intro .eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.menu-intro h1 { margin: 0; font-size: clamp(25px, 3vw, 32px); line-height: 1.2; letter-spacing: -.7px; }
.menu-intro > p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.tabs a {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; padding: 9px 16px; color: var(--muted);
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: color .15s, background .15s, box-shadow .15s;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active, .tabs a[aria-current="page"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16, 42, 67, .12); }
.tabs button:hover { color: var(--ink); }
.tabs button.active,
.tabs button[aria-selected="true"] {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16, 42, 67, .12);
}

/* ---------- Layout & Cards ---------- */
.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-card);
}
.preview-card { position: sticky; top: 86px; }
.section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -.2px;
}
.section-heading > .text-button,
.section-heading > .tiny-badge { margin-left: auto; }

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #33465a;
  margin: 16px 0 6px;
}
label:first-child { margin-top: 0; }
textarea, input[type=text], input[type=number], select {
  width: 100%;
  border: 1px solid #d5dde5;
  background: #fff;
  border-radius: var(--radius-small);
  color: var(--ink);
  padding: 11px 12px;
  transition: border-color .15s, box-shadow .15s;
}
select { appearance: auto; }
textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  min-height: 100px;
}
#freetext { font-family: var(--font-ui); font-size: 14px; }
#freetext::placeholder { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; }
textarea:focus, input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 105, 151, .14);
  outline: none;
}
.scan-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
}
.design-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  margin-top: 16px;
}
.design-row .field { flex: 1; min-width: 130px; margin: 0; }
.design-row .field select { margin-top: 6px; }
.text-tools { display: flex; align-items: center; justify-content: flex-end; margin-top: 6px; }
.character-count { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.editor-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.editor-controls .field, .editor-controls .range-field { margin: 0; min-width: 0; }
.editor-controls .field select { margin-top: 6px; padding: 9px 10px; }
.range-field { display: block; font-size: 11px; font-weight: 600; color: #33465a; }
.range-field output { float: right; color: var(--accent); font-variant-numeric: tabular-nums; }
.range-control { display: grid; grid-template-columns: minmax(0, 1fr) 70px; align-items: center; gap: 10px; margin-top: 8px; }
.range-control input[type=range] { display: block; width: 100%; margin: 0; accent-color: var(--accent); }
.range-control input[type=number], .range-control input[type=text] { width: 70px; padding: 6px 8px; text-align: center; font-variant-numeric: tabular-nums; }
.editor-check { grid-column: 1 / -1; margin: 0; }
.code-editor { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.code-toggle-button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  color: var(--ink);
  text-align: left;
  background: #f8fafc;
  border: 1px solid #d5dde5;
  border-radius: 11px;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.code-toggle-button:hover { border-color: var(--accent); background: #f2f8fc; }
.code-toggle-button.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(23, 105, 151, .08); }
.code-toggle-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 9px; color: var(--accent-strong); background: #fff; font-size: 25px; line-height: 1; }
.code-toggle-copy { display: grid; gap: 2px; flex: 1; }
.code-toggle-copy strong { font-size: 13px; }
.code-toggle-copy small { color: var(--muted); font-size: 11px; }
.code-toggle-state { padding: 5px 9px; border-radius: 999px; color: var(--muted); background: #fff; font-size: 10px; font-weight: 700; white-space: nowrap; }
.code-toggle-button.active .code-toggle-state { color: #fff; background: var(--accent-strong); }
.code-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.code-options > label:first-child { grid-column: 1 / -1; }
.code-options input, .code-options select { margin-top: 6px; }
.code-editor > .hint { margin-bottom: 0; }
.check.compact { margin: 0 0 11px; white-space: nowrap; }
.date-row {
  display: flex;
  gap: 10px;
}
.date-row input { flex: 1; }
.post-date-card {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid #dce7ef;
  border-radius: 16px;
  background: linear-gradient(145deg, #f8fbfd, #f0f6fa);
}
.post-date-heading { display: flex; align-items: center; gap: 13px; }
.post-date-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid #d7e6f0;
  border-radius: 13px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 23px;
}
.post-date-heading h3 { margin: 0; font-size: 14px; line-height: 1.35; }
.post-date-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.post-date-card > label { margin-top: 19px; }
#post-date {
  display: block;
  width: 100%;
  min-height: 62px;
  padding: 10px 14px;
  border: 1px solid #cbd9e3;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  box-shadow: 0 2px 5px rgba(16, 42, 67, .04);
  color-scheme: light;
}
#post-date:hover { border-color: #9cb7ca; }
#post-date::-webkit-calendar-picker-indicator {
  width: 24px;
  height: 24px;
  padding: 5px;
  border-radius: 7px;
  cursor: pointer;
  opacity: .72;
}
#post-date::-webkit-calendar-picker-indicator:hover { background: var(--accent-soft); opacity: 1; }
.post-date-shortcuts { display: flex; gap: 8px; margin-top: 11px; }
.date-chip {
  padding: 7px 13px;
  border: 1px solid #d5e2eb;
  border-radius: 999px;
  background: #fff;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 650;
  transition: background .15s, border-color .15s, transform .05s;
}
.date-chip:hover { border-color: #9bb9cc; background: #f8fcff; }
.date-chip:active { transform: translateY(1px); }
.case-input-wrap {
  display: flex;
  align-items: center;
  min-height: 58px;
  overflow: hidden;
  border: 1px solid #cbd9e3;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(16, 42, 67, .04);
}
.case-input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23, 105, 151, .14); }
.case-input-wrap > span {
  padding-left: 15px;
  color: var(--accent-strong);
  font-family: ui-monospace, "DejaVu Sans Mono", monospace;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: .03em;
}
.case-input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  padding: 10px 14px 10px 8px;
  font-family: ui-monospace, "DejaVu Sans Mono", monospace;
  font-size: 25px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: .1em;
}
.case-input-wrap input:focus { outline: 0; box-shadow: none; }
.case-input-wrap input::placeholder { color: #b7c4ce; }
.case-input-large { max-width: 360px; min-height: 72px; }
.case-input-large > span { padding-left: 19px; font-size: 27px; }
.case-input-large input { font-size: 34px; }
.case-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.jira-entry-card { min-height: 240px; }
.jira-icon { font-family: ui-monospace, "DejaVu Sans Mono", monospace; font-size: 15px; font-weight: 800; }
.hint {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: 10px 0 0;
}
.button {
  border: 0;
  border-radius: var(--radius-small);
  background: linear-gradient(180deg, #1b78ab, var(--accent-strong));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 20px;
  display: inline-flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
  box-shadow: 0 1px 2px rgba(15, 86, 126, .3);
  transition: filter .15s, transform .05s;
}
.button:hover:not(:disabled) { filter: brightness(1.07); }
.button:active:not(:disabled) { transform: translateY(1px); }
.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid #d5dde5;
  border-radius: var(--radius-small);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  transition: border-color .15s, color .15s;
}
.secondary:hover { border-color: var(--accent); color: var(--accent); }
.text-button {
  border: 0;
  background: none;
  font-size: 12px;
  padding: 4px 0;
  color: var(--accent);
  font-weight: 600;
}
.text-button:hover:not(:disabled) { color: var(--accent-strong); text-decoration: underline; }
.status {
  font-size: 12px;
  line-height: 1.6;
  margin-top: 18px;
  padding: 11px 13px;
  background: var(--accent-soft);
  color: #1d5a7e;
  border-radius: var(--radius-small);
}
.status.error { color: #933024; background: #fdefec; }
.metadata {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  padding: 16px;
  margin: 18px 0 4px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
}
dt { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 3px; }
dd { margin: 0; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.optional { font-weight: 400; color: var(--muted); font-size: 11px; margin-left: 4px; }
.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12px;
  line-height: 1.6;
  font-weight: 400;
  color: var(--ink);
  margin: 14px 0;
}
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin-top: 2px; flex-shrink: 0; }
.verify-button {
  width: 100%;
  margin: 14px 0 4px;
  border: 1px solid #d5dde5;
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius-small);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background .15s, border-color .15s, color .15s;
}
.verify-button::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 1.5px solid #9fb2c2;
  border-radius: 5px;
  background: #fff;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  line-height: 1;
  color: #fff;
  transition: background .15s, border-color .15s;
}
.verify-button:hover { border-color: var(--accent); }
.verify-button:hover::before { border-color: var(--accent); }
.verify-button[aria-pressed="true"],
.verify-button.active {
  background: #e9f7f0;
  border-color: #27835c;
  color: #1c6847;
}
.verify-button[aria-pressed="true"]::before,
.verify-button.active::before {
  content: "✓";
  background: #27835c;
  border-color: #27835c;
}
.warning {
  font-size: 12px;
  line-height: 1.6;
  color: #8a4d15;
  background: #fdf5e7;
  border: 1px solid #f3e3c4;
  border-radius: var(--radius-small);
  padding: 10px 12px;
}
details {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 14px;
}
summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color .15s;
}
summary::-webkit-details-marker { display: none; }
summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .15s;
  flex-shrink: 0;
}
details[open] summary::before { transform: rotate(45deg); }
summary:hover { color: var(--ink); }
details[open] summary { margin-bottom: 14px; }

/* ---------- Preview ---------- */
.preview-stage {
  min-height: 250px;
  background:
    radial-gradient(circle, #cfdae3 1px, transparent 1px) 0 0 / 18px 18px,
    #f6f8fa;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  margin-bottom: 18px;
}
#empty-preview { text-align: center; color: #8ba0b1; }
#empty-preview strong { font-size: 13px; font-weight: 500; }
.empty-symbol { font-size: 30px; color: #a7bac9; margin-bottom: 12px; }
#label {
  width: 100%;
  max-width: 440px;
  height: auto;
  box-shadow: 0 2px 4px rgba(16, 42, 67, .10), 0 14px 30px -10px rgba(16, 42, 67, .22);
  border-radius: 4px;
  image-rendering: pixelated;
}
#label[hidden] { display: none; }

.print-row {
  display: flex;
  align-items: end;
  gap: 12px;
}
.copies { width: 78px; font-size: 11px; color: var(--muted); margin: 0; }
.copies input { margin-top: 6px; background: #fff; height: 44px; text-align: center; }
.print-button { flex: 1; height: 44px; }
.dymo-status {
  margin: 12px 0 0;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.dymo-status.ok { color: #1c6847; }
.dymo-status.ok::before { content: "●"; font-size: 8px; vertical-align: 2px; margin-right: 5px; }
.fallback-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 12px;
}

.pdf-print-frame {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 850px) {
  .topbar { padding: 0 18px; }
  .badge { display: none; }
  main { padding: 18px 16px 32px; }
  .tabs { display: flex; }
  .tabs a { flex: 1; padding: 9px 10px; }
  .workspace { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  .preview-card { position: static; }
  .preview-stage { min-height: 200px; }
}
@media (max-width: 420px) {
  .editor-controls { grid-template-columns: 1fr; }
  .editor-check { grid-column: auto; }
  .code-options { grid-template-columns: 1fr; }
  .code-options > label:first-child { grid-column: auto; }
}

/* ---------- Print ---------- */
@media print {
  @page { size: 25mm 54mm; margin: 0; }
  html, body { width: 25mm; height: 54mm; margin: 0 !important; padding: 0 !important; background: #fff; }
  body * { visibility: hidden; }
  #label {
    visibility: visible !important;
    display: block !important;
    position: absolute;
    left: 0; top: 0;
    width: 54mm !important;
    max-width: none !important;
    height: 25mm !important;
    border-radius: 0;
    box-shadow: none;
    transform-origin: 0 0;
    transform: translateY(54mm) rotate(-90deg);
  }
  main, .workspace, .card, .preview-stage { display: contents !important; }
  .topbar, .tabs, .input-card, .preview-card > :not(.preview-stage), .preview-stage > :not(canvas), .pdf-print-frame {
    display: none !important;
  }
}
