/* ClinicOS Home v2 (Stage 4) — Shell 2 only. Scoped to `html body.cos-shell-on #cos-home`; the classic Home markup is hidden (not removed) in Shell 2. Tokens: css/ds/tokens.css. */
html body.cos-shell-on #page-home { background: none !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; padding: 0 !important; }   /* classic Home paints its own gradient wash on the page container */
html body.cos-shell-on #page-home::before, html body.cos-shell-on #page-home::after { display: none !important; }
html body.cos-shell-on #page-home > :not(#cos-home) { display: none !important; }   /* classic Home stays in the DOM for the classic shell; !important needed because classic Home hotfixes force display */

html body.cos-shell-on #cos-home { max-width: 1280px; margin: 0 auto; padding: var(--cos-space-2) 0 var(--cos-space-16); font-family: var(--cos-font); color: var(--cos-color-text-primary); }
html body.cos-shell-on #cos-home * { box-sizing: border-box; }
html body.cos-shell-on #cos-home button { font-family: inherit; }

/* Intro */
html body.cos-shell-on #cos-home .hv2-intro { position: relative; padding: var(--cos-space-6) 0 var(--cos-space-8); }
html body.cos-shell-on #cos-home .hv2-art { position: absolute; right: 24px; top: 0; width: min(340px, 42%); height: auto; opacity: .8; pointer-events: none; -webkit-mask-image: radial-gradient(ellipse 50% 60% at 73% 38%, #000 35%, transparent 75%); mask-image: radial-gradient(ellipse 50% 60% at 73% 38%, #000 35%, transparent 75%); }
html body.cos-shell-on #cos-home .hv2-eyebrow { position: relative; margin: 0 0 var(--cos-space-3); font: var(--cos-weight-medium) 0.8125rem/1.3 var(--cos-font); letter-spacing: .01em; color: var(--cos-color-text-muted); }
html body.cos-shell-on #cos-home .hv2-title { position: relative; margin: 0; font: var(--cos-weight-bold) var(--cos-text-hero)/1.05 var(--cos-font); letter-spacing: -.04em; color: var(--cos-color-text-primary); }
html body.cos-shell-on #cos-home .hv2-tag { position: relative; margin: var(--cos-space-3) 0 0; font: var(--cos-weight-regular) 1.5rem/1.2 var(--cos-font); letter-spacing: -.02em; color: var(--cos-color-text-muted); }
html body.cos-shell-on #cos-home .hv2-ctx { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--cos-space-2) var(--cos-space-3); margin-top: var(--cos-space-6); }
html body.cos-shell-on #cos-home .hv2-chip { display: inline-flex; align-items: center; gap: var(--cos-space-2); height: 28px; padding: 0 var(--cos-space-3); border: 1px solid var(--cos-color-border-subtle); border-radius: var(--cos-radius-pill); background: var(--cos-color-bg-surface); font: var(--cos-weight-medium) 0.75rem/1 var(--cos-font); color: var(--cos-color-text-secondary); }
html body.cos-shell-on #cos-home .hv2-chip svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; color: var(--cos-color-brand-primary); }
html body.cos-shell-on #cos-home .hv2-chip[data-tone="warn"] svg { color: var(--cos-color-warning); } html body.cos-shell-on #cos-home .hv2-chip[data-tone="danger"] svg { color: var(--cos-color-danger); } html body.cos-shell-on #cos-home .hv2-chip[data-tone="neutral"] svg { color: var(--cos-color-text-muted); }
html body.cos-shell-on #cos-home .hv2-link { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--cos-color-text-link); font: var(--cos-weight-medium) 0.8125rem/1.3 var(--cos-font); cursor: pointer; text-decoration: none; }
html body.cos-shell-on #cos-home .hv2-link:hover { text-decoration: underline; }
html body.cos-shell-on #cos-home .hv2-link svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
html body.cos-shell-on #cos-home button:focus-visible { outline: 2px solid var(--cos-color-focus); outline-offset: 2px; border-radius: var(--cos-radius-sm); }

