/* Tokens, type and shared primitives. Values follow IBM Carbon (white theme, IBM Plex)
   with the practice's brand colours layered on top. */

@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url(../fonts/IBMPlexSans-Regular-Latin1.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url(../fonts/IBMPlexSans-SemiBold-Latin1.woff2) format('woff2'); }

:root {
  --cds-text-primary: #161616;
  --cds-text-secondary: #525252;
  --cds-text-helper: #6f6f6f;
  --cds-text-body: #393939;
  --cds-border-subtle: #e0e0e0;
  --cds-border-strong: #8d8d8d;
  --cds-border-control: #c6c6c6;
  --cds-background: #f4f4f4;
  --cds-layer: #ffffff;
  --cds-support-success: #0e6027;
  --cds-support-error: #da1e28;

  --brand: #8BC2D8;
  --brand-hover: #7BB4CC;
  --brand-ink: #3D7E99;
  --brand-ink-hover: #2E657C;
  --brand-tint: #EAF4F8;
  --paper: #ECE5E0;
  --quote-rule: #D8CCC2;
  --low: #8E6A00;
  --low-bg: #FDF3D8;
  --low-line: #E8C55B;
  --ok-bg: #E4EFE7;
  --ok-line: #BEDAC5;
  --ok-ink: #2C5138;

  --ai-fill: linear-gradient(150deg, rgba(51,177,255,.09), rgba(139,194,216,.06) 48%, rgba(190,149,255,.09));
  --ai-line: linear-gradient(150deg, rgba(51,177,255,.55), rgba(139,194,216,.45) 48%, rgba(190,149,255,.55));

  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --serif: 'EB Garamond', Garamond, Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 400 14px/20px var(--sans); color: var(--cds-text-primary); background: var(--cds-background); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-ink); }
a:hover { color: var(--brand-ink-hover); }
:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }

/* Type */
.h-hero, .h-page, .h-detail, .h-thread { font-family: var(--serif); font-weight: 400; }
.h-hero { font-size: 34px; line-height: 40px; }
.h-page { font-size: 26px; line-height: 32px; }
.h-detail { font-size: 30px; line-height: 36px; }
.h-thread { font-size: 19px; line-height: 25px; }
.h-card { font-size: 21px; line-height: 28px; font-weight: 600; }
.h-task { font-size: 17px; line-height: 24px; font-weight: 600; }
.eyebrow { font-size: 12px; line-height: 16px; letter-spacing: .32px; font-weight: 600; text-transform: uppercase; color: var(--cds-text-secondary); }
.eyebrow--plain { font-weight: 400; font-size: 11px; line-height: 15px; color: var(--cds-text-helper); display: block; }
.lede { font-size: 15px; line-height: 22px; color: var(--cds-text-secondary); }
.lead { font-size: 18px; line-height: 28px; text-wrap: pretty; }
.body { font-size: 15px; line-height: 23px; color: var(--cds-text-body); text-wrap: pretty; }
.sub { font-size: 13.5px; line-height: 20px; color: var(--cds-text-secondary); margin-top: 2px; }
.meta { font-size: 12.5px; line-height: 18px; color: var(--cds-text-helper); }
.strong { font-weight: 600; }
.value { font-size: 17px; line-height: 23px; font-weight: 600; font-variant-numeric: tabular-nums; }
.value--lg { font-size: 20px; line-height: 26px; }
.is-low { color: var(--low); }
.is-urgent { color: var(--cds-support-error); }
.is-brand { color: var(--brand-ink); }
.is-done, .done, .confirm { color: var(--cds-support-success); }
.done, .confirm { display: flex; gap: 8px; align-items: center; font-size: 14px; line-height: 21px; }
.i { fill: currentColor; flex-shrink: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 20px; border: 1px solid var(--cds-text-primary); border-radius: 999px; background: transparent; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--cds-text-primary); }
.btn--primary { background: var(--brand); }
.btn--primary:hover { background: var(--brand-hover); }
.btn--tertiary:hover { background: var(--brand-tint); }
.btn--ghost:hover { background: var(--cds-background); }
.btn--block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--brand-ink); text-decoration: underline; font-size: 13px; line-height: 19px; }

