*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg: #f5f7fa; --surface: #fff; --text: #1f2933; --muted: #616e7c; --border: #dde3ea;
  --accent: #2563eb; --danger: #b42318; --danger-bg: #fef3f2; --warn-bg: #fffaeb; --warn: #93370d;
  --env-production: #b42318; --env-staging: #dc6803; --env-dev: #1d4ed8;
}

body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; margin: 0; background: var(--bg);
       color: var(--text); font-size: 14px; }

/* ── Shell (design §21.18) ── */
#shell-header { position: sticky; top: 0; z-index: 10; background: var(--surface);
                border-bottom: 1px solid var(--border); }
.env-band { color: #fff; font-weight: 600; text-align: center; padding: 4px 16px; letter-spacing: 0.04em; }
.env-band.env-production { background: var(--env-production); }
.env-band.env-staging    { background: var(--env-staging); }
.env-band.env-dev        { background: var(--env-dev); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
          padding: 10px 24px; flex-wrap: wrap; }
.product { font-weight: 600; font-size: 15px; }
.user-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-email { color: var(--muted); }
.role-chip { border: 1px solid var(--border); border-radius: 999px; padding: 1px 10px; font-size: 12px; }
.tabs { display: flex; gap: 4px; padding: 0 24px; overflow-x: auto; }
.tabs a { padding: 8px 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent;
          white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.banner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid #fedf89;
          padding: 8px 24px; text-align: center; }

/* ── Page ── */
#app { max-width: 1280px; margin: 24px auto; padding: 0 24px; }
#loading { text-align: center; padding: 60px 0; color: var(--muted); }
h1 { font-size: 20px; margin: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px;
             margin-bottom: 16px; flex-wrap: wrap; }
.page-actions { display: flex; align-items: center; gap: 12px; }
.muted { color: var(--muted); font-size: 13px; }

.btn { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 7px 14px;
       font: inherit; cursor: pointer; }
.btn:hover { filter: brightness(0.95); }
/* aria-disabled rather than `disabled`, so the control stays focusable and its reason shows on hover
   and on focus (design §21.19). */
.btn[aria-disabled="true"] { background: #c5ccd6; cursor: not-allowed; filter: none; }
.link-btn { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 24px 28px;
        max-width: 640px; margin: 40px auto; }
.card h2 { margin: 0 0 8px; font-size: 17px; }
.card p { margin: 0 0 12px; line-height: 1.55; }
.card-warn  { background: var(--warn-bg); border-color: #fedf89; }
.card-error { background: var(--danger-bg); border-color: #fecdca; max-width: none; margin: 0 0 16px; padding: 14px 18px; }
.card-error p { margin: 0 0 8px; }
.card.full { max-width: none; }
.ref { color: var(--muted); font-size: 12px; font-family: ui-monospace, monospace; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8fafc; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-title { color: var(--text); font-weight: 600; margin-bottom: 4px; }
#placeholder-view h1 { margin-bottom: 16px; }
#placeholder-view .empty { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
