/* app.css — GeoServices' SPA below the Strata bar. Needs shell/tokens.css + shell/shell.css. Logical properties only. */
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 14px; }
a { color: var(--brand); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); }
.s-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { display: flex; min-height: calc(100vh - var(--bar-h)); }
.drawer { width: 264px; flex: none; padding: 8px 12px 24px; position: sticky; top: var(--bar-h); align-self: flex-start;
  max-height: calc(100vh - var(--bar-h)); overflow-y: auto; overflow-x: hidden; }
body.drawer-closed .drawer { display: none; }
.drawer .grp { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 16px 16px 6px; }
.drawer a { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 40px; border-radius: var(--r-pill); color: var(--fg);
  text-decoration: none; font-weight: 500; }
.drawer a:hover { background: var(--surface-2); }
.drawer a[aria-current="page"] { background: var(--brand-soft); color: var(--sel-fg); }
.drawer a .part { margin-inline-start: auto; font: 12px var(--mono); color: var(--muted); direction: ltr; white-space: nowrap; }
.drawer a[aria-current="page"] .part { color: var(--sel-fg); }
.drawer .tree { margin-inline-start: 18px; border-inline-start: 1px solid var(--line); padding-inline-start: 6px; }
.scrim { display: none; }
.new-wrap { position: relative; padding: 4px 4px 12px; }
.new-btn { display: inline-flex; align-items: center; gap: 12px; border: 0; background: var(--surface); box-shadow: var(--shadow-1); border-radius: 16px;
  padding: 16px 24px 16px 18px; font: 500 15px var(--font); color: var(--fg); cursor: pointer; }
.new-btn:hover { box-shadow: var(--shadow); background: #f6f8fc; }
.new-btn svg { width: 24px; height: 24px; fill: none; stroke: var(--app-svc); stroke-width: 2.4; stroke-linecap: round; }
.new-menu { position: absolute; inset-block-start: 64px; inset-inline-start: 4px; width: 240px; padding: 8px; }
.drawer a.t-top { margin-block-end: 4px; }
.drawer a.t-top svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.drawer .grp { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.drawer .grp a { display: inline; height: auto; padding: 0; font-weight: 500; color: var(--muted); border-radius: 4px; }
.drawer .grp a[aria-current="page"] { background: none; color: var(--brand); }
.drawer .grp a.grp-all { text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--brand); }
.tree-root details { margin: 0; }
.tree-root summary { list-style: none; display: flex; align-items: center; gap: 6px; padding-inline-start: 8px; border-radius: var(--r-pill); cursor: pointer; }
.tree-root summary::-webkit-details-marker { display: none; }
.tree-root summary::before { content: ""; width: 0; height: 0; border-block: 5px solid transparent; border-inline-start: 6px solid var(--muted); transition: transform .12s; flex: none; }
[dir="rtl"] .tree-root summary::before { transform: scaleX(-1); }
.tree-root details[open] > summary::before { transform: rotate(90deg); }
.tree-root summary:hover { background: var(--surface-2); }
.tree-root summary a { flex: 1; min-width: 0; height: 34px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-root summary a:hover { background: none; }
.tree-root .t-count { font-size: 12px; color: var(--muted); padding-inline-end: 12px; }
.tree-root .t-off { color: var(--muted); font-size: 10px; padding-inline-end: 12px; }
.tree-root .t-svc { margin-inline-start: 16px; }
.tree-root a.t-type { height: 30px; margin-inline-start: 40px; font: 12px var(--mono); font-weight: 500; color: var(--green); }
.tree-root .t-empty { display: block; margin-inline-start: 32px; color: var(--muted); font-size: 12px; padding: 4px 0; }
.dlg { border: 0; border-radius: var(--r-pop); padding: 24px; box-shadow: var(--shadow); width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--fg); }
.dlg::backdrop { background: rgba(0,0,0,.3); }
.spop .sep { height: 1px; background: var(--line); margin: 6px 0; }
main { flex: 1; min-width: 0; padding: 8px 24px 48px; }
main:focus { outline: none; }

.page-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; }
.page-h h1 { font-size: 22px; font-weight: 400; margin: 0; }
.page-h .grow { flex: 1; }
.lead { color: var(--muted); margin: 0 0 16px; max-width: 72ch; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-block-end: 16px; }
.card h2 { font-size: 16px; font-weight: 500; margin: 0 0 12px; }

