/* Workbench — layout: sandbox band, header, tabs, page, split panes, shell bar. */

/* sandbox band */
.band { position: fixed; inset: 0 0 auto; z-index: 60; height: var(--band); display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 16px; overflow: hidden; white-space: nowrap;
  background: repeating-linear-gradient(-45deg, #0000 0 10px, #00000012 10px 20px), var(--sandbox); color: var(--acc-ink); font: 600 12.5px/1 var(--f-ui); }
body:not([data-mode="sandbox"]) .band { display: none; }
.band b { font: 800 10.5px/1 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; padding: 4px 7px; border-radius: 5px; background: #00000022; }
.band span { overflow: hidden; text-overflow: ellipsis; }
.band button { margin-left: 4px; padding: 0; background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* header */
.top { position: sticky; top: var(--band); z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.top-row { height: var(--top); display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { width: 26px; height: 26px; }
.brand b { font: 800 15px/1 var(--f-display); font-stretch: 112%; letter-spacing: .01em; }
.envbtn { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 10px; margin-left: 4px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--s1); font-size: 12.5px; font-weight: 600; transition: border-color .15s, background .15s; }
.envbtn:hover, .envbtn[aria-expanded="true"] { border-color: var(--line-3); background: var(--s2); }
.envbtn .dot { width: 7px; height: 7px; }
body[data-mode="live"] .envbtn .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
body[data-mode="sandbox"] .envbtn { border-color: color-mix(in srgb, var(--sandbox) 45%, transparent); background: color-mix(in srgb, var(--sandbox) 9%, var(--s1)); }
body[data-mode="sandbox"] .envbtn .dot { background: var(--sandbox); }
.envbtn .i { color: var(--ink-4); width: 15px; height: 15px; }
.top-sp { flex: 1; }
.search { position: relative; width: min(300px, 32vw); }
.search .i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-4); width: 15px; height: 15px; pointer-events: none; }
.search input { width: 100%; height: 32px; padding: 0 44px 0 32px; background: var(--s1); border: 1px solid var(--line-2); border-radius: 8px; font-size: 13px; transition: border-color .15s, box-shadow .15s, background .15s; }
.search input:focus { outline: none; border-color: var(--acc); background: var(--bg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 18%, transparent); }
.search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-2); font-size: 11px; color: var(--ink-4); }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0; background: linear-gradient(135deg, var(--acc), var(--acc-lo)); color: var(--acc-ink); font: 800 12px/1 var(--f-display); }
.vsep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }

/* tabs (sliding indicator) */
.tabs { position: relative; height: var(--tabs); display: flex; align-items: stretch; gap: 2px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; background: none; border: 0; color: var(--ink-3); font-size: 13.5px; font-weight: 500; text-decoration: none; white-space: nowrap; transition: color .15s; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); }
.tab .i { width: 15px; height: 15px; }
.tab em { font: 700 9.5px/1 var(--f-mono); font-style: normal; letter-spacing: .06em; padding: 3px 5px; border-radius: 5px; background: color-mix(in srgb, var(--acc) 16%, transparent); color: var(--acc); }
.tab-ind { position: absolute; bottom: -1px; left: 0; height: 2px; width: 0; border-radius: 2px; background: var(--acc); transition: transform .35s var(--ease), width .35s var(--ease); pointer-events: none; }

/* page */
.main { padding: 24px 24px calc(var(--shellbar) + 40px); max-width: 1640px; margin: 0 auto; outline: none; }
.page { animation: page .35s var(--ease) both; }
@keyframes page { from { opacity: 0; transform: translateY(6px); } }
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.ph-t { min-width: 0; max-width: 760px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 12.5px; color: var(--acc); text-decoration: none; font-weight: 600; }
.crumb:hover { text-decoration: underline; }
.ph h1 { margin: 0; font: 800 24px/1.2 var(--f-display); font-stretch: 106%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; overflow-wrap: anywhere; }
.ph p { margin: 6px 0 0; color: var(--ink-3); font-size: 13.5px; line-height: 1.6; overflow-wrap: anywhere; }
.ph-a { display: flex; gap: 8px; flex-wrap: wrap; }
.sec { margin-top: 28px; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sec-h h2 { margin: 0; font: 700 16px/1.3 var(--f-ui); display: flex; align-items: center; gap: 10px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* sub tabs (inside a page) */
.subtabs { position: relative; display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 20px; overflow-x: auto; scrollbar-width: none; }
.subtabs button { position: relative; height: 38px; padding: 0 8px; background: none; border: 0; color: var(--ink-3); font-size: 13px; font-weight: 500; white-space: nowrap; transition: color .15s; }
.subtabs button:hover { color: var(--ink); }
.subtabs button.on { color: var(--acc); }
.subtabs button.on::after { content: ''; position: absolute; left: 4px; right: 4px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--acc); animation: grow-x .3s var(--ease); }
@keyframes grow-x { from { transform: scaleX(.3); opacity: 0; } }

/* list + detail split (events, logs, deliveries) */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--r); background: var(--s1); overflow: hidden;
  height: calc(100vh - var(--band) - var(--top) - var(--tabs) - var(--shellbar) - var(--split-off, 150px)); min-height: 440px; }
