/* Interface typography only. The artboard and exported SiteDocument keep their
   authored geometry and fonts. Do not replace this scope with a global * rule. */
:root {
  --ui-text-body: 1rem;
  --ui-text-control: .9375rem;
  --ui-text-label: .875rem;
  --ui-text-caption: .8125rem;
  --ui-leading-body: 1.5;
  --ui-ink: #202922;
  --ui-ink-secondary: #52604f;
  /* Honour the browser's base text size. rem roles otherwise stay pinned to
     16px even when the user chooses larger default text in browser settings. */
  font-size: 100%;
}
.topbar, .rail, .toolbar, .left, .right, .page, #modal, #toast {
  font-size: var(--ui-text-body);
  line-height: var(--ui-leading-body);
}
.topbar button, .topbar a.btn, .topbar a.primary,
.toolbar button, .page button, .page input, .page select, .page textarea,
#modal button, #modal input, #modal select, #modal textarea {
  font-size: var(--ui-text-control);
  line-height: 1.4;
}
.left button, .right button, .left input, .right input,
.right select, .right textarea, .tabs button, .rail button,
.inspector-section label, .inspector-section h3, .inspector-section summary,
.inspector-group summary, .inspector-title small, .layer button,
.layer .layer-name, .canvas-options summary {
  font-size: var(--ui-text-label);
  line-height: 1.45;
}
.left .help, .right .help, .page small, .page .help, .page .tag,
.statusbar, .artboard-title, .topbar .saved, #modal small {
  font-size: var(--ui-text-caption);
  line-height: 1.5;
}
.left .help, .right .help, .inspector-section label, .inspector-title small {
  color: var(--ui-ink-secondary);
}
.layer { min-height: 44px; }
/* Layer names are task information. Wrap the real selection button instead
   of relying on a hover-only title; this also works with keyboard and touch. */
.layer > button:first-of-type {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
  text-align: left;
}
.layer .layer-name { white-space: normal; overflow-wrap: anywhere; }
.page p, #modal p { line-height: 1.6; }
.page h1 { font-size: clamp(1.75rem, 3vw, 2.25rem); line-height: 1.25; }
.page h2 { font-size: 1.375rem; line-height: 1.35; }
.page h3 { font-size: 1.125rem; line-height: 1.4; }
.page .eyebrow { font-size: .8125rem; letter-spacing: .08em; }
.page button, #modal button { white-space: normal; overflow-wrap: anywhere; }
.toolbar button, .topbar button, .topbar a.btn, .topbar a.primary,
.page button, #modal button { min-height: 40px; }
svg.ks-icon { width: 18px; height: 18px; stroke-width: 1.75; flex: none; pointer-events: none; }
.rail svg.ks-icon { width: 21px; height: 21px; }
/* Feedback stays in colour/border changes: moving controls on hover would
   make small alignment tools harder to target. */
.toolbar button, .topbar button, .page button, .rail button {
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
button:focus-visible, a:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #4b6a23; outline-offset: 3px;
}
@media (max-width: 700px) {
  .rail button { font-size: var(--ui-text-label); min-height: 44px; }
  .toolbar button, .topbar button, .page button, #modal button { min-height: 44px; }
  .toolbar button { font-size: var(--ui-text-label); }
  .page input, .page select, .page textarea, #modal input, #modal select,
  #modal textarea, .right input, .right select, .right textarea { font-size: 1rem; }
  .statusbar { font-size: var(--ui-text-caption); }
}
@media (prefers-reduced-motion: reduce) {
  .toolbar button, .topbar button, .page button, .rail button { transition: none; }
}

/* Readable navigation needs room; shrinking labels would undo the type scale. */
@media(max-width:700px){
  .rail { width:84px; flex:0 0 84px; padding-inline:4px; }
  .rail button { width:100%; padding-inline:2px; white-space:normal; }
  .artboard-title { flex-wrap:wrap; gap:5px; height:auto; }
  #modal { max-width:calc(100vw - 24px); padding:18px; }
  [data-add-sheet] .addgrid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  [data-add-sheet] .addgrid button { min-width:0; font-size:14px; }
  [data-add-sheet] h2 { font-size:22px; }
}
/* The page identity is UI text, so it wraps even while the canvas can pan. */
@media(max-width:700px){
  .artboard-title { display:block; max-width:calc(100vw - 112px); white-space:normal; overflow-wrap:anywhere; }
  .artboard-title i { display:inline-block; margin-right:6px; }
  .artboard-title .spacer { display:block; }
}
/* Text zoom changes control height as well as glyph size. Let the header take
   the space it needs; the editor consumes the remaining viewport via flex. */
