/* QLCAD console shell (2026-10-18)
   One navigation and one content width for every signed-in account page. Before this file,
   account.html (1480px + 4-item left rail), billing.html (1400px + a different 4-item rail) and
   the portal pages (1120px + a top bar) each invented their own chrome, so moving between them
   jumped the content 360px sideways and changed the nav's shape. The shell below is applied to
   .console-body pages only; the login screen keeps its own layout. */

.console-body {
  --console-width: min(1120px, calc(100% - 48px));
  --console-rail: 208px;
  background: var(--bg);
}

/* Header: same tokens, same 34px mark, same height as the rest of the site. */
.console-body .console-header {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 12px max(24px, calc((100% - var(--console-width)) / 2));
  background: var(--paper);
  border-bottom: 1px solid var(--sand);
}
.console-body .console-header .brand { font-size: 20px; }
.console-body .console-header .header-caption {
  color: var(--muted);
  font-size: var(--text-small);
  border-left: 1px solid var(--sand);
  padding-left: 14px;
  margin-left: 2px;
}
.console-body .console-header nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: var(--text-secondary);
}
.console-body .console-header nav a { display: inline-flex; align-items: center; min-height: 44px; }

/* Two-column console: a fixed rail plus the page body, identical on every page. */
.console-body .console-shell {
  width: var(--console-width);
  max-width: 100%;
  margin: 28px auto 0;
  display: grid;
  grid-template-columns: var(--console-rail) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.console-body .console-rail {
  position: sticky;
  top: 20px;
  padding-right: 20px;
  border-right: 1px solid var(--sand-light);
}
.console-body .console-rail strong {
  display: block;
  margin: 0 0 10px;
  padding: 0 12px;
  color: var(--muted);
  font-size: var(--text-copyright);
  font-weight: 600;
  letter-spacing: .08em;
}
.console-body .console-nav { display: grid; gap: 4px; }
.console-body .console-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 2px;
  color: var(--muted);
  font-size: var(--text-secondary);
}
.console-body .console-nav a i {
  width: 18px;
  font-style: normal;
  text-align: center;
  font-size: 15px;
}
.console-body .console-nav a:hover { background: var(--sand-light); color: var(--brand-deep); }
.console-body .console-nav a[aria-current] {
  background: var(--sand-light);
  color: var(--brand-deep);
  font-weight: 650;
}
.console-body .console-main { min-width: 0; }
.console-body .console-main > .portal-card { margin: 0; }

/* account.html: the old dashboard was a 190px + content grid. Inside the console shell the rail
   already owns that column, so the dashboard must collapse to a single column or the body gets
   squeezed to 0px. The nested shell must keep the shared width, not the old 1480px. */
.console-body .console-main .account-content { display: block; }
.console-body .account-dashboard { display: block; }
.console-body .account-dashboard > .console-shell {
  width: var(--console-width);
  max-width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--console-rail) minmax(0, 1fr);
  gap: 32px;
}
.console-body .billing-main,
.console-body .billing-workbench { min-width: 0; max-width: 100%; }
/* A hidden container must stay hidden: the route gate sets main[hidden] for anonymous users, and
   a display rule here would otherwise reveal the protected page behind the login card. */
.console-body [hidden] { display: none !important; }

/* Billing ships its own two-column shell in workspace.css (190px base, 150px at <=1000px and a
   display:block at <=640px). Inside the console those rules must not apply, so every property the
   old rule sets is reset here. The base reset must NOT use !important: the responsive overrides
   below are the only ones allowed to win, and an !important base rule would outrank them all. */
