/* ==========================================================================
   BalloonLab — application chrome
   Dark CAD-style shell so the white drawing sheet carries the eye.
   ========================================================================== */

:root {
  --bg: #0e1420;
  --bg-soft: #131b29;
  --panel: #151d2c;
  --panel-2: #1a2334;
  --line: #223049;
  --line-soft: #1b2637;
  --ink: #e8eefb;
  --ink-dim: #b3c2d8;
  --muted: #8497b3;
  --accent: #3b82f6;
  --accent-soft: #1d3a63;
  --accent-ink: #93c0ff;
  --ok: #34d399;
  --ok-dim: #4fbf95;
  --warn: #fbbf24;
  --bad: #f87171;
  --stage: #080c14;
  --radius: 8px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::selection {
  background: var(--accent-soft);
}

/* -------------------------------------------------------------- scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: #2b3a55 transparent;
}
*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
*::-webkit-scrollbar-thumb {
  background: #2b3a55;
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: #3c5075;
  background-clip: content-box;
}

/* ================================================================== layout */
/* Flex rather than a fixed row template: the notice banner is optional, and a
   grid with `1fr` on row 2 silently hands the banner the whole viewport when
   it appears. */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.app > .topbar {
  flex: 0 0 50px;
}

.app > .statusbar {
  flex: 0 0 28px;
}

.app > .body {
  flex: 1 1 auto;
  min-height: 0;
}

.body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  min-height: 0;
}

/* ================================================================== topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: linear-gradient(180deg, #16203300, #0e1420), var(--bg-soft);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-right: 4px;
  user-select: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(150deg, #4f8ef7, #1d4ed8);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 10px #1d4ed855, inset 0 1px 0 #ffffff30;
  flex: none;
}

.brand-mark svg {
  display: block;
}

.brand-name {
  font-weight: 650;
  letter-spacing: -0.2px;
  font-size: 14px;
}

.brand-name span {
  color: var(--accent-ink);
}

.file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #0f1726;
  border-radius: 999px;
  color: var(--ink-dim);
  max-width: 340px;
  min-width: 0;
}

.file-chip .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.file-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
  box-shadow: 0 0 0 3px #34d39922;
}

.spacer {
  flex: 1 1 auto;
}

/* Language picker: a native select so it inherits the OS menu, restyled to sit
   with the buttons instead of looking like a form control. */
.lang {
  height: 28px;
  max-width: 132px;
  padding: 0 22px 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background-color: #0f1726;
  color: var(--ink-dim);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #8296b4 50%),
    linear-gradient(135deg, #8296b4 50%, transparent 50%);
  background-position: calc(100% - 13px) 11px, calc(100% - 9px) 11px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
  transition: border-color 0.12s, color 0.12s;
}

.lang:hover {
  border-color: #33456a;
  color: var(--ink);
}

.lang:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #3b82f625;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #182133;
  color: var(--ink-dim);
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.btn:hover {
  background: #1e293e;
  border-color: #2d3f5e;
  color: var(--ink);
}

.btn:active {
  transform: translateY(0.5px);
}

.btn.primary {
  background: linear-gradient(180deg, #4b8cf7, #2f6fe0);
  border-color: #2f6fe0;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 0 #ffffff26 inset;
}

.btn.primary:hover {
  background: linear-gradient(180deg, #5a96f8, #3a78e8);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
}

.btn.ghost:hover {
  background: #1c2740;
}

.btn.danger {
  color: #fca5a5;
  border-color: #4a2430;
  background: #2a1620;
}

.btn.danger:hover {
  background: #3a1c28;
  color: #fecaca;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.btn.icon {
  width: 30px;
  padding: 0;
  justify-content: center;
}

.btn svg {
  display: block;
  flex: none;
}

/* ------------------------------------------------------------- export menu */
.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 268px;
  background: #131c2b;
  border: 1px solid #2a3a57;
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 18px 40px #00000066, 0 0 0 1px #ffffff08;
  z-index: 60;
}

.menu-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  padding: 8px 9px 5px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  background: transparent;
  border-radius: 7px;
  text-align: left;
  color: var(--ink-dim);
}

.menu-item:hover {
  background: #1d2b42;
  color: var(--ink);
}

.menu-item .mi-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: #1a2740;
  color: var(--accent-ink);
  flex: none;
}

