/* OpenZPL visual system on top of Bootstrap 5.3 (served locally from
   static/vendor, like the sibling projects). Only tokens and the components
   Bootstrap doesn't have live here: the code editor, the label preview and the
   dashboard shell. */

:root {
  --oz-blue: #1e5eff;
  --oz-blue-dark: #1748c9;
  --oz-blue-soft: #e8efff;
  --oz-ink: #0f172a;
  --oz-text: #334155;
  --oz-muted: #64748b;
  --oz-line: #e2e8f0;
  --oz-surface: #f8fafc;
  --oz-code-cmd: #1d4ed8;
  --oz-code-data: #15803d;
  --oz-code-comment: #94a3b8;
  --oz-warn-bg: #fff8e6;
  --oz-warn-line: #f5d27a;

  --bs-primary: var(--oz-blue);
  --bs-primary-rgb: 30, 94, 255;
  --bs-link-color: var(--oz-blue);
  --bs-link-color-rgb: 30, 94, 255;
  --bs-link-hover-color: var(--oz-blue-dark);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-color: var(--oz-text);
  --bs-emphasis-color: var(--oz-ink);
  --bs-border-color: var(--oz-line);
  --bs-border-radius: .5rem;
  --bs-border-radius-lg: .75rem;
  --oz-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

body { background: #fff; }
h1, h2, h3, h4, h5, .h1, .h2, .h3, .h4, .h5 { color: var(--oz-ink); font-weight: 700; letter-spacing: -.01em; }
code, pre, .font-mono { font-family: var(--oz-mono); }
:focus-visible { outline: 3px solid rgba(30, 94, 255, .45); outline-offset: 2px; }

.btn-primary {
  --bs-btn-bg: var(--oz-blue); --bs-btn-border-color: var(--oz-blue);
  --bs-btn-hover-bg: var(--oz-blue-dark); --bs-btn-hover-border-color: var(--oz-blue-dark);
  --bs-btn-active-bg: var(--oz-blue-dark); --bs-btn-active-border-color: var(--oz-blue-dark);
  --bs-btn-disabled-bg: var(--oz-blue); --bs-btn-disabled-border-color: var(--oz-blue);
  font-weight: 600;
}
.btn-outline-primary {
  --bs-btn-color: var(--oz-blue); --bs-btn-border-color: var(--oz-blue);
  --bs-btn-hover-bg: var(--oz-blue); --bs-btn-hover-border-color: var(--oz-blue);
  --bs-btn-active-bg: var(--oz-blue-dark);
  font-weight: 600;
}
.btn-light-outline {
  --bs-btn-color: var(--oz-ink); --bs-btn-bg: #fff; --bs-btn-border-color: var(--oz-line);
  --bs-btn-hover-bg: var(--oz-surface); --bs-btn-hover-border-color: #cbd5e1; --bs-btn-hover-color: var(--oz-ink);
  --bs-btn-active-bg: #eef2f7; --bs-btn-active-border-color: #cbd5e1;
  font-weight: 500;
}
.form-control, .form-select { border-color: var(--oz-line); }
.form-control:focus, .form-select:focus { border-color: #9db8ff; box-shadow: 0 0 0 .2rem rgba(30, 94, 255, .15); }
.form-check-input:checked { background-color: var(--oz-blue); border-color: var(--oz-blue); }

/* ── Header and footer ───────────────────────────────────────────────── */
.oz-header { border-bottom: 1px solid var(--oz-line); background: #fff; }
.oz-header .navbar { min-height: 64px; }
.oz-brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 800; font-size: 1.35rem; color: var(--oz-ink); text-decoration: none; letter-spacing: -.02em; }
.oz-brand img { width: 30px; height: 30px; }
.oz-header .nav-link { color: var(--oz-ink); font-weight: 500; }
.oz-header .nav-link:hover, .oz-header .nav-link.active { color: var(--oz-blue); }
.oz-header .dropdown-menu { border-color: var(--oz-line); box-shadow: 0 10px 30px rgba(15, 23, 42, .08); }
.oz-footer { border-top: 1px solid var(--oz-line); color: var(--oz-muted); font-size: .9rem; }
.oz-footer a { color: var(--oz-text); text-decoration: none; }
.oz-footer a:hover { color: var(--oz-blue); text-decoration: underline; }

/* ── Home hero ───────────────────────────────────────────────────────── */
.oz-hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.2rem); font-weight: 800; letter-spacing: -.03em; }
.oz-hero .text-accent { color: var(--oz-blue); }
.oz-hero .lead { color: var(--oz-text); font-size: 1.25rem; }

/* ── Viewer shell ────────────────────────────────────────────────────── */
.oz-viewer { border: 1px solid var(--oz-line); border-radius: var(--bs-border-radius-lg); background: #fff; overflow: hidden; }
.oz-viewer__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .75rem 1rem; border-bottom: 1px solid var(--oz-line); }
.oz-viewer__settings { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .6rem 1rem; border-bottom: 1px solid var(--oz-line); background: var(--oz-surface); font-size: .9rem; }
.oz-viewer__settings label { color: var(--oz-muted); margin: 0; }
.oz-viewer__settings .form-control, .oz-viewer__settings .form-select { width: auto; font-size: .9rem; }
.oz-viewer__settings .oz-num { width: 5rem; }
.oz-viewer__divider { width: 1px; align-self: stretch; background: var(--oz-line); }
/* Fixed-height panes: the editor and the preview scroll inside, the page doesn't grow with the label. */
.oz-viewer__toolbar .form-select { width: auto; }
.oz-viewer__panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: 600px; }
.oz-viewer__panes > * { min-height: 0; overflow: hidden; }
.oz-viewer--full .oz-viewer__panes { height: max(520px, calc(100vh - 360px)); }
.oz-viewer__footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .65rem 1rem; border-top: 1px solid var(--oz-line); font-size: .9rem; color: var(--oz-muted); }
.oz-filename { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; color: var(--oz-ink); padding-right: .75rem; margin-right: .25rem; border-right: 1px solid var(--oz-line); }

