/* Cloud Pavilion V2 — flat layer + phone layout.
   Loaded last. Overrides V1's styles for V2 only (V1 files are untouched).
   Rule of thumb: no boxed cards. Structure comes from hairline dividers, spacing and type;
   corners are square or barely rounded (2–4px); no glows, no thick borders. */

:root { --radius: 4px; --radius-s: 3px; --hair: 1px solid var(--line); }

/* ---------- controls ---------- */
.btn { border-radius: 5px; }
.btn.primary { box-shadow: none; }
.btn.sm { border-radius: 4px; }
.iconbtn { border-radius: 5px; background: transparent; }
.search, .goto { border-radius: 5px; }
kbd { border-bottom-width: 1px; border-radius: 3px; }
.tag2 { border-radius: 2px; }

/* filters become text tabs with an underline */
.chips { gap: 18px; border-bottom: var(--hair); margin-bottom: 22px; }
.chip { height: 36px; padding: 0; border: 0; border-radius: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; }
.chip.on { background: transparent; color: var(--text); border-bottom-color: var(--canopy); font-weight: 600; }
.chip.on .n { color: var(--text-3); }

/* state: a dot and a word, no capsule */
.pill { border: 0; background: transparent !important; padding: 0; gap: 6px; }
.brainbadge { border: 0; padding: 0; color: var(--text-3); }

/* ---------- stats: one ruled row, not four boxes ---------- */
.stats { gap: 0; border-top: var(--hair); border-bottom: var(--hair); }
.stat { background: transparent; border: 0; border-radius: 0; border-left: var(--hair); padding: 14px 18px; }
.stat:first-child { border-left: 0; padding-left: 0; }