/* Primary information: typography-led, ruled, not boxed */
html body.cos-shell-on #cos-home .hv2-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); padding: var(--cos-space-5) 0; margin-bottom: var(--cos-space-6); border-top: 1px solid var(--cos-color-border); border-bottom: 1px solid var(--cos-color-border); }
html body.cos-shell-on #cos-home .hv2-metric { display: flex; flex-direction: column; gap: 6px; padding: 0 var(--cos-space-6); min-width: 0; border-left: 1px solid var(--cos-color-border-subtle); }
html body.cos-shell-on #cos-home .hv2-metric:first-child { padding-left: 0; border-left: 0; }
html body.cos-shell-on #cos-home .hv2-label { font: var(--cos-weight-semibold) 11px/1.3 var(--cos-font); letter-spacing: .07em; text-transform: uppercase; color: var(--cos-color-text-muted); }
html body.cos-shell-on #cos-home .hv2-num { font: var(--cos-weight-semibold) 2.125rem/1.1 var(--cos-font); letter-spacing: -.03em; font-variant-numeric: tabular-nums lining-nums; color: var(--cos-color-text-primary); white-space: nowrap; }
html body.cos-shell-on #cos-home .hv2-num small { font: var(--cos-weight-regular) 0.875rem/1 var(--cos-font); letter-spacing: 0; color: var(--cos-color-text-muted); }
html body.cos-shell-on #cos-home .hv2-num[data-tone="warn"] { color: var(--cos-color-warning); } html body.cos-shell-on #cos-home .hv2-num[data-tone="good"] { color: var(--cos-color-brand-primary); }
html body.cos-shell-on #cos-home .hv2-muted { color: var(--cos-color-text-muted); }
html body.cos-shell-on #cos-home .hv2-sub-line { font: 0.8125rem/1.4 var(--cos-font); color: var(--cos-color-text-secondary); }

/* Body grid */
html body.cos-shell-on #cos-home .hv2-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--cos-space-4); align-items: start; }
html body.cos-shell-on #cos-home .hv2-col { display: flex; flex-direction: column; gap: var(--cos-space-4); min-width: 0; }
html body.cos-shell-on #cos-home .hv2-card { background: var(--cos-color-bg-surface); border: 1px solid var(--cos-color-border-subtle); border-radius: var(--cos-radius-lg); box-shadow: var(--cos-shadow-1); padding: var(--cos-space-5) var(--cos-space-6); }
html body.cos-shell-on #cos-home .hv2-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--cos-space-3); margin-bottom: var(--cos-space-4); }
html body.cos-shell-on #cos-home .hv2-card-head h2 { margin: 0; font: var(--cos-weight-semibold) 1.125rem/1.3 var(--cos-font); letter-spacing: -.015em; color: var(--cos-color-text-primary); }
html body.cos-shell-on #cos-home .hv2-meta { font: 0.75rem/1 var(--cos-font); font-variant-numeric: tabular-nums; color: var(--cos-color-text-muted); }
html body.cos-shell-on #cos-home .hv2-empty { display: flex; align-items: center; gap: var(--cos-space-2); margin: 0; padding: var(--cos-space-4) 0; font: 0.875rem/1.5 var(--cos-font); color: var(--cos-color-text-secondary); }
html body.cos-shell-on #cos-home .hv2-empty.ok { color: var(--cos-tone-teal-ink); } html body.cos-shell-on #cos-home .hv2-empty svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
html body.cos-shell-on #cos-home .hv2-err { margin: var(--cos-space-2) 0 0; font: 0.8125rem/1.4 var(--cos-font); color: var(--cos-color-danger); }