/* Code editor: a transparent textarea over a highlighted <pre>, same metrics. */
.oz-editor { position: relative; display: flex; border-right: 1px solid var(--oz-line); min-height: 0; background: #fff; }
.oz-editor__gutter { flex: 0 0 auto; padding: .75rem .6rem .75rem .9rem; text-align: right; color: #94a3b8; user-select: none; font: 400 .875rem/1.6 var(--oz-mono); white-space: pre; overflow: hidden; background: #fff; }
.oz-editor__gutter .is-current { color: var(--oz-ink); font-weight: 600; }
.oz-editor__body { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; }
.oz-editor__highlight, .oz-editor__input {
  position: absolute; inset: 0; margin: 0; padding: .75rem 1rem .75rem .5rem; border: 0;
  font: 400 .875rem/1.6 var(--oz-mono); white-space: pre; overflow: auto; tab-size: 2;
}
.oz-editor__highlight { color: var(--oz-ink); pointer-events: none; }
.oz-editor__input { color: transparent; background: transparent; caret-color: var(--oz-ink); resize: none; outline: none; }
.oz-editor__input::selection { background: rgba(30, 94, 255, .2); color: transparent; }
.oz-editor__line { position: absolute; left: 0; right: 0; height: 1.6em; background: #eef4ff; font-size: .875rem; pointer-events: none; }
.oz-tok-cmd { color: var(--oz-code-cmd); }
.oz-tok-data { color: var(--oz-code-data); }
.oz-tok-comment { color: var(--oz-code-comment); font-style: italic; }
.oz-help { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: .75rem 1rem; border-top: 1px solid var(--oz-line); background: #fff; font-size: .9rem; }
.oz-help strong { color: var(--oz-ink); }
.oz-help p { margin: .15rem 0 0; color: var(--oz-muted); }
.oz-editor-col { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--oz-line); }
.oz-editor-col .oz-editor { flex: 1 1 auto; border-right: 0; }

/* Preview: the label sits on a dotted surface; the label image is never
   filtered or shadowed inside, because people compare it with what prints. */
.oz-preview { display: flex; flex-direction: column; min-height: 0; background: var(--oz-surface); }
.oz-preview__bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem 1rem; border-bottom: 1px solid var(--oz-line); background: #fff; }
.oz-preview__bar h2 { font-size: 1rem; margin: 0; }
.oz-preview__stage {
  position: relative; flex: 1 1 auto; overflow: auto; padding: 1.5rem; display: flex; align-items: flex-start; justify-content: center;
  background-color: #f6f8fb; background-image: radial-gradient(#d7dee8 1px, transparent 1px); background-size: 16px 16px;
}
.oz-label { background: #fff; border: 2px solid var(--oz-ink); border-radius: 6px; box-shadow: 0 6px 18px rgba(15, 23, 42, .08); transform-origin: top center; }
.oz-label img { display: block; width: 100%; height: auto; image-rendering: auto; }
.oz-label.is-empty { width: 320px; aspect-ratio: 2 / 3; border-style: dashed; border-color: #cbd5e1; box-shadow: none; }
.oz-preview__pager { display: flex; align-items: center; justify-content: center; gap: .75rem; padding: .5rem; font-size: .9rem; }
.oz-preview__error { position: absolute; left: 1.5rem; right: 1.5rem; top: 1.5rem; }
.oz-zoom-value { min-width: 3.5rem; text-align: center; font-size: .9rem; }
.oz-spinner { width: 1rem; height: 1rem; }

.oz-warnings { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .6rem 1rem; background: var(--oz-warn-bg); border: 1px solid var(--oz-warn-line); border-radius: var(--bs-border-radius); font-size: .9rem; color: var(--oz-ink); }
.oz-statusbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; font-size: .85rem; color: var(--oz-muted); }
.oz-dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: #16a34a; margin-right: .4rem; vertical-align: middle; }
.oz-dot.is-busy { background: #f59e0b; }
.oz-dot.is-error { background: #dc2626; }

/* API banner and tool links on the home page */
.oz-api-banner { background: var(--oz-blue-soft); border-radius: var(--bs-border-radius-lg); }
.oz-api-banner__icon { width: 3rem; height: 3rem; border-radius: .75rem; display: grid; place-items: center; background: #d6e2ff; color: var(--oz-blue); font-size: 1.4rem; }
.oz-endpoint { display: flex; align-items: center; gap: .75rem; background: #fff; border: 1px solid var(--oz-line); border-radius: var(--bs-border-radius); padding: .5rem .5rem .5rem .75rem; font-family: var(--oz-mono); font-size: .9rem; min-width: 0; }
.oz-endpoint code { color: var(--oz-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.oz-method { font: 600 .8rem var(--oz-mono); color: var(--oz-blue); background: var(--oz-blue-soft); border-radius: .35rem; padding: .2rem .45rem; }
.oz-tool-link { display: flex; gap: .85rem; text-decoration: none; color: var(--oz-text); }
.oz-tool-link i { font-size: 1.6rem; color: var(--oz-blue); }
.oz-tool-link strong { color: var(--oz-blue); font-size: 1.05rem; }
.oz-tool-link:hover strong { text-decoration: underline; }

/* Code samples in docs */
.oz-code { background: #0f172a; color: #e2e8f0; border-radius: var(--bs-border-radius); padding: 1rem 1.25rem; font-size: .875rem; line-height: 1.6; overflow-x: auto; }

/* ── Dashboard shell ─────────────────────────────────────────────────── */
.oz-app { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; background: #fff; }
.oz-sidebar { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem 1rem; border-right: 1px solid var(--oz-line); background: #fbfcfe; position: sticky; top: 0; height: 100vh; }
.oz-sidebar .nav-link { display: flex; align-items: center; gap: .75rem; padding: .6rem .8rem; border-radius: .5rem; color: var(--oz-ink); font-weight: 500; }
.oz-sidebar .nav-link i { font-size: 1.1rem; color: var(--oz-muted); }
.oz-sidebar .nav-link:hover { background: #f1f5f9; }
.oz-sidebar .nav-link.active { background: var(--oz-blue-soft); color: var(--oz-blue); }
.oz-sidebar .nav-link.active i { color: var(--oz-blue); }
.oz-sidebar__bottom { margin-top: auto; }
.oz-user { display: flex; align-items: center; gap: .75rem; padding: .5rem; border-top: 1px solid var(--oz-line); padding-top: 1rem; }
.oz-avatar { width: 2.5rem; height: 2.5rem; border-radius: 50%; display: grid; place-items: center; background: var(--oz-blue-soft); color: var(--oz-blue); font-weight: 700; }
.oz-main { padding: 1.5rem 2rem 3rem; min-width: 0; }
.oz-card { border: 1px solid var(--oz-line); border-radius: var(--bs-border-radius-lg); background: #fff; }
.oz-stat__icon { width: 3rem; height: 3rem; border-radius: .6rem; display: grid; place-items: center; font-size: 1.3rem; }
.oz-stat__value { font-size: 1.85rem; font-weight: 700; color: var(--oz-ink); line-height: 1.1; }
.oz-plan-badge { font: 700 .8rem var(--bs-body-font-family); letter-spacing: .02em; color: var(--oz-blue); background: var(--oz-blue-soft); border-radius: .4rem; padding: .45rem .8rem; }
.oz-usage .progress { height: .6rem; background: #eef2f7; }
.oz-usage .progress-bar { background: #f5b301; }
.oz-usage .progress-bar.is-low { background: var(--oz-blue); }
.oz-chart { display: grid; grid-template-columns: auto 1fr; gap: .5rem; height: 220px; }
.oz-chart__axis { display: flex; flex-direction: column; justify-content: space-between; font-size: .8rem; color: var(--oz-muted); text-align: right; padding-bottom: 1.6rem; }
.oz-chart__plot { display: flex; align-items: flex-end; gap: .6rem; border-left: 1px solid var(--oz-line); border-bottom: 1px solid var(--oz-line); padding: 0 .5rem; position: relative; }
.oz-chart__bar { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.oz-chart__bar span { display: block; width: 100%; max-width: 56px; background: var(--oz-blue); border-radius: 3px 3px 0 0; min-height: 2px; }
.oz-chart__bar small { position: absolute; bottom: -1.5rem; font-size: .8rem; color: var(--oz-muted); }
.oz-status { font: 600 .85rem var(--oz-mono); border-radius: .4rem; padding: .3rem .55rem; background: #fde8e8; color: #b42318; }
.oz-key { font-family: var(--oz-mono); font-size: .9rem; }
.oz-new-key { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--bs-border-radius); }
.table > :not(caption) > * > * { padding: .8rem 1rem; }
.table thead th { color: var(--oz-muted); font-weight: 500; font-size: .9rem; background: var(--oz-surface); }

@media (max-width: 991.98px) {
  .oz-viewer__panes, .oz-viewer--full .oz-viewer__panes { grid-template-columns: minmax(0, 1fr); grid-template-rows: 360px 460px; height: auto; }
  .oz-editor-col, .oz-editor { border-right: 0; border-bottom: 1px solid var(--oz-line); }
  .oz-editor-col { min-height: 360px; }
  .oz-preview { min-height: 420px; }
  .oz-app { grid-template-columns: minmax(0, 1fr); }
  .oz-sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--oz-line); }
  .oz-sidebar__bottom, .oz-user { display: none !important; }
  .oz-main { padding: 1.25rem 1rem 3rem; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