/* ---------- agent grid: thumbnails and text, no card box ---------- */
.grid { gap: 30px 22px; }
.card { background: transparent; border: 0; border-radius: 0; overflow: visible; }
.card:hover { transform: none; border: 0; }
.card .thumb { border: var(--hair); border-radius: 3px; }
.card:hover .thumb { border-color: var(--line-3); }
.card.needs { border: 0; box-shadow: none; }
.card.needs .thumb { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.card .body { padding: 11px 1px 0; }
.card .ask { left: 0; right: 0; top: 0; border: 0; border-radius: 0; border-bottom: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.card.new { min-height: 0; aspect-ratio: 1280 / 760; border: 1px dashed var(--line-2); border-radius: 3px; }
.card.new:hover { border: 1px dashed var(--line-3); }
.card.new .plus { border-radius: 4px; background: transparent; }

/* ---------- panels / tables: ruled sections ---------- */
.panel { background: transparent; border: 0; border-top: var(--hair); border-radius: 0; overflow-x: auto; }
.panel .ph { padding: 14px 0; }
table.t th { padding: 10px 14px 10px 0; }
table.t td { padding: 11px 14px 11px 0; }
.tile { background: transparent; border: 0; border-top: var(--hair); border-radius: 0; padding: 16px 0 6px; min-height: 0; }
.tile .logo { border-radius: 4px; }
.three { gap: 0 28px; }
.codeblock { border-radius: 2px; }
.gate { padding: 18px 0; }
.gate .box { border-radius: 2px; background: transparent; }
.gate .box.mid { background: color-mix(in srgb, var(--canopy) 6%, transparent); }

/* asks and notes: a rule on the left, no box */
.approval { border: 0; border-left: 2px solid var(--warn); border-radius: 0; background: color-mix(in srgb, var(--warn) 5%, transparent); }
.approval.done { border-left-color: var(--line-2); background: transparent; }
.approval pre { border: 0; border-radius: 2px; }
.note { border: 0; border-left: 2px solid var(--sky); border-radius: 0; background: transparent; padding: 2px 0 2px 12px; }
.note.warn { border-left-color: var(--warn); }
.check { background: transparent; border: 0; border-bottom: var(--hair); border-radius: 0; padding: 10px 0; }

/* ---------- overlays ---------- */
.modal, .palette { border-radius: 4px; border-color: transparent; box-shadow: var(--elev-3); }
.opt { border-radius: 3px; background: transparent; }
.opt.on { box-shadow: none; }
.field input[type=text], .field select, .field textarea { border-radius: 4px; }
.toast { border-radius: 4px; }
.toast .ti { border-radius: 4px; }
.keybox { border-radius: 3px; }

/* ---------- agent view ---------- */
.screen { border-radius: 3px; }
.win { border-radius: 6px; }
.winstrip button { border-radius: 4px; background: transparent; }
.winstrip button.on { background: var(--ink-2); }
.composer .box { border-radius: 4px; }
.ev .ic { border-radius: 4px; }
.ev.msg .bubble { border: 0; border-radius: 3px; }

/* ---------- V2 layer ---------- */
#grounds { touch-action: auto; }
#grounds.world { touch-action: none; }
.own, .own .frame { border-radius: 2px; }
.own .corner { border-width: 0; }
.own .corner.tl { border-width: 1.5px 0 0 1.5px; border-radius: 0; }
.own .corner.tr { border-width: 1.5px 1.5px 0 0; border-radius: 0; }
.own .corner.bl { border-width: 0 0 1.5px 1.5px; border-radius: 0; }
.own .corner.br { border-width: 0 1.5px 1.5px 0; border-radius: 0; }
.own .plate button { border-radius: 4px; background: transparent; }
.own .plate button.zoom { background: var(--paper); }
.own .plate .lockchip { border: 0; padding: 0; }
.own .plate .lockchip.open { background: transparent; }
#grounds.world .own .frame { border-width: 1.5px; }
.hud-top { border-radius: 5px; box-shadow: none; }
.legend, .minimap { border-radius: 3px; }
.hud-zoom button { border-radius: 4px; }
.homebtn button { border-radius: 5px; box-shadow: var(--elev-2); }
.hovercard { border-radius: 3px; }
.hud-msg { border-radius: 4px; }
.counter .offer { background: transparent; border: 0; border-bottom: var(--hair); border-radius: 0; padding: 14px 2px; }
.counter .offer:last-of-type { border-bottom: 0; }
.counter .panel { border-top: 0; }
.counter textarea, .counter input.amt, .offer select { border-radius: 3px; }
.receipt { border: 0; border-left: 2px solid var(--ok); border-radius: 0; }
.toggle { border-radius: 11px; }
.counter .sec { margin-top: 14px; }

/* ---------- phone tab bar (lives inside the console, at the bottom of .main) ---------- */
.mnav { display: none; }
.mnav button { flex: 1; background: none; border: 0; color: var(--text-3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; position: relative; padding: 0; }
.mnav button svg { width: 20px; height: 20px; }
.mnav button.on { color: var(--text); }
.mnav button.on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; background: var(--canopy); }
.mnav .b { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 15px; height: 15px; border-radius: 8px; background: var(--canopy); color: var(--canopy-ink); font-size: 9.5px; font-weight: 700; display: grid; place-items: center; padding: 0 3px; }
.morelist { display: flex; flex-direction: column; }
.morelist button { display: flex; align-items: center; gap: 12px; background: none; border: 0; border-bottom: var(--hair); color: var(--text); padding: 15px 4px; text-align: left; font-size: 15px; }
.morelist button svg { width: 18px; height: 18px; color: var(--text-2); }
.morelist button span { margin-left: auto; color: var(--text-3); font-size: 13px; font-family: var(--mono); }
/* More's Views (views.js): a full-width column like the rest of the list, one hairline per row under the row (the row's
   ↑ ↓ sit inside it, borderless) — the hairline stopped at the label, and "New view" was only as wide as its words */
.morelist #moreViews { display: flex; flex-direction: column; }
.morelist .vw-more-row { border-bottom: var(--hair); }
.morelist .vw-more-row > button:first-child { border-bottom: 0; }
.morelist .vw-more-mv .btn { border: 0; background: none; min-width: 36px; justify-content: center; }
.morelist .vw-more-mv .btn:disabled { opacity: .35; }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .agentview { display: block; height: auto; }
  .agentview .stage { border-right: 0; }
  .agentview .screenwrap { flex: none; height: min(62vw, 560px); min-height: 220px; }
  .agentview .side { display: flex; border-top: var(--hair); }
  .agentview .feed { max-height: none; overflow: visible; }
}

/* ---------- phone ---------- */
@media (max-width: 780px) {
  body { font-size: 15px; }
  .mnav { display: flex; flex: none; height: 58px; border-top: var(--hair); background: var(--ink-0); padding-bottom: env(safe-area-inset-bottom); }
  .topbar { padding: 0 12px; gap: 8px; height: 52px; }
  .crumbs, .avatars { display: none; }
  .search { width: auto; flex: 1; padding: 8px 10px; font-size: 14px; }
  .search kbd { display: none; }
  .page { padding: 18px 14px 40px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 24px; }
  .page-head p { font-size: 14px; }
  .page-head .actions { margin-left: 0; width: 100%; flex-wrap: wrap; } /* three or four buttons wrap rather than run off the edge (the artifact page) */
  .page-head .actions .btn { flex: 1 1 auto; justify-content: center; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 12px 0 12px 14px; }
  .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: var(--hair); }
  .stat .v { font-size: 21px; }
  .chips { gap: 16px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .chip { flex: none; }
  .grid { grid-template-columns: 1fr; gap: 26px; }
  .two, .three { grid-template-columns: 1fr; }
  table.t { font-size: 12.5px; }
  /* a button in a table cell wraps its words on a phone rather than pushing the table past the screen's edge
     (Machines › Jobs: "Add key in the vault" was cut at 375 px) */
  table.t td .btn { white-space: normal; height: auto; min-height: 30px; min-width: 6.5em; padding: 5px 8px; line-height: 1.25; text-align: center; justify-content: center; }
  .gate { grid-template-columns: 1fr; }
  .gate .arrow { transform: rotate(90deg); }
  .agentbar { padding: 10px 12px; gap: 8px; }
  .agentbar .sub { flex-wrap: wrap; gap: 4px 10px; }
  .agentbar .tag2 { display: none; }
  .tabs { overflow-x: auto; scrollbar-width: none; padding: 0 6px; }
  .tabs button { flex: none; }
  .agentview .screenwrap { padding: 10px; height: 64vw; min-height: 210px; }
  .winstrip { padding: 0 10px 12px; }
  .composer { position: sticky; bottom: 0; background: var(--ink-0); }
  /* sheets fill the screen */
  .modal { width: 100vw; max-height: 100%; height: 100%; margin: 0; border-radius: 0; border: 0; display: flex; flex-direction: column; }
  .modal .mb { flex: 1; overflow: auto; }
  .drawer { width: 100vw; border-left: 0; }
  .palette { margin: 0; width: 100vw; border-radius: 0; border: 0; height: 100%; }
  .palette .res { max-height: none; }
  .toasts { left: 10px; right: 10px; bottom: 70px; }
  .toast { width: auto; }
  .entry h1 { font-size: 34px; }
  .entry p.lede { font-size: 15px; }
  .entry .acts { flex-direction: column; }
  .keybox { font-size: 11.5px; }

  /* V2 on a phone */
  .own .plate { gap: 8px; height: 40px; }
  .own .plate .lbl, .own .plate .sep, .own .plate .pvname { display: none; }
  .own .plate button { padding: 0 9px; height: 30px; }
  .own .plate button svg { width: 15px; height: 15px; }
  .own .corner { display: none; }
  .hud-top { top: 10px; left: 10px; right: 10px; padding: 6px; gap: 6px; }
  .hud-top .title .lbl, .hud-top .title small, .hud-top .lbl { display: none; }
  .goto { flex: 1 1 auto !important; min-width: 0; }
  .goto input { width: 100%; }
  .hud-top .chip { height: 32px; border-bottom: 0; }
  .legend, .hud-zoom { display: none; }
  .minimap { width: 92px; height: 92px; right: 10px; bottom: 10px; }
  .homebtn { bottom: 14px; }
  .homebtn button { height: 44px; }
  .counter { width: 100vw; border-left: 0; }
  .counter .head { padding: 18px 16px 12px; }
  .counter .meta { padding: 0 16px 12px; }
  .counter .body { padding: 10px 14px 30px; }
  .counter table.t th:nth-child(4), .counter table.t td:nth-child(4) { display: none; }
  body.inworld .toasts { right: 10px; bottom: 112px; }
}
@media (max-width: 780px) {
  .own .plate { left: 2px; right: 2px; }
  .own .plate .num { font-size: 14px; }
  .own .plate .lockchip svg { width: 14px; height: 14px; }
  .own .plate #walletBtn { padding: 0 8px; }
}
@media (max-width: 780px) {
  .hud-top { flex-wrap: nowrap; }
  .hud-top .soonb { display: none; }
  .hud-top .chip { padding: 0 4px; }
}
.goto input { width: 168px; }
@media (max-width: 780px) { .goto input { width: 100%; } }

/* legend: folds into a small button */
.legend { gap: 8px; }
.legend .lg-toggle { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; color: var(--text-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; cursor: pointer; }
.legend .lg-toggle:hover { color: var(--text); }
.legend .lg-chev { margin-left: auto; font-size: 10px; transform: rotate(180deg); transition: transform .15s; }
.legend.min .lg-chev { transform: none; }
.legend .lg-dots { display: inline-flex; gap: 3px; }
.legend .lg-dots i { width: 8px; height: 8px; border-radius: 1px; display: block; }
.legend .lg-dots .you { border: 1.5px solid var(--canopy); }
.legend .lg-dots .open { background: repeating-linear-gradient(90deg, #ff5a36 0 2px, #f5f3ee 2px 4px); }
.legend .lg-dots .covered { background: repeating-linear-gradient(135deg, #0e1319 0 2px, #2a3542 2px 3px); }
.legend.min { padding: 8px 12px; max-width: none; }
.legend.min .row, .legend.min .hint { display: none; }
.legend:not(.min) .lg-dots { display: none; }
@media (max-width: 780px) { .legend { display: flex !important; left: 10px; top: 62px; bottom: auto; } .legend:not(.min) { right: 10px; } }

/* ---------- Grounds header: you · search · filter ---------- */
.hud-top.gh { gap: 0; padding: 0; height: 46px; width: min(680px, calc(100vw - 32px)); align-items: stretch; overflow: visible; background: rgba(11,15,20,.92); }
.hud-top.gh > * { flex: none; }
.gh-you { display: flex; align-items: center; gap: 9px; padding: 0 14px 0 8px; background: none; border: 0; border-right: 1px solid var(--line-2); color: var(--text); cursor: pointer; }
.gh-you:hover { background: var(--ink-2); }
.gy-logo { width: 26px; height: 26px; border-radius: 3px; display: grid; place-items: center; overflow: hidden; flex: none; }
.gy-logo.mark svg { width: 24px; height: 24px; }
.gy-logo .lg { font-size: 11px; }
.gy-n { font: 600 13px var(--mono); letter-spacing: .02em; }
.gh-search { flex: 1 1 auto !important; min-width: 0; position: relative; display: flex; align-items: center; gap: 6px; padding: 0 12px; }
.gh-search:focus-within { background: var(--ink-0); }
.gh-hash { font: 600 16px var(--mono); color: var(--canopy); }
.gh-search input { flex: 1; min-width: 0; width: auto !important; background: transparent; border: 0; outline: 0; color: var(--paper); font: 500 14.5px var(--sans); }
.gh-search input::placeholder { color: var(--text-3); }
.gh-kbd { font-family: var(--mono); font-size: 11px; color: var(--text-3); border: 1px solid var(--line-2); border-radius: 3px; padding: 0 5px; }
.gh-search:focus-within .gh-kbd { display: none; }
.gh-filter { display: flex; align-items: center; gap: 8px; padding: 0 14px; background: none; border: 0; border-left: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; cursor: pointer; }
.gh-filter:hover { color: var(--text); background: var(--ink-2); }
.gh-filter b { font: 600 12px var(--mono); color: var(--text-3); }
.gh-filter .gh-awn { width: 16px; height: 10px; border-radius: 1px; background: repeating-linear-gradient(90deg, var(--text-3) 0 4px, transparent 4px 8px); border-bottom: 1px solid var(--text-3); }
.gh-filter.on { color: var(--paper); box-shadow: inset 0 -2px 0 var(--canopy); }
.gh-filter.on b { color: var(--canopy-2); }
.gh-filter.on .gh-awn { background: repeating-linear-gradient(90deg, #ff5a36 0 4px, #f5f3ee 4px 8px); border: 0; }
.gh-sugg { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--ink-1); border: 0; border-radius: 4px; box-shadow: var(--elev-2); overflow: hidden; z-index: var(--z-float); }
.gs-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.gs-row:last-child { border-bottom: 0; }
.gs-row.on, .gs-row:hover { background: var(--ink-3); }
.gs-sw { width: 28px; height: 22px; border-radius: 2px; flex: none; display: grid; place-items: center; overflow: hidden; }
.gs-sw .lg { font-size: 10px; } .gs-sw img.lg { width: 80%; height: 80%; object-fit: contain; }
.gs-sw.you { border: 1.5px solid var(--canopy); }
.gs-sw.open { background: linear-gradient(#121821, #121821) bottom / 100% 60% no-repeat, repeating-linear-gradient(90deg, var(--aw) 0 4px, #f5f3ee 4px 8px); border: 1px solid var(--line-2); }
.gs-sw.covered { background: repeating-linear-gradient(135deg, #0e1319 0 3px, #1a222c 3px 5px); border: 1px solid var(--line); }
.gs-sw.free { border: 1px dashed var(--line-2); }
.gs-n { font: 600 13px var(--mono); color: var(--paper); min-width: 58px; }
.gs-t { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.gs-t b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-t small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-go { width: 14px; color: var(--text-3); font-size: 12px; }
.gs-empty { padding: 12px; color: var(--text-3); font-size: 13px; }
.gh-caption { top: 66px; left: 50%; transform: translateX(-50%); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); pointer-events: none; white-space: nowrap; }
.gh-caption.off { transform: translate(-50%, -6px); }
.gh-prson { top: 16px; right: 18px; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; background: rgba(11,15,20,.92); border: 1px solid var(--line-2); border-radius: 5px; color: var(--text-2); cursor: pointer; text-align: left; }
.gh-prson:hover { color: var(--text); border-color: rgba(140,200,255,.45); }
.gh-prson svg { width: 18px; height: 18px; color: var(--sky); }
.gh-prson b { display: block; font-size: 13px; color: var(--text); font-weight: 600; }
.gh-prson small { display: block; font-size: 11px; color: var(--text-3); }
@media (max-width: 1240px) { .gh-prson span { display: none; } .gh-prson { padding: 0 13px; } }
@media (max-width: 1060px) { .hud-top.gh { left: 18px; transform: none; width: auto; right: 84px; } .hud-top.gh.off { transform: translateY(-8px); } .gh-caption { display: none; } }
@media (max-width: 780px) {
  .hud-top.gh { left: 10px; right: 10px; top: 10px; height: 44px; }
  .gh-you { padding: 0 10px 0 7px; } .gy-n, .gh-kbd { display: none; }
  .gh-filter { padding: 0 12px; } .gh-filter .lbl, .gh-filter b { display: none; }
  .gh-prson { display: none; }
  .gh-search input { font-size: 15px; }
}
.hud-top.gh { z-index: calc(var(--z-sheet) + 3); } /* over the Grounds prototype's own HUD layers */
.hud-top.gh:focus-within ~ .gh-caption, body:has(#goto[aria-expanded="true"]) .gh-caption { opacity: 0; }
