:root {
  color-scheme: light;
  --bg: #f6f6f4; --card: #ffffff; --ink: #1c1f22; --muted: #6b7177; --line: #e3e3de;
  --accent: #2f6f6a; --accent-ink: #ffffff; --tile: #e9ecea; --danger: #b3402f; --ok: #2f6f6a;
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #16181c; --card: #1f2227; --ink: #e8e9ea; --muted: #9aa0a6; --line: #2d3137;
  --accent: #5fb3ab; --accent-ink: #10201e; --tile: #262a30; --danger: #e07a69; --ok: #5fb3ab; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 720px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); min-height: 100vh; }
h1 { font-size: 1.4rem; margin: 0; font-weight: 650; }
h2 { font-size: 1rem; margin: 24px 0 8px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: .78rem; }
.top { display: flex; align-items: center; gap: 12px; padding: calc(16px + env(safe-area-inset-top)) 0 12px; }
.top h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme { display: flex; gap: 2px; background: var(--tile); border-radius: 999px; padding: 3px; flex: 0 0 auto; }
.theme button { background: none; color: var(--muted); padding: 5px 7px; border-radius: 999px; line-height: 0; font-weight: 400; }
.theme button svg { width: 18px; height: 18px; }
.theme button.on { background: var(--card); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.login .theme { margin: 0 0 0 auto; width: fit-content; }
.back { background: none; border: 0; font-size: 1.4rem; color: var(--accent); padding: 4px 8px 4px 0; cursor: pointer; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 84px; resize: vertical; }
label { display: block; font-size: .82rem; color: var(--muted); margin: 14px 0 6px; }
button, .btn { font: inherit; border: 0; border-radius: 12px; padding: 12px 18px; background: var(--accent); color: var(--accent-ink);
  font-weight: 600; cursor: pointer; display: inline-block; text-decoration: none; text-align: center; }
button.ghost, .btn.ghost { background: var(--tile); color: var(--ink); }
button.danger { background: none; color: var(--danger); border: 1px solid var(--line); }
button.small { padding: 6px 12px; font-size: .85rem; border-radius: 10px; }
button:disabled { opacity: .5; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row > .fit { flex: 0 0 auto; }
.stack > * + * { margin-top: 10px; }
.muted { color: var(--muted); font-size: .9rem; }
.error { color: var(--danger); margin: 10px 0 0; min-height: 1.2em; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 16px; overflow: hidden; background: var(--tile); cursor: pointer;
  display: flex; align-items: flex-end; border: 0; padding: 0; text-align: left; color: #fff; }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile .initial { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.6rem; font-weight: 700; color: var(--muted); opacity: .45; }
.tile .label { position: relative; width: 100%; padding: 28px 12px 10px; font-weight: 600; line-height: 1.2;
  background: linear-gradient(transparent, rgba(0,0,0,.62)); }
.tile.plain .label { background: none; color: var(--ink); }
.tile .count { font-weight: 400; opacity: .8; font-size: .8rem; display: block; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.card + .card { margin-top: 12px; }
.item .tile .label .count { opacity: .9; }
.badge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; border-radius: 999px; padding: 2px 9px; font-size: .78rem; z-index: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { background: var(--tile); border-radius: 999px; padding: 2px 10px; font-size: .78rem; color: var(--muted); }

.photos { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.photos .ph { position: relative; flex: 0 0 82%; max-width: 420px; aspect-ratio: 4/3; border-radius: 16px; overflow: hidden; background: var(--tile); scroll-snap-align: start; }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.photos .ph button { position: absolute; top: 8px; right: 8px; padding: 4px 10px; background: rgba(0,0,0,.6); color: #fff; font-size: .8rem; }
.camera { display: grid; place-items: center; gap: 6px; width: 100%; aspect-ratio: 4/3; border-radius: 16px; background: var(--tile); color: var(--accent);
  border: 2px dashed var(--line); font-weight: 600; cursor: pointer; overflow: hidden; padding: 0; }
.camera img { width: 100%; height: 100%; object-fit: cover; }
.camera svg { width: 44px; height: 44px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input { text-align: center; flex: 1; }
.stepper button { width: 48px; padding: 12px 0; }

.cab { margin-top: 12px; }
.grid { display: grid; gap: 6px; }
.cell { aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  display: grid; place-items: center; font-size: .78rem; padding: 0; cursor: pointer; font-weight: 500; position: relative; }
.cell.has { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cell.sel { outline: 3px solid var(--ink); outline-offset: 1px; }
.cell b { font-size: 1rem; display: block; line-height: 1; }
.cell small { opacity: .85; }
.legend { display: flex; gap: 14px; margin-top: 8px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 5px; border: 1px solid var(--line); background: var(--card); }
.legend i.has { background: var(--accent); border-color: var(--accent); }

nav.bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 4px; z-index: 5; }
nav.bar a { flex: 1; max-width: 120px; text-align: center; text-decoration: none; color: var(--muted); font-size: .72rem; padding: 4px 0; border-radius: 10px; }
nav.bar a svg { width: 24px; height: 24px; display: block; margin: 0 auto 2px; }
nav.bar a.on { color: var(--accent); }
nav.bar a.add { color: var(--accent-ink); background: var(--accent); border-radius: 16px; max-width: 76px; padding: 6px 0; }
nav.bar a .dot { position: absolute; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.modal > div, .modal > form { background: var(--bg); width: 100%; max-width: 720px; max-height: 85vh; overflow-y: auto; overscroll-behavior: contain; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: 999px; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; max-width: 90vw; }
#toast.show { opacity: 1; }
.login { max-width: 360px; margin: 14vh auto 0; }
.login h1 { text-align: center; margin-bottom: 24px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 6px; }
.tabs button { background: var(--tile); color: var(--ink); padding: 8px 14px; white-space: nowrap; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); }
.log { font-size: .82rem; color: var(--muted); }
.log div { padding: 4px 0; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
td, th { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* tool trolley drawing */
.trolley { display: block; width: 100%; max-width: 520px; height: auto; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.trolley .loc[role=button] { cursor: pointer; outline: none; }
.trolley .loc .ring { fill: none; stroke: transparent; stroke-width: 3; }
.trolley .loc[role=button]:hover .ring, .trolley .loc:focus-visible .ring { stroke: rgba(255,255,255,.7); }
.trolley .loc.sel .ring, .trolley .loc.sel[role=button]:hover .ring { stroke: #ffd23f; stroke-width: 3.5; }
.trolley .shelf.sel .ring { fill: rgba(255,210,63,.12); }
.trolley .tlabel { font: 700 13px system-ui, sans-serif; fill: rgba(255,255,255,.88); letter-spacing: .06em; }
.trolley .tplate { font: 700 8.5px system-ui, sans-serif; fill: #333; letter-spacing: .08em; }
.trolley .tmore { font: 700 12px system-ui, sans-serif; fill: #555; }
.trolley .tbadge circle { fill: #fff; stroke: var(--accent); stroke-width: 2; }
.trolley .tbadge text { font: 700 11px system-ui, sans-serif; fill: #1c1f22; }
.trolley.mini { width: 120px; flex: 0 0 120px; margin: 0; }
.trolley.mini .loc.sel .ring { stroke-width: 9; fill: rgba(255,210,63,.6); }
.locpic { display: flex; align-items: center; gap: 12px; text-align: left; }
input[type=checkbox] { width: 18px; height: 18px; flex: 0 0 auto; padding: 0; accent-color: var(--accent); }
/* storage unit drawings: organizer cells and selection */
.trolley .dcell { fill: #ece8da; stroke: #b9a96a; stroke-width: .6; }
.trolley .loc.has .dcell { fill: var(--accent); fill-opacity: .7; stroke: var(--accent); }
.trolley .cell .ring { stroke-width: 1.6; }
.trolley .loc.sel.cell .ring { stroke-width: 2.4; fill: rgba(255,210,63,.35); }
.trolley.mini.unit-organizer .loc.sel .ring { stroke-width: 4; }
.trolley.mini { width: 120px; flex: 0 0 120px; }

nav.bar a { position: relative; }
.bubble { position: absolute; top: 0; left: calc(50% + 6px); background: var(--danger); color: #fff; border-radius: 999px; font-size: .64rem; font-weight: 700; min-width: 17px; padding: 1px 5px; line-height: 1.25; }
.chip { display: inline-block; }
.tabs.three button { flex: 1; padding: 8px 4px; font-size: .9rem; }
button.small, .btn.small { white-space: nowrap; }


[hidden] { display: none !important; }
html:has(.modal), body:has(.modal) { overflow: hidden; }
.modal { overscroll-behavior: contain; }
@media (min-width: 721px) { .modal { align-items: center; } .modal > div, .modal > form { border-radius: 20px; } }
.banner { background: #b3261e; color: #fff; padding: 10px 14px; margin: 8px 0; border-radius: 12px; font-size: 14px; }

.trolley .ubg { fill: var(--muted); }
.trolley .utag { user-select: none; }
.trolley.thumb { width: 100%; max-width: none; height: 140px; margin: 0; }

.stgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.stcard { display: flex; flex-direction: column; gap: 4px; padding: 10px; text-decoration: none; color: inherit; }
.stcard b { font-size: .95rem; line-height: 1.25; }
.stcard .muted { font-size: .78rem; }
.stpic { height: 140px; display: flex; align-items: center; justify-content: center; background: var(--tile); border-radius: 12px; padding: 6px; margin-bottom: 4px; }
.stpic .trolley.thumb { height: 100%; }
.gthumb { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); }
.gthumb svg { width: 40px; height: 40px; }
.stgrid .card { margin: 0; }

.stgrid { margin-top: 12px; }

/* item cards: photo on top with status and quantity markers, text underneath */
.igrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 14px; }
.icard { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; text-decoration: none; color: var(--ink); }
.ipic { position: relative; aspect-ratio: 4 / 3; background: var(--tile); }
.ipic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ipic .initial { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.2rem; font-weight: 700; color: var(--muted); opacity: .4; }
.pill, .qty { position: absolute; top: 8px; display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; line-height: 1.3;
  background: rgba(255,255,255,.92); color: #1c1f22; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.pill { left: 8px; }
.qty { right: 8px; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: #999; }
.s-in-use i { background: #e0a030; }
.s-reserved i { background: #4a86d8; }
.s-broken i { background: #d4503f; }
.s-missing i { background: #8a64c8; }
.ibody { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; min-width: 0; }
.iname { font-size: .95rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.iproj { font-size: .78rem; color: var(--accent); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.iloc { font-size: .78rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.iloc::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 1px; }
.iloc.none::before { background: var(--line); }
.photoadd > * { flex: 1; }
.log .logrow { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.log .logd { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.modal canvas { background: #000; }
.modal .tabs { flex-wrap: wrap; }

/* ---- refined look: calm surfaces, one clear primary action per screen ---- */
:root { --bg: #f7f7f5; --line: #e8e8e3; --soft: #e6efed; --shadow: 0 1px 2px rgba(25,35,35,.05), 0 4px 14px rgba(25,35,35,.04); --warn: #b4531a; --warn-bg: #fbeee3; }
:root[data-theme="dark"] { --bg: #16181c; --soft: #22302e; --shadow: none; --warn: #f0a060; --warn-bg: #36291f; }
.card { box-shadow: var(--shadow); border-radius: 18px; padding: 16px; }
.card + .card { margin-top: 0; }
.stack > .card + .card, .stack > * + * { margin-top: 12px; }
h2 { display: flex; align-items: center; gap: 8px; margin: 26px 0 10px; letter-spacing: .06em; }
h2 .count, .seg .count { background: var(--soft); color: var(--accent); border-radius: 999px; padding: 1px 8px; font-size: .74rem; letter-spacing: 0; }
button.soft { background: var(--soft); color: var(--accent); }
button.quiet { background: none; color: var(--muted); font-weight: 500; }
button svg { width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; }
.field { display: block; }
.field label { margin: 14px 0 6px; font-weight: 600; color: var(--ink); font-size: .84rem; }
.field .req { color: var(--danger); }
.field .opt { color: var(--muted); font-weight: 400; }
.modal h1 { font-size: 1.25rem; margin-bottom: 4px; }
.modal > div, .modal > form { padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); }
.modal .row > * { flex: 1; }

/* request an item: one clear call to action under the search */
.cta { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; background: var(--soft); color: var(--accent); padding: 12px 16px; border-radius: 14px; }
.cta b { font-size: 1rem; } .cta span { font-size: .82rem; color: var(--muted); font-weight: 500; }

/* item sheet for the lab */
.sheet { display: grid; gap: 10px; }
.facts { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bigqty { font-size: 1.9rem; font-weight: 700; line-height: 1; } .bigqty small { font-size: .85rem; color: var(--muted); font-weight: 500; }
.pill.flat { position: static; box-shadow: none; background: var(--tile); }
.trail { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 600; font-size: .95rem; }
.trail .sep { color: var(--muted); font-weight: 400; }
.trail.none { color: var(--muted); font-weight: 500; }
.iproj { color: var(--accent); font-weight: 600; font-size: .9rem; }
.loanline { font-size: .88rem; color: var(--muted); padding: 6px 10px; background: var(--tile); border-radius: 10px; }
.loanline.late, .late { color: var(--warn); } .loanline.late { background: var(--warn-bg); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions button { padding: 14px 10px; }
.actions button.quiet { grid-column: 1 / -1; padding: 8px; }

/* photo adding: compact */
.photoadd.empty { border: 1.5px dashed var(--line); border-radius: 16px; padding: 16px; text-align: center; background: var(--card); }
.photoadd.empty p { margin: 0 0 10px; }
.photoadd .row > button { padding: 10px 12px; }
.photopick { display: flex; align-items: center; gap: 12px; } .photopick img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; }
.photopick > button { flex: 1; }
.pimg { width: 100%; max-height: 240px; object-fit: cover; border-radius: 14px; }

/* to do */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--tile); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { background: none; color: var(--muted); padding: 9px 4px; font-size: .9rem; border-radius: 11px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.item-row { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: inherit; }
.item-row.link { align-items: center; }
.grow { flex: 1; min-width: 0; }
.btns { margin-top: 10px; justify-content: flex-start; } .btns > * { flex: 0 0 auto; }
.alertcard { border-color: var(--warn); background: var(--warn-bg); }
.quiet-empty { color: var(--muted); font-size: .9rem; padding: 14px 4px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .9rem; margin-top: 2px; }
.linkish { background: none; color: var(--ink); padding: 0; text-align: left; font-size: 1rem; }
.tinylink { font-size: .82rem; color: var(--accent); margin-right: 10px; }
.statuspick { width: auto; padding: 6px 28px 6px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; margin-top: 10px; background: var(--soft); color: var(--accent); }
.statuspick.st-delayed { background: var(--warn-bg); color: var(--warn); }
.chip.st-acquired { background: var(--soft); color: var(--accent); } .chip.st-dismissed { text-decoration: line-through; }
.doneBox { margin-top: 18px; } .doneBox summary { cursor: pointer; color: var(--muted); font-weight: 600; margin-bottom: 10px; } .doneBox .card { margin-bottom: 10px; opacity: .8; }

/* overdue popup */
.overdue > div { border-top: 5px solid var(--warn); }
.overlist { margin: 0; padding-left: 18px; } .overlist li { margin: 4px 0; }
.callout { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }

/* menu */
.who { display: flex; flex-direction: column; gap: 2px; padding: 4px 2px 8px; } .who b { font-size: 1.2rem; }
.menulist { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.menurow { display: flex; justify-content: space-between; align-items: center; padding: 16px; color: var(--ink); text-decoration: none; font-weight: 600; border-top: 1px solid var(--line); }
.menurow:first-child { border-top: 0; } .menurow .chev { color: var(--muted); font-size: 1.3rem; }
.acct .muted { font-size: .85rem; }
.tabs { margin-bottom: 12px; }
nav.bar { box-shadow: 0 -4px 18px rgba(25,35,35,.05); }
.actions button:first-child { grid-column: 1 / -1; }

/* problems lead with what is wrong */
.problem { border-left: 4px solid var(--warn); }
.problem.closed { border-left-color: var(--accent); opacity: .92; }
.problem .said { font-size: 1.08rem; font-weight: 650; line-height: 1.35; margin-bottom: 12px; }
.chip.warn { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.chip.ok { background: var(--soft); color: var(--accent); font-weight: 600; }
.notebox { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: var(--tile); font-size: .9rem; }
.notebox span { font-weight: 600; }
.detail { font-size: .9rem; margin-top: 2px; white-space: pre-wrap; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.three button { padding: 9px 4px; font-size: .85rem; background: var(--tile); color: var(--ink); }
.three button.on { background: var(--accent); color: var(--accent-ink); opacity: 1; }
.seg.four { grid-auto-columns: auto; grid-template-columns: repeat(4, auto); }
.seg.four button { padding: 9px 6px; font-size: .84rem; }
.exportrow { margin-top: 18px; } .exportrow > * { flex: 1 1 0; }
.chip { margin-top: 6px; }
.btns { flex-wrap: wrap; }
.exportrow { flex-wrap: wrap; } .exportrow > * { flex: 1 1 140px; }
.seg.four { grid-template-columns: repeat(4, 1fr); gap: 2px; }
.seg.four button { padding: 9px 2px; font-size: .8rem; gap: 4px; }
.seg.four .count { padding: 0 6px; }

/* calmer problem cards, no side stripes */
.problem { border-left: 0 !important; opacity: 1 !important; display: grid; gap: 12px; }
.problem .said { background: var(--warn-bg); color: var(--ink); border-radius: 12px; padding: 10px 14px; font-size: 1.05rem; font-weight: 600; line-height: 1.35; }
.problem .said.past { background: var(--tile); font-weight: 500; }
.lbl { display: block; font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; opacity: .65; margin-bottom: 3px; }
.problem .pitem { align-items: center; }
.problem .pitem .tile { width: 48px !important; height: 48px !important; flex-basis: 48px !important; border-radius: 10px !important; }
.problem .btns { margin-top: 0; }
.problem .chip { justify-self: start; margin-top: 0; }
.resolved { background: var(--soft); color: var(--ink); border-radius: 12px; padding: 10px 14px; }
.resolved .lbl { color: var(--accent); opacity: 1; }
.stpic.cat { padding: 0; overflow: hidden; } .stpic.cat img { width: 100%; height: 100%; object-fit: cover; }
.initial2 { font-size: 2.6rem; font-weight: 700; color: var(--muted); opacity: .4; }

/* shape editor for custom storage units: tools left, the canvas in the middle, the selection right, name on top, undo and save below */
body.wide #app { max-width: 1180px; }
.lyed { display: grid; gap: 10px; grid-template-columns: 150px minmax(0, 1fr) 240px; grid-template-areas: "top top top" "tools main props" "bottom bottom bottom"; align-items: start; user-select: none; -webkit-user-select: none; }
.lyed input, .lyed select { user-select: text; -webkit-user-select: text; }
.lyed-top { grid-area: top; display: flex; gap: 8px; align-items: flex-end; }
.lyed-top .lyed-num.grow { flex: 1; }
.lyed-tools { grid-area: tools; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-height: calc(100vh - 230px); overflow-y: auto; align-content: start; }
.lyed-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.lyed-main .lyed-hint { align-self: stretch; }
.lyed-hint { margin: 0 0 6px; font-size: .85rem; color: var(--muted); min-height: 2.6em; }
.lyed-canvas { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; height: clamp(300px, calc(100vh - 400px), 700px); aspect-ratio: 1; max-width: 100%; touch-action: none; }
.lyed-props { grid-area: props; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; max-height: calc(100vh - 150px); overflow-y: auto; }
.lyed-bottom { grid-area: bottom; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 0; z-index: 2; }
.lyed-bottom > button { flex: 0 0 auto; }
.lyed-cap { grid-column: 1 / -1; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 8px 0 0; }
.lyed-tool { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px; font-size: .68rem; line-height: 1.1; text-align: center; background: var(--tile); color: var(--ink); border-radius: 10px; }
.lyed-tools > .lyed-tool:first-child { grid-column: 1 / -1; flex-direction: row; gap: 6px; }
.lyed-tool svg { width: 22px; height: 22px; }
.lyed-tool.on { background: var(--accent); color: var(--accent-ink); }
.lyed-num label, .lyed-props label, .lyed-top label { margin: 8px 0 3px; font-size: .74rem; }
.lyed-num input, .lyed-props input:not([type=range]), .lyed-props select, .lyed-top input { padding: 8px 10px; }
.lyed-props input[type=range] { padding: 0; width: 100%; accent-color: var(--accent); }
.lyed-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lyed-props .row { margin-top: 10px; } .lyed-props > button { margin-top: 8px; width: 100%; }
.lyed-note { margin: 2px 0 0; font-size: .74rem; }
.lyed-snap { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); font-size: .85rem; }
.lyed-status { font-size: .8rem; }
.lyed-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; pointer-events: none; color: var(--muted); padding: 24px; }
.lyed-empty b { color: var(--ink); font-size: 1.05rem; margin-bottom: 4px; } .lyed-empty small { margin-top: 10px; max-width: 280px; }
.lyed-svg { display: block; width: 100%; height: 100%; margin: 0; touch-action: none; }
.lyed-svg.draw { cursor: crosshair; }
.lyed-dot { fill: var(--line); }
.lyed-hit { fill: transparent; cursor: move; }
.lyed-sel { fill: rgba(255,210,63,.1); stroke: #ffd23f; stroke-width: 2; }
.lyed-ghost { fill: rgba(47,111,106,.25); stroke: var(--accent); stroke-width: 2; stroke-dasharray: 5 3; pointer-events: none; }
.lyed-band { fill: rgba(47,111,106,.12); stroke: var(--accent); stroke-width: 1; pointer-events: none; }
.lyed-guide { stroke: #e0457b; stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.lyed-h { fill: #fff; stroke: #1c1f22; stroke-width: 1.5; }
.h-nw, .h-se { cursor: nwse-resize; } .h-ne, .h-sw { cursor: nesw-resize; } .h-n, .h-s { cursor: ns-resize; } .h-e, .h-w { cursor: ew-resize; }
.lyed-dpad { display: grid; grid-template-columns: repeat(3, 44px); gap: 4px; justify-content: start; }
.lyed-dpad button { padding: 8px 0; font-size: 1.1rem; }
.lyed-swatch { flex: 1; min-height: 38px; border: 1px solid var(--line); background: var(--tile); color: var(--ink); display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; border-radius: 10px; font-size: .85rem; }
.lyed-colour { margin-top: 4px; }
/* colour picker */
.cp { margin-top: 8px; display: grid; gap: 8px; }
.cp-sv { position: relative; height: 130px; border-radius: 8px; cursor: crosshair; touch-action: none; }
.cp-hue { position: relative; height: 14px; border-radius: 7px; cursor: pointer; touch-action: none; background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.cp-thumb { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; }
.cp-hue .cp-thumb { top: 50%; background: transparent; }
.cp-fields { display: flex; align-items: center; gap: 4px; }
.cp-fields label { margin: 0; flex: 0 0 34px; font-size: .72rem; }
.cp-fields input { flex: 1; min-width: 0; padding: 6px 2px; text-align: center; font-size: .82rem; -moz-appearance: textfield; appearance: textfield; }
.cp-fields input::-webkit-outer-spin-button, .cp-fields input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cp-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.cp-cap { font-size: .7rem; color: var(--muted); margin-right: 4px; }
.cp-sw { width: 24px; height: 24px; padding: 0; border-radius: 6px; border: 1px solid var(--line); }
@media (max-width: 720px) {
  .lyed { grid-template-columns: 1fr; grid-template-areas: "top" "tools" "main" "props" "bottom"; }
  .lyed-tools { display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; max-height: none; gap: 6px; padding-bottom: 4px; }
  .lyed-tools .lyed-cap { display: none; } .lyed-tool, .lyed-tools > .lyed-tool:first-child { flex: 0 0 74px; flex-direction: column; }
  .lyed-canvas { width: 100%; height: auto; }
  .lyed-props { max-height: none; }
  .lyed-status { display: none; }
}

/* sharing, recovery key, reminders */
.notice { background: #fff4d6; color: #5c4400; border: 1px solid #e8cf86; padding: 10px 14px; border-radius: 12px; font-size: 14px; margin: 8px 0; }
:root[data-theme="dark"] .notice { background: #3a3114; color: #f2dd9a; border-color: #5c4d1d; }
.linkbtn { background: none; color: var(--accent); padding: 6px; font-weight: 500; text-decoration: underline; }
.keybox { font-family: ui-monospace, Consolas, monospace; font-size: 1.25rem; font-weight: 700; letter-spacing: .06em; text-align: center; word-break: break-all; background: var(--tile); border-radius: 12px; padding: 14px; user-select: all; }
.qrbox { display: flex; justify-content: center; } .qrbox svg { border-radius: 12px; max-width: 100%; height: auto; }
.kv { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; } .kv span:last-child { text-align: right; word-break: break-all; min-width: 0; }
.tabs.wrap { flex-wrap: wrap; overflow: visible; }
