/* Account pages (manage.html, redeem.html). Loaded after site.css.
   The plan is a cheque printed on the navy tint; everything you act on
   (apps, devices, codes, billing) is white paper on the pale ground. */

/* ---------- Sign in (signed out) ---------- */

.acct-signin-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(32px, 4.5vw, 72px);
  align-items: start;
}
.page-hero.acct-signin-hero { padding-bottom: clamp(56px, 6vw, 88px); }
.acct-signin-head h1 { letter-spacing: -0.035em; margin-bottom: 12px; }
.acct-signin-head .lead { font-size: clamp(17px, 1.4vw, 19px); line-height: 1.45; margin: 0; max-width: 44ch; }

.acct-signin-body { padding: 0 0 clamp(56px, 6vw, 88px); }
.acct-signin-body .acct-signin-cols { align-items: start; }
.acct-signin-panel {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  z-index: 2;
  margin-top: calc(-1 * clamp(150px, 13vw, 196px));
}
.acct-signin-copy { grid-column: 1; grid-row: 1; padding-top: clamp(36px, 3.4vw, 52px); }
.acct-signin-copy h2 { font-size: 22px; letter-spacing: -0.02em; margin-bottom: 18px; }

.acct-can { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; max-width: 520px; }
.acct-can li { display: flex; gap: 14px; align-items: center; font-weight: 500; color: var(--navy); line-height: 1.35; }
.acct-can-ico {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--blue);
}
.acct-can-ico .ico { width: 22px; height: 22px; }

.signin-card { padding: clamp(24px, 2.4vw, 34px); box-shadow: var(--shadow); }
.signin-card h2 { font-size: 26px; letter-spacing: -0.03em; margin-bottom: 18px; }
.signin-card .notice { margin-top: 0; }
.signin-sent { font-size: 15.5px; margin-bottom: 18px; }
.signin-sent strong { color: var(--navy); overflow-wrap: anywhere; }
.signin-foot { margin: 16px 0 0; line-height: 1.5; }

/* ---------- Status band: the plan, printed on the tint ---------- */

.acct-band {
  --state: var(--blue);
  position: relative;
  padding: 0 0 clamp(76px, 7vw, 96px);
}
.acct-band::before { content: ""; display: block; height: 4px; background: var(--state); }
.acct-band[data-state="ok"] { --state: var(--green); }
.acct-band[data-state="warn"] { --state: var(--gold); }
.acct-band[data-state="bad"] { --state: var(--danger); }
.acct-band[data-state="neutral"] { --state: var(--blue); }

.acct-bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--on-navy-dim);
  padding: 18px 0 0;
  margin-bottom: clamp(24px, 2.6vw, 36px);
}
.acct-bar strong { color: #fff; font-weight: 600; overflow-wrap: anywhere; }
.acct-bar a { color: #fff; font-weight: 600; }

.acct-band-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}
.acct-band .plan-title {
  font-size: clamp(34px, 3.9vw, 56px);
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0 0 14px;
}
.acct-band .plan-summary { color: #B9D3FA; font-size: clamp(17px, 1.3vw, 19px); line-height: 1.5; max-width: 54ch; margin: 0; }
.acct-band .plan-summary strong { color: #fff; font-weight: 600; }

.plan-meter { margin-top: 22px; max-width: 440px; }
.plan-meter-track { height: 8px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.14); margin-bottom: 8px; }
.plan-meter-fill { height: 100%; border-radius: 999px; background: var(--state); transition: width 0.6s var(--ease); }
#plan-meter-label { font-size: 14px; color: var(--on-navy); font-variant-numeric: tabular-nums; }

.plan-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.plan-actions:empty { display: none; }

/* The facts slip: a cheque with the plan written on it. */
.acct-cheque { border-color: rgba(201, 218, 246, 0.6); }
.acct-facts { margin: 0; padding: 4px 20px; }
.acct-facts div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.acct-facts div:last-child { border-bottom: none; }
.acct-facts div[hidden] { display: none; }
.acct-facts dt { color: var(--muted); }
.acct-facts dd { margin: 0; color: var(--navy); font-weight: 600; text-align: right; }

/* ---------- The path: Premium, apps, devices ---------- */

.acct-body-band { padding-bottom: clamp(56px, 6vw, 88px); }
.acct-body { position: relative; }
.acct-body > .notice { position: relative; z-index: 2; margin: 0; top: -24px; box-shadow: var(--shadow-soft); }
.acct-body > .notice:not([hidden]) { margin-bottom: 0; }

.acct-path {
  list-style: none;
  margin: -48px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
}
.acct-body > .notice:not([hidden]) + .acct-path { margin-top: 0; }
.acct-path.is-covered { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 0.95fr); }

.step { display: flex; flex-direction: column; gap: 12px; padding: 22px 24px 24px; align-items: flex-start; position: relative; }
.step h2 { font-size: 17px; letter-spacing: -0.01em; margin: 2px 0 4px; }
.step p { font-size: 14.5px; color: var(--muted); margin: 0; line-height: 1.4; }

/* A line runs from each step's mark to the next. */
.acct-path > .step:not([id="step-devices"])::after,
.acct-path.is-covered > .step[id="step-devices"]::after {
  content: "";
  position: absolute;
  top: 37px;
  left: 66px;
  right: -12px;
  border-top: 2px dashed var(--line-strong);
}
.acct-path > .step[data-done="true"]::after { border-top: 2px solid var(--blue); }
.acct-path > .step[data-done="partial"]::after { border-top: 2px solid var(--gold); }

.step-mark {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px dashed var(--line-strong);
  background: var(--surface);
  position: relative;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.step[data-done="true"] .step-mark { background: var(--blue); border: 2px solid var(--blue); }
.step[data-done="true"] .step-mark::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 5px;
  width: 7px;
  height: 13px;
  border-right: 2.5px solid #fff;
  border-bottom: 2.5px solid #fff;
  transform: rotate(45deg);
}
.step[data-done="attention"] .step-mark { background: var(--gold); border: 2px solid var(--gold); }
.step[data-done="attention"] .step-mark::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 6px;
  width: 4px;
  height: 11px;
  border-radius: 2px;
  background: var(--navy);
  box-shadow: 0 13px 0 -0.5px var(--navy);
}
.step[data-done="attention"] p { color: #7A5606; }
.step[data-done="partial"] .step-mark { border: 2px solid var(--gold); background: var(--gold-soft); }
.step[data-done="partial"] .step-mark::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: conic-gradient(var(--gold) 0 50%, transparent 50% 100%);
}