/* Offices table */
html body.cos-shell-on #cos-home .hv2-table { width: 100%; border-collapse: separate; border-spacing: 0; font: 0.875rem/1.4 var(--cos-font); }
html body.cos-shell-on #cos-home .hv2-table th { padding: 0 0 var(--cos-space-2); text-align: left; font: var(--cos-weight-semibold) 11px/1.3 var(--cos-font); letter-spacing: .06em; text-transform: uppercase; color: var(--cos-color-text-muted); border-bottom: 1px solid var(--cos-color-border-subtle); }
html body.cos-shell-on #cos-home .hv2-table tbody th { padding: var(--cos-space-3) var(--cos-space-3) var(--cos-space-3) 0; text-transform: none; letter-spacing: 0; font: var(--cos-weight-semibold) 0.875rem/1.3 var(--cos-font); color: var(--cos-color-text-primary); border-bottom: 1px solid var(--cos-color-border-subtle); }
html body.cos-shell-on #cos-home .hv2-table td { padding: var(--cos-space-3) 0; border-bottom: 1px solid var(--cos-color-border-subtle); }
html body.cos-shell-on #cos-home .hv2-table tbody tr:last-child th, html body.cos-shell-on #cos-home .hv2-table tbody tr:last-child td { border-bottom: 0; }
html body.cos-shell-on #cos-home .hv2-r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
html body.cos-shell-on #cos-home .hv2-dot { display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 50%; background: var(--cos-tone-teal); vertical-align: middle; }
html body.cos-shell-on #cos-home .hv2-badge { display: inline-flex; align-items: center; height: 24px; padding: 0 var(--cos-space-3); border-radius: var(--cos-radius-pill); background: var(--cos-color-neutral-bg); color: var(--cos-color-neutral); font: var(--cos-weight-medium) 0.75rem/1 var(--cos-font); white-space: nowrap; }
html body.cos-shell-on #cos-home .hv2-badge[data-s="submitted"], html body.cos-shell-on #cos-home .hv2-badge[data-s="verified"] { background: var(--cos-color-success-bg); color: var(--cos-color-success); }
html body.cos-shell-on #cos-home .hv2-badge[data-s="draft"] { background: var(--cos-color-info-bg); color: var(--cos-color-info); }
html body.cos-shell-on #cos-home .hv2-badge[data-s="reopened"] { background: var(--cos-color-warning-bg); color: var(--cos-color-warning); }
html body.cos-shell-on #cos-home .hv2-flag { margin-left: 6px; padding: 1px 7px; border-radius: var(--cos-radius-pill); background: var(--cos-color-warning-bg); color: var(--cos-color-warning); font-size: 0.6875rem; font-weight: var(--cos-weight-medium); }
html body.cos-shell-on #cos-home .hv2-foot { margin-top: var(--cos-space-4); padding-top: var(--cos-space-4); border-top: 1px solid var(--cos-color-border-subtle); }

/* Attention list + quick actions */
html body.cos-shell-on #cos-home .hv2-list { list-style: none; margin: 0; padding: 0; }
html body.cos-shell-on #cos-home .hv2-list li + li { border-top: 1px solid var(--cos-color-border-subtle); }
html body.cos-shell-on #cos-home .hv2-list button { display: flex; align-items: center; gap: var(--cos-space-3); width: 100%; padding: var(--cos-space-3) 0 var(--cos-space-3) var(--cos-space-3); border: 0; border-left: 3px solid var(--cos-tone-teal); background: none; text-align: left; cursor: pointer; color: var(--cos-color-text-primary); }
html body.cos-shell-on #cos-home .hv2-list button[data-tone="warn"] { border-left-color: var(--cos-tone-amber); } html body.cos-shell-on #cos-home .hv2-list button[data-tone="info"] { border-left-color: var(--cos-tone-blue); }
html body.cos-shell-on #cos-home .hv2-list button:hover { background: var(--cos-color-bg-hover); }
html body.cos-shell-on #cos-home .hv2-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
html body.cos-shell-on #cos-home .hv2-tx b { font: var(--cos-weight-semibold) 0.875rem/1.3 var(--cos-font); } html body.cos-shell-on #cos-home .hv2-tx small { font: 0.75rem/1.3 var(--cos-font); color: var(--cos-color-text-muted); }
html body.cos-shell-on #cos-home .hv2-list svg { width: 16px; height: 16px; flex: none; stroke: var(--cos-color-text-muted); fill: none; stroke-width: 2; }
html body.cos-shell-on #cos-home .hv2-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--cos-space-2); }
html body.cos-shell-on #cos-home .hv2-actions button { display: flex; align-items: center; gap: var(--cos-space-3); min-height: 48px; padding: 0 var(--cos-space-3); border: 1px solid var(--cos-color-border-subtle); border-radius: var(--cos-radius-md); background: var(--cos-color-bg-app); color: var(--cos-color-text-primary); font: var(--cos-weight-medium) 0.8125rem/1.2 var(--cos-font); text-align: left; cursor: pointer; transition: border-color var(--cos-duration-fast) var(--cos-ease), background-color var(--cos-duration-fast) var(--cos-ease); }
html body.cos-shell-on #cos-home .hv2-actions button:hover { background: var(--cos-color-bg-surface); border-color: var(--cos-color-brand-primary); }
html body.cos-shell-on #cos-home .hv2-ico { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--cos-radius-tile); background: var(--cos-tone-teal-soft); color: var(--cos-tone-teal-ink); }
html body.cos-shell-on #cos-home .hv2-ico svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
html body.cos-shell-on #cos-home .hv2-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--cos-space-4); margin-top: var(--cos-space-4); }
html body.cos-shell-on #cos-home .hv2-strip button { display: flex; align-items: center; gap: var(--cos-space-4); padding: var(--cos-space-4) var(--cos-space-5); border: 1px solid var(--cos-color-border-subtle); border-radius: var(--cos-radius-lg); background: var(--cos-color-bg-surface); text-align: left; cursor: pointer; color: var(--cos-color-text-primary); }
html body.cos-shell-on #cos-home .hv2-strip button:hover { border-color: var(--cos-color-brand-primary); }
html body.cos-shell-on #cos-home .hv2-strip svg { width: 22px; height: 22px; flex: none; stroke: var(--cos-color-brand-primary); fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
html body.cos-shell-on #cos-home .hv2-strip span { display: flex; flex-direction: column; gap: 2px; } html body.cos-shell-on #cos-home .hv2-strip b { font: var(--cos-weight-semibold) 0.875rem/1.3 var(--cos-font); } html body.cos-shell-on #cos-home .hv2-strip small { font: 0.75rem/1.3 var(--cos-font); color: var(--cos-color-text-muted); }

