/* n8n-grid — Airtable-like look. No inline styles anywhere (strict CSP). */
:root {
  --base: #166ee1; --base-dark: #0d52b0; --base-ink: #ffffff;
  --bg: #f5f6f8; --panel: #ffffff; --side: #fbfbfc; --line: #e3e5e8; --line-strong: #d0d3d8;
  --text: #1d1f25; --muted: #616670; --accent: #166ee1; --accent-soft: #e7f0fd; --danger: #dc2d2d;
  --row-hover: #f6f8fb; --sel-row: #ecf3fe; --head: #f7f8f9; --shadow: 0 10px 30px rgba(16, 24, 40, .16);
  --cell-h: 32px; --radius: 6px;
  --p-blue: #cfe0fc; --p-cyan: #c7eff7; --p-teal: #c2f0e3; --p-green: #d0f0c0; --p-yellow: #ffeab6;
  --p-orange: #fee2c5; --p-red: #ffdce5; --p-pink: #fad7f0; --p-purple: #e2d9fc; --p-gray: #e5e9f0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --base: #2a5db8; --base-dark: #1e468c; --bg: #15171b; --panel: #1b1e23; --side: #17191d; --line: #2a2e35; --line-strong: #3a3f48;
    --text: #e8eaee; --muted: #9aa1ad; --accent: #5b9dff; --accent-soft: #1d2b44; --danger: #ff6b5e;
    --row-hover: #20242b; --sel-row: #1f2a3d; --head: #1f2227; --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    --p-blue: #1f3a66; --p-cyan: #134a52; --p-teal: #14473b; --p-green: #234a1c; --p-yellow: #554812;
    --p-orange: #5a3515; --p-red: #5c2130; --p-pink: #57203f; --p-purple: #3b2c66; --p-gray: #353a42;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --base: #2a5db8; --base-dark: #1e468c; --bg: #15171b; --panel: #1b1e23; --side: #17191d; --line: #2a2e35; --line-strong: #3a3f48;
  --text: #e8eaee; --muted: #9aa1ad; --accent: #5b9dff; --accent-soft: #1d2b44; --danger: #ff6b5e;
  --row-hover: #20242b; --sel-row: #1f2a3d; --head: #1f2227; --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  --p-blue: #1f3a66; --p-cyan: #134a52; --p-teal: #14473b; --p-green: #234a1c; --p-yellow: #554812;
  --p-orange: #5a3515; --p-red: #5c2130; --p-pink: #57203f; --p-purple: #3b2c66; --p-gray: #353a42;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Heebo", Arial, sans-serif; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
.hidden { display: none !important; }
.sp { flex: 1; }
.hint { color: var(--muted); font-size: 12px; }

/* ---- layout ---- */
#app { display: flex; flex-direction: column; height: 100%; }
#topbar { display: flex; align-items: flex-end; gap: 10px; background: var(--base); color: var(--base-ink); padding: 0 14px; min-height: 52px; flex: none; }
#topbar .logo { font-size: 20px; align-self: center; }
#baseTitle { font-weight: 700; font-size: 16px; align-self: center; white-space: nowrap; margin-inline-end: 10px; }
#tableTabs { display: flex; gap: 2px; align-self: flex-end; overflow-x: auto; scrollbar-width: none; }
#tableTabs::-webkit-scrollbar { display: none; }
.tab { color: rgba(255, 255, 255, .85); padding: 8px 14px; border-radius: 6px 6px 0 0; white-space: nowrap; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.tab:hover { background: rgba(0, 0, 0, .12); color: #fff; }
.tab.active { background: var(--panel); color: var(--text); font-weight: 600; }
.tb { color: #fff; align-self: center; }
.tb:hover { background: rgba(0, 0, 0, .15) !important; }
.tb-link { color: #fff; text-decoration: none; align-self: center; padding: 5px 10px; border-radius: 14px; background: rgba(255, 255, 255, .16); font-weight: 500; }
.tb-link:hover { background: rgba(255, 255, 255, .28); }
#body { flex: 1; display: flex; min-height: 0; }
#viewsPanel { width: 230px; flex: none; background: var(--side); border-inline-end: 1px solid var(--line); display: flex; flex-direction: column; overflow: auto; }
#app.panel-closed #viewsPanel { display: none; }
.vp-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 14px 16px 6px; }
#viewList { padding: 0 8px; }
.vitem { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius); cursor: pointer; }
.vitem:hover { background: var(--line); }
.vitem.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.vitem .vn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vitem .vm { opacity: 0; color: var(--muted); padding: 0 4px; }
.vitem:hover .vm { opacity: 1; }
.vi { width: 16px; text-align: center; color: var(--accent); }
#viewCreate { padding: 0 8px 8px; border-top: 1px solid var(--line); margin-top: 10px; }
.vnew { display: flex; width: 100%; gap: 8px; align-items: center; padding: 6px 8px; border-radius: var(--radius); color: var(--muted); }
.vnew:hover { background: var(--line); color: var(--text); }
.side-foot { margin-top: auto; padding: 10px 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; border-top: 1px solid var(--line); }
.link { color: var(--muted); padding: 2px 0; }
.link:hover { color: var(--accent); }
main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--panel); }
#toolbar { display: flex; align-items: center; gap: 12px; padding: 6px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#viewName { font-weight: 600; font-size: 14px; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tools { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }
.tool { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: var(--radius); color: var(--muted); }
.tool b { font-weight: 500; }
.tool:hover { background: var(--head); color: var(--text); }
.tool.on { background: var(--accent-soft); color: var(--accent); }
#btnFilter.on { background: #e6f6ea; color: #1e8a3c; }
#btnGroup.on { background: #f3e9fd; color: #7a3fc7; }
#btnSort.on { background: #fff1e3; color: #c5620d; }
.tool.danger { color: var(--danger); }
.badge { font-style: normal; font-size: 11px; background: var(--accent); color: #fff; border-radius: 9px; padding: 0 6px; }
#btnFilter .badge { background: #1e8a3c; } #btnGroup .badge { background: #7a3fc7; } #btnSort .badge { background: #c5620d; }
.badge:empty { display: none; }
.icon { width: 30px; height: 30px; border-radius: var(--radius); color: var(--muted); font-size: 16px; }
.icon:hover { background: var(--head); }
.primary { display: inline-flex; gap: 4px; align-items: center; background: var(--accent); color: #fff; padding: 6px 12px; border-radius: var(--radius); font-weight: 600; }
.primary b { font-weight: 600; }
.primary:hover { filter: brightness(1.08); }
.primary:disabled { opacity: .5; cursor: default; }
.primary.danger-bg { background: var(--danger); }
.ghost { padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--line-strong); }
.ghost:hover { background: var(--head); }
.ghost.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
#search { width: 170px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
#search:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* ---- grid ---- */
#gridWrap { flex: 1; overflow: auto; position: relative; outline: none; }
#grid { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: max-content; min-width: 100%; }
#grid.rh-medium { --cell-h: 56px; }
#grid.rh-tall { --cell-h: 92px; }
#grid th, #grid td { height: var(--cell-h); border-bottom: 1px solid var(--line); border-inline-end: 1px solid var(--line); padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: start; }
#grid.rh-medium tbody td, #grid.rh-tall tbody td { white-space: normal; vertical-align: top; padding-top: 6px; }
#grid.rh-medium tbody td:not(.rn) { display: table-cell; }
#grid.rh-tall img.att { height: 64px; width: 64px; }
#grid.rh-medium img.att { height: 40px; width: 40px; }
#grid thead th { position: sticky; top: 0; z-index: 3; background: var(--head); font-weight: 600; color: var(--muted); user-select: none; border-bottom-color: var(--line-strong); height: 34px; }
#grid th .th { display: flex; align-items: center; gap: 6px; }
#grid th .th .ti { opacity: .7; font-size: 12px; flex: none; width: 14px; text-align: center; }
#grid th .th .tn { overflow: hidden; text-overflow: ellipsis; flex: 1; color: var(--text); font-weight: 500; }
#grid th .th .ts { color: var(--accent); }
#grid th .th .tm { opacity: 0; color: var(--muted); padding: 0 2px; }
#grid th:hover .tm { opacity: 1; }
#grid th .rz { position: absolute; top: 0; inset-inline-end: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 2; }
#grid th .rz:hover, #grid th .rz.drag { background: var(--accent); opacity: .5; }
#grid th.addcol { width: 44px; text-align: center; color: var(--muted); cursor: pointer; font-size: 16px; }
#grid .rn { position: sticky; inset-inline-start: 0; z-index: 2; background: var(--panel); color: var(--muted); font-size: 11px; text-align: center; padding: 0 4px; vertical-align: middle !important; }
#grid thead .rn { z-index: 4; background: var(--head); }
#grid .rn .num { display: inline-block; min-width: 22px; }
#grid .rn input { display: none; margin: 0; vertical-align: middle; }
#grid .rn .exp { display: none; color: var(--accent); font-size: 12px; padding: 0 2px; }
#grid tr:hover .rn .num, #grid tr.sel .rn .num { display: none; }
#grid tr:hover .rn input, #grid tr.sel .rn input, #grid thead .rn input { display: inline-block; }
#grid tr:hover .rn .exp { display: inline-block; }
#grid tbody tr:hover td { background: var(--row-hover); }
#grid tbody tr.sel td { background: var(--sel-row); }
#grid td.primary-col, #grid th.primary-col { position: sticky; inset-inline-start: 56px; z-index: 1; background: var(--panel); border-inline-end: 2px solid var(--line-strong); font-weight: 500; }
#grid thead th.primary-col { z-index: 4; background: var(--head); }
#grid td { cursor: default; position: relative; }
#grid td.active { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 2px; }
#grid td.editing { padding: 0; box-shadow: inset 0 0 0 2px var(--accent); background: var(--panel) !important; overflow: visible; }
#grid td.ro { color: var(--muted); }
#grid td.num, #grid td.cur, #grid td.pct { text-align: end; font-variant-numeric: tabular-nums; }
#grid td.saving { opacity: .55; }
#grid td input.ed { width: 100%; height: 100%; border: 0; padding: 0 8px; background: transparent; outline: none; }
#grid tr.addrow td { color: var(--muted); cursor: pointer; }
#grid tr.addrow td:hover { color: var(--accent); background: var(--row-hover); }
#grid tr.more td { text-align: center; color: var(--muted); }
#grid tr.grp td { background: var(--head) !important; cursor: pointer; font-weight: 600; height: 38px; position: sticky; inset-inline-start: 0; border-top: 1px solid var(--line-strong); }
#grid tr.grp .caret { color: var(--muted); display: inline-block; width: 14px; }
#grid tr.grp .gl { color: var(--muted); font-weight: 500; font-size: 11px; margin-inline-end: 6px; }
#grid tr.grp .gc, .gc { color: var(--muted); font-weight: 500; font-size: 12px; margin-inline-start: 6px; }
#grid tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--head); height: 30px; border-top: 1px solid var(--line-strong); color: var(--muted); font-size: 12px; text-align: end; }
#grid tfoot td.rn { z-index: 4; text-align: center; }
#grid tfoot td.primary-col { z-index: 3; background: var(--head); text-align: start; }
#grid tfoot .sl { font-size: 10px; text-transform: uppercase; letter-spacing: .3px; opacity: .8; }
#grid a { color: var(--accent); text-decoration: none; }
#grid a:hover { text-decoration: underline; }
.chk { display: inline-flex; width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-strong); align-items: center; justify-content: center; font-size: 11px; color: #fff; vertical-align: middle; }
.chk.on { background: #20a35b; border-color: #20a35b; }
.stars { letter-spacing: 1px; color: #f5a623; }
.stars .off { color: var(--line-strong); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; line-height: 18px; margin-inline-end: 4px; background: var(--p-gray); color: var(--text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.c-blue { background: var(--p-blue); } .c-cyan { background: var(--p-cyan); } .c-teal { background: var(--p-teal); }
.c-green { background: var(--p-green); } .c-yellow { background: var(--p-yellow); } .c-orange { background: var(--p-orange); }
.c-red { background: var(--p-red); } .c-pink { background: var(--p-pink); } .c-purple { background: var(--p-purple); } .c-gray { background: var(--p-gray); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
#empty { padding: 60px 20px; text-align: center; color: var(--muted); }
#status { padding: 5px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

/* ---- gallery & kanban ---- */
#cards { flex: 1; overflow: auto; padding: 16px; background: var(--bg); }
#cards.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); grid-auto-rows: max-content; gap: 16px; align-content: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; text-align: start; box-shadow: 0 1px 2px rgba(0, 0, 0, .05); transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: 0 6px 18px rgba(16, 24, 40, .12); transform: translateY(-1px); }
.card .cover { height: 150px; background: var(--head); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); }
.card .cover img.att { width: 100%; height: 100%; object-fit: cover; border-radius: 0; margin: 0; border: 0; cursor: pointer; }
.card .nocover { font-size: 28px; opacity: .25; }
.card .ctitle { font-weight: 600; padding: 10px 12px 4px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .cf { padding: 3px 12px; }
.card .cf:last-child { padding-bottom: 12px; }
.card .cl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.card .cv { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 18px; }
.card .cv a { color: var(--accent); text-decoration: none; }
.card.addcard { display: flex; align-items: center; justify-content: center; min-height: 120px; color: var(--muted); border-style: dashed; background: transparent; font-size: 14px; box-shadow: none; }
.card.addcard:hover { color: var(--accent); border-color: var(--accent); }
#cards.kanban { display: flex; gap: 12px; align-items: flex-start; }
.kb-col { flex: none; width: 270px; background: color-mix(in srgb, var(--line) 55%, transparent); border-radius: 10px; padding: 8px; max-height: 100%; display: flex; flex-direction: column; }
.kb-head { display: flex; align-items: center; padding: 4px 4px 8px; }
.kb-list { display: flex; flex-direction: column; gap: 8px; min-height: 40px; overflow: auto; border-radius: 8px; padding: 2px; }
.kb-list.over { background: var(--accent-soft); outline: 2px dashed var(--accent); }
.kb-list > .card { flex: none; }
.kb-list .card .cover { height: 110px; }
.card.dragging { opacity: .4; }
.kb-add { margin-top: 6px; padding: 6px; border-radius: 6px; color: var(--muted); text-align: start; }
.kb-add:hover { background: var(--panel); color: var(--accent); }
.kb-empty { color: var(--muted); padding: 40px; text-align: center; width: 100%; }

/* ---- popovers / modals ---- */
#popover { position: fixed; z-index: 50; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 10px; min-width: 220px; max-width: min(560px, calc(100vw - 20px)); max-height: 70vh; overflow: auto; }
.pop-title { font-weight: 600; margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.menu { display: flex; flex-direction: column; margin: -4px; }
.menu button { text-align: start; padding: 7px 10px; border-radius: 5px; display: flex; gap: 8px; align-items: center; }
.menu button:hover { background: var(--head); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.frow { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.frow select, .frow input, .field select, .field input, .field textarea { padding: 5px 7px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--panel); min-width: 0; }
.frow .conj { width: 76px; color: var(--muted); font-size: 12px; text-align: center; flex: none; }
.frow .x { color: var(--muted); padding: 2px 6px; }
.frow .x:hover { color: var(--danger); }
.addlink { color: var(--accent); padding: 4px 0; }
.chklist label { display: flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer; }
.opts button { display: block; width: 100%; text-align: start; padding: 4px 6px; border-radius: 5px; }
.opts button:hover, .opts button.hl { background: var(--head); }
.opts input.find { width: 100%; padding: 5px 7px; border: 1px solid var(--line-strong); border-radius: 5px; margin-bottom: 6px; background: var(--panel); }
textarea.long { width: min(440px, 80vw); min-height: 140px; resize: vertical; padding: 8px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--panel); }
textarea.export { width: 100%; min-height: 320px; }
#modalBack { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; overflow: auto; }
#modal { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); width: min(640px, 100%); padding: 20px 22px; }
#modal:has(.utable) { width: min(1000px, 100%); }
#modal h2 { margin: 0 0 14px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
#modal h2 .sp { flex: 1; }
#modal h3 { font-size: 14px; margin: 18px 0 8px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field > label { color: var(--muted); font-size: 12px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.field input, .field select, .field textarea { width: 100%; padding: 7px 9px; }
.field input[type="checkbox"] { width: auto; padding: 0; }
.field > label > input[type="checkbox"] { margin: 0; }
.field textarea { min-height: 90px; resize: vertical; }
.field .multi { display: flex; flex-wrap: wrap; gap: 6px; }
.field .multi label { display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.actions .sp { flex: 1; }
.optrow { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.optrow input { flex: 1; }
.optrow select { width: 110px; flex: none; }
.err-msg { color: var(--danger); font-size: 12px; min-height: 16px; }
#toasts { position: fixed; bottom: 16px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; }
[dir="rtl"] #toasts { transform: translateX(50%); }
.toast { background: #1d1f24; color: #fff; padding: 9px 14px; border-radius: 7px; box-shadow: var(--shadow); max-width: 90vw; }
.toast.err { background: var(--danger); }

/* ---- auth / admin ---- */
/* signed-out: clean branded backdrop instead of a blurred empty app */
#app.locked { visibility: hidden; }
body:has(#app.locked) { background: linear-gradient(160deg, var(--base) 0%, var(--base-dark) 100%); }
body:has(#app.locked) #modalBack { background: transparent; padding-top: 12vh; }
body:has(#app.locked) #modal { width: min(400px, 100%); padding: 28px 30px; }
#meBox { margin-bottom: 4px; font-size: 12px; }
.qrbox { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 6px 0 16px; }
.qrbox img.qr { width: 200px; height: 200px; image-rendering: pixelated; background: #fff; padding: 6px; border-radius: 6px; }
code.secret { font-family: ui-monospace, Consolas, monospace; font-size: 14px; letter-spacing: 1px; background: var(--head); padding: 6px 10px; border-radius: 6px; user-select: all; word-break: break-all; }
code.secret.big { display: block; text-align: center; font-size: 18px; margin: 10px 0; }
input.code { font-size: 22px; letter-spacing: 6px; text-align: center; font-family: ui-monospace, Consolas, monospace; }
.tablewrap { overflow: auto; max-height: 55vh; border: 1px solid var(--line); border-radius: 6px; }
.utable { border-collapse: collapse; width: 100%; font-size: 12px; }
.utable th, .utable td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.utable th { position: sticky; top: 0; background: var(--head); color: var(--muted); }
.utable tr.bad td { color: var(--danger); }
.utable input:not([type=checkbox]), .utable select { padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--panel); width: 100%; min-width: 80px; }
.utable .acts { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.utable .acts .link { font-size: 12px; padding: 0; }
.nowrap { white-space: nowrap; }
.small { font-size: 11px; word-break: break-all; }
.inline-form { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form input, .inline-form select { padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--panel); flex: 1; min-width: 110px; }
.inline-form .primary { flex: none; }

/* ---- attachments ---- */
img.att { height: 24px; width: 24px; object-fit: cover; border-radius: 4px; margin-inline-end: 4px; vertical-align: middle; background: var(--line); cursor: zoom-in; border: 1px solid var(--line); }
img.att.broken { opacity: .3; }
.attf { display: inline-block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--head); margin-inline-end: 4px; cursor: pointer; }
.attedit { width: min(380px, 85vw); }
.attlist { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; margin-bottom: 8px; }
.attrow { display: flex; align-items: center; gap: 8px; }
.attrow img.att { height: 40px; width: 40px; }
.attrow .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attrow .x { color: var(--muted); padding: 2px 6px; }
.attrow .x:hover { color: var(--accent); }
.drop { display: block; border: 2px dashed var(--line-strong); border-radius: 8px; padding: 14px; text-align: center; color: var(--muted); cursor: pointer; font-size: 12px; }
.drop.over, .drop:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.attbox { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.attbox img.att { height: 56px; width: 56px; }
.viewer { display: flex; justify-content: center; }
.viewer img { max-width: 100%; max-height: 70vh; border-radius: 6px; }

/* ---- mobile ---- */
@media (max-width: 760px) {
  #viewsPanel { position: fixed; top: 52px; bottom: 0; inset-inline-start: 0; z-index: 30; display: none; box-shadow: var(--shadow); }
  #viewsPanel.open { display: flex; }
  #app.panel-closed #viewsPanel.open { display: flex; }
  .tool b { display: none; }
  #search { width: 110px; }
  #baseTitle { display: none; }
  #cards.gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
}
