/* Buli connect page and the small static pages on mcp.bulifitness.fi.
   No inline styles anywhere: the Content-Security-Policy is style-src 'self'. */

:root {
  color-scheme: light dark;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-muted: #edf1ee;
  --text: #111513;
  --text-muted: #4a5450;
  --border: #d6ddd8;
  --border-strong: #8e9a93;
  /* Brand: greenDeep for text and icons on light, logo green on dark. */
  --accent: #0f853e;
  --focus: #0f853e;
  /* The primary button is logo green with a black label in both themes. */
  --primary: #13e265;
  --primary-hover: #0fd05b;
  --on-primary: #000000;
  --primary-edge: rgba(0, 0, 0, 0.14);
  --warning-bg: #fff5d9;
  --warning-border: #d4a017;
  --warning-text: #3b2e00;
  --error-bg: #fdeceb;
  --error-border: #d93025;
  --error-text: #8c1d18;
  --radius: 12px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0f0d;
    --surface: #151a17;
    --surface-muted: #1c231f;
    --text: #edf2ee;
    --text-muted: #a7b1ab;
    --border: #2b332e;
    --border-strong: #56625b;
    --accent: #13e265;
    --focus: #13e265;
    --primary-hover: #3fe985;
    --primary-edge: transparent;
    --warning-bg: #2c2510;
    --warning-border: #b8901f;
    --warning-text: #f4e2a6;
    --error-bg: #2d1513;
    --error-border: #e5675e;
    --error-text: #ffb4ab;
  }
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.page {
  max-width: 32rem;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
}

.brand-mark {
  display: block;
  width: 24px;
  height: 24px;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
}

h2 {
  margin: 32px 0 8px;
  font-size: 1.125rem;
  line-height: 1.3;
}

p {
  margin: 0 0 12px;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

[tabindex="-1"]:focus {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.lead {
  font-size: 1.0625rem;
  color: var(--text-muted);
}

.icon {
  flex: none;
  display: block;
}

/* Where the browser goes back to after Allow or Cancel. */
.return-to {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.return-to .icon {
  color: var(--accent);
}

.return-to p {
  margin: 0;
  min-width: 0;
}

.return-to strong,
#signed-in-as strong {
  overflow-wrap: anywhere;
}

.setup-command {
  overflow-wrap: anywhere;
}

.notice {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.notice-warning {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning-text);
  font-weight: 600;
}

.notice-error {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error-text);
}

.notice-muted {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.card {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.card-lead {
  margin: 0 0 12px;
  font-weight: 600;
}

/* Help page: a card opens with its heading, not a heading's top margin. */
.card > h2:first-child {
  margin-top: 0;
}

.steps {
  margin: 0 0 12px;
  padding-left: 1.4em;
}

.steps li {
  margin: 0 0 8px;
  padding-left: 0.2em;
}

/* An address, ID or command to copy: breaks anywhere rather than widening
   the page on a phone. */
code.value {
  display: inline-block;
  max-width: 100%;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-muted);
  font-size: 0.8125em;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-all;
  user-select: all;
}

.stack {
  display: grid;
  gap: 10px;
}

/* Fieldsets read as plain groups inside a card. min-width stops a long
   label from widening the page on narrow screens. */
fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
  margin-bottom: 4px;
  font-weight: 700;
  font-size: 1.0625rem;
}

fieldset:disabled .choice {
  opacity: 0.55;
  cursor: default;
}

.choices {
  display: grid;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.choices > .choice:first-child {
  border-top: 0;
}

/* Goal editing sits under goal reading: it needs it. */
.choice-sub {
  margin-left: 32px;
}

.choice.is-disabled {
  opacity: 0.55;
  cursor: default;
}

.choice-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.assistant-choice {
  flex-direction: column;
  gap: 2px;
  padding-block: 12px;
}

.assistant-choice-title {
  font-weight: 700;
}

.assistant-choice-hint {
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.75;
}

.choice-title {
  font-weight: 600;
}

.choice-desc {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

input[type="checkbox"],
input[type="radio"] {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.consent {
  margin: 20px 0 8px;
  font-size: 0.9375rem;
}

.consent-points {
  margin: 4px 0 12px;
  padding-left: 1.25rem;
}

.consent-points li {
  margin: 6px 0;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 8px 0 4px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}

.actions {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
}

.button:hover:not(:disabled) {
  background: var(--surface-muted);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.button-primary {
  background: var(--primary);
  border-color: var(--primary-edge);
  color: var(--on-primary);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

/* A disabled primary must not look like a ready one. */
.button-primary:disabled {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text-muted);
  opacity: 1;
}

.link-button {
  display: inline-block;
  min-height: 44px;
  padding: 10px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.email-form {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.email-form label {
  font-weight: 600;
}

.email-form input {
  width: 100%;
  min-height: 48px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.email-form .button {
  margin-top: 4px;
}

.hint {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.status {
  min-height: 1.5em;
  margin: 12px 0 0;
  color: var(--text-muted);
}

.status:empty {
  min-height: 0;
  margin: 0;
}

.status.is-error {
  color: var(--error-text);
  font-weight: 600;
}

#view-error .button {
  margin-top: 8px;
}

@media (prefers-reduced-motion: no-preference) {
  .button,
  .link-button {
    transition: background-color 120ms ease;
  }
}

@media (forced-colors: active) {
  .button,
  .card,
  .notice,
  .check,
  .return-to {
    border: 1px solid CanvasText;
  }
}