/* Surfaces */
.card { background: var(--cds-layer); border: 1px solid var(--cds-border-subtle); }
.card--pad { padding: 20px; }
.card--pad-sm { padding: 14px; }
.card--lg { padding: 24px; }
.card--accent { border-left: 3px solid var(--brand); }
.ai { padding: 20px; background: var(--ai-fill); border: 1px solid; border-image: var(--ai-line) 1; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.ai > * { max-width: 100%; }
.ai-mark { display: inline-flex; align-items: center; gap: 9px; padding: 4px 9px; font-size: 11px; line-height: 16px; letter-spacing: .32px;
  background: linear-gradient(90deg, rgba(51,177,255,.38), rgba(139,194,216,.3), rgba(190,149,255,.4), rgba(51,177,255,.38)) 0 0 / 300% 100%;
  border: 1px solid; border-image: linear-gradient(90deg, #0F9BFF, #5FC9F0, #A56EFF, #0F9BFF) 1;
  animation: ai-roll 2.4s ease-out 1 both; }
@keyframes ai-roll { from { background-position: 100% 0; } to { background-position: 0 0; } }
  background: linear-gradient(115deg, rgba(51,177,255,.18), rgba(139,194,216,.14) 46%, rgba(190,149,255,.18)); border: 1px solid; border-image: linear-gradient(115deg, #33B1FF, #8BC2D8 48%, #BE95FF) 1; }
.ai-mark svg { color: #6929C4; width: 16px; height: 16px; animation: ai-sparkle 1.6s ease-in-out infinite; transform-origin: 50% 50%; overflow: visible; }
@keyframes ai-sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); filter: brightness(1.1) drop-shadow(0 0 2px rgba(51,177,255,.5)); }
  40% { transform: scale(2) rotate(45deg); filter: brightness(1.8) saturate(1.8) drop-shadow(0 0 6px #33B1FF) drop-shadow(0 0 12px #BE95FF) drop-shadow(0 0 18px rgba(51,177,255,.8)); }
  60% { transform: scale(1.8) rotate(60deg); filter: brightness(1.7) saturate(1.7) drop-shadow(0 0 8px #33B1FF) drop-shadow(0 0 14px rgba(190,149,255,.85)); }
}
@media (prefers-reduced-motion: reduce) { .ai-mark, .ai-mark svg { animation: none; } }
.source { font-size: 12px; line-height: 17px; color: var(--cds-text-helper); }

/* Tags, chips, toggles */
.tag { flex-shrink: 0; font-size: 13px; line-height: 20px; padding: 2px 12px; border-radius: 999px; border: 1px solid; }
.tag--low { background: var(--low-bg); border-color: var(--low-line); color: var(--low); }
.tag--ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 12.5px; line-height: 17px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--cds-border-control); background: var(--cds-layer); color: var(--cds-text-secondary); }
.chips--static .chip { color: var(--cds-text-primary); font-size: 13px; line-height: 19px; }
.chip--lg { font-size: 13.5px; line-height: 20px; padding: 8px 14px; color: var(--cds-text-primary); }
.chip--time { font-size: 14px; line-height: 20px; padding: 9px 16px; border-color: var(--cds-text-primary); color: var(--cds-text-primary); }
.chip[aria-pressed="true"] { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; font-weight: 600; }
.toggle { position: relative; flex-shrink: 0; width: 46px; height: 26px; padding: 0; border-radius: 999px; border: 1px solid var(--cds-border-strong); background: var(--cds-layer); }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--cds-border-strong); transition: left .15s; }
.toggle[aria-checked="true"] { background: var(--brand-ink); border-color: var(--brand-ink); }
.toggle[aria-checked="true"]::after { left: 23px; background: #fff; }

/* Layout helpers */
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack--sm { gap: 8px; width: 100%; }
.stack--lg { gap: 26px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.split-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; width: 100%; }
.split-row--top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