/* Loading skeletons */
html body.cos-shell-on #cos-home .hv2-skel { display: block; border-radius: var(--cos-radius-sm); background: linear-gradient(90deg, var(--cos-color-bg-subtle) 25%, var(--cos-color-border-subtle) 37%, var(--cos-color-bg-subtle) 63%); background-size: 400% 100%; animation: hv2-shimmer 1.4s ease infinite; }
html body.cos-shell-on #cos-home .hv2-skel-num { width: 96px; height: 32px; } html body.cos-shell-on #cos-home .hv2-skel-line { width: 70%; height: 12px; } html body.cos-shell-on #cos-home .hv2-skel-pill { width: 84px; height: 24px; border-radius: var(--cos-radius-pill); }
html body.cos-shell-on #cos-home .hv2-skels { display: flex; flex-direction: column; gap: 12px; padding: 6px 0; }
@keyframes hv2-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { html body.cos-shell-on #cos-home .hv2-skel { animation: none; } }

/* Responsive: laptop keeps two columns; tablet compresses metrics to two per row and stacks the body once, no card wall */
@media (max-width: 1279px) { html body.cos-shell-on #cos-home .hv2-title { font-size: 2.5rem; } html body.cos-shell-on #cos-home .hv2-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } html body.cos-shell-on #cos-home .hv2-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 899px) {
  html body.cos-shell-on #cos-home .hv2-grid { grid-template-columns: minmax(0, 1fr); }
  html body.cos-shell-on #cos-home .hv2-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--cos-space-5); }
  html body.cos-shell-on #cos-home .hv2-metric:nth-child(odd) { padding-left: 0; border-left: 0; }
  html body.cos-shell-on #cos-home .hv2-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html body.cos-shell-on #cos-home .hv2-art { opacity: .6; width: 70%; }
}
@media (max-width: 599px) { html body.cos-shell-on #cos-home .hv2-title { font-size: 2rem; } html body.cos-shell-on #cos-home .hv2-tag { font-size: 1.125rem; } html body.cos-shell-on #cos-home .hv2-metrics { grid-template-columns: minmax(0, 1fr); } html body.cos-shell-on #cos-home .hv2-metric, html body.cos-shell-on #cos-home .hv2-metric:nth-child(odd) { padding: 0; border-left: 0; } html body.cos-shell-on #cos-home .hv2-num { font-size: 1.75rem; } }

html body.cos-shell-on #cos-home .hv2-scope { margin-left: 6px; padding: 2px 8px; border-radius: var(--cos-radius-pill); background: var(--cos-color-info-bg); color: var(--cos-color-info); font: var(--cos-weight-semibold) 10px/1.4 var(--cos-font); letter-spacing: .04em; text-transform: uppercase; vertical-align: 1px; }
html body.cos-shell-on #cos-home .hv2-label { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; } html body.cos-shell-on #cos-home .hv2-scope { margin-left: 0; white-space: nowrap; display: inline-block; }