.menu-item .mi-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.menu-item .mi-title {
  font-size: 12.5px;
  color: var(--ink);
}

.menu-item .mi-sub {
  font-size: 11px;
  color: var(--muted);
}

.menu-sep {
  height: 1px;
  background: var(--line-soft);
  margin: 5px 4px;
}

/* =================================================================== stage */
.stage {
  position: relative;
  overflow: hidden;
  background-color: var(--stage);
  background-image: radial-gradient(circle at center, #1b2637 1px, transparent 1px);
  background-size: 22px 22px;
  min-width: 0;
  cursor: default;
}

.stage.panning {
  cursor: grabbing;
}

.stage.adding {
  cursor: crosshair;
}

.stage.regioning {
  cursor: crosshair;
}

.page-stack {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
  line-height: 0;
}

.page-stack svg.sheet {
  display: block;
  background: #fff;
  box-shadow: 0 12px 40px #00000080, 0 0 0 1px #ffffff14;
  border-radius: 2px;
  user-select: none;
}

.sheet-bg {
  line-height: 0;
  pointer-events: none;
}

.anno-layer {
  position: absolute;
  top: 0;
  left: 0;
  line-height: 0;
}

.anno-layer > svg {
  display: block;
  overflow: visible;
}

.page-stack svg.sheet text {
  user-select: none;
}

.balloon {
  cursor: grab;
}

.balloon.dragging {
  cursor: grabbing;
}

.balloon .hit {
  fill: transparent;
}

.balloon .ring {
  fill: #fff;
  fill-opacity: 0.001;
  stroke: transparent;
}

.balloon.selected .ring {
  stroke: #ffd166;
  stroke-width: 2.2;
  stroke-dasharray: 5 3;
  fill-opacity: 0.001;
}

/* --------------------------------------------------------------- stage hud */
.stage-hud {
  position: absolute;
  left: 12px;
  top: 12px;
  display: flex;
  gap: 6px;
  z-index: 5;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  background: #101a2acc;
  border: 1px solid #24314a;
  color: var(--ink-dim);
  font-size: 11.5px;
  backdrop-filter: blur(8px);
}

.chip b {
  color: var(--ink);
  font-weight: 600;
}

.stage-tools {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #101a2ae6;
  border: 1px solid #24314a;
  box-shadow: 0 8px 24px #00000059;
  z-index: 5;
  backdrop-filter: blur(8px);
}

.tool {
  width: 30px;
  height: 28px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  color: var(--ink-dim);
  display: grid;
  place-items: center;
}

.tool:hover {
  background: #1e2b42;
  color: var(--ink);
}

.tool.on {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.tool-sep {
  height: 1px;
  background: #24314a;
  margin: 2px 4px;
}

/* ------------------------------------------------------------ empty state */
.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.dropzone {
  width: min(560px, 92%);
  border: 1.5px dashed #2d405f;
  border-radius: 16px;
  padding: 34px 30px 30px;
  text-align: center;
  background: radial-gradient(120% 100% at 50% 0%, #16203366, #0b111c00);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.dropzone.hot {
  border-color: var(--accent);
  background: radial-gradient(120% 100% at 50% 0%, #1c3a6666, #0b111c00);
  transform: scale(1.005);
}

.dropzone h1 {
  margin: 16px 0 6px;
  font-size: 19px;
  letter-spacing: -0.3px;
  font-weight: 650;
}

.dropzone p {
  margin: 0 auto;
  max-width: 420px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 12.5px;
}

.dropzone .actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
  flex-wrap: wrap;
}

.dropzone .fine {
  margin-top: 16px;
  font-size: 11px;
  color: #64789a;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

/* =================================================================== panel */
.panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  min-height: 0;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 8px 8px 0;
  border-bottom: 1px solid var(--line);
  background: #121a27;
}

.tab {
  flex: 1;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: 7px 7px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  position: relative;
}

.tab:hover {
  color: var(--ink-dim);
  background: #172233;
}

.tab.active {
  color: var(--ink);
  background: var(--panel);
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.panel-body {
  overflow: auto;
  min-height: 0;
}

.panel-foot {
  border-top: 1px solid var(--line);
  background: #121a27;
  padding: 8px;
}

/* ---------------------------------------------------------- list toolbar */
.list-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(180deg, var(--panel) 70%, #151d2c00);
}

/* ---------------------------------------------------- sheet roll-up strip */
.sheets {
  border-bottom: 1px solid var(--line-soft);
  background: #121a27;
}

.sheets-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  text-align: left;
}

.sheets-head:hover {
  background: #172233;
}

.sheets-head svg {
  color: #7f93b5;
  flex: none;
}

.sheets-head .sh-sum {
  font-size: 11.5px;
  font-weight: 600;
}

.sheets-head .sh-sub {
  flex: 1 1 auto;
  font-size: 10.5px;
  color: var(--warn);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheets-head .chev {
  font-size: 9px;
  color: var(--muted);
  transition: transform 0.15s;
  transform: rotate(-90deg);
}

.sheets-head .chev.open {
  transform: rotate(0deg);
}

.sheet-rows {
  display: flex;
  flex-direction: column;
  padding: 0 6px 6px;
  gap: 1px;
}

.sheet-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-dim);
  font-size: 11px;
  text-align: left;
}

.sheet-row:hover {
  background: #1a2437;
}

.sheet-row.cur {
  background: #1b2c47;
  border-color: #2f4c78;
  color: var(--ink);
}

.sheet-row.empty {
  color: #5e7292;
}

.sheet-row .sn {
  font-family: var(--mono);
  font-size: 10px;
  color: #8fa8c9;
}

.sheet-row .sr {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.sheet-row .sc {
  font-family: var(--mono);
  font-size: 11px;
  min-width: 18px;
  text-align: right;
}

.sheet-row .sl {
  font-size: 9.5px;
  font-weight: 700;
  color: #0f1726;
  background: var(--warn);
  border-radius: 999px;
  padding: 0 5px;
  line-height: 14px;
}

.sheet-warn {
  margin: 0 8px 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #2a1620;
  border: 1px solid #4a2430;
  color: #fca5a5;
  font-size: 10.5px;
  line-height: 1.45;
}

/* sheet / all segmented toggle */
.scope {
  display: flex;
  gap: 1px;
  background: #0f1726;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px;
  flex: none;
}

.scope button {
  height: 22px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 10.5px;
}

.scope button.on {
  background: #263a5a;
  color: #fff;
}

.scope button:hover:not(.on) {
  color: var(--ink-dim);
}

/* page tag shown when the list spans the whole drawing */
.ptag {
  font-family: var(--mono);
  font-size: 9px;
  padding: 0 4px;
  border-radius: 3px;
  background: #223049;
  color: #9fb0c8;
  flex: none;
}

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #0f1726;
  color: var(--muted);
  min-width: 0;
}

.search input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  min-width: 0;
  color: var(--ink);
}

.search input::placeholder {
  color: #5e7292;
}

/* --------------------------------------------------------------- rows */
.rows {
  padding: 0 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  background: transparent;
  width: 100%;
}

.row:hover {
  background: #1a2437;
}

.row.sel {
  background: #1b2c47;
  border-color: #2f4c78;
}

.row .bnum {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex: none;
}

.row .mid {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row .ch {
  font-size: 12.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row .meta {
  font-size: 10.5px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  flex: none;
}

.badge.dim {
  background: #17325a;
  color: #8fc0ff;
}
.badge.gdt {
  background: #2c1f4d;
  color: #c0a8ff;
}
.badge.thr {
  background: #3a2a12;
  color: #f3c078;
}
.badge.note {
  background: #242c3a;
  color: #9fb0c8;
}

.tol {
  font-family: var(--mono);
  font-size: 10.5px;
  color: #9db4d4;
}

.flag {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}

.flag.low {
  background: var(--warn);
  box-shadow: 0 0 0 3px #fbbf2422;
}

/* ---------------------------------------------------------- detail editor */
.detail {
  border-top: 1px solid var(--line);
  padding: 10px 12px 12px;
  background: #131c2b;
}

.detail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.detail-head .t {
  font-weight: 600;
  font-size: 12.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-raw {
  font-family: var(--mono);
  font-size: 11px;
  color: #93a8c6;
  background: #0e1624;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 9px;
  word-break: break-word;
  line-height: 1.45;
}

.detail-raw[data-verdict="pass"] {
  border-color: #1d5c47;
  color: #9fe0c6;
}

.detail-raw[data-verdict="fail"] {
  border-color: #6b2b34;
  color: #ffc9c9;
  background: #1e1116;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 7px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.field > label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.55px;
  color: var(--muted);
}

.input,
.select,
.textarea {
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #0f1726;
  padding: 0 8px;
  outline: none;
  width: 100%;
  min-width: 0;
  color: var(--ink);
  transition: border-color 0.12s, box-shadow 0.12s;
}

.textarea {
  height: auto;
  padding: 6px 8px;
  resize: vertical;
  min-height: 52px;
  line-height: 1.45;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #3b82f625;
}

.input.mono {
  font-family: var(--mono);
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #8296b4 50%),
    linear-gradient(135deg, #8296b4 50%, transparent 50%);
  background-position: calc(100% - 13px) 12px, calc(100% - 9px) 12px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  padding-right: 22px;
  cursor: pointer;
}

.row-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

/* ------------------------------------------------------------- form blocks */
.section {
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.section h3 {
  margin: 0 0 9px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  font-weight: 600;
}

/* Spacing between sibling rows of a section. Scoped to direct children: a
   `.field` sitting in a `.grid2` is a grid item, already spaced by the gap, and
   the extra margin on only the second column pushed its control out of line
   with the first (the Drawing / Report pair). */
.section > .grid2 + .grid2,
.section > .grid2 + .field,
.section > .field + .grid2,
.section > .field + .field,
.section > .grid3 + .grid2 {
  margin-top: 7px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 3px 0;
}

.switch input {
  appearance: none;
  width: 30px;
  height: 17px;
  border-radius: 999px;
  background: #2a3a56;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex: none;
  margin: 0;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #93a8c6;
  transition: transform 0.15s, background 0.15s;
}

.switch input:checked {
  background: var(--accent);
}

.switch input:checked::after {
  transform: translateX(13px);
  background: #fff;
}

.switch span {
  font-size: 12px;
  color: var(--ink-dim);
}

.swatches {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  outline: 1px solid #ffffff1f;
  cursor: pointer;
  padding: 0;
}

.swatch.on {
  border-color: #fff;
  box-shadow: 0 0 0 2px #3b82f666;
}

.seg {
  display: flex;
  gap: 2px;
  background: #0f1726;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 2px;
}

.seg button {
  flex: 1;
  height: 24px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  display: grid;
  place-items: center;
}

.seg button.on {
  background: #263a5a;
  color: #fff;
}

.seg button:hover:not(.on) {
  background: #1a2437;
  color: var(--ink-dim);
}

.hint {
  font-size: 10.5px;
  color: #64789a;
  line-height: 1.5;
  margin-top: 6px;
}

/* =============================================================== statusbar */
.statusbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  background: #0c111b;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
  /* Anchor for the centred contact address. */
  position: relative;
}

.statusbar .sep {
  width: 1px;
  height: 12px;
  background: var(--line);
}

.statusbar .msg {
  color: var(--ink-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statusbar .privacy {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ok-dim);
}

/* Centred on the bar itself, so loading a drawing (which widens the left-hand
   groups) cannot push the address off centre. */
.statusbar .contact {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ok-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.12s;
}

.statusbar .contact:hover {
  color: var(--ok);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* The status readouts crowd the bar on narrow windows; the address is the least
   urgent of the three, so it steps aside first. */
@media (max-width: 860px) {
  .statusbar .contact {
    display: none;
  }
}

.pager {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pager button {
  width: 20px;
  height: 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 12px;
  line-height: 1;
}

.pager button:hover:not(:disabled) {
  background: #1c2740;
  color: var(--ink);
}

.pager button:disabled {
  opacity: 0.3;
  cursor: default;
}

.pager .of {
  font-family: var(--mono);
  padding: 0 3px;
  color: var(--ink-dim);
}

/* ================================================================= toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  background: #1b2740;
  border: 1px solid #2f4467;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  box-shadow: 0 12px 30px #00000073;
  z-index: 200;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 7px;
}

.toast.bad {
  border-color: #63303a;
  background: #341c24;
  color: #ffd9d9;
}

/* ================================================================== modal */
.scrim {
  position: fixed;
  inset: 0;
  background: #05080fc4;
  backdrop-filter: blur(2px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal {
  width: min(520px, 100%);
  background: #141d2c;
  border: 1px solid #2a3a57;
  border-radius: 12px;
  box-shadow: 0 28px 70px #000000a6;
  overflow: hidden;
}

.modal header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.modal .content {
  padding: 14px 16px;
  color: var(--ink-dim);
  line-height: 1.6;
  font-size: 12.5px;
}

.modal footer {
  padding: 10px 16px 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.kv {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 4px 12px;
  font-size: 12px;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11.5px;
}

.shortcuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 18px;
  font-size: 12px;
}

.shortcuts div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 0;
}

kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  background: #0f1726;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink-dim);
  white-space: nowrap;
}

.empty-note {
  padding: 26px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* ------------------------------------------------------------------ notices */

.notice-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 14px;
  background: linear-gradient(180deg, #3c2a12, #33230f);
  border-bottom: 1px solid #6b4a1d;
  color: #f3cc8a;
  font-size: 12px;
  line-height: 1.5;
  flex: 0 0 auto;
}

.notice-bar svg {
  flex: 0 0 auto;
  margin-top: 2px;
  opacity: 0.9;
}

.notice-text {
  flex: 1 1 auto;
  min-width: 0;
}

.notice-text p {
  margin: 0;
}

.notice-text p + p {
  margin-top: 3px;
  opacity: 0.86;
}

.notice-close {
  flex: 0 0 auto;
  background: none;
  border: 0;
  color: #f3cc8a;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  opacity: 0.7;
}

.notice-close:hover {
  opacity: 1;
}

/* ------------------------------------------------------------------ license */

/* The chip is the only always-visible statement about licensing, so it says
   the state in one word and colours the dot instead of shouting. */
.lic-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0f1726;
  color: var(--ink-dim);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.lic-chip:hover {
  color: var(--ink);
  border-color: #33456a;
}

/* Same pill as the status chip, one step brighter: this is the only control in
   the header that leaves the page, and it should read as an action rather than
   as another readout. */
.lic-chip.buy {
  color: var(--accent-ink);
  text-decoration: none;
}

.lic-chip.buy:hover {
  color: #cbdcff;
  border-color: #31527f;
  background: #12203a;
}

.lic-chip.ok {
  color: #a7f3d0;
  border-color: #1c5443;
  background: #0d1f1a;
}

.lic-chip.eval {
  color: #fcd88a;
  border-color: #5c4a1c;
  background: #1f1a0c;
}

.lic-chip.bad {
  color: #fecaca;
  border-color: #5c2626;
  background: #1f0f0f;
}

.lic-chip.wait {
  color: var(--muted);
}

.modal.lic {
  width: min(560px, 100%);
}

.lic-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.lic-badge.ok {
  color: #a7f3d0;
  border-color: #1c5443;
  background: #0d1f1a;
}

.lic-badge.eval {
  color: #fcd88a;
  border-color: #5c4a1c;
  background: #1f1a0c;
}

.lic-badge.bad {
  color: #fecaca;
  border-color: #5c2626;
  background: #1f0f0f;
}

.lic-state {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 12.5px;
}

.lic-problem {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid #5c2626;
  background: #1f0f0f;
  color: #fecaca;
  font-size: 12px;
  line-height: 1.5;
}

.lic-grid {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.lic-row {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 10px;
  padding: 6px 10px;
  font-size: 11.5px;
  border-bottom: 1px solid var(--line-soft);
}

.lic-row:last-child {
  border-bottom: 0;
}

.lic-row > span {
  color: var(--muted);
}

.lic-row > b {
  color: var(--ink);
  font-weight: 500;
  font-family: var(--mono);
  font-size: 11px;
  word-break: break-all;
}

.lic-intro,
.lic-howto {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.lic-howto {
  margin: 8px 0 0;
}

.lic-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 5px;
}

.lic-input {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #0b1220;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
}

.lic-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #3b82f625;
}
