:root {
  --bg: #0d0b12;
  --bg2: #120f19;
  --s1: #17131f;
  --s2: #1e1929;
  --s3: #272036;
  --line: #2e2640;
  --line2: #3b3252;
  --text: #efebf7;
  --muted: #a39cb8;
  --dim: #6f6886;
  --or: #ff7a1a;
  --or2: #ff9a4d;
  --pu: #8b5cf6;
  --pu2: #a86bff;
  --ok: #36d68a;
  --bad: #ff4d5e;
  --warn: #ffb020;
  --grad: linear-gradient(135deg, #ff7a1a 0%, #e0458c 52%, #8b5cf6 100%);
  --r: 12px;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.4 var(--sans); overflow: hidden; }
body { overscroll-behavior: none; user-select: none; -webkit-user-select: none; }
input, textarea, select, [contenteditable] { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; }
.ic { flex: none; display: block; }
.hidden { display: none !important; }
#app { height: 100dvh; display: flex; flex-direction: column; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line2); background: var(--s2); color: var(--text); font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: background .15s, border-color .15s, transform .08s; }
.btn:active { transform: scale(.97); }
.btn:hover { background: var(--s3); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--s2); }
.btn.danger { color: #ff7f8a; border-color: #5a2633; background: #2a1219; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 44px; padding: 0; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.iconbtn { width: 44px; height: 44px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer; }
.iconbtn:hover { background: var(--s2); color: var(--text); }
.iconbtn[disabled] { opacity: .35; pointer-events: none; }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.in, select.in, textarea.in { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--bg2); color: var(--text); font: 15px var(--sans); outline: none; }
textarea.in { min-height: 88px; resize: vertical; line-height: 1.45; }
.in:focus { border-color: var(--or); box-shadow: 0 0 0 3px rgba(255,122,26,.18); }
.in.mono { font-family: var(--mono); font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.spacer { flex: 1; }

.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); min-height: 36px; padding: 0 14px; border-radius: 8px;
  font-weight: 600; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.seg button.on { background: var(--s3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line2);
  background: var(--s1); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip.on { color: #fff; border-color: var(--or); background: rgba(255,122,26,.14); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--s3); color: var(--muted); white-space: nowrap; }
.pill.ok { background: rgba(54,214,138,.14); color: var(--ok); }
.pill.bad { background: rgba(255,77,94,.14); color: var(--bad); }
.pill.warn { background: rgba(255,176,32,.14); color: var(--warn); }
.pill.or { background: rgba(255,122,26,.15); color: var(--or2); }
.badge { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #120e1a; flex: none;
  box-shadow: 0 0 0 2px rgba(12,10,18,.9); }
.badge.lg { width: 46px; height: 46px; }

/* ---------- connect / auth ---------- */
.connect { flex: 1; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(800px 500px at 15% 0%, rgba(255,122,26,.16), transparent 60%),
  radial-gradient(800px 600px at 100% 100%, rgba(139,92,246,.2), transparent 60%), var(--bg); overflow: auto; }
.card { background: var(--s1); border: 1px solid var(--line); border-radius: 18px; padding: 28px; width: min(480px, 100%); box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.brandmark { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.brandmark img { width: 52px; height: 52px; border-radius: 12px; }
.brandmark .t1 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--or2); font-weight: 800; }
.brandmark .t2 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.err { color: #ff8d97; font-size: 13px; min-height: 18px; }

/* ---------- sites ---------- */
.topbar { height: 64px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #15111e, #110e18); position: relative; z-index: 5; }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--grad); opacity: .55; }
.topbar .title { display: flex; flex-direction: column; min-width: 0; }
.topbar .title b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { height: 36px; max-width: 150px; object-fit: contain; }
.sites { flex: 1; overflow: auto; padding: 22px; }
.sites-head { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.sites-head h1 { margin: 0; font-size: 26px; letter-spacing: -.01em; }
.search { position: relative; flex: 1; max-width: 420px; min-width: 200px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.search .in { padding-left: 40px; }
.sitegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.sitecard { background: var(--s1); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  transition: border-color .15s, transform .1s; }
.sitecard:hover { border-color: var(--line2); }
.sitecard:active { transform: scale(.985); }
.sitecard .thumb { aspect-ratio: 16/10; background: #fff center/contain no-repeat; position: relative; }
.sitecard .thumb.none { background: repeating-linear-gradient(45deg, var(--s2) 0 12px, var(--s1) 12px 24px); display: grid; place-items: center; color: var(--dim); }
.sitecard .meta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.sitecard .meta b { font-size: 16px; }
.sitecard .meta .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sitecard .meta .stats { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.empty-state { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-state h2 { color: var(--text); margin: 14px 0 6px; }

/* ---------- editor ---------- */
.editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ebody { flex: 1; display: flex; min-height: 0; position: relative; }
.rail { width: 72px; flex: none; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 10px 0; overflow-y: auto; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.tool { width: 58px; min-height: 54px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; font-size: 10px; font-weight: 700;
  letter-spacing: .02em; position: relative; flex: none; }
.tool:hover { background: var(--s2); color: var(--text); }
.tool.on { background: var(--s3); color: #fff; border-color: var(--line2); }
.tool.on::before { content: ""; position: absolute; left: -7px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--or); }
.tool .sw { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #120e1a; }
.tool.toggle.off { opacity: .45; }
.rail hr { width: 40px; border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.tool .more { position: absolute; right: 5px; bottom: 5px; width: 0; height: 0; border-left: 5px solid transparent; border-bottom: 5px solid currentColor; opacity: .6; }

.stage { flex: 1; position: relative; overflow: hidden; background:
  radial-gradient(circle at 1px 1px, rgba(255,255,255,.05) 1px, transparent 0) 0 0/22px 22px, #0b0910; touch-action: none; }
.stage canvas { position: absolute; inset: 0; touch-action: none; }
.hint { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(22,18,31,.94); border: 1px solid var(--line2);
  padding: 9px 14px 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; display: flex; gap: 10px; align-items: center; box-shadow: 0 8px 30px rgba(0,0,0,.4);
  max-width: calc(100% - 40px); z-index: 3; }
.hint .btn { min-height: 30px; }
.zoomctl { position: absolute; right: 14px; bottom: 14px; display: flex; flex-direction: column; background: rgba(22,18,31,.94); border: 1px solid var(--line2);
  border-radius: 14px; padding: 4px; gap: 2px; z-index: 3; }
.tray { position: absolute; left: 14px; right: 80px; bottom: 14px; display: flex; gap: 8px; align-items: center; background: rgba(22,18,31,.96);
  border: 1px solid var(--line2); border-radius: 14px; padding: 8px; overflow-x: auto; z-index: 3; scrollbar-width: thin; }
.tray .lbl { font-size: 12px; font-weight: 800; color: var(--or2); text-transform: uppercase; letter-spacing: .08em; padding: 0 6px; white-space: nowrap; }
.traychip { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px 0 6px; border-radius: 999px; border: 1px solid var(--line2);
  background: var(--s2); cursor: pointer; white-space: nowrap; font-weight: 600; font-size: 14px; flex: none; }
.traychip .badge { width: 30px; height: 30px; }
.traychip.on { border-color: var(--or); background: rgba(255,122,26,.15); }
.ebody.panel-open .zoomctl { right: 414px; }
.ebody.panel-open .tray { right: 480px; }
.ebody.panel-open .hint { left: calc(50% - 200px); max-width: calc(100% - 440px); }
.emptyplan { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; }
.dropzone { border: 2px dashed var(--line2); border-radius: 22px; padding: 44px 36px; text-align: center; max-width: 520px; background: rgba(23,19,31,.7); }
.dropzone h2 { margin: 16px 0 6px; }
.dropzone p { color: var(--muted); margin: 0 0 22px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); font-weight: 600; padding: 0 6px; white-space: nowrap; }
.status .d { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.status.saving .d { background: var(--warn); animation: pulse 1s infinite; }
.status.offline .d, .status.error .d { background: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }

/* popover menus */
.pop { position: fixed; z-index: 60; background: var(--s1); border: 1px solid var(--line2); border-radius: 14px; padding: 6px; min-width: 210px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55); display: flex; flex-direction: column; gap: 2px; }
.pop button { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 9px; border: 0; background: transparent; text-align: left;
  font-weight: 600; cursor: pointer; }
.pop button:hover, .pop button.on { background: var(--s3); }
.pop .badge { width: 30px; height: 30px; }

/* side panel */
.panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 92%); background: var(--s1); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 10; box-shadow: -20px 0 60px rgba(0,0,0,.45); transform: translateX(105%); transition: transform .22s ease; }
.panel.open { transform: none; }
.panel .ph { display: flex; align-items: center; gap: 12px; padding: 14px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.panel .ph .ref { font-size: 12px; font-weight: 800; letter-spacing: .1em; color: var(--or2); }
.panel .pb { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.panel .pf { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.sect { display: flex; flex-direction: column; gap: 12px; }
.sect > h4 { margin: 4px 0 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); font-weight: 800; }
.slider { display: grid; grid-template-columns: 74px 1fr 64px; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); font-weight: 600; }
.slider input[type=range] { width: 100%; accent-color: var(--or); height: 32px; }
.slider .val { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 13px; }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: rgba(255,122,26,.1); border: 1px solid rgba(255,122,26,.35); font-size: 14px; }
.banner.info { background: rgba(139,92,246,.1); border-color: rgba(139,92,246,.35); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); overflow-wrap: anywhere; }
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photos .ph-i { aspect-ratio: 1; border-radius: 10px; background: var(--s3) center/cover no-repeat; border: 1px solid var(--line); cursor: pointer; position: relative; }
.photos .ph-i .cap { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; padding: 4px 6px; background: linear-gradient(transparent, rgba(0,0,0,.8));
  border-radius: 0 0 10px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photos .add { aspect-ratio: 1; border-radius: 10px; border: 2px dashed var(--line2); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer; background: transparent; }
.photos .add.busy { opacity: .5; pointer-events: none; }
.stylechips { display: flex; gap: 6px; flex-wrap: wrap; }

/* list view */
.listview { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.listbar { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.listbar .chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tablewrap { flex: 1; overflow: auto; }
table.devs { width: 100%; border-collapse: collapse; font-size: 14px; }
table.devs th { position: sticky; top: 0; background: var(--bg2); text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim);
  padding: 10px 12px; border-bottom: 1px solid var(--line); z-index: 1; white-space: nowrap; }
table.devs td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
table.devs tr { cursor: pointer; }
table.devs tbody tr:hover td { background: var(--s1); }
table.devs tr.sel td { background: rgba(255,122,26,.08); }
table.devs .nm { display: flex; align-items: center; gap: 10px; }
table.devs .nm .badge { width: 30px; height: 30px; }
table.devs .nm b { display: block; }
table.devs .nm small { color: var(--muted); }
table.devs td.mono { font-size: 13px; color: #d9d3ea; }
.groupcap td { background: var(--bg) !important; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); cursor: default; padding-top: 18px !important; }

/* modals */
.scrim { position: fixed; inset: 0; background: rgba(5,4,9,.66); backdrop-filter: blur(3px); z-index: 40; display: grid; place-items: center; padding: 18px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--s1); border: 1px solid var(--line2); border-radius: 18px; width: min(640px, 100%); max-height: calc(100dvh - 36px); display: flex; flex-direction: column;
  box-shadow: 0 30px 90px rgba(0,0,0,.6); animation: rise .18s ease; }
.modal.wide { width: min(860px, 100%); }
.modal.narrow { width: min(420px, 100%); }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.modal .mh { display: flex; align-items: center; gap: 12px; padding: 16px 14px 14px 20px; border-bottom: 1px solid var(--line); }
.modal .mh h3 { margin: 0; font-size: 18px; flex: 1; }
.modal .mb { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal .mf { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.radiocards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.radiocards label { border: 1px solid var(--line2); border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; background: var(--bg2); }
.radiocards label b { font-size: 14px; }
.radiocards label span { font-size: 12px; color: var(--muted); }
.radiocards input { display: none; }
.radiocards label:has(input:checked) { border-color: var(--or); background: rgba(255,122,26,.1); }
.checks { display: flex; flex-direction: column; gap: 2px; }
.checks label { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 600; cursor: pointer; }
.checks input { width: 22px; height: 22px; accent-color: var(--or); }
.syncrow { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.syncrow:last-child { border-bottom: 0; }
.syncrow .sub { font-size: 12px; color: var(--muted); font-family: var(--mono); }
.syncrow select { min-height: 38px; padding: 6px 10px; width: 210px; }
.synchead { display: flex; align-items: center; gap: 10px; font-weight: 800; margin-top: 4px; }
.progress { height: 6px; border-radius: 6px; background: var(--s3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--grad); width: 0; transition: width .2s; }
.logoprev { height: 64px; border-radius: 10px; border: 1px solid var(--line2); background: #fff center/contain no-repeat; flex: 1; }
.colorin { width: 54px; height: 44px; padding: 3px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.92); display: flex; flex-direction: column; }
.lightbox .lbimg { flex: 1; background: center/contain no-repeat; margin: 12px; }
.lightbox .lbbar { display: flex; gap: 10px; padding: 12px 16px 18px; align-items: center; }

/* toast */
.toasts { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #241d33; border: 1px solid var(--line2); border-radius: 12px; padding: 12px 18px; font-weight: 600; box-shadow: 0 10px 40px rgba(0,0,0,.5);
  animation: rise .2s; max-width: 90vw; }
.toast.bad { border-color: #6b2a35; }

@media (max-width: 760px) {
  .topbar .hide-sm { display: none !important; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .radiocards { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
}

/* completion / tasks */
.tick { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line2); display: inline-flex; align-items: center; justify-content: center; flex: none; background: var(--bg2); color: #fff; transition: background .15s, border-color .15s; }
.tick.on { background: #1fbf6f; border-color: #1fbf6f; }
.tick.add { border-style: dashed; color: var(--muted); }
.donebtn { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--bg2); font-weight: 700; font-size: 15px; cursor: pointer; text-align: left; }
.donebtn.on { border-color: rgba(31,191,111,.55); background: rgba(31,191,111,.12); color: #7ff0b4; }
.segcount { font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 999px; background: var(--s3); color: var(--muted); }
.segcount:empty { display: none; }
.segcount.full { background: rgba(31,191,111,.2); color: var(--ok); }
.taskhead { display: flex; gap: 16px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.tprog { flex: 1; max-width: 520px; }
.tprog .row { gap: 12px; align-items: baseline; }
.tasklist { padding: 4px 16px 40px; max-width: 900px; }
.tsect { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 18px 4px 8px; }
.tsect span { letter-spacing: 0; font-variant-numeric: tabular-nums; }
.trow { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 6px 8px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 10px; }
.trow:hover { background: var(--s1); }
.trow.sel { background: rgba(255,122,26,.08); }
.trow .badge { width: 30px; height: 30px; }
.tbtn { background: transparent; border: 0; padding: 6px; margin: -6px; cursor: pointer; }
.ttext { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ttext b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ttext small { color: var(--muted); font-size: 12px; }
.trow.done .ttext b { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.3); }
.addtask { cursor: default; }
.addtask .in { min-height: 40px; }

/* iPad / iPhone home-screen app: keep clear of the status bar, rounded corners and home indicator */
#app { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.rail { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.panel .pf { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.zoomctl { bottom: calc(14px + env(safe-area-inset-bottom)); }
.tray { bottom: calc(14px + env(safe-area-inset-bottom)); }
.sites, .tablewrap { padding-bottom: env(safe-area-inset-bottom); }
.lightbox .lbbar { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
/* iOS zooms into inputs under 16px — keep form fields at 16px on touch devices */
@media (pointer: coarse) { .in, select.in, textarea.in { font-size: 16px; } }

/* UniFi model picker */
.pop.picker { width: 330px; max-height: min(620px, calc(100dvh - 16px)); padding: 0; overflow: hidden; }
.pop.picker .psearch { position: relative; padding: 8px; border-bottom: 1px solid var(--line); flex: none; }
.pop.picker .psearch .ic { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.pop.picker .psearch .in { padding-left: 36px; min-height: 40px; }
.pop.picker .plist { overflow-y: auto; padding: 4px 6px 8px; display: flex; flex-direction: column; gap: 1px; -webkit-overflow-scrolling: touch; }
.pop.picker .plist button { min-height: 44px; }
.pop.picker .plist button > span:not(.badge):not(.pthumb) { flex: 1; }
.pop.picker .plist button > .badge, .pop.picker .plist button > .pthumb { flex: none; }
.pop.picker .plist button small { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.pop .pgrp { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); padding: 10px 12px 4px; }
.modelbtn { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; }
.modelbtn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* UniFi product pictures */
.pthumb { position: relative; display: inline-flex; flex: none; width: 34px; height: 34px; align-items: center; justify-content: center; }
.pthumb > img { position: absolute; inset: -3px; width: calc(100% + 6px); height: calc(100% + 6px); object-fit: contain; opacity: 0; transition: opacity .15s; }
.pthumb.ok > img { opacity: 1; }
.pthumb.ok > .badge { opacity: 0; }
.pop .pthumb, .trow .pthumb, table.devs .pthumb { width: 30px; height: 30px; }
.syncrow .pthumb { width: 34px; height: 34px; }
.prodhero { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px;
  background: radial-gradient(120% 140% at 0% 50%, rgba(255,255,255,.09), rgba(255,255,255,.02)); border: 1px solid var(--line); }
.prodhero img { width: 92px; height: 92px; object-fit: contain; flex: none; filter: drop-shadow(0 6px 14px rgba(0,0,0,.45)); }
.prodhero b { display: block; font-size: 17px; }
.prodhero small { color: var(--muted); }