.split > * { min-width: 0; min-height: 0; overflow-y: auto; }
.split-l { border-right: 1px solid var(--line); }
.split-r { position: relative; }
.split-r > .detail { animation: detail .3s var(--ease); }
@keyframes detail { from { opacity: 0; transform: translateX(10px); } }

/* filters bar */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .sp { flex: 1; }
.fsearch { position: relative; width: 220px; }
.fsearch .i { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-4); }
.fsearch input { width: 100%; height: 30px; padding: 0 10px 0 30px; background: var(--s1); border: 1px solid var(--line-2); border-radius: 8px; font-size: 12.5px; }
.fsearch input:focus { outline: none; border-color: var(--acc); }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px dashed var(--line-3); border-radius: 99px; background: none; color: var(--ink-3); font-size: 12.5px; font-weight: 600; white-space: nowrap; transition: border-color .15s, color .15s, background .15s; }
.fchip:hover { color: var(--ink); border-color: var(--ink-4); }
.fchip .i { width: 14px; height: 14px; }
.fchip.on { border-style: solid; border-color: color-mix(in srgb, var(--acc) 45%, transparent); background: color-mix(in srgb, var(--acc) 10%, transparent); color: var(--ink); }
.fchip.on b { color: var(--acc); font-weight: 600; }

/* shell bar */
.shellbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: var(--shellbar); display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px; background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line-2); font: 13px var(--f-mono); }
.shellbar .bdg { font-family: var(--f-ui); }
.shellbar .prompt { color: var(--ink-2); white-space: nowrap; }
.shellbar .prompt b { color: var(--acc); font-weight: 600; }
.shellbar input { flex: 1; min-width: 0; height: 32px; background: none; border: 0; outline: none; font: 13px var(--f-mono); color: var(--ink); }
.shellbar input::placeholder { color: var(--ink-4); }
.shellbar.flash { animation: flash .6s var(--ease); }
@keyframes flash { 30% { background: color-mix(in srgb, var(--acc) 12%, var(--bg-2)); } }

/* gate (signed out) */
.gate { min-height: calc(100vh - 160px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 16px; }
.gate-mark { width: 64px; height: 64px; margin-bottom: 22px; filter: drop-shadow(0 10px 30px color-mix(in srgb, var(--acc) 45%, transparent)); animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }
.gate h1 { margin: 0; font: 800 34px/1.1 var(--f-display); font-stretch: 108%; }
.gate p { max-width: 560px; margin: 12px 0 24px; color: var(--ink-3); font-size: 15px; line-height: 1.6; }
.gate-cta { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
body[data-state="gate"] .tabs, body[data-state="gate"] .shellbar, body[data-state="gate"] .top-r { display: none; }
body[data-state="loading"] .tabs, body[data-state="loading"] .shellbar { visibility: hidden; }
.boot { display: grid; place-items: center; min-height: 60vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--s3); border-top-color: var(--acc); animation: spin .8s linear infinite; }

@media (max-width: 1180px) { .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .top-row { padding: 0 12px; gap: 8px; }
  .search { display: none; }
  .main { padding: 18px 14px calc(var(--shellbar) + 32px); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .split-l { border-right: 0; max-height: 46vh; border-bottom: 1px solid var(--line); }
  .split-r { min-height: 300px; }
  .hide-m { display: none !important; }
  .fsearch { width: 100%; }
}
@media (max-width: 600px) {
  .brand b { display: none; }
  .ph h1 { font-size: 20px; }
  .ph-a { width: 100%; } .ph-a .btn { flex: 1; }
  .hide-s { display: none !important; }
  .band span { display: none; }
  .shellbar .prompt span { display: none; }
}
.envbtn > span:not(.dot) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
@media (max-width: 600px) { .envbtn > span:not(.dot) { max-width: 120px; } }
.top-r { display: flex; align-items: center; gap: 4px; }
body[data-state="gate"] .top-r, body[data-state="gate"] .envbtn, body[data-state="loading"] .envbtn { display: none; }