.console-body .billing-shell,
.console-body.billing-body .billing-shell {
  width: var(--console-width);
  max-width: 100%;
  margin: 28px auto 0;
  padding: 0;
  display: grid;
  grid-template-columns: var(--console-rail) minmax(0, 1fr);
  grid-template-areas: none;
  gap: 32px;
}
.console-body .billing-shell > .console-main {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  grid-column: auto !important;
}
.console-body .billing-main {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
@media (max-width: 1000px) {
  .console-body .billing-shell { grid-template-columns: minmax(0, 1fr) !important; }
}
@media (max-width: 900px) {
  .console-body .billing-shell { gap: 16px !important; }
  .console-body .billing-shell > .console-rail { width: auto; }
}
/* workspace.css flips billing to display:block at <=640px for its private sidebar. The console
   keeps the grid so the rail stays above the content instead of being pushed into a row. */
@media (max-width: 640px) {
  .console-body .billing-shell {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 0 !important;
  }
}

.console-body .billing-main { min-width: 0; }
.console-body .billing-sidebar { display: none; }

.console-body .console-footer {
  width: var(--console-width);
  max-width: 100%;
  margin: 40px auto 0;
  padding: 20px 0 72px;
  border-top: 1px solid var(--sand);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: var(--text-copyright);
}
.console-body .console-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.console-body .console-footer a { display: inline-flex; align-items: center; min-height: 44px; }

@media (max-width: 900px) {
  .console-body { --console-width: calc(100% - 32px); }
  /* Must repeat every selector that sets a grid, otherwise a more specific rule
     (.account-dashboard > .console-shell) keeps the two-column layout on phones. */
  .console-body .console-shell,
  .console-body .billing-shell,
  .console-body .account-dashboard > .console-shell { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .console-body .console-rail {
    position: static;
    padding: 0 0 12px;
    border-right: 0;
    border-bottom: 1px solid var(--sand-light);
    width: auto;
  }
  .console-body .console-rail strong { display: none; }
  .console-body .console-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
  }
  .console-body .console-nav a { min-height: 44px; padding: 8px 10px; }
  .console-body .console-nav a i { display: none; }
  .console-body .console-header { flex-wrap: wrap; gap: 8px 16px; }
  .console-body .console-header .header-caption { display: none; }
}

/* Last rule in the file on purpose: several display rules above are !important, and the route
   gate relies on main[hidden] to keep a protected page dark until the session is verified. */
.console-body [hidden] { display: none !important; }

/* The account page moved its health summary from .account-header into .console-header. Reuse the
   same compact treatment so the header stays one row and the refresh button keeps its size. */
.console-header .ws-status-header{display:flex;align-items:center;flex:0 0 auto;min-width:0;margin:0;padding:0;border:0;background:transparent}
.console-header .ws-status-header>.ws-status-head,.console-header .ws-status-header>.ws-status-grid,.console-header .ws-status-header>small{display:none}
.console-header .ws-status.ws-status-header .ws-status-compact{display:flex;align-items:center;justify-content:flex-end;gap:8px;font:13px/1.5 var(--body)}
.console-header .ws-status-header .ws-status-compact a{display:flex;align-items:center;min-height:44px;color:var(--muted);border:0;text-decoration:none}
.console-header .ws-status-header button{min-height:44px}
.console-header .ws-status-header + .account-home{margin-left:0;white-space:nowrap;flex-shrink:0}

/* Phone header stays one row, like the old account header: keep the brand, the health summary,
   the home link and a single account shortcut; drop the rest of the desktop nav. */
@media (max-width: 760px) {
  .console-body .console-header {
    flex-wrap: nowrap;
    min-height: 56px;
    padding: 6px 16px;
    gap: 8px;
  }
  .console-body .console-header .header-caption { display: none; }
  .console-body .console-header .brand { font-size: 18px; flex: 0 0 auto; }
  .console-body .console-header .brand img { width: 28px; height: 28px; }
  .console-body .console-header nav {
    margin-left: auto;
    gap: 8px;
    flex-wrap: nowrap;
    font-size: var(--text-small);
    min-width: 0;
  }
  .console-body .console-header nav > a:not(.account-home) { display: none; }
  .console-body .console-header .ws-status-compact { gap: 4px; font-size: 12px; }
  .console-body .console-header .ws-status-compact a { min-height: 36px; }
  .console-body .console-header .ws-status-header button { min-height: 36px; width: 28px; }
  .console-body .console-header .account-home { min-height: 36px; }
}

/* ── Loading skeleton ─────────────────────────────────────────────────────────
   The account page briefly showed a centred "正在加载账户信息…" line before the dashboard
   replaced it. A skeleton in the dashboard's shape removes that flash and makes the wait read
   as the page already being there. */
.console-body .account-loading {
  display: none;
  width: var(--console-width);
  max-width: 100%;
  margin: 28px auto 0;
  min-height: 0;
  place-items: start;
}
html.has-session body.console-body .account-loading { display: block; height: auto; }
.console-body .skeleton-shell {
  width: var(--console-width);
  max-width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: var(--console-rail) minmax(0, 1fr);
  gap: 32px;
}
.console-body .skeleton-rail,
.console-body .skeleton-body { display: grid; gap: 12px; align-content: start; }
.console-body .skeleton-rail { padding-right: 20px; border-right: 1px solid var(--sand-light); }
.console-body .skeleton-head { display: flex; justify-content: space-between; align-items: center; }
.console-body .skeleton-head i { height: 28px; border-radius: 2px; }
.console-body .skeleton-head .w40 { width: 40%; }
.console-body .skeleton-head .pill { width: 108px; }
.console-body .skeleton-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.console-body .skeleton-cards i { height: 92px; border-radius: 2px; }
.console-body .skeleton-panel { display: grid; gap: 12px; padding: 20px; border: 1px solid var(--sand); background: var(--paper); }
.console-body .skeleton-panel i { height: 16px; border-radius: 2px; }
.console-body .skeleton-panel .w30 { width: 30%; height: 22px; }
.console-body .skeleton-panel .w80 { width: 80%; }
.console-body .skeleton-panel .w60 { width: 60%; }
.console-body .skeleton-rail i,
.console-body .skeleton-shell i {
  display: block;
  background: linear-gradient(90deg, var(--sand-light) 25%, var(--paper) 50%, var(--sand-light) 75%);
  background-size: 200% 100%;
  animation: console-shimmer 1.2s linear infinite;
}
.console-body .skeleton-rail i { height: 36px; border-radius: 2px; }
@keyframes console-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .console-body .skeleton-shell i { animation: none; } }
@media (max-width: 900px) {
  .console-body .skeleton-shell { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .console-body .skeleton-rail {
    display: flex;
    gap: 8px;
    padding: 0 0 12px;
    border-right: 0;
    border-bottom: 1px solid var(--sand-light);
  }
  .console-body .skeleton-rail i { flex: 1; }
  .console-body .skeleton-rail i:nth-child(n + 5) { display: none; }
  .console-body .skeleton-cards { grid-template-columns: minmax(0, 1fr); }
}

/* ── Density: match the admin console ─────────────────────────────────────────
   The user console is a data tool, not a marketing page. Measured before this layer:
   h1 24/36, nav rows 44px, summary cards 174px with 16/20 padding, KPI numbers 26px,
   quota reading 32px, page height 1131px at 1440x900 - noticeably looser than the admin
   console (title 20/28, rows 44px, KPI 22px, table text 14px).

   Everything here only overrides spacing and type scale inside .console-body; no component
   changes shape, and touch targets stay >= 44px via padding on the hit area. */
.console-body .overview-heading h1,
.console-body .page-heading h1,
.console-body .billing-main > h1 {
  font-size: 20px;
  line-height: 28px;
  margin: 0;
}
.console-body .overview-heading .section-label,
.console-body .section-label {
  font-size: var(--text-decorative);
  line-height: 16px;
  margin-bottom: 4px;
}
.console-body .overview-heading {
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

/* Summary cards read as one KPI strip: less padding, smaller numbers, tighter labels. */
.console-body .summary-grid { gap: 12px; margin-bottom: 16px; }
.console-body .summary-card {
  /* workspace.css:15 pins this with !important; the console density layer overrides it here. */
  padding: 12px 16px !important;
  display: grid;
  gap: 4px;
}
.console-body .summary-card .metric-label { font-size: var(--text-small); line-height: 20px; }
.console-body .summary-card strong { font-size: 22px; line-height: 30px; }
.console-body .summary-card .metric-value { align-items: baseline; gap: 4px; }
.console-body .summary-card small { font-size: var(--text-copyright); line-height: 18px; }
.console-body .summary-card a { font-size: var(--text-small); }

/* Detail cards: tighter frame, smaller headings, the big percentage capped at KPI scale. */
.console-body .detail-grid { gap: 16px; }
.console-body .quota-card,
.console-body .client-card { padding: 16px !important; }
.console-body .quota-card h2,
.console-body .client-card h2 { font-size: 16px; line-height: 24px; }
.console-body .quota-reading strong { font-size: 22px; line-height: 30px; }
.console-body .quota-reading span { font-size: var(--text-small); }
.console-body .period-label { font-size: var(--text-copyright); }
.console-body .quota-card p { font-size: var(--text-small); line-height: 1.6; }

/* Rail: same 44px hit height, tighter visual rhythm. */
.console-body .console-nav { gap: 2px; }
.console-body .console-nav a { padding: 6px 12px; font-size: var(--text-small); min-height: 40px; }
.console-body .console-nav a i { font-size: 14px; }

/* Portal cards (profile/devices/history/terminology/plans) use the admin card rhythm. */
.console-body .portal-card { padding: 24px; }
.console-body .portal-card h1 { font-size: 20px; line-height: 28px; margin: 0 0 10px; }
.console-body .portal-card h2 { font-size: 16px; line-height: 24px; }
.console-body .portal-card .page-lead,
.console-body .portal-card > p { font-size: var(--text-secondary); }
.console-body .portal-page { margin: 20px auto 32px; }
.console-body .page-heading { margin-bottom: 16px; }
.console-body .page-heading p { font-size: var(--text-small); }
.console-body .portal-form label,
.console-body .field-hint { font-size: var(--text-small); }
.console-body .form-message,
.console-body .field-hint { line-height: 1.7; }

/* Billing workbench cards follow the same rhythm. */
.console-body .billing-main .billing-lead { font-size: var(--text-small); }
.console-body .billing-main h2 { font-size: 16px; line-height: 24px; }
.console-body .orders-section { margin-top: 16px; }

@media (max-width: 900px) {
  .console-body .summary-card { padding: 12px; }
  .console-body .quota-card,
  .console-body .client-card { padding: 14px; }
  .console-body .portal-card { padding: 16px; }
}
/* Header status must size to its compact contents, never inherit the legacy
   full-panel width from .ws-status on secondary user pages. */
.console-header .ws-status.ws-status-header { width:auto; max-width:none; }
