/* WCSH Document Control System
   Palette taken from the hospital logo: banner orange, the blue of the building and of the hospital stamp, ink for text. */

@font-face {
  font-family: "Archivo";
  src: url("../vendor/fonts/Archivo-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans Ethiopic";
  src: url("../vendor/fonts/NotoSansEthiopic-Regular.woff2") format("woff2");
  font-weight: 400;
  unicode-range: U+1200-139F, U+2D80-2DDF, U+AB00-AB2F;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans Ethiopic";
  src: url("../vendor/fonts/NotoSansEthiopic-Bold.woff2") format("woff2");
  font-weight: 700;
  unicode-range: U+1200-139F, U+2D80-2DDF, U+AB00-AB2F;
  font-display: swap;
}

:root {
  --orange: #f26b21;
  --orange-soft: #fdebdd;
  --ember: #c9460a;
  --ember-dark: #a53708;
  --ink: #17202e;
  --ink-2: #44506a;
  --ink-3: #6b768c;
  --mist: #f1f3f6;
  --paper: #ffffff;
  --line: #d8dde5;
  --line-2: #c3cad6;
  --blue: #2b55c9;
  --blue-soft: #e8eefc;
  --ok: #1e7b4b;
  --ok-soft: #e4f4ec;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --warn-soft: #fff4d6;
  --radius: 6px;
  --font: "Archivo", "Noto Sans Ethiopic", system-ui, -apple-system, "Segoe UI", Roboto, "Nyala", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
img { max-width: 100%; }
h1, h2, h3 { font-stretch: 112%; font-weight: 750; letter-spacing: -0.012em; line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: var(--ember); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 100; border-radius: var(--radius); }
.skip:focus { left: 8px; }

/* ---------- app shell ---------- */
.shell { display: flex; flex: 1; min-height: 100vh; }
.sidebar {
  width: 264px; flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--orange); color: var(--ink);
  display: flex; flex-direction: column; padding: 20px 14px 16px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-logo { display: grid; place-items: center; width: 54px; height: 54px; flex: none; background: #fff; border-radius: 14px; box-shadow: 0 1px 0 rgb(0 0 0 / .08); }
.brand-logo img { display: block; width: 42px; height: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-stretch: 112%; font-weight: 800; font-size: 17px; }
.brand-text small { font-size: 12px; margin-top: 2px; opacity: .85; }
.sidenav { display: flex; flex-direction: column; gap: 4px; margin-top: 26px; }
.sidenav a {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink);
  font-weight: 650; font-size: 15.5px; padding: 11px 12px; border-radius: 10px;
  transition: background-color .12s;
}
.sidenav a svg, .tabbar a svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sidenav a:hover { background: rgb(255 255 255 / .22); }
.sidenav a[aria-current="page"] { background: #fff; box-shadow: 0 2px 8px rgb(23 32 46 / .16); }
.sidenav a[aria-current="page"] svg { stroke: var(--ember); }
.side-foot { margin-top: auto; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; padding: 0 6px; opacity: .85; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--mist); }
.mobilebar, .tabbar { display: none; }

main { flex: 1; outline: none; }

/* ---------- buttons and form controls ---------- */
.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  font: inherit; font-weight: 650; font-size: 15px;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  cursor: pointer; text-decoration: none;
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ember); border-color: var(--ember); color: #fff; }
.btn.primary:hover { background: var(--ember-dark); border-color: var(--ember-dark); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.dark:hover { background: #0b111b; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--mist); color: var(--ink); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .label { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.field .hint, .hint { font-size: 13px; color: var(--ink-3); }
input[type="text"], input[type="url"], input[type="number"], input[type="date"], input[type="password"], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 10px;
  font: inherit; font-size: 15px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius);
}
textarea { min-height: 84px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input[type="range"] { width: 100%; accent-color: var(--ember); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--ember); width: 17px; height: 17px; flex: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 14px; font-size: 14px; font-weight: 600; color: var(--ink-2); border-right: 1px solid var(--line); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: -3px; }

.notice { padding: 10px 12px; border-radius: var(--radius); font-size: 14px; background: var(--blue-soft); color: #1b3a8a; }
.notice.warn { background: var(--warn-soft); color: #6b4a00; }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }

.chip { display: inline-block; font-size: 12.5px; font-weight: 650; padding: 2px 8px; border-radius: 99px; background: var(--mist); color: var(--ink-2); border: 1px solid var(--line); }
.chip.stamp { background: var(--blue-soft); color: #1b3a8a; border-color: #c9d6f7; }
.chip.sig { background: var(--orange-soft); color: #8a3306; border-color: #f7cfae; }

.checker {
  background-color: #fff;
  background-image: linear-gradient(45deg, #e6e9ee 25%, transparent 25%, transparent 75%, #e6e9ee 75%),
                    linear-gradient(45deg, #e6e9ee 25%, transparent 25%, transparent 75%, #e6e9ee 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
}

.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; width: min(92vw, 460px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--radius); font-size: 15px; box-shadow: 0 6px 24px rgb(0 0 0 / .25); }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }

.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 56px; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(26px, 3.2vw, 34px); }
.page-head p { color: var(--ink-2); max-width: 60ch; margin-top: 6px; }

/* ---------- home ---------- */
.home { max-width: 1100px; }
.banner {
  display: flex; align-items: center; gap: 20px;
  background: var(--orange); border-radius: 18px; padding: 22px 26px; margin-bottom: 18px;
  background-image: radial-gradient(circle at 92% 20%, rgb(255 255 255 / .22) 0 90px, transparent 91px), radial-gradient(circle at 100% 100%, rgb(255 255 255 / .14) 0 140px, transparent 141px);
}
.banner-logo { height: 84px; width: auto; flex: none; background: #fff; border-radius: 18px; padding: 8px 10px; }
.banner h1 { font-size: clamp(22px, 2.6vw, 30px); font-stretch: 118%; font-weight: 800; }
.banner p { margin-top: 4px; font-size: 15.5px; max-width: 52ch; }
.tiles { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.tile {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 20px;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.tile:hover { border-color: var(--orange); box-shadow: 0 6px 20px rgb(23 32 46 / .1); transform: translateY(-1px); }
.tile b { font-size: 18px; font-stretch: 108%; font-weight: 750; margin-top: 8px; }
.tile > span:last-child { color: var(--ink-2); font-size: 14.5px; }
.tile-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--orange-soft); color: var(--ember); }
.tile-ic svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.tile.primary > span:last-child { color: #cfd6e4; }
.tile.primary .tile-ic { background: var(--orange); color: var(--ink); }
.tile.primary:hover { border-color: var(--orange); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 30px; font-stretch: 112%; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat > span, .stat a > span:last-child { color: var(--ink-2); font-size: 14px; }
.stat a { color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: 6px; height: 100%; justify-content: space-between; }
.pills { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.pill { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 99px; background: var(--mist); color: var(--ink-3); border: 1px solid var(--line); }
.pill.on { background: var(--ok-soft); color: var(--ok); border-color: #bfe3cf; }
.recent { padding: 8px 20px 12px; }
.recent-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 8px; }
.recent-head h2 { font-size: 19px; }
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.file-ic { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--orange-soft); color: var(--ember); flex: none; }
.file-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rl-main b { font-weight: 700; }
.rl-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.rl-main small { color: var(--ink-3); font-size: 13px; }
.empty { padding: 18px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--ink-2); background: var(--paper); margin-bottom: 8px; }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }

/* ---------- document editor ---------- */
.editor { display: grid; grid-template-columns: 410px minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.side { position: sticky; top: 20px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; overflow: hidden; }
.side-scroll { overflow-y: auto; flex: 1; }
.sec { border-bottom: 1px solid var(--line); }
.sec > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-weight: 700; font-stretch: 105%; font-size: 16px; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); transition: transform .15s; }
.sec[open] > summary::after { transform: rotate(-135deg); }
.sec > summary .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--orange); font-size: 13px; font-weight: 800; flex: none; }
.sec > summary .done { color: var(--ok); font-size: 13px; font-weight: 650; margin-left: 4px; }
.sec-body { padding: 2px 16px 18px; display: flex; flex-direction: column; gap: 14px; }

.dropzone {
  border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 22px 16px; text-align: center;
  background: var(--mist); color: var(--ink-2); cursor: pointer; transition: border-color .12s, background-color .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--orange); background: var(--orange-soft); }
.dropzone b { display: block; color: var(--ink); font-size: 16px; }
.filebox { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--mist); }
.filebox .nm { font-weight: 650; overflow-wrap: anywhere; }
.filebox small { display: block; color: var(--ink-3); }

