/* Tokens, type, layout and controls for the connect page; colours come from the prototype. */
:root {
  color-scheme: light;
  --ground: #F4F2EC;
  --nav: #EAE7DF;
  --surface: #FFFFFF;
  --surface-muted: #FAF9F6;
  --surface-neutral: #EFEDE8;
  --border: #DAD6CC;
  --border-control: #CFCAC0;
  --border-field: #8C877C;
  --text: #1A1D21;
  --text-strong: #3B4047;
  --text-muted: #5A5F66;
  --text-quiet: #5F646B;
  --accent: #0E5B5F;
  --accent-hover: #0A4346;
  --accent-tint: #E3EEEE;
  --chip: #EEF4F4;
  --chip-label: #44505A;
  --info-text: #22313A;
  --track: #ECE9E2;
  --success-bg: #E4F0E7;
  --success-text: #1E5E34;
  --success-solid: #1E6B3A;
  --warning-bg: #FBF1DC;
  --warning-text: #6B4600;
  --warning-strong: #4D3300;
  --danger-bg: #FBEDEA;
  --danger-text: #962A1D;
  --danger-strong: #A12A1C;
  --danger-border: #E3C3BE;
  --backdrop: rgba(26, 29, 33, 0.45);
  --shadow-dialog: 0 24px 60px rgba(26, 29, 33, 0.25);
  --radius-control: 8px;
  --radius-card: 12px;
  --radius-dialog: 14px;
  --radius-pill: 999px;
  --target: 44px;
  --font-sans: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, 'Liberation Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
}

body.has-dialog { overflow: hidden; }

h1, h2, h3, p { margin: 0; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }
.main:focus { outline: none; }

.mono { font-family: var(--font-mono); overflow-wrap: anywhere; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The shell: a left nav on wide screens, a top bar on narrow ones. */
.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.nav {
  background: var(--nav);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 16px;
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-name { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--text-muted); }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--target);
  padding: 0 10px;
  border-radius: var(--radius-control);
  color: var(--text-strong);
  text-decoration: none;
  font-size: 14px;
}

.nav-link:hover { background: rgba(255, 255, 255, 0.55); color: var(--text); }
.nav-link.is-current { background: var(--surface); color: var(--text); font-weight: 500; }

/* The signed-in person and Sign out: at the foot of the nav, or at the end of the top bar. */
.account { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 16px 8px 0; border-top: 1px solid var(--border); min-width: 0; }
.account[hidden] { display: none; }
.account-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; max-width: 100%; }
.account-label { font-size: 12px; color: var(--text-muted); }
.account-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main {
  padding: 44px 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

.main > :not(.sr-only) { width: 100%; max-width: 880px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; }
.page-heading { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.page-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.page-intro { font-size: 15px; color: var(--text-muted); max-width: 600px; }

.page-fault {
  padding: 12px 16px;
  background: var(--danger-bg);
  color: var(--danger-text);
  border-bottom: 1px solid var(--danger-border);
  font-size: 14px;
}

.noscript { padding: 24px; }

/* Buttons: 44 px targets, real buttons, visible focus. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--target);
  padding: 0 18px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover { background: var(--surface-muted); color: var(--text); }
.button--primary { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }
.button--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #FFFFFF; }
.button--danger { color: var(--danger-text); border-color: var(--danger-border); }
.button--danger:hover { background: var(--danger-bg); color: var(--danger-text); }
.button--compact { min-width: var(--target); padding: 0 12px; }
.button[aria-disabled="true"] { cursor: not-allowed; }
.button--secondary[aria-disabled="true"] { color: var(--text-muted); }

/* Form fields. */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 500; }

.input {
  width: 100%;
  min-height: var(--target);
  padding: 0 12px;
  border: 1px solid var(--border-field);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.input::placeholder { color: var(--text-muted); opacity: 1; }
.field-hint { font-size: 13px; color: var(--text-muted); }
.field-message { font-size: 13px; color: var(--text-muted); }
.field-message:empty { display: none; }
.field-message--error { color: var(--danger-strong); }

.checkbox { width: 20px; height: 20px; margin: 0; flex-shrink: 0; accent-color: var(--accent); }

.status-note { font-size: 13px; color: var(--text-muted); }
.slot:empty { display: none; }

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .nav {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0; }
  .nav { flex-wrap: wrap; }
  .account { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; padding: 0; border-top: 0; }
  .account-label { display: none; }
  .account-name { max-width: 40vw; }
  .main { padding: 24px 16px 40px; gap: 20px; }
  .page-title { font-size: 28px; }
}
