/* Shared page frame. Page-specific layout remains responsible for charts and forms. */
*, *::before, *::after { box-sizing: border-box; }

html { min-width: 320px; }

body {
  min-width: 320px;
  color: var(--qice-ink);
  font-family: var(--qice-font-sans);
}

body[data-design-system="qice-v1"] { overflow-x: hidden; }

a { color: inherit; }

button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }

.site-shell,
.shell,
.app-shell,
.member-dashboard-shell {
  width: min(var(--qice-shell-max), calc(100% - (var(--qice-page-gutter) * 2)));
  margin-inline: auto;
}

.shell { padding-top: var(--qice-header-top); }

.site-topbar {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, auto) minmax(220px, 1fr);
  align-items: center;
  gap: var(--qice-space-5);
  width: min(var(--qice-shell-max), calc(100% - (var(--qice-page-gutter) * 2)));
  min-height: 82px;
  margin: var(--qice-header-top) auto var(--qice-space-6);
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--qice-line) 82%, transparent);
  border-radius: var(--qice-radius-lg);
  background: color-mix(in srgb, var(--qice-surface) 92%, transparent);
  box-shadow: var(--qice-shadow-sm);
  backdrop-filter: blur(14px);
}

.shell > .site-topbar { margin-top: 0; }

.site-brand,
.brand.site-brand,
.member-global-brand.site-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: var(--qice-space-3);
  color: inherit;
  text-decoration: none;
}

.site-brand .brand-mark,
.site-brand .brand-logo,
.member-global-brand > img {
  display: block;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  object-fit: cover;
  overflow: hidden;
  border: 1px solid rgba(31, 107, 91, .16);
  border-radius: 14px;
  background: #f7f4ea;
  box-shadow: var(--qice-shadow-sm);
}

.site-brand .brand-mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.site-brand .brand-name,
.site-brand .brand strong,
.member-global-brand strong,
.admin-topbar .brand strong { display: block; font: 700 19px/1.15 var(--qice-font-serif); letter-spacing: .06em; }
.site-brand .brand-tagline,
.site-brand .brand p,
.site-brand .brand small,
.member-global-brand > span > span,
.admin-topbar .brand small { display: block; margin-top: 4px; color: var(--qice-muted); font-size: var(--qice-text-xs); line-height: 1.4; }

.topbar-actions,
.site-account { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: var(--qice-space-2); flex-wrap: wrap; }

.member-link,
.member-access-link,
.member-global-entry,
.topbar-link,
.site-account-link {
  display: inline-flex;
  min-height: var(--qice-control-height-compact);
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border: 1px solid var(--qice-line);
  border-radius: var(--qice-radius-sm);
  color: var(--qice-brand);
  background: var(--qice-surface);
  font-size: var(--qice-text-sm);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.member-link:hover,
.member-access-link:hover,
.member-global-entry:hover,
.topbar-link:hover,
.site-account-link:hover { border-color: var(--qice-brand); background: var(--qice-brand-soft); }

.member-center-chip { max-width: 180px; }
.engine-status { min-width: 0; white-space: nowrap; }

.page-content,
.shell > main,
.app-shell > main,
.app-shell > .page-main {
  width: min(var(--qice-content-max), 100%);
  margin-inline: auto;
}

.panel,
.surface { border-radius: var(--qice-radius-md); }

/* Admin keeps the same brand, but its information density is intentionally higher. */
.admin-topbar {
  position: sticky;
  top: 0;
  display: block;
  width: 100%;
  min-height: 72px;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--qice-surface) 96%, transparent);
}

.admin-topbar .bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  width: min(var(--qice-content-max), calc(100% - (var(--qice-page-gutter) * 2)));
  min-height: 72px;
  margin-inline: auto;
  align-items: center;
  gap: var(--qice-space-4);
}

.admin-topbar .brand { display: inline-flex; align-items: center; gap: var(--qice-space-3); text-decoration: none; }
.admin-topbar .mark { display: block; width: 44px; height: 44px; overflow: hidden; border-radius: 12px; background: #f7f4ea; }
.admin-topbar .mark img { display: block; width: 100%; height: 100%; object-fit: cover; }
.admin-topbar .nav { justify-content: flex-end; }