.step-count { font-variant-numeric: tabular-nums; }
.slots { display: flex; gap: 5px; margin-top: 10px; }
.slots[hidden] { display: none; }
.slots i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); transition: background 0.2s var(--ease); }
.slots i.on { background: var(--blue); }
.step[data-done="attention"] .slots i.on { background: var(--gold); }

.path-end {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  padding: 18px 24px 20px;
  border-radius: 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0;
}
.path-end img { width: 42px; height: 42px; flex: none; }
.path-end h2 { font-size: 17px; margin: 0 0 4px; }
.path-end p { font-size: 14.5px; margin: 0; color: #B9D3FA; }

/* ---------- Apps, devices ---------- */

.acct-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(24px, 3vw, 40px);
  margin-top: clamp(32px, 3.4vw, 48px);
  align-items: start;
}

.acct-section { margin-bottom: clamp(32px, 3vw, 44px); }
.acct-section:last-child { margin-bottom: 0; }
.acct-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.acct-section-head h2 { font-size: clamp(22px, 1.9vw, 26px); letter-spacing: -0.03em; margin: 0; }
.acct-section-head a { font-weight: 600; }
.acct-note { margin: 12px 0 0; }
.acct-note-top { margin: -4px 0 14px; }
.acct-note strong { color: var(--navy); overflow-wrap: anywhere; }

.app-rows, .device-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.app-rows li,
.device-list .device-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.app-rows li:last-child,
.device-list .device-row:last-child { border-bottom: none; }
.app-rows li > div > strong,
.device-row > div > strong { display: block; font-size: 16px; font-weight: 600; color: var(--navy); line-height: 1.3; }
.app-state,
.device-row > div > span { display: block; font-size: 13.5px; color: var(--muted); line-height: 1.4; margin-top: 1px; }
.app-rows li.is-on { background: linear-gradient(90deg, rgba(226, 244, 234, 0.55), rgba(226, 244, 234, 0) 60%); }
.app-rows li.is-on .app-state { color: var(--green-ink); font-weight: 500; }
.app-pair { display: flex; gap: 8px; }
.app-pair .btn { font-family: var(--mono); font-weight: 500; font-size: 14px; }

.device-row .tag {
  display: inline-block;
  margin-left: 8px;
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-radius: 999px;
  padding: 1px 9px;
  vertical-align: 2px;
}
.device-list .btn-ghost:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.device-empty { padding: 20px; margin: 0; }

/* ---------- Side cards ---------- */

.acct-side { display: grid; gap: 16px; }
.acct-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px 24px;
}
.acct-card h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.acct-card h2 .ico { width: 22px; height: 22px; color: var(--blue); }
.acct-card p { margin-bottom: 12px; }
.acct-card p strong { color: var(--navy); overflow-wrap: anywhere; }
.acct-card .notice { margin: 0 0 14px; }