#app:has(> .topbar) { display:flex; flex-direction:column; height:100dvh; }
#app > .topbar { height:auto; min-height:60px; flex:none; flex-wrap:wrap; padding-block:8px; }
#app > .appbody { height:auto; flex:1; min-height:0; }
.topbar > .user { width:2.75rem; height:2.75rem; min-width:2.75rem; min-height:2.75rem; padding:0; line-height:1.2; flex:none; }
.rail { width:max-content; min-width:min(5.5rem,35vw); max-width:35vw; flex:0 0 auto; }
.rail button { width:100%; white-space:normal; overflow-wrap:anywhere; }

/* Operational labels carry decisions (status, limits, routes), so they use the
   label scale rather than the smaller caption scale. Scope stays outside canvas. */
.page small, .page .tag, .page .notice, .page .mono, .page .chip,
.page .search-notice p, .page .search-notice.compact p,
.page a.btn, .page .search-notice.compact button, .topbar .saved {
  font-size: var(--ui-text-label);
  line-height: 1.5;
}
/* The legacy demo-note rule is important; match that priority deliberately so
   limitations remain readable instead of being reduced to a 12px footnote. */
.page .demo-note, #modal .demo-note {
  font-size: var(--ui-text-label) !important;
  line-height: 1.6;
}
.page .listtable th, .page .listtable td p {
  font-size: var(--ui-text-label);
  line-height: 1.5;
}

.mobile-column-label { display: none; }
@media (max-width: 700px) {
  /* Row cards keep actions in view without reducing the text or duplicating
     controls. The real header remains available to assistive technology. */
  .page .listtable[data-responsive] { display: block; width: 100%; }
  .page .listtable[data-responsive] thead {
    position: absolute; width: 1px; height: 1px; padding: 0;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .page .listtable[data-responsive] tbody { display: block; }
  .page .listtable[data-responsive] tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr);
    padding-block: 12px; border-bottom: 1px solid var(--line);
  }
  .page .listtable[data-responsive] tbody tr:last-child { border-bottom: 0; }
  .page .listtable[data-responsive] td {
    display: block; width: auto; min-width: 0;
    padding: 8px 0; border: 0; text-align: left; white-space: normal; overflow-wrap: anywhere;
  }
  .page .listtable[data-responsive] .mobile-column-label {
    display: block; margin-bottom: 4px;
    font: 500 var(--ui-text-label)/1.5 Arial, sans-serif;
    color: var(--ui-ink-secondary);
  }
  .page .listtable[data-responsive] button { width: 100%; }
}

/* Long layer names also appear in the inspector and selection status. Give
   each flex child permission to shrink and wrap instead of covering siblings. */
.inspector-title > div { min-width: 0; overflow-wrap: anywhere; }
.inspector-title > svg { flex: none; }
.statusbar { flex-wrap: wrap; align-items: flex-start; }
.statusbar > span { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.statusbar #selection-status { flex: 1 1 100%; }
.page-heading > div { min-width: 0; }
.page-heading h1 { overflow-wrap: anywhere; }


/* Persistent labels survive typing; the selected category wraps outside the
   native select, whose single-line rendering is controlled by the browser. */
.catalog-filter > .catalog-search-field { flex: 1 1 0; }
.catalog-filter > .catalog-category-field { flex: 0 1 18rem; }
.catalog-filter label { display: grid; gap: .5rem; min-width: 0; align-content: start; }
.catalog-filter > div { min-width: 0; }
.catalog-filter label > span { font-size: var(--ui-text-label); overflow-wrap: anywhere; }
.catalog-filter input, .catalog-filter select { width: 100%; min-width: 0; max-width: 100%; }
.catalog-filter [data-catalog-selected] { margin: .5rem 0 0; font-size: var(--ui-text-label); overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .catalog-filter > .catalog-search-field, .catalog-filter > .catalog-category-field { flex: auto; }
}


/* Match the breakpoint that hides the sidebar, including tablet widths. */
.toolbar .mobile-layers-button { display: none; }
@media (max-width: 800px) {
  .toolbar .mobile-layers-button { display: inline-flex; }
}
#modal:has([data-layer-sheet]) { width: min(36rem, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; }
[data-layer-sheet] h2 { font-size: 1.375rem; overflow-wrap: anywhere; }
[data-layer-sheet] .row.between { flex-wrap: wrap; }
[data-layer-sheet] .layer { margin-inline: 0; }
[data-layer-sheet] .layer > button { font-size: var(--ui-text-label); }
[data-layer-sheet] .layer .mini { min-width: 44px; min-height: 44px; flex-basis: 44px; }


/* Imported QA evidence stays readable without changing exported site styles. */
[data-package-quality] { margin-top: 1.5rem; border-top: 1px solid #cdd5c6; padding-top: 1rem; overflow-wrap: anywhere; }
[data-package-quality] label { display: grid; gap: .5rem; }
[data-package-quality] input { min-width: 0; max-width: 100%; }
[data-quality-details] li { margin-block: .75rem; }
