/* Creago: the account page, "Your Creago". Colours, type, buttons, the panel look, the top bar, spec rows and the plan
   panels come from site.css; command blocks, steps, Peek over a panel, the state dot, notices and the confirm box
   from pages.css. This file adds the app shell (rail, panels, status bar) and what sits in the panels. */

/* No timeline here. The status bar along the bottom of the window takes its place: --tl is its height, so the toast
   sits above it */
body.account { --tl: 32px; padding-bottom: var(--tl); }
/* site.css hides the right-hand link on phones; here it is the only thing on the right */
.account .top-link { display: inline; }
.account .top-link[hidden] { display: none; }

/* ---------- the shell: the rail on the left, the heading and the panels on the right ---------- */
.shell { max-width: calc(1040px + var(--pad) * 2); margin: 0 auto; padding: calc(var(--top) + 48px) var(--pad) 72px;
  display: grid; grid-template-columns: 200px minmax(0, 1fr); grid-template-areas: "rail head" "rail panels"; column-gap: 56px; align-items: start; }
/* without the rail (loading, signed out, an error, no plan) the page is one column */
.shell:not([data-state="plan"]) { max-width: calc(920px + var(--pad) * 2); grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "panels"; }
/* the room under the head is Peek's: he stands on the first panel's top edge */
.acct-head { grid-area: head; display: grid; gap: 16px; justify-items: start; margin-bottom: 108px; }
.acct-head h1.display { font-size: clamp(40px, 8vw, 56px); letter-spacing: -0.035em; line-height: 1.02; max-width: none; }
.acct-who { margin: -4px 0 0; color: var(--t2); font-size: 16px; }
.acct-who[hidden] { display: none; }
.acct-who b { font-weight: 600; color: var(--t1); }
.acct-who span { margin-left: 8px; font-size: 15px; color: var(--t3); }