.slot { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px 10px; align-items: center; }
.slot > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.slot select { min-height: 38px; }
.subhead { font-size: 13.5px; font-weight: 700; color: var(--ink); padding-top: 4px; border-top: 1px solid var(--line); margin-top: 2px; }
.extra-items { display: flex; flex-direction: column; gap: 6px; }
.extra-items .chipbtn { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: 14px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--mist); }

.actionbar { border-top: 1px solid var(--line); padding: 14px 16px; background: var(--paper); display: flex; flex-direction: column; gap: 10px; }
.actionbar .btn { width: 100%; }
.progress { height: 6px; border-radius: 3px; background: var(--mist); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--orange); transition: width .2s; }

.preview { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.preview-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.tabs { display: inline-flex; gap: 2px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; }
.tabs button { appearance: none; border: 0; background: transparent; font: inherit; font-weight: 650; font-size: 14.5px; padding: 7px 14px; border-radius: 4px; cursor: pointer; color: var(--ink-2); }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }
.canvas-stage { background: #dfe3ea; border: 1px solid var(--line); border-radius: 8px; padding: 22px; display: grid; place-items: start center; min-height: 420px; overflow: auto; }
.canvas-wrap { position: relative; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .12), 0 8px 28px rgb(23 32 46 / .18); touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none; }
.canvas-wrap canvas { display: block; width: 100%; height: auto; }
.placeholder { padding: 70px 24px; text-align: center; color: var(--ink-2); max-width: 44ch; margin: 0 auto; }
.placeholder b { display: block; color: var(--ink); font-size: 18px; font-stretch: 108%; margin-bottom: 6px; }

