:root {
  color-scheme: light;
  --bg: var(--yk-bg, #eef1f4);
  --surface: var(--yk-surface, #f4f6f8);
  --text: var(--yk-text, #18212f);
  --muted: var(--yk-muted, #586579);
  --border: var(--yk-border, #d6dde7);
  --accent: var(--yk-focus, #176b87);
  --danger: var(--yk-danger, #a3262a);
  --gutter: 12px;
  font: 13px/1.35 system-ui, sans-serif;
}
html[data-theme=dark] {
  color-scheme: dark;
  --bg: var(--yk-bg, #111923);
  --surface: var(--yk-surface, #1b2734);
  --text: var(--yk-text, #edf3f8);
  --muted: var(--yk-muted, #b5c0cc);
  --border: var(--yk-border, #405061);
  --accent: var(--yk-focus, #83c9df);
  --danger: var(--yk-danger, #ff9696);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  width: 100%;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); }
h1 { font-size: 19px; }
h2 { font-size: 14px; }

/* V1: the identity row and both nav rows are fixed-height bands in document
   flow. Nothing above the page content is a max-width wrapper. */
.top { width: 100%; background: var(--surface); border-bottom: 1px solid var(--border); }
.identity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; text-decoration: none; color: var(--text); white-space: nowrap; }
.brand span { font-weight: 400; color: var(--muted); }
.tenant-field { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.tenant-select { width: 260px; max-width: 260px; }
.tenant-note { color: var(--muted); font-size: 12px; }
#theme-toggle { margin-right: auto; }

.analytics-nav,
.account-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 32px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.account-nav { gap: 18px; }
.analytics-nav a,
.account-nav a { text-decoration: none; white-space: nowrap; }
.analytics-nav a[aria-current],
.account-nav a[aria-current] { color: var(--text); font-weight: 700; text-decoration: underline; text-underline-offset: 5px; }

main {
  margin: 0;
  padding: 8px var(--gutter) 24px;
  width: 100%;
  max-width: none;
  min-height: 65vh;
  min-width: 0;
}
main[data-state=ready] { min-height: 65vh; }
#app > h1 { height: 32px; line-height: 32px; margin: 0 0 8px; font-size: 19px; }
.muted { color: var(--muted); }
.notice { padding: .5rem .6rem; border: 1px solid var(--border); background: var(--surface); border-radius: 2px; margin: .5rem 0; }
.notice.error { border-color: var(--danger); }
.notice strong { display: block; margin-bottom: .15rem; }
footer { display: flex; justify-content: space-between; padding: 8px var(--gutter); border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

button,
input,
select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  min-height: 28px;
  padding: .15rem .45rem;
}
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }

/* Workspace shell: native elements first, visible focus, no animation. */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.workspace-panel,
.scope-bar,
.coverage-strip,
.question-group,
.saved-boards,
.follow-bar { background: var(--surface); border: 1px solid var(--border); border-radius: 2px; }
@media(prefers-reduced-motion:reduce) { * { animation: none !important; transition: none !important; } }

@media(max-width:900px) {
  :root { --gutter: 8px; }
  .identity-row { height: auto; min-height: 46px; flex-wrap: wrap; padding-top: 4px; padding-bottom: 4px; }
  .tenant-select { width: 200px; max-width: 200px; }
  .analytics-nav,
  .account-nav { height: auto; min-height: 32px; flex-wrap: wrap; padding-top: 4px; padding-bottom: 4px; overflow: visible; }
  #app > h1 { height: auto; line-height: 1.2; margin-bottom: 6px; }
  main { padding-top: 4px; }
}
