:root {
  color-scheme: dark;
  --bg: #0b1020;
  --col: #070b17;
  --line: rgb(255 255 255 / .08);
  --text: #e8ecf5;
  --muted: #9aa4bd;
  --accent: #6d8cff;
  --err: #ff8a8a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  display: flex;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

/* Workspace badges (corner switcher, manage list) */
.ws {
  width: 42px; height: 42px; display: grid; place-items: center; flex: none;
  border: 0; border-radius: 13px; color: #fff; cursor: pointer;
  font: 750 13px/1 system-ui, sans-serif; letter-spacing: .02em;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .22);
}
.ws:focus-visible, .citem:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.ws.mini { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; cursor: inherit; }
.ws.plus { background: rgb(255 255 255 / .1); font-size: 16px; font-weight: 500; }

/* Corner switcher: only while a workspace shows its sign-in page (no rail). */
.corner { position: fixed; z-index: 5; left: calc(16px + env(safe-area-inset-left)); bottom: calc(16px + env(safe-area-inset-bottom)); }
.cmenu { position: absolute; bottom: 52px; left: 0; min-width: 260px; padding: 6px; border-radius: 16px;
  background: rgb(20 26 46 / .94); border: 1px solid var(--line); box-shadow: 0 16px 40px rgb(0 0 0 / .35);
  display: flex; flex-direction: column; }
.citem { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; border-radius: 9px;
  background: none; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.citem:hover { background: rgb(255 255 255 / .08); }
.citem[aria-current="true"] { background: rgb(255 255 255 / .06); }
.citem .txt { display: grid; min-width: 0; }
.citem small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#corner-list:not(:empty) { padding-bottom: 4px; margin-bottom: 4px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }

/* Workspace frames */
.stage { position: relative; flex: 1; min-width: 0; }
.frames, .frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.frames iframe { background: var(--bg); }

/* Welcome (no workspaces yet) */
.welcome { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto;
  background: radial-gradient(1200px 600px at 70% -10%, #23305e 0%, transparent 60%), var(--bg); }
.card { width: min(420px, 100%); padding: 32px 28px; border-radius: 20px;
  background: rgb(255 255 255 / .05); border: 1px solid var(--line); text-align: center; }
.card img { border-radius: 14px; }
.card h1 { margin: 14px 0 6px; font-size: 24px; }
.card > p { margin: 0 0 22px; color: var(--muted); }

/* Add form (welcome card and dialog) */
.add-form { display: grid; gap: 8px; text-align: left; }
.add-form label { font-size: 13px; color: var(--muted); }
.addr { display: flex; align-items: center; border-radius: 10px; background: rgb(0 0 0 / .3);
  border: 1px solid rgb(255 255 255 / .14); padding: 0 12px; }
.addr:focus-within { border-color: var(--accent); }
.addr input { flex: 1; min-width: 0; padding: 11px 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; text-align: right; }
.addr .suffix { color: var(--muted); white-space: nowrap; }
.err { margin: 0; color: var(--err); font-size: 13px; }
.primary { margin-top: 6px; padding: 11px 16px; border: 0; border-radius: 10px; background: var(--accent);
  color: #fff; font: 600 15px/1 system-ui, sans-serif; cursor: pointer; }
.primary:disabled { opacity: .6; cursor: progress; }

/* Dialog */
.sheet { width: min(420px, calc(100vw - 32px)); padding: 24px; border-radius: 18px;
  border: 1px solid var(--line); background: #121933; color: var(--text); }
.sheet::backdrop { background: rgb(0 0 0 / .55); }
.sheet h2 { margin: 0 0 16px; font-size: 19px; }
.sheet h3 { margin: 22px 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.x-form { position: absolute; right: 10px; top: 8px; margin: 0; }
.x { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 22px; cursor: pointer; }
.x:hover { background: rgb(255 255 255 / .08); color: #fff; }
.manage { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.manage li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: rgb(255 255 255 / .04); }
.manage .who { flex: 1; min-width: 0; display: grid; }
.manage .who small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage .rm { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.manage .rm:hover { color: var(--err); background: rgb(255 255 255 / .06); }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