.redeem-form { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.redeem-form .field { margin-bottom: 0; }
.redeem-input { font-family: var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.redeem-flash { animation: redeem-flash 1.4s var(--ease); }
@keyframes redeem-flash { from { box-shadow: 0 0 0 4px rgba(30, 99, 233, 0.4); } to { box-shadow: 0 0 0 0 rgba(30, 99, 233, 0); } }

.history summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.history summary::-webkit-details-marker { display: none; }
.history summary::after { content: "Show"; font-size: 14px; font-weight: 600; color: var(--blue); }
.history[open] summary::after { content: "Hide"; }
.history summary h2 { margin: 0; }
.history[open] summary { margin-bottom: 8px; }
.history-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.history-row:last-child { border-bottom: none; padding-bottom: 0; }
.history-row strong { display: block; color: var(--navy); font-weight: 600; }
.history-row > div > span { display: block; font-size: 13px; color: var(--muted); line-height: 1.45; font-variant-numeric: tabular-nums; }
.history-row > span { flex: none; font-size: 12.5px; font-weight: 600; color: var(--navy); background: var(--ground); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; }

.cancel-foot { margin: 14px 0 0; }
.acct-foot { margin: 4px 4px 0; }

/* ---------- Redeem page ---------- */

.redeem-body { padding: clamp(32px, 3.6vw, 52px) 0 clamp(56px, 6vw, 88px); }
.redeem-cheque { margin: 0 0 24px; }
.redeem-cheque .cheque-body { padding: 22px 24px 24px; }
.redeem-label { font-weight: 600; color: var(--navy); margin: 0 0 6px; }
.code-box {
  font-family: var(--mono);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--navy);
  line-height: 1.1;
  margin: 0 0 18px;
  word-break: break-all;
}
.redeem-cheque .store-row .btn { width: auto; padding: 10px 20px; }
.store-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
#copied { font-size: 14px; font-weight: 600; color: var(--green-ink); }
.redeem-none { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin: 0 0 24px; max-width: none; }
.redeem-none strong { font-family: var(--mono); font-weight: 500; font-size: 0.94em; }
.redeem-steps-card h2 { font-size: 24px; letter-spacing: -0.03em; margin-bottom: 4px; }
.redeem-steps { counter-reset: rstep; list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 0; }
.redeem-steps li { position: relative; padding: 16px 0 16px 50px; border-top: 1px solid var(--line); }
.redeem-steps li:first-child { border-top: none; padding-top: 4px; }
.redeem-steps li::before {
  counter-increment: rstep;
  content: counter(rstep);
  position: absolute;
  left: 0;
  top: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: grid;
  place-items: center;
}
.redeem-steps li:first-child::before { top: 2px; }
.redeem-steps strong { color: var(--navy); }
.redeem-foot { margin: 22px 0 0; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .acct-signin-cols { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .page-hero.acct-signin-hero { padding-bottom: 72px; }
  .acct-signin-panel { grid-column: 1; grid-row: 1; margin-top: -48px; }
  .acct-signin-copy { grid-column: 1; grid-row: 2; padding-top: 0; }

  .acct-band-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .acct-path, .acct-path.is-covered { grid-template-columns: minmax(0, 1fr); }
  .step { flex-direction: row; padding: 18px 20px; gap: 16px; }
  .path-end { flex-direction: row; align-items: center; gap: 16px; border-radius: 0 0 calc(var(--radius) - 1px) calc(var(--radius) - 1px); }
  .acct-path > .step:not([id="step-devices"])::after,
  .acct-path.is-covered > .step[id="step-devices"]::after {
    top: 54px; bottom: -16px; left: 35px; right: auto; width: 0;
    border-top: none; border-left: 2px dashed var(--line-strong);
  }
  .acct-path > .step[data-done="true"]::after { border-top: none; border-left: 2px solid var(--blue); }
  .acct-path > .step[data-done="partial"]::after { border-top: none; border-left: 2px solid var(--gold); }
  .acct-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .acct-signin-head .lead { font-size: 16px; }
  .signin-card { padding: 22px 18px; }
  .acct-bar { flex-direction: column; gap: 2px; }
  .acct-band .plan-actions .btn { flex: 1 1 100%; }
  .acct-facts { padding: 2px 14px; }
  .acct-facts div { font-size: 14px; }
  .app-rows li, .device-list .device-row { grid-template-columns: 38px minmax(0, 1fr); gap: 12px 14px; padding: 14px 16px; }
  .app-rows li > .btn, .app-rows li > .app-pair, .device-list .device-row > .btn { grid-column: 2; justify-self: start; }
  .acct-card { padding: 20px 18px 22px; }
  .redeem-cheque .cheque-body { padding: 18px 16px 20px; }
  .store-row .btn { flex: 1 1 auto; }
  .redeem-steps li { padding-left: 46px; }
}

@media (prefers-reduced-motion: reduce) { .redeem-flash { animation: none; } }