.pitem { position: absolute; cursor: grab; outline: 1px dashed transparent; touch-action: none; }
.pitem img { width: 100%; height: 100%; display: block; mix-blend-mode: multiply; pointer-events: none; -webkit-user-drag: none; }
.pitem:hover { outline-color: var(--blue); }
.pitem.sel { outline: 1.5px solid var(--blue); }
.pitem.dragging { cursor: grabbing; }
.pitem .rh { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: var(--blue); border: 2px solid #fff; border-radius: 3px; cursor: nwse-resize; display: none; }
.pitem.sel .rh { display: block; }

.inspector { display: grid; grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr)) auto; gap: 12px 16px; align-items: end; padding: 14px 16px; }
.inspector .name { font-weight: 700; overflow-wrap: anywhere; }
.inspector .name small { display: block; font-weight: 400; color: var(--ink-3); }
.meta-line { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; color: var(--ink-2); }

/* ---------- stamps and signatures ---------- */
.lib { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.bench-head { padding: 16px; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bench-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair figure { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pair figcaption { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.pane { position: relative; border: 1px solid var(--line); border-radius: var(--radius); min-height: 190px; display: grid; place-items: center; overflow: hidden; background: var(--mist); touch-action: none; }
.pane canvas { max-width: 100%; max-height: 360px; display: block; }
.pane.checker canvas { background: transparent; }
.cropbox { position: absolute; border: 2px solid var(--blue); background: rgb(43 85 201 / .12); pointer-events: none; }
.sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.empty-bench { padding: 44px 20px; text-align: center; color: var(--ink-2); }
.empty-bench b { display: block; color: var(--ink); font-size: 18px; font-stretch: 108%; margin-bottom: 6px; }
.asset-list { list-style: none; margin: 0; padding: 0; }
.asset-list h3 { font-size: 15px; padding: 14px 16px 8px; font-stretch: 105%; }
.asset { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); }
.asset .thumb { width: 96px; height: 64px; border: 1px solid var(--line); border-radius: 4px; display: grid; place-items: center; overflow: hidden; }
.asset .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 3px; }
.asset .nm { font-weight: 650; overflow-wrap: anywhere; }
.asset small { color: var(--ink-3); display: block; }
.asset .acts { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

dialog { border: 0; border-radius: 10px; padding: 0; max-width: min(94vw, 640px); width: 100%; box-shadow: 0 20px 60px rgb(0 0 0 / .35); color: var(--ink); }
dialog::backdrop { background: rgb(23 32 46 / .55); }
dialog form { display: flex; flex-direction: column; }
dialog h2 { font-size: 22px; padding: 18px 20px 4px; }
dialog .dlg-body { padding: 8px 20px 16px; display: flex; flex-direction: column; gap: 14px; }
dialog .dlg-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.padwrap { border: 1px solid var(--line-2); border-radius: var(--radius); background: #fff; position: relative; }
.padwrap canvas { display: block; width: 100%; height: 220px; touch-action: none; cursor: crosshair; }
.padwrap::after { content: ""; position: absolute; left: 6%; right: 6%; bottom: 52px; border-bottom: 1px dashed var(--line-2); pointer-events: none; }

/* ---------- register and settings ---------- */
.table-wrap { overflow-x: auto; position: relative; }
table.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: left; font-weight: 700; color: var(--ink-2); padding: 11px 14px; border-bottom: 2px solid var(--ink); white-space: nowrap; background: var(--paper); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: #fafbfc; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.settings .panel { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.settings h2 { font-size: 20px; }
.settings .wide { grid-column: 1 / -1; }
.ok-text { color: var(--ok); font-weight: 650; }
.bad-text { color: var(--bad); font-weight: 650; }
code, kbd { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .92em; background: var(--mist); padding: 1px 5px; border-radius: 3px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .editor { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .side-scroll { overflow: visible; }
  .lib { grid-template-columns: 1fr; }
  .inspector { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 980px) {
  .tiles { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .settings { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .page { padding: 20px 14px 44px; }
  .pair, .sliders, .row2, .row3 { grid-template-columns: 1fr; }
  .asset { grid-template-columns: 76px minmax(0, 1fr); }
  .asset .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .asset .thumb { width: 76px; }
  .canvas-stage { padding: 10px; }
  .slot { grid-template-columns: 1fr; }
}

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.pane.checker {
  background-color: #fff;
  background-image: linear-gradient(45deg, #e6e9ee 25%, transparent 25%, transparent 75%, #e6e9ee 75%),
                    linear-gradient(45deg, #e6e9ee 25%, transparent 25%, transparent 75%, #e6e9ee 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}

/* ---------- phones and narrow windows: top bar plus bottom tab bar ---------- */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .mobilebar { display: flex; align-items: center; background: var(--orange); padding: calc(8px + env(safe-area-inset-top)) 14px 8px; position: sticky; top: 0; z-index: 20; }
  .mobilebar .brand-logo { width: 42px; height: 42px; border-radius: 11px; }
  .mobilebar .brand-logo img { width: 32px; }
  .mobilebar .brand-text strong { font-size: 16px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--paper); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; text-decoration: none; color: var(--ink-3); font-size: 12px; font-weight: 650; border-top: 3px solid transparent; }
  .tabbar a[aria-current="page"] { color: var(--ember); border-top-color: var(--orange); }
  main { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .banner { flex-direction: column; align-items: flex-start; padding: 18px; }
  .banner-logo { height: 64px; }
  .side { top: auto; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat b { font-size: 26px; }
}

.inspector:empty { display: none; }
@media (max-width: 860px) {
  .tile { display: grid; grid-template-columns: 48px 1fr; column-gap: 14px; row-gap: 2px; padding: 14px 16px; align-items: center; }
  .tile .tile-ic { grid-row: 1 / span 2; }
  .tile b { margin-top: 0; font-size: 17px; }
  .tiles { gap: 10px; }
  .banner p { font-size: 14.5px; }
}

.credit { text-align: center; color: var(--ink-3); font-size: 14px; font-weight: 600; margin: 26px 0 4px; }

/* ---------- touch screens ---------- */
@media (pointer: coarse) {
  .pitem .rh { width: 26px; height: 26px; right: -13px; bottom: -13px; border-radius: 6px; }
  .pitem { outline-color: rgb(43 85 201 / .45); }
  .btn.small { min-height: 40px; }
  .seg span { padding: 11px 14px; }
  input[type="range"] { min-height: 32px; }
}
@media (max-width: 860px) {
  input[type="text"], input[type="url"], input[type="number"], input[type="date"], input[type="password"], select, textarea { font-size: 16px; }
  .page-head .inline { width: 100%; }
  .actionbar { position: sticky; bottom: 0; }
  .inspector { grid-template-columns: 1fr 1fr; }
  .inspector .name, .inspector .btn { grid-column: 1 / -1; }
  dialog { max-width: 94vw; }
  .recent-list li { flex-wrap: wrap; }
}

.mobile-only { display: none; }
@media (max-width: 1100px) {
  .mobile-only { display: inline-flex; }
  .side { overflow: visible; }
  .actionbar { border-radius: 0 0 8px 8px; box-shadow: 0 -6px 16px rgb(23 32 46 / .08); }
}
@media (max-width: 860px) {
  .actionbar { bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 5; }
  .preview { scroll-margin-top: 64px; }
}

@media (max-width: 720px) {
  table.table, .table tbody, .table tr, .table td { display: block; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table td { border: 0; padding: 3px 0; display: grid; grid-template-columns: 112px 1fr; gap: 8px; }
  .table td[data-label]::before { content: attr(data-label); color: var(--ink-3); font-weight: 650; font-size: 13.5px; }
  .table td:empty { display: none; }
  .table td.acts { display: flex; gap: 8px; padding-top: 8px; }
  .table tr:hover td { background: transparent; }
  .table .num { white-space: normal; }
}

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