/* the example bar: shown only while the server address is the placeholder */
.demo { justify-self: stretch; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; align-items: center; padding: 14px 16px; border-radius: 18px; background: var(--glass); box-shadow: 0 0 0 1px var(--line2) inset; }
.demo[hidden] { display: none; }
.demo-tag { padding: 4px 10px; border-radius: 999px; background: var(--t1); color: #170C33; font: 600 13px/1.3 var(--text); }
.demo-text { margin: 0; font-size: 15px; line-height: 1.45; color: var(--t2); }
.demo-pick { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.demo-pick a { height: 32px; display: inline-flex; align-items: center; padding: 0 13px; border-radius: 999px; font: 500 13px/1 var(--text); color: var(--t2); box-shadow: 0 0 0 1px var(--line) inset; transition: background-color var(--fast), color var(--fast); }
.demo-pick a:hover { background: rgba(185, 160, 255, .1); color: var(--t1); }
.demo-pick a[aria-current] { background: rgba(139, 92, 246, .24); color: var(--t1); box-shadow: 0 0 0 1px rgba(185, 160, 255, .34) inset; }
.ex-tag { padding: 1px 8px; border-radius: 999px; box-shadow: 0 0 0 1px var(--line2) inset; color: var(--t2); }
.ex-tag[hidden] { display: none; }

/* the rail: four links, the current one marked with a violet line */
.rail { grid-area: rail; position: sticky; top: calc(var(--top) + 32px); display: grid; gap: 2px; margin-top: 6px; }
.rail[hidden] { display: none; }
.rail a { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 42px; padding: 0 12px 0 16px; border-radius: 12px; font-size: 15px; font-weight: 500; color: var(--t2); transition: background-color var(--fast), color var(--fast); }
.rail a b { font-weight: 400; font-size: 13px; color: var(--t3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rail a:hover { background: rgba(185, 160, 255, .08); color: var(--t1); }
.rail a::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--accent); transform: scaleY(0); transition: transform 260ms var(--ease); }
.rail a.on { background: rgba(139, 92, 246, .16); color: var(--t1); }
.rail a.on::before { transform: none; }
.rail a.on b { color: var(--t2); }
.rail a:focus-visible { outline-offset: 2px; border-radius: 12px; }

.panels { grid-area: panels; display: grid; gap: 24px; min-width: 0; }
.panels > [hidden] { display: none; }
/* a panel you jump to lands 24 px under the top bar (html's scroll-padding-top in site.css already counts the bar) */
.apanel { scroll-margin-top: 24px; }
.apanel .panel-facts { color: var(--t2); }
.apanel-body { display: grid; gap: 20px; align-content: start; padding: 24px 28px 28px; }
.stack { display: grid; gap: 20px; }
.stack[hidden] { display: none; }
.line { margin: 0; color: var(--t2); font-size: 16px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.link-btn { color: var(--t1); text-decoration: underline; text-decoration-color: rgba(194, 174, 255, .6); text-underline-offset: 3px; font: inherit; }
.link-btn:hover { color: var(--t1); }

/* loading */
.acct-loading { display: grid; gap: 10px; font-size: 15px; color: var(--t2); max-width: 360px; }
.acct-loading i { position: relative; height: 2px; border-radius: 2px; background: var(--s3); overflow: hidden; }
.acct-loading i::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--accent); animation: sweep 1.2s var(--wipe) infinite; }

/* ---------- signed out: one button, one line ---------- */
.signin { max-width: 560px; }
.signin .apanel-body { justify-items: start; gap: 14px; padding: 32px 28px 30px; }
.signin-btn { height: 52px; padding: 0 24px; font-size: 16px; }
.signin-btn { gap: 12px; padding: 0 16px 0 22px; height: 56px; }
.signin-ways { display: inline-flex; align-items: center; gap: 6px; }
.signin-ways img, .signin-at { width: 26px; height: 26px; border-radius: 8px; display: block; background: #fff; object-fit: cover; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.signin-at { display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-weight: 700; font-size: 15px; line-height: 1; color: #170C33; }
.signin .fine { margin: 0; color: var(--t3, var(--t2)); font-size: 13px; }

/* ---------- an error ---------- */
.err-panel { max-width: 640px; }
.err-msg { margin: 0; font-family: var(--display); font-weight: 600; font-size: 24px; letter-spacing: -0.015em; line-height: 1.25; }
.err-fix { margin: -6px 0 0; color: var(--t2); font-size: 16px; }
.err-fix b { font-weight: 600; color: var(--t1); }

/* ---------- no plan yet ---------- */
.noplan { display: grid; gap: 0; }
.noplan-head { display: grid; gap: 10px; margin-bottom: 112px; }
.noplan-head h2.display { max-width: none; }
.apanel h2.display { max-width: none; }
.noplan .plan-grid { max-width: none; }
.noplan .plan-grid.one { max-width: 480px; }
.noplan .plan-what { flex: 1; }
.noplan .fine { margin-top: 12px; }

/* ---------- 1. the plan ---------- */
.plan-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.plan-id { display: grid; gap: 10px; }
.plan-id .plan-price { font-size: 18px; }
.plan-id .plan-price b { font-size: 40px; }
.incl { display: grid; gap: 6px; padding: 14px 16px; border-radius: 16px; background: var(--s2); box-shadow: 0 0 0 1px var(--line) inset; }
.incl-k { font-size: 13px; font-weight: 600; color: var(--t3); }
.incl-v { margin: 0; font-size: 16px; line-height: 1.5; color: var(--t1); }

/* ---------- 2. the key ---------- */
.key-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.keyfield { display: flex; align-items: center; min-height: 52px; padding: 12px 18px; border-radius: 16px; background: var(--s2); box-shadow: 0 0 0 1px var(--line) inset; min-width: 0; }
.keyfield code { font-family: var(--text); font-size: 16px; font-weight: 500; line-height: 1.4; letter-spacing: .01em; color: var(--t1); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.key-row .btn { height: 52px; min-width: 84px; }
.key-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.key-actions .fine { flex: 1 1 220px; }
/* Delete key stays a quiet button; the confirm box says plainly what it does */
.btn[disabled] { opacity: .45; cursor: default; pointer-events: none; }

/* ---------- 3. the computer ---------- */
.device { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 14px 14px 18px; border-radius: 16px; background: var(--s2); box-shadow: 0 0 0 1px var(--line) inset; }
.device[hidden] { display: none; }
.device-ic { width: 40px; height: 28px; fill: none; stroke: var(--t2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.device-text { display: grid; gap: 3px; min-width: 0; }
.device-text b { font-weight: 600; font-size: 17px; overflow-wrap: anywhere; }
.device-text span { font-size: 14px; color: var(--t3); }
.switches { display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--t2); }
.pips { display: inline-flex; gap: 4px; }
.pips i { width: 22px; height: 6px; border-radius: 3px; background: var(--s3); box-shadow: 0 0 0 1px var(--line) inset; }
.pips i.on { background: var(--accent-soft); box-shadow: none; }
.move { display: grid; gap: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.move > p { margin: 0; }

/* ---------- the footer row at the end of the panels ---------- */
.acct-foot { margin-top: 48px; }

/* ---------- the status bar along the bottom of the window ---------- */
.status { position: fixed; inset: auto 0 0 0; z-index: 30; height: var(--tl); display: flex; align-items: center; gap: 8px; padding: 0 var(--pad); background: rgba(5, 3, 14, .9); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--line2); font-size: 13px; color: var(--t3); }
.status i { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--t3); }
.status i.ok { background: var(--ok); }
.status i.busy { background: var(--accent); }
.status span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- narrower screens ---------- */
@media (max-width: 900px) {
  .shell, .shell:not([data-state="plan"]) { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "rail" "panels"; }
  .acct-head { margin-bottom: 20px; }
  .shell:not([data-state="plan"]) .acct-head { margin-bottom: 92px; }
  /* the rail becomes a row of chips under the heading; it stays under the top bar while the panels scroll.
     The current chip carries the violet line under it */
  .rail { top: var(--top); z-index: 3; display: flex; gap: 6px; margin: 0 calc(var(--pad) * -1) 92px; padding: 10px var(--pad); background: rgba(3, 1, 8, .88); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); overflow-x: auto; scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .rail a { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; box-shadow: 0 0 0 1px var(--line) inset; }
  .rail a b { display: none; }
  .rail a::before { left: 14px; right: 14px; top: auto; bottom: 0; width: auto; height: 2px; transform: scaleX(0); }
  .rail a.on::before { transform: none; }
  .apanel { scroll-margin-top: 70px; }               /* under the chips row */
  #plan.apanel { scroll-margin-top: 162px; }         /* and under Peek */
}
/* the key field gets its own row, with Show and Copy under it, so the whole key stays on one line */
@media (max-width: 680px) {
  .key-row { grid-template-columns: 1fr 1fr; }
  .keyfield { grid-column: 1 / -1; }
  .device { grid-template-columns: auto minmax(0, 1fr); }
  .device .btn { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 560px) {
  .rail { margin-bottom: 76px; }
  .shell:not([data-state="plan"]) .acct-head { margin-bottom: 76px; }
  #plan.apanel { scroll-margin-top: 146px; }
  .apanel-body { padding: 20px 18px 22px; gap: 18px; }
  .signin .apanel-body { padding: 26px 18px 24px; }
  .keyfield { padding: 12px 12px; }
  .keyfield code { font-size: 14px; }
  .plan-id .plan-price b { font-size: 36px; }
  .demo { grid-template-columns: minmax(0, 1fr); }
  .demo-tag { justify-self: start; }
  .switches { flex-wrap: wrap; row-gap: 8px; }
  .status { padding: 0 16px; font-size: 13px; gap: 7px; }
}

/* no plan: Peek stands on a plan panel further down, so the head needs no room under it */
.shell[data-state="noplan"] .acct-head { margin-bottom: 48px; }

@media (prefers-reduced-motion: reduce) {
  .rail a::before { transition: none; }
  .acct-loading i::after { animation: none; width: 100%; opacity: .5; }
}