.btn { border: 1px solid var(--line); background: var(--surface); color: var(--brand); border-radius: var(--r-pill); padding: 8px 16px;
  font-weight: 500; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); color: #fff; border-color: transparent; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-block-end: 12px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 12px; cursor: pointer; text-decoration: none; color: var(--fg); }
.chip[aria-pressed="true"], .chip.on { background: var(--brand-soft); color: var(--sel-fg); border-color: transparent; }

table.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
table.list th { text-align: start; font-weight: 500; color: var(--muted); font-size: 12px; padding: 10px 12px; border-block-end: 1px solid var(--line); background: var(--surface); }
table.list td { padding: 10px 12px; border-block-end: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-block-end: 0; }
table.list tr:hover td { background: #fbfcfe; }
table.list .name { font-weight: 500; }
table.list .actions { white-space: nowrap; text-align: end; }
.thumb { width: 48px; height: 48px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); object-fit: contain; }

.pill { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: var(--r-pill); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.off { background: #eceff1; color: var(--muted); }
.pill.lock { background: var(--warn-soft); color: var(--warn); }
.pill.pub { background: var(--surface-2); color: var(--fg); }

/* The URL anatomy: every row shows its full URL; each segment links to its component's screen. */
.urlchip { display: flex; align-items: center; gap: 4px; margin-block-start: 6px; max-width: 100%; }
.urlchip .segs { font: 12px var(--mono); direction: ltr; unicode-bidi: isolate; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 8px; overflow-x: auto; white-space: nowrap; min-width: 0; }
.urlchip .segs a { color: var(--fg); text-decoration: none; border-radius: 4px; padding: 0 1px; }
.urlchip .segs a:hover { background: var(--brand-soft); color: var(--sel-fg); }
.urlchip .segs a.p-folder { color: #8430ce; } .urlchip .segs a.p-service { color: var(--app-svc); font-weight: 600; }
.urlchip .segs a.p-type { color: var(--green); } .urlchip .segs a.p-layer { color: var(--brand); font-weight: 600; }
.urlchip .segs .sep { color: var(--muted); }

.anatomy { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-block-start: 12px; }
.anatomy .seg { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.anatomy .seg b { display: block; font: 600 13px var(--mono); direction: ltr; unicode-bidi: isolate; overflow-wrap: anywhere; }
.anatomy .seg span { display: block; font-size: 12px; color: var(--muted); margin-block-start: 2px; }
.anatomy .seg small { display: block; font-size: 12px; color: var(--muted); margin-block-start: 6px; }
.anatomy .seg.empty b { color: var(--muted); font-weight: 400; }

form.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea { border: 1px solid #747775; border-radius: 6px; padding: 9px 10px; background: var(--surface); min-width: 0; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
.field small { color: var(--muted); font-size: 12px; }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; grid-column: 1 / -1; }
.seg-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-pill); overflow: hidden; }
.seg-toggle button { border: 0; background: transparent; padding: 6px 14px; cursor: pointer; }
.seg-toggle button[aria-pressed="true"] { background: var(--brand-soft); color: var(--sel-fg); }
textarea.token { width: 100%; font: 12px var(--mono); direction: ltr; min-height: 72px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.source-row { display: flex; align-items: center; gap: 8px; margin-block-end: 8px; flex-wrap: wrap; }
.source-row input { flex: 1; min-width: 220px; border: 1px solid #747775; border-radius: 6px; padding: 9px 10px; font: 13px var(--mono); background: var(--surface); }
.err { color: var(--bad); background: var(--bad-soft); border-radius: 12px; padding: 8px 12px; }
.note { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; color: var(--fg); }
.help h2 { font-size: 15px; margin: 0 0 4px; }
.help p { margin: 0 0 14px; max-width: 72ch; color: var(--muted); }
.logs td { font-size: 12px; } .logs td.msg { font-family: var(--mono); overflow-wrap: anywhere; }

.snack { position: fixed; inset-block-end: 24px; inset-inline-start: 50%; transform: translateX(-50%); background: #303030; color: #fff;
  padding: 12px 20px; border-radius: 8px; box-shadow: var(--shadow); z-index: 80; max-width: calc(100vw - 32px); }
[dir="rtl"] .snack { transform: translateX(50%); }

/* the bar's search results */
.spop.wide .label { margin-block-start: 8px; }
.spop .hit { display: flex !important; flex-direction: column; gap: 2px; }
.spop .hit .ht { font-weight: 500; }
.spop .hit .hs { font-size: 12px; color: var(--muted); font-family: var(--mono); direction: ltr; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pop-search { max-height: min(70vh, 560px); overflow: auto; }
#s-search-btn { display: none; }

@media (max-width: 900px) {
  .drawer { position: fixed; inset-block: var(--bar-h) 0; inset-inline-start: 0; background: var(--bg); z-index: 50; max-height: none;
    box-shadow: var(--shadow); display: none; }
  body.drawer-open .drawer { display: block; }
  body.drawer-open .scrim { display: block; position: fixed; inset: var(--bar-h) 0 0 0; background: rgba(0,0,0,.25); z-index: 45; }
  main { padding: 8px 16px 48px; }
}
@media (max-width: 760px) {
  #s-search-btn { display: grid; }
  body.s-searching .sbar .search { display: flex; position: absolute; inset-inline: 8px; inset-block-start: 8px; margin: 0; max-width: none; z-index: 2; }
  table.list thead { display: none; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
  table.list tr { border-block-end: 1px solid var(--line); padding: 6px 0; }
  table.list td { border: 0; padding: 4px 12px; }
  table.list .actions { text-align: start; white-space: normal; }
}

/* New › Feature service (#/layers/new): stepper, tabs, storage browser, drop zone, upload rows. */
.small { font-size: 12px; }
.stepper { display: flex; gap: 8px 24px; flex-wrap: wrap; list-style: none; padding: 0; margin: 4px 0 16px; color: var(--muted); }
.stepper li { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.stepper .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); font-size: 12px; }
.stepper li.on { color: var(--fg); } .stepper li.on .num { background: var(--brand); border-color: transparent; color: #fff; }
.stepper li.done .num { background: var(--brand-soft); border-color: transparent; color: var(--sel-fg); }
.tabs { display: flex; gap: 4px; border-block-end: 1px solid var(--line); margin-block-end: 16px; overflow-x: auto; }
.tabs .tab { padding: 10px 16px; color: var(--muted); text-decoration: none; font-weight: 500; border-block-end: 3px solid transparent; white-space: nowrap; }
.tabs .tab[aria-selected="true"] { color: var(--brand); border-block-end-color: var(--brand); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-weight: 500; margin-block-end: 4px; }
.crumbs a { text-decoration: none; } .crumbs .sep { color: var(--muted); }
[dir="rtl"] .crumbs .sep { transform: scaleX(-1); display: inline-block; }
table.files { margin-block-start: 8px; }
table.files .fobj { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); overflow-wrap: anywhere; }
table.files .fobj .i { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linejoin: round; }
table.files a.fobj .i { stroke: var(--app-svc); }
details.card > summary { cursor: pointer; font-weight: 500; color: var(--brand); }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; margin-block: 16px 8px; padding: 28px 16px;
  border: 2px dashed #a8c7fa; border-radius: var(--r); background: #f8fafd; cursor: pointer; }
.dropzone svg { width: 36px; height: 36px; fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dropzone b { font-size: 16px; font-weight: 500; }
.dropzone .link { color: var(--brand); font-weight: 500; }
.dropzone small { color: var(--muted); max-width: 60ch; }
.dropzone.over, .dropzone:hover { background: var(--brand-soft); border-color: var(--brand); }
.dropzone:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.uplist { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.uplist li { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.uplist .up-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.uplist .up-h .name { font-weight: 500; overflow-wrap: anywhere; min-width: 0; }
.uplist .up-h .pill { margin-inline-start: auto; white-space: normal; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.busy { background: var(--brand-soft); color: var(--sel-fg); }
.progress { block-size: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-block-start: 8px; }
.progress span { display: block; block-size: 100%; background: var(--brand); transition: inline-size .2s; }
.progress.indeterminate span { animation: gs-indet 1.2s ease-in-out infinite; inline-size: 40% !important; }
@keyframes gs-indet { from { margin-inline-start: -40%; } to { margin-inline-start: 100%; } }
.uplist .out { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-block-start: 8px; font-size: 13px; }
.uplist .out > span:first-child { overflow-wrap: anywhere; min-width: 0; }
.uplist .out .btn { margin-inline-start: auto; }
main p.small, main .note, main .lead { overflow-wrap: anywhere; }

/* Publish › add a view: the field picker (ADR-0003 §5) */
.cols { border: 0; padding: 0; margin: 0; }
.col-list { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-block-start: 6px; max-block-size: 220px; overflow: auto; }
.col-list .check { display: inline-flex; align-items: center; gap: 6px; }
td.use { white-space: nowrap; }
/* storage form: radios drawn as chips */
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
label.chip:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ── My data (my.mjs): storage bar, query builder, attributes, the admin's store form ─────────────────────── */
.quota { block-size: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-block: 12px 6px; }
.quota > span { display: block; block-size: 100%; background: var(--brand); }
.quota.warn > span { background: var(--warn); }
.quota.full > span { background: var(--bad); }
.pub-layer h3, .card h3 { font-weight: 500; font-size: 15px; margin-block: 18px 6px; }
.q { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.qhead, .qadd, .rule { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rules { display: flex; flex-direction: column; gap: 8px; margin-block: 8px; }
.rules:empty { display: none; }
.rule select, .rule input, .qhead select, table.attrs input:not([type="checkbox"]), table.list input[type="number"] {
  border: 1px solid #747775; border-radius: 6px; padding: 7px 9px; background: var(--surface); color: var(--fg); min-inline-size: 0; max-inline-size: 100%; }
.rule input { flex: 1 1 140px; }
.rgroup { border-inline-start: 3px solid var(--brand); padding-inline-start: 12px; }
table.attrs small { display: block; }
#ustore-form [data-for] { display: none; }
#ustore-form[data-kind="local"] [data-for~="local"], #ustore-form[data-kind="rustfs"] [data-for~="rustfs"], #ustore-form[data-kind="ovh"] [data-for~="ovh"], #ustore-form[data-kind="geostore"] [data-for~="geostore"] { display: flex; }
#ustore-form small[data-for] { margin-block-start: 4px; }
#ustore-form[data-kind="local"] small[data-for~="local"], #ustore-form[data-kind="rustfs"] small[data-for~="rustfs"], #ustore-form[data-kind="ovh"] small[data-for~="ovh"], #ustore-form[data-kind="geostore"] small[data-for~="geostore"] { display: block; }
.tscroll { overflow-x: auto; max-inline-size: 100%; }
.urlchip.my-url { max-inline-size: 100%; margin-block-start: 4px; }
.urlchip.my-url .segs { overflow-wrap: anywhere; white-space: normal; min-inline-size: 0; }

/* Publish view, "1 · Service location" (25 Nov 2026): an existing service's title and description, read only. */
#pub-form p.ro { margin: 2px 0 0; padding: 6px 8px; border-radius: 6px; background: var(--surface-2, #f4f6f8); white-space: pre-wrap; overflow-wrap: anywhere; }
#pub-form #pb-target { max-width: 100%; }
