:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --panel-alt: #eef3f1;
  --ink: #17201d;
  --muted: #687670;
  --line: #d9e2df;
  --teal: #127b72;
  --green: #48a868;
  --amber: #c9822b;
  --blue: #2f6fb2;
  --rose: #c95f5f;
  --shadow: 0 18px 42px rgba(31, 49, 44, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

.auth-gate { display:none; }
.auth-gate.is-visible { position:fixed; z-index:50; inset:0; display:grid; place-items:center; background:#102622; }
.auth-card { width:min(430px, calc(100vw - 36px)); padding:30px; border:1px solid rgba(255,255,255,.16); border-radius:8px; background:#17352f; color:#f7fbfa; box-shadow:0 20px 60px rgba(0,0,0,.22); }
.auth-card .brand-mark { margin-bottom:18px; }
.auth-card h1 { margin:0 0 8px; font-size:24px; }
.auth-card > p:not(.eyebrow) { margin:0 0 22px; color:rgba(247,251,250,.68); font-size:13px; line-height:1.6; }
.auth-card label { color:rgba(247,251,250,.86); }
.auth-card .primary-button { width:100%; margin-top:6px; }
.auth-state { display:block; min-height:18px; margin-top:12px; color:#9ee1d6; font-size:12px; }
.auth-method-tabs { display:grid; grid-template-columns:1fr 1fr; gap:4px; margin:20px 0 18px; padding:4px; border-radius:6px; background:rgba(255,255,255,.08); }
.auth-method-tabs button { border:0; border-radius:4px; background:transparent; padding:9px 12px; color:rgba(247,251,250,.68); font-weight:700; }
.auth-method-tabs button.is-active { background:#f6fbf9; color:#17352f; }
#accountLoginPanel > p,
.wechat-login-panel > p { margin:0 0 16px; color:rgba(247,251,250,.68); font-size:13px; line-height:1.6; }
.wechat-login-panel { text-align:center; }
.wechat-qr-frame { display:grid; width:270px; height:270px; margin:0 auto 14px; place-items:center; border:1px solid rgba(255,255,255,.18); border-radius:6px; background:#fff; overflow:hidden; }
.wechat-qr-frame img { display:block; width:260px; height:260px; }
.wechat-qr-frame span { max-width:190px; color:#66726e; font-size:13px; line-height:1.6; }
.wechat-login-panel > strong { display:block; min-height:20px; color:#9ee1d6; font-size:13px; }
.wechat-login-panel .ghost-button { width:100%; margin-top:12px; border-color:rgba(255,255,255,.24); color:#f7fbfa; }
.wechat-login-panel .ghost-button:hover { background:rgba(255,255,255,.08); }
.current-user { align-self:center; color:var(--muted); font-size:12px; white-space:nowrap; }

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.workspace-panel {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #102622;
  color: #f7fbfa;
  padding: 22px 20px;
  overflow: auto;
}

.brand-block {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #1f6f66;
  border-radius: 8px;
  font-weight: 800;
}

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

h1 {
  font-size: 18px;
  line-height: 1.3;
}

.brand-block p,
.workspace-panel label span {
  color: rgba(247, 251, 250, 0.68);
  font-size: 12px;
}

.workspace-tools {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.workspace-tools > p {
  margin: 6px 10px 4px;
  color: rgba(247, 251, 250, 0.54);
  font-size: 11px;
  font-weight: 800;
}

.workspace-menu-divider { height: 9px; }

.workspace-tool-button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 12px;
  column-gap: 10px;
  align-items: center;
  min-height: 54px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 3px;
  padding: 8px 9px;
  background: transparent;
  color: #f7fbfa;
  text-align: left;
}

.workspace-tool-button::after {
  content: "›";
  color: rgba(247, 251, 250, 0.34);
  font-size: 18px;
}

.workspace-tool-button:hover,
.workspace-tool-button:focus-visible {
  border-left-color: rgba(121, 211, 200, 0.55);
  background: rgba(121, 211, 200, 0.1);
  outline: none;
}

.workspace-tool-button.is-active {
  border-left-color: #79d3c8;
  background: rgba(121, 211, 200, 0.14);
}

.workspace-tool-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  align-self: center;
  border-radius: 5px;
  background: rgba(121, 211, 200, 0.12);
  color: #a9e3da;
  font-size: 11px;
  font-weight: 800;
}

.workspace-tool-copy { display:grid; min-width:0; gap:3px; }
.workspace-tool-copy strong { font-size:13px; }
.workspace-tool-copy small { overflow:hidden; color:rgba(247,251,250,.54); font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.workspace-tool-button.is-active .workspace-tool-icon { background:#2a8177; color:#fff; }
.workspace-tool-button.is-active::after { color:#9ee1d6; }

.sidebar-account {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 15px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.sidebar-account-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(158, 225, 214, 0.28);
  border-radius: 6px;
  background: #1f6f66;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.sidebar-account-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.sidebar-account-copy > span {
  color: rgba(247, 251, 250, 0.48);
  font-size: 10px;
}

.sidebar-account-copy strong {
  overflow: hidden;
  color: #f7fbfa;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-copy small {
  color: #9ee1d6;
  font-size: 10px;
}

.sidebar-account-name {
  grid-column: 2;
  margin-top: -6px;
  color: rgba(247, 251, 250, 0.44);
  font-size: 10px;
}

.panel-section {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 20px 0;
}

.ai-settings {
  color: rgba(247, 251, 250, 0.84);
}

.ai-settings summary {
  display: flex;
  cursor: pointer;
  justify-content: space-between;
  align-items: center;
  color: #dfeae7;
  font-size: 14px;
  font-weight: 700;
  list-style: none;
}

.ai-settings summary::-webkit-details-marker {
  display: none;
}

.ai-settings summary span {
  color: rgba(247, 251, 250, 0.58);
  font-size: 11px;
  font-weight: 500;
}

.advanced-content {
  padding-top: 18px;
}

.section-title,
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title {
  color: #dfeae7;
  font-size: 14px;
  font-weight: 700;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: rgba(247, 251, 250, 0.82);
  font-size: 13px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-radius: 6px;
  padding: 10px 11px;
  outline: none;
}

textarea {
  min-height: 124px;
  resize: vertical;
}

select {
  appearance: auto;
}

input[type="range"] {
  padding: 0;
  accent-color: #79d3c8;
}

input:focus,
textarea:focus {
  border-color: #79d3c8;
  box-shadow: 0 0 0 3px rgba(121, 211, 200, 0.16);
}

.metric-input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.file-zone {
  border: 1px dashed rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.file-zone input {
  display: none;
}

.file-zone strong {
  font-size: 14px;
}

.import-state {
  min-height: 18px;
  color: rgba(247, 251, 250, 0.68);
  font-size: 12px;
}

.import-state.is-error {
  color: #ffb6aa;
}

.section-count {
  color: rgba(247, 251, 250, 0.58);
  font-size: 11px;
  font-weight: 500;
}

.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: #9ee1d6;
  font-size: 12px;
  font-weight: 700;
}

.image-preview-list {
  display: grid;
  gap: 8px;
  margin: 2px 0 12px;
}

.image-preview-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.image-preview-item img {
  width: 46px;
  height: 38px;
  object-fit: cover;
  border-radius: 4px;
}

.image-preview-name {
  overflow: hidden;
  color: rgba(247, 251, 250, 0.88);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-remove-button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #f7fbfa;
  font-size: 18px;
  line-height: 1;
}

.full-button {
  width: 100%;
}

.button-row,
.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  background: var(--teal);
  color: white;
}

.ghost-button {
  background: rgba(18, 123, 114, 0.1);
  color: var(--teal);
}

.workspace-panel .ghost-button {
  background: rgba(255, 255, 255, 0.1);
  color: #e9fffb;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 34px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.main-stage {
  height: 100vh;
  min-width: 0;
  padding: 26px;
  overflow: auto;
}

.template-workspace {
  position: relative;
  grid-column: 2;
  height: 100vh;
  min-width: 0;
  overflow: hidden;
  background: #dce5e1;
}

.template-workspace iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #f7faf9;
}

.template-workspace-state {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
}

.template-workspace.is-loaded .template-workspace-state { display:none; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.workflow-guide {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #cfe2dc;
  background: #eaf3f0;
  color: #33514a;
}

.workflow-guide div {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
}

.workflow-guide b {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 12px;
}

.workflow-guide i {
  height: 1px;
  flex: 1;
  min-width: 16px;
  background: #a8c9bf;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

h2 {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.15;
}

h3 {
  font-size: 18px;
}

.hospital-overview-topbar {
  align-items: flex-start;
  margin-bottom: 20px;
}

.hospital-overview-context {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.hospital-overview-actions {
  align-items: center;
  justify-content: flex-end;
}

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

.hospital-directory {
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
}

.hospital-directory-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  gap: 12px;
  min-height: 118px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.hospital-directory-toolbar h3 {
  margin: 0;
  font-size: 17px;
}

.hospital-directory-toolbar p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.hospital-directory-filters {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) repeat(3, minmax(110px, 1fr));
  gap: 8px;
}

.hospital-directory-filters input,
.hospital-directory-filters select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.hospital-directory-filters input:focus,
.hospital-directory-filters select:focus {
  border-color: var(--teal);
  outline: 2px solid rgba(26, 113, 100, 0.12);
  outline-offset: 0;
}

.hospital-filter-reset {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f7faf9;
  color: #52605b;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.hospital-filter-reset:hover { border-color: #99b2aa; background: #eef5f2; }
.hospital-filter-reset:focus-visible { border-color: var(--teal); outline: 2px solid var(--teal); outline-offset: 2px; }

.agent-source-panel {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #f7faf9;
}

.agent-source-panel > header,
.agent-source-row,
.agent-source-actions {
  display: flex;
  align-items: center;
}

.agent-source-panel > header {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.agent-source-panel h3 { margin: 2px 0 0; font-size: 16px; }
.agent-source-panel > header > span { color: var(--muted); font-size: 11px; }

.agent-source-form {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 120px;
  align-items: end;
  gap: 10px;
}

.agent-source-form label { display: grid; gap: 5px; margin: 0; color: #68736f; font-size: 10px; font-weight: 700; }
.agent-source-form input,
.agent-source-row input[type="text"] {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.agent-source-list { display: grid; gap: 8px; margin-top: 12px; }
.agent-source-row { justify-content: space-between; gap: 14px; border-top: 1px solid #e1e8e5; padding-top: 10px; }
.agent-source-main { display: grid; grid-template-columns: minmax(220px, 360px) auto; align-items: center; gap: 10px; min-width: 0; }
.agent-source-main small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; line-height: 1.5; }
.agent-source-enabled { display: inline-flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; font-size: 11px; }
.agent-source-actions { flex: 0 0 auto; gap: 8px; }
.agent-source-actions .ghost-button { min-height: 36px; }
.agent-source-status { font-weight: 700; }
.agent-source-status.is-success { color: #25823d; }
.agent-source-status.is-failed { color: #b7473e; }
.agent-source-status.is-running { color: #9b651e; }

.hospital-directory-table-wrap {
  max-width: 100%;
  max-height: clamp(420px, 64vh, 720px);
  overflow: auto;
  overscroll-behavior-inline: contain;
}

.hospital-directory-table {
  width: 100%;
  min-width: 1873px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  color: #4e5a56;
  font-size: 12px;
}

.hospital-directory-table th,
.hospital-directory-table td {
  height: 64px;
  border-right: 1px solid #e5ebe9;
  border-bottom: 1px solid #e5ebe9;
  padding: 10px 12px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.hospital-directory-table thead th {
  position: sticky;
  z-index: 3;
  top: 0;
  height: 42px;
  padding: 8px 10px;
  background: #edf1f7;
  color: #66706c;
  font-size: 11px;
  font-weight: 800;
}

.hospital-directory-table thead tr:nth-child(2) th {
  top: 42px;
}

.hospital-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  min-height: 26px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.hospital-sort-button span {
  color: #9aa4a0;
  font-size: 12px;
  line-height: 1;
}

.hospital-directory-table th[aria-sort="ascending"] .hospital-sort-button,
.hospital-directory-table th[aria-sort="descending"] .hospital-sort-button {
  color: #176f61;
}

.hospital-directory-table th[aria-sort="ascending"] .hospital-sort-button span,
.hospital-directory-table th[aria-sort="descending"] .hospital-sort-button span {
  color: #176f61;
}

.hospital-sort-button:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.hospital-directory-table thead tr:first-child > th:first-child,
.hospital-directory-table tbody td:first-child {
  position: sticky;
  z-index: 2;
  left: 0;
  background: #fff;
}

.hospital-directory-table thead tr:first-child > th:nth-child(2),
.hospital-directory-table tbody td:nth-child(2) {
  position: sticky;
  z-index: 2;
  left: 54px;
  background: #fff;
  box-shadow: 8px 0 12px rgba(50, 71, 64, 0.05);
}

.hospital-directory-table thead tr:first-child > th:first-child,
.hospital-directory-table thead tr:first-child > th:nth-child(2) {
  z-index: 5;
  background: #edf1f7;
}

.hospital-col-index { width: 54px; }
.hospital-col-name { width: 230px; }
.hospital-col-province { width: 96px; }
.hospital-col-created { width: 148px; }
.hospital-col-boolean { width: 74px; }
.hospital-col-expiry { width: 105px; }
.hospital-col-days { width: 92px; }
.hospital-col-system,
.hospital-col-stat { width: 96px; }
.hospital-col-wide-stat { width: 116px; }

.hospital-directory-table tbody tr:hover td,
.hospital-directory-table tbody tr:hover td:first-child,
.hospital-directory-table tbody tr:hover td:nth-child(2) {
  background: #f2f7f5;
}

.hospital-directory-table tbody tr.is-current td,
.hospital-directory-table tbody tr.is-current td:first-child,
.hospital-directory-table tbody tr.is-current td:nth-child(2) {
  background: #e8f2ff;
}

.hospital-directory-table tbody tr:last-child td {
  border-bottom: 0;
}

.hospital-directory-table tbody td:last-child,
.hospital-directory-table thead th:last-child {
  border-right: 0;
}

.hospital-name-button {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: #26332f;
  text-align: left;
}

.hospital-name-button strong,
.hospital-name-button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hospital-name-button strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.hospital-name-button small {
  color: #89938f;
  font-size: 10px;
}

.hospital-name-button:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.directory-state {
  font-weight: 800;
}

.directory-state.is-positive { color: #25823d; }
.directory-state.is-negative { color: #d94b45; }
.directory-state.is-neutral { color: #7b8581; }
.directory-days.is-warning { color: #d94b45; font-weight: 800; }
.directory-days.is-expired { color: #ad3733; font-weight: 800; }

.hospital-directory-empty {
  position: static !important;
  height: 140px !important;
  background: #fff !important;
  color: var(--muted);
  text-align: center !important;
}

.hospital-directory-source {
  display: block;
  margin-top: 4px;
  color: #929b98;
  font-size: 9px;
}

.activity-workspace {
  grid-column: 2;
  height: 100vh;
  min-width: 0;
  overflow: auto;
  background: var(--bg);
}

.activity-surface {
  min-height: 100%;
  padding: 26px;
}

.activity-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.activity-header h2 {
  font-size: 30px;
}

.activity-header > div > p:last-child {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.activity-scope-toolbar {
  display: flex;
  align-items: end;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #edf1f7;
}

.activity-scope-toolbar label {
  display: grid;
  width: min(260px, 100%);
  gap: 5px;
  margin: 0;
  color: #68736f;
  font-size: 10px;
  font-weight: 700;
}

.activity-scope-toolbar select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d7dfdc;
  border-radius: 4px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.activity-scope-toolbar p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.activity-history-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 26px;
}

.activity-history-header h3 {
  margin: 2px 0 0;
  font-size: 20px;
}

.activity-history-header > div > p:last-child {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.activity-filters {
  display: grid;
  grid-template-columns: 130px 140px minmax(210px, 1fr) minmax(200px, 1fr) 140px;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #edf1f7;
}

.activity-filters label {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: 0;
  color: #68736f;
  font-size: 10px;
  font-weight: 700;
}

.activity-filters input,
.activity-filters select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid #d7dfdc;
  border-radius: 4px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.activity-summary-strip {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 48px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-top: 0;
  background: #fff;
  white-space: nowrap;
}

.activity-summary-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-height: 24px;
  padding: 0 15px;
  border-right: 1px solid #e4eae8;
  color: #66726e;
  font-size: 11px;
}

.activity-summary-item strong {
  color: #25342f;
  font-size: 13px;
}

.activity-summary-item.is-risk strong { color: #bd4c40; }
.activity-summary-item.is-adoption strong { color: #9b651e; }

.activity-adoption-panel {
  border: 1px solid #e2d7c5;
  background: #fffdf8;
  padding: 16px;
}

.activity-adoption-panel > header,
.activity-adoption-alert > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.activity-adoption-panel h3,
.activity-adoption-alert h4 {
  margin: 0;
  letter-spacing: 0;
}

.activity-adoption-panel h3 { font-size: 17px; }

.activity-adoption-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.activity-adoption-heading-actions > span { color: var(--muted); font-size: 13px; }

.activity-adoption-toggle {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid #d8c9b4;
  border-radius: 6px;
  background: #fff;
  color: #725a38;
  cursor: pointer;
}

.activity-adoption-toggle:hover { border-color: #b99a6b; background: #fff9ef; }
.activity-adoption-toggle:focus-visible { outline: 2px solid #aa7a36; outline-offset: 2px; }

.activity-adoption-chevron {
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: translateY(2px) rotate(45deg);
  transition: transform 160ms ease;
}

.activity-adoption-panel.is-collapsed .activity-adoption-chevron { transform: translateY(-2px) rotate(225deg); }

.activity-adoption-content { margin-top: 14px; }

.activity-adoption-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.activity-adoption-tags button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  border: 1px solid #ded5c7;
  border-radius: 4px;
  background: #fff;
  padding: 6px 10px;
  color: #655d52;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.activity-adoption-tags button:hover { border-color: #c9ad82; background: #fffaf2; }
.activity-adoption-tags button:focus-visible { outline: 2px solid #aa7a36; outline-offset: 2px; }
.activity-adoption-tags button.is-active { border-color: #a87934; background: #f5ead7; color: #704817; }
.activity-adoption-tags button[data-adoption-filter="high"].is-active { border-color: #c85b50; background: #f8dfdb; color: #963b33; }
.activity-adoption-tags button[data-adoption-filter="medium"].is-active { border-color: #d29a48; background: #fff0d8; color: #805116; }
.activity-adoption-tags button[data-adoption-filter="exclude-unused"].is-active { border-color: #7ba2e4; background: #eaf2ff; color: #245fcf; }
.activity-adoption-tags button[data-adoption-filter="theory-only"].is-active { border-color: #62a981; background: #e7f5ed; color: #23744a; }
.activity-adoption-tags button[data-adoption-filter="single-department"].is-active { border-color: #d29a48; background: #fff0d8; color: #805116; }

.activity-adoption-tags button span {
  min-width: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  padding: 1px 6px;
  text-align: center;
  font-size: 11px;
}

.activity-adoption-alerts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.activity-adoption-alert {
  min-width: 0;
  border: 1px solid #ead7bd;
  border-left: 4px solid #d29a48;
  border-radius: 6px;
  background: #fff;
  padding: 14px;
}

.activity-adoption-alert.is-high { border-left-color: #c85b50; }
.activity-adoption-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 2px;
}
.activity-adoption-flags:empty { display: none; }
.activity-adoption-flags span {
  border: 1px solid #d8e3f2;
  border-radius: 4px;
  padding: 3px 7px;
  background: #f1f6fd;
  color: #536987;
  font-size: 10px;
  font-weight: 700;
}
.activity-adoption-alert h4 { font-size: 15px; }
.activity-adoption-alert header div > span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }

.activity-adoption-level {
  flex: 0 0 auto;
  border-radius: 4px;
  background: #fff0d8;
  color: #8f5c19;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
}

.activity-adoption-alert.is-high .activity-adoption-level { background: #f8dfdb; color: #a43e35; }

.activity-adoption-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.activity-adoption-metrics span { min-width: 0; border-right: 1px solid var(--line); }
.activity-adoption-metrics span:last-child { border-right: 0; }
.activity-adoption-metrics small { display: block; color: var(--muted); font-size: 11px; }
.activity-adoption-metrics strong { display: block; margin-top: 3px; font-size: 17px; }
.activity-adoption-alert ul { margin: 0; padding-left: 18px; color: #594f41; font-size: 13px; line-height: 1.7; }

.activity-adoption-recommendation {
  margin: 12px 0 0;
  border-top: 1px solid #eee3d3;
  padding-top: 10px;
  color: #7f5218;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.activity-adoption-healthy {
  border-left: 4px solid var(--green);
  background: #edf7f1;
  padding: 12px 14px;
  color: #28744a;
  font-size: 13px;
}

.activity-state {
  min-height: 32px;
  padding: 9px 2px 7px;
  color: var(--muted);
  font-size: 11px;
}

.activity-state.is-error { color: #a33f37; }

.activity-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  background: #fff;
}

.activity-table {
  width: 100%;
  min-width: 2040px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  color: #4e5a56;
  font-size: 11px;
}

.activity-table th,
.activity-table td {
  height: 58px;
  border-right: 1px solid #e5ebe9;
  border-bottom: 1px solid #e5ebe9;
  padding: 9px 10px;
  text-align: center;
  vertical-align: middle;
}

.activity-table th {
  position: sticky;
  z-index: 3;
  top: 0;
  height: 42px;
  background: #edf1f7;
  color: #69736f;
  font-weight: 800;
  white-space: nowrap;
}

.activity-table th:nth-child(1),
.activity-table td:nth-child(1) { width: 54px; }
.activity-table th:nth-child(2),
.activity-table td:nth-child(2) { width: 150px; text-align: left; }
.activity-table th:nth-child(3),
.activity-table td:nth-child(3) { width: 280px; text-align: left; }
.activity-table th:nth-child(4),
.activity-table td:nth-child(4) { width: 94px; }
.activity-table th:nth-child(5),
.activity-table td:nth-child(5) { width: 82px; }
.activity-table th:nth-child(n+6):nth-child(-n+11),
.activity-table td:nth-child(n+6):nth-child(-n+11) { width: 82px; }
.activity-table th:nth-child(12),
.activity-table td:nth-child(12),
.activity-table th:nth-child(13),
.activity-table td:nth-child(13),
.activity-table th:nth-child(14),
.activity-table td:nth-child(14) { width: 132px; }
.activity-table th:nth-child(15),
.activity-table td:nth-child(15) { width: 100px; }
.activity-table th:nth-child(16),
.activity-table td:nth-child(16) { width: 260px; text-align: left; }

.activity-table tbody tr:hover td { background: #f4f8f7; }
.activity-table tbody tr.is-high-risk td { background: #fff8f4; }
.activity-table tbody tr.is-medium-risk td { background: #fffdf6; }
.activity-table tbody tr.is-aggregate td { background: #f7faff; }

.activity-name-cell strong,
.activity-name-cell small {
  display: block;
  overflow-wrap: anywhere;
}

.activity-name-cell strong {
  margin-bottom: 4px;
  color: #283730;
  font-size: 12px;
}

.activity-name-cell small {
  color: var(--muted);
  font-size: 10px;
}

.activity-status,
.activity-risk-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 3px;
  padding: 0 7px;
  font-size: 10px;
  font-weight: 800;
}

.activity-status.is-running { background: #fff0d9; color: #b56c16; }
.activity-status.is-finished { background: #e9eeec; color: #697570; }
.activity-status.is-aggregate { background: #e8f0ff; color: #2f64bd; }
.activity-risk-label.is-high { background: #f8dfdb; color: #a43e35; }
.activity-risk-label.is-medium { background: #fff0d8; color: #9b651e; }
.activity-risk-label.is-normal { background: #e2f1e8; color: #28744a; }
.activity-risk-label.is-aggregate { background: #e8f0ff; color: #2f64bd; }

.activity-risk-reasons {
  margin-top: 5px;
  color: #7a6256;
  font-size: 10px;
  line-height: 1.45;
}

.activity-empty {
  height: 140px !important;
  color: var(--muted);
  text-align: center !important;
}

.activity-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  color: var(--muted);
  font-size: 11px;
}

.activity-pagination > div {
  display: flex;
  gap: 8px;
}

.activity-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-item,
.wide-panel,
.side-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi-item {
  display: grid;
  gap: 6px;
  min-height: 126px;
  padding: 18px;
}

.kpi-item span,
.muted-label {
  color: var(--muted);
  font-size: 12px;
}

.kpi-item strong {
  font-size: 34px;
  line-height: 1;
}

.kpi-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 14px;
}

.wide-panel,
.side-panel {
  padding: 18px;
}

.status-pill {
  border-radius: 999px;
  background: rgba(72, 168, 104, 0.14);
  color: #287144;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.dashboard-preview {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.donut-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.donut {
  --value: 0;
  display: grid;
  place-items: center;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 57%, transparent 58%),
    conic-gradient(var(--teal) calc(var(--value) * 1%), #dfe8e5 0);
}

.donut span {
  font-size: 32px;
  font-weight: 800;
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(76px, 120px) minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  background: #e3ece9;
  border-radius: 999px;
}

.bar-fill {
  width: var(--bar-width);
  height: 100%;
  background: var(--bar-color, var(--teal));
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 5px;
  background: #dfe8e5;
}

.heat-cell[data-level="1"] {
  background: #bcd8d0;
}

.heat-cell[data-level="2"] {
  background: #74b8aa;
}

.heat-cell[data-level="3"] {
  background: #25887c;
}

.insight-list {
  display: grid;
  gap: 10px;
}

.insight-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 68px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.insight-item:first-child {
  border-top: 0;
}

.insight-color {
  width: 8px;
  height: 100%;
  min-height: 46px;
  border-radius: 99px;
  background: var(--teal);
}

.insight-item strong {
  display: block;
  margin-bottom: 5px;
}

.insight-item p,
.priority-list li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.priority-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.priority-list li::marker {
  color: var(--amber);
  font-weight: 800;
}

.admin-drawer {
  display: none;
}

.admin-drawer.is-open {
  display: block;
  height: 100vh;
  min-width: 0;
  grid-column: 2;
  overflow: auto;
}

.ai-config-drawer.is-open {
  display: block;
}

.admin-surface {
  min-height: 100%;
  width: 100%;
  padding: 26px;
  background: var(--bg);
}

.ai-config-surface { padding: 26px; }

.management-page .admin-header {
  min-height: 76px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.management-page .admin-header h2 {
  margin-top: 3px;
  font-size: 28px;
}

.management-subtitle {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.management-tabs {
  display: flex;
  gap: 22px;
  min-height: 48px;
  align-items: end;
  border-bottom: 1px solid var(--line);
}

.management-tabs button {
  min-height: 48px;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 0 2px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.management-tabs button:hover,
.management-tabs button:focus-visible {
  color: var(--teal);
  outline: none;
}

.management-tabs button.is-active {
  border-bottom-color: var(--teal);
  color: var(--ink);
}

.management-tab-panel { padding-top: 18px; }

.drawer-description {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--teal);
  background: #e8f1ee;
  color: #53645f;
  font-size: 12px;
  line-height: 1.6;
}

.config-section {
  padding: 24px 0;
  border-top: 1px solid var(--line);
}

.config-section:first-of-type { margin-top: 18px; }

.config-section-heading,
.config-section-heading > div,
.config-save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.config-section-heading { margin-bottom: 18px; }
.config-section-heading > div { justify-content:flex-start; }
.config-section-heading span { color:var(--teal); font-size:11px; font-weight:800; }
.config-section-heading h3 { margin:0; font-size:16px; }
.config-section-heading small { color:var(--muted); font-size:11px; }

.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.config-grid .span-2 { grid-column: 1 / -1; }
.model-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.model-picker-row label { margin: 0; }
.model-picker-row .ghost-button { min-width: 148px; }
.config-save-row { margin-top: 4px; }
.config-save-row .drawer-state { flex:1; margin:0; }
.config-save-row .primary-button,
.config-save-row .ghost-button { min-width:180px; }

.ai-config-form label {
  color: var(--ink);
}

.ai-config-form input,
.ai-config-form select {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.ai-config-form .toggle-label {
  display: flex;
  align-items: center;
  gap: 9px;
}

.ai-config-form .toggle-label input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--teal);
}

.drawer-state {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.drawer-state.is-success { color: #23774c; }
.drawer-state.is-warning { color: #946018; }
.drawer-state.is-error { color: #ae3f3f; }

.ai-test-row,
.ai-test-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-test-row { justify-content: space-between; }
.ai-test-summary { min-width: 0; }
.ai-test-summary i {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border: 2px solid #a8b4b0;
  border-radius: 50%;
  background: #fff;
}

.ai-test-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.ai-test-summary.is-testing i { border-color: var(--teal); }
.ai-test-summary.is-success i { border-color: #23774c; background: #23774c; }
.ai-test-summary.is-success p { color: #23774c; }
.ai-test-summary.is-error i { border-color: #ae3f3f; background: #ae3f3f; }
.ai-test-summary.is-error p { color: #ae3f3f; }

.ai-runtime-settings {
  margin-top: 0;
}

.ai-runtime-settings h3 { font-size: 15px; }
.ai-runtime-settings output { color:var(--teal); font-weight:800; }

.admin-header,
.admin-toolbar,
.form-heading,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.admin-toolbar {
  margin: 0 0 12px;
}

.user-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.user-filters input,
.user-filters select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

.admin-close {
  background: #e6eeeb;
  color: var(--ink);
}

.user-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--panel);
}

.user-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.user-table th,
.user-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.user-table th {
  color: var(--muted);
  font-weight: 700;
}

.user-table td strong,
.user-table td span {
  display: block;
}

.user-table td > small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 120px;
}

.user-access-cell {
  min-width: 250px;
}

.user-access-cell strong {
  margin-bottom: 4px;
  color: #215f56;
}

.user-access-cell span,
.user-access-cell small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.status-active,
.status-disabled {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.status-active { background: #dcf0e1; color: #287144; }
.status-disabled { background: #f6e3df; color: #9e473c; }

.user-form {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.form-grid,
.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.user-form label,
.user-form fieldset {
  color: var(--ink);
}

.user-form input,
.user-form select {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.user-form fieldset {
  margin: 16px 0 0;
  border: 1px solid var(--line);
}

.user-form legend { padding: 0 6px; font-size: 13px; font-weight: 700; }

.permission-option {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: 13px;
}

.permission-option input { width: auto; accent-color: var(--teal); }
.permission-option.is-required { color: #1e6259; font-weight: 700; }
.permission-option.is-required input { opacity: 1; }
.permission-required { margin-left:auto; color:#1e6259; font-size:10px; font-weight:700; }

.override-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 120px 110px auto;
  gap: 8px;
}

.override-row select { padding: 8px; }

.override-list { display: grid; gap: 7px; margin-top: 10px; }

.override-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: #eef4f1;
  font-size: 12px;
}

.access-preview-fieldset {
  background: #f8faf9;
}

.access-scope-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.access-scope-heading strong {
  color: #1d6258;
  font-size: 15px;
}

.access-scope-heading span,
.access-scope-empty {
  color: var(--muted);
  font-size: 11px;
}

.access-hospital-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 190px;
  overflow: auto;
}

.access-hospital-item {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #dce6e2;
  border-radius: 3px;
  background: #fff;
  color: #41534d;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.role-menu-panel {
  margin-top: 0;
  padding: 18px 0;
  border: 1px solid var(--line);
  border-right: 0;
  border-left: 0;
  background: var(--panel);
}

.audit-panel {
  margin-top: 0;
  padding: 18px 0;
  border: 1px solid var(--line);
  border-right: 0;
  border-left: 0;
  background: var(--panel);
}

.audit-log-list {
  display: grid;
  gap: 0;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.audit-log-item {
  display: grid;
  grid-template-columns: minmax(100px, 0.9fr) minmax(0, 1.5fr) auto;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.audit-log-item strong { color: var(--ink); }

.role-menu-panel label {
  color: var(--ink);
}

.role-menu-panel select {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.permission-route {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

@media (max-width: 820px) {
  .admin-drawer.is-open { display: block; }
  .admin-surface { padding: 18px; }
  .form-grid, .permission-grid, .override-row, .user-filters, .config-grid { grid-template-columns: 1fr; }
  .config-grid .span-2 { grid-column:auto; }
  .config-save-row, .ai-test-row { align-items:stretch; flex-direction:column; }
  .model-picker-row { grid-template-columns:1fr; }
  .model-picker-row .ghost-button, .ai-test-row .ghost-button { width:100%; }
  .config-save-row .primary-button, .config-save-row .ghost-button { width:100%; }
  .audit-log-item { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .workspace-panel {
    position: static;
    height: auto;
  }

  .sidebar-account { margin-top: 18px; }

  .admin-drawer.is-open { grid-column: 1; }
  .main-stage, .admin-drawer.is-open { height:auto; }
  .template-workspace,
  .activity-workspace { grid-column:1; height:100vh; }
}

@media (max-width: 820px) {
  .main-stage,
  .workspace-panel {
    padding: 18px;
  }

  .topbar,
  .dashboard-preview {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .hospital-overview-actions {
    align-items: stretch;
    justify-content: flex-start;
  }

  .hospital-directory-toolbar,
  .agent-source-panel > header,
  .agent-source-row,
  .access-scope-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .hospital-directory-toolbar {
    grid-template-columns: 1fr;
  }

  .hospital-directory-filters,
  .agent-source-form,
  .agent-source-main,
  .access-hospital-list,
  .activity-scope-toolbar,
  .activity-filters {
    grid-template-columns: 1fr;
  }
  .activity-scope-toolbar { display: grid; align-items: stretch; }
  .activity-scope-toolbar label { width: 100%; }
  .activity-scope-toolbar p { margin: 0; }
  .agent-source-main small { grid-column: auto; }
  .agent-source-actions { width: 100%; }
  .agent-source-actions button { flex: 1; }
  .activity-adoption-panel > header,
  .activity-adoption-alert > header { align-items: flex-start; }
  .activity-adoption-panel > header { flex-direction: column; }
  .activity-adoption-heading-actions { width: 100%; justify-content: space-between; }
  .activity-adoption-alerts { grid-template-columns: 1fr; }
  .activity-adoption-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-adoption-metrics span:nth-child(2) { border-right: 0; }

  .activity-surface { padding: 18px; }
  .activity-header { align-items: stretch; flex-direction: column; }
  .activity-header .ghost-button { align-self: flex-start; }

  .kpi-strip,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .metric-input-grid {
    grid-template-columns: 1fr;
  }

  .workflow-guide {
    align-items: flex-start;
    flex-direction: column;
  }

  .workflow-guide i {
    width: 1px;
    min-height: 12px;
    margin-left: 10px;
  }

  .bar-row {
    grid-template-columns: 88px minmax(0, 1fr) 42px;
  }
}

@media (max-width: 520px) {
  .hospital-directory-toolbar {
    padding: 14px;
  }
}

@media print {
  body {
    background: white;
  }

  .workspace-panel,
  .top-actions {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .main-stage {
    padding: 0;
  }

  .kpi-item,
  .wide-panel,
  .side-panel {
    box-shadow: none;
    break-inside: avoid;
  }
}

/* 2026 blue clinical workspace refresh */
:root {
  --bg: #f4f7fc;
  --panel: #ffffff;
  --panel-alt: #eef4fd;
  --ink: #172033;
  --muted: #69758a;
  --line: #dce5f2;
  --teal: #2f6fec;
  --green: #299764;
  --amber: #c67a1d;
  --blue: #2f6fec;
  --rose: #c94f5c;
  --shadow: 0 10px 28px rgba(35, 65, 120, 0.07);
}

body {
  background: var(--bg);
  color: var(--ink);
}

h2 { font-size: 28px; }

button,
input,
select,
textarea {
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 111, 236, 0.16);
  outline-offset: 1px;
}

.app-shell { grid-template-columns: 286px minmax(0, 1fr); }

.workspace-panel {
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 8px 0 26px rgba(41, 75, 135, 0.04);
}

.brand-block {
  gap: 12px;
  margin: 0 4px 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e6edf7;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border: 1px solid #8fbbff;
  border-radius: 8px;
  background: #2f6fec;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(47, 111, 236, 0.18);
}

.brand-block h1 {
  color: #172033;
  font-size: 17px;
}

.brand-block p,
.workspace-panel label span {
  color: #7a879b;
}

.workspace-tools {
  gap: 5px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom-color: #e6edf7;
}

.workspace-tools > p {
  margin: 8px 10px 5px;
  color: #8a96a8;
  font-size: 10px;
  text-transform: uppercase;
}

.workspace-tool-button {
  min-height: 58px;
  border: 1px solid transparent;
  border-left-width: 1px;
  border-radius: 7px;
  padding: 9px 10px;
  color: #38445a;
}

.workspace-tool-button::after {
  color: #a5b0c0;
  font-size: 17px;
}

.workspace-tool-button:hover,
.workspace-tool-button:focus-visible {
  border-color: #d5e3fb;
  background: #f4f8ff;
  color: #215fce;
}

.workspace-tool-button.is-active {
  border-color: #cfe0fb;
  background: #eaf2ff;
  color: #195cc9;
  box-shadow: inset 3px 0 #2f6fec;
}

.workspace-tool-icon {
  border: 1px solid #d8e5f8;
  border-radius: 7px;
  background: #f0f5fd;
  color: #4e6f9f;
}

.workspace-tool-copy strong { font-size: 13px; }
.workspace-tool-copy small { color: #8995a7; }
.workspace-tool-button.is-active .workspace-tool-icon {
  border-color: #2f6fec;
  background: #2f6fec;
  color: #ffffff;
}
.workspace-tool-button.is-active::after { color: #2f6fec; }

.sidebar-account {
  border: 1px solid #d9e6f8;
  border-radius: 8px;
  padding: 12px;
  background: #f1f6fe;
}

.sidebar-account-avatar {
  border-color: #bfd4f7;
  border-radius: 7px;
  background: #dceaff;
  color: #235fc6;
}

.sidebar-account-copy > span,
.sidebar-account-name { color: #8995a7; }
.sidebar-account-copy strong { color: #1f2a3d; }
.sidebar-account-copy small { color: #2f6fec; }

.primary-button,
.ghost-button,
.icon-button {
  min-height: 40px;
  border-radius: 6px;
}

.primary-button {
  background: #2f6fec;
  box-shadow: 0 5px 12px rgba(47, 111, 236, 0.16);
}
.primary-button:hover { background: #245fcf; }
.text-button { color: #2f6fec; }
.text-button:hover { color: #1f58be; }
.ghost-button {
  border: 1px solid #cfe0f8;
  background: #f3f7fe;
  color: #2b64c8;
}
.ghost-button:hover { border-color: #9dbcf0; background: #eaf2ff; }

.main-stage { padding: 0 26px 26px; }

.topbar,
.activity-header,
.management-page .admin-header {
  min-height: 92px;
  margin: 0 -26px 22px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.topbar h2,
.activity-header h2,
.management-page .admin-header h2 {
  color: #172033;
  font-size: 26px;
}

.eyebrow {
  margin-bottom: 5px;
  color: #2f6fec;
  font-size: 10px;
}

.hospital-overview-context,
.activity-header > div > p:last-child,
.management-subtitle { color: #748197; }

.hospital-directory {
  overflow: hidden;
  border-color: #d9e4f2;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hospital-directory-toolbar {
  min-height: 126px;
  padding: 18px 20px;
  border-bottom-color: #dfe8f4;
  background: #fbfdff;
}

.hospital-directory-toolbar h3 { color: #1f2a3d; }

.hospital-directory-filters { gap: 9px; }

.hospital-directory-filters input,
.hospital-directory-filters select,
.activity-filters input,
.activity-filters select,
.user-filters input,
.user-filters select,
.ai-config-form input,
.ai-config-form select,
.user-form input,
.user-form select {
  min-height: 40px;
  border-color: #d7e2f0;
  border-radius: 6px;
  background: #ffffff;
  color: #273247;
}

.hospital-directory-filters input:focus,
.hospital-directory-filters select:focus,
.activity-filters input:focus,
.activity-filters select:focus {
  border-color: #6f9ff1;
  outline: 3px solid rgba(47, 111, 236, 0.11);
}

.hospital-filter-reset {
  border-color: #d7e2f0;
  border-radius: 6px;
  background: #f5f8fd;
  color: #657188;
}
.hospital-filter-reset:hover { border-color: #9dbcf0; background: #eaf2ff; color: #2b64c8; }

.agent-source-panel { border-color: #dfe8f4; background: #f4f8fe; }

.hospital-directory-table { color: #4d596d; }
.hospital-directory-table th,
.hospital-directory-table td { border-color: #e4ebf5; }
.hospital-directory-table thead th,
.hospital-directory-table thead tr:first-child > th:first-child,
.hospital-directory-table thead tr:first-child > th:nth-child(2) {
  background: #edf3fc;
  color: #647087;
}
.hospital-directory-table tbody tr:nth-child(even) td,
.hospital-directory-table tbody tr:nth-child(even) td:first-child,
.hospital-directory-table tbody tr:nth-child(even) td:nth-child(2) { background: #fbfcff; }
.hospital-directory-table tbody tr:hover td,
.hospital-directory-table tbody tr:hover td:first-child,
.hospital-directory-table tbody tr:hover td:nth-child(2) { background: #eef5ff; }
.hospital-directory-table tbody tr.is-current td,
.hospital-directory-table tbody tr.is-current td:first-child,
.hospital-directory-table tbody tr.is-current td:nth-child(2) { background: #e2eeff; }
.hospital-directory-table th[aria-sort="ascending"] .hospital-sort-button,
.hospital-directory-table th[aria-sort="descending"] .hospital-sort-button,
.hospital-directory-table th[aria-sort="ascending"] .hospital-sort-button span,
.hospital-directory-table th[aria-sort="descending"] .hospital-sort-button span { color: #2f6fec; }

.hospital-name-button { color: #253149; }
.directory-state.is-positive { color: #238452; }
.directory-state.is-negative,
.directory-days.is-warning { color: #ce4e59; }

.activity-workspace { background: var(--bg); }
.activity-surface { padding: 0 26px 26px; }
.activity-scope-toolbar,
.activity-filters {
  border: 1px solid #dbe6f3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}
.activity-summary-strip { border-color: #dbe6f3; border-radius: 8px; box-shadow: var(--shadow); }
.activity-summary-item { background: #ffffff; }
.activity-summary-item strong { color: #2f6fec; }
.activity-adoption-panel { border-color: #eadabd; border-radius: 8px; background: #fffaf1; }
.activity-adoption-alert { border-color: #eadfce; border-radius: 7px; background: #ffffff; }
.activity-table-wrap { overflow: auto; border-color: #dbe6f3; border-radius: 8px; box-shadow: var(--shadow); }
.activity-table th { background: #edf3fc; color: #657188; }
.activity-table th,
.activity-table td { border-color: #e4ebf5; }
.activity-table tbody tr:hover td { background: #eef5ff; }

.admin-surface,
.ai-config-surface { padding: 0 26px 26px; background: var(--bg); }
.management-tabs {
  margin-top: -22px;
  padding: 0 2px;
  background: #ffffff;
}
.management-tabs button.is-active { border-bottom-color: #2f6fec; color: #215fce; }
.drawer-description { border-left-color: #2f6fec; background: #edf4ff; color: #53627a; }
.config-section-heading span { color: #2f6fec; }
.config-section { border-color: #dbe4f0; }
.user-table-wrap,
.user-form { overflow: hidden; border-color: #dbe5f2; border-radius: 8px; box-shadow: var(--shadow); }
.user-table th { background: #edf3fc; color: #657188; }
.user-table th,
.user-table td { border-color: #e4ebf5; }
.user-table tbody tr:hover td { background: #f3f7fe; }
.user-access-cell strong,
.access-scope-heading strong { color: #2b64c8; }
.status-active { background: #e4f5ec; color: #237b4e; }
.status-disabled { background: #f9e8e8; color: #a7464d; }
.override-item { background: #eef4fd; }
.permission-option.is-required,
.permission-required { color: #2b64c8; }
.access-preview-fieldset { background: #f7faff; }
.access-hospital-item { border-color: #dce6f3; }
.role-menu-panel,
.audit-panel { border-color: #dbe4f0; background: transparent; }
.ai-test-summary.is-testing i { border-color: #2f6fec; }

.auth-gate.is-visible {
  background:
    radial-gradient(circle at 13% 18%, rgba(66, 133, 244, 0.1), transparent 27%),
    radial-gradient(circle at 88% 82%, rgba(52, 168, 83, 0.08), transparent 24%),
    #f8fafd;
}
.auth-gate.is-visible {
  place-items: center;
  overflow: auto;
  padding: 28px;
}
.auth-layout {
  display: grid;
  grid-template-columns: minmax(440px, 1fr) 430px;
  gap: 42px;
  align-items: center;
  width: min(1040px, 100%);
}
.auth-card {
  width: 100%;
  border: 1px solid #e1e7ef;
  border-radius: 28px;
  padding: 34px;
  background: #ffffff;
  color: #202124;
  box-shadow: 0 24px 64px rgba(60, 64, 67, 0.13);
}
.auth-card-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 22px;
}
.auth-card .brand-mark {
  flex: 0 0 auto;
  margin: 0;
  border-radius: 14px;
  background: #1a73e8;
  box-shadow: 0 6px 16px rgba(26, 115, 232, 0.22);
}
.auth-card-brand .eyebrow { margin: 0 0 3px; color: #1967d2; }
.auth-card-brand span {
  color: #80868b;
  font-size: 11px;
  font-weight: 600;
}
.auth-card h1 {
  margin: 0;
  color: #202124;
  font-size: 27px;
  letter-spacing: -0.03em;
}
.auth-card .auth-card-intro {
  margin: 10px 0 22px;
  color: #5f6368;
  font-size: 13px;
  line-height: 1.65;
}
.auth-card > p:not(.eyebrow),
#accountLoginPanel > p,
.wechat-login-panel > p,
.auth-card label { color: #6d798d; }
.auth-card .auth-field {
  display: grid;
  gap: 8px;
  margin: 0 0 15px;
  color: #3c4043;
  font-size: 12px;
  font-weight: 700;
}
.auth-input-shell {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-shell > svg {
  position: absolute;
  z-index: 1;
  left: 14px;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #80868b;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: stroke 160ms ease;
}
.auth-card .auth-field input {
  width: 100%;
  min-height: 50px;
  border: 1px solid #dadce0;
  border-radius: 14px;
  padding: 0 46px;
  background: #f8fafd;
  color: #111827 !important;
  caret-color: #1a73e8;
  font-size: 14px;
  font-weight: 600;
  -webkit-text-fill-color: #111827;
  outline: none;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.auth-card .auth-field input::placeholder {
  color: #9aa0a6;
  font-weight: 400;
  opacity: 1;
}
.auth-card .auth-field input:hover { border-color: #bdc1c6; }
.auth-card .auth-field input:focus {
  border-color: #1a73e8;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.13);
}
.auth-input-shell:focus-within > svg { stroke: #1a73e8; }
.auth-field.is-invalid input {
  border-color: #d93025;
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.08);
}
.auth-field.is-invalid .auth-input-shell > svg { stroke: #d93025; }
.auth-field-error {
  min-height: 15px;
  margin-top: -3px;
  color: #d93025;
  font-size: 11px;
  font-weight: 500;
}
.password-toggle {
  position: absolute;
  z-index: 2;
  right: 8px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #5f6368;
}
.password-toggle:hover { background: #e8f0fe; color: #1967d2; }
.password-toggle:focus-visible { outline: 2px solid #1a73e8; outline-offset: 1px; }
.password-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.password-toggle .password-eye-closed,
.password-toggle.is-visible .password-eye-open { display: none; }
.password-toggle.is-visible .password-eye-closed { display: block; }
.auth-submit-button {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 3px;
  border-radius: 999px;
  background: #1a73e8;
  box-shadow: 0 6px 16px rgba(26, 115, 232, 0.22);
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.auth-submit-button:hover:not(:disabled) {
  background: #185abc;
  box-shadow: 0 8px 20px rgba(26, 115, 232, 0.28);
  transform: translateY(-1px);
}
.auth-submit-button:focus-visible { outline: 3px solid rgba(26, 115, 232, 0.24); outline-offset: 2px; }
.auth-submit-button:disabled { cursor: wait; opacity: 0.78; }
.auth-submit-spinner {
  display: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: auth-spinner 700ms linear infinite;
}
.auth-submit-button.is-loading .auth-submit-spinner { display: block; }
@keyframes auth-spinner { to { transform: rotate(360deg); } }
.auth-state {
  display: flex;
  min-height: 20px;
  align-items: center;
  justify-content: center;
  margin-top: 13px;
  color: #1967d2;
  font-size: 12px;
  font-weight: 600;
}
.auth-state.is-error { color: #d93025; }
.auth-state.is-success { color: #188038; }
.auth-state.is-loading { color: #1967d2; }
.auth-security-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 0 !important;
  color: #80868b !important;
  font-size: 10px !important;
  line-height: 1.5 !important;
}
.auth-security-note svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #34a853;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-card label input:-webkit-autofill,
.auth-card label input:-webkit-autofill:hover,
.auth-card label input:-webkit-autofill:focus {
  -webkit-text-fill-color: #111827;
  caret-color: #2f6fec;
  box-shadow: 0 0 0 1000px #ffffff inset, 0 0 0 3px rgba(47, 111, 236, 0.08);
}
.auth-method-tabs {
  gap: 5px;
  margin: 0 0 22px;
  border-radius: 999px;
  padding: 5px;
  background: #eef3fb;
}
.auth-method-tabs button {
  min-height: 40px;
  border-radius: 999px;
  color: #5f6368;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.auth-method-tabs button.is-active { background: #ffffff; color: #1967d2; box-shadow: 0 2px 8px rgba(60, 64, 67, 0.12); }
.auth-state,
.wechat-login-panel > strong { color: #2f6fec; }
.wechat-login-panel .ghost-button { border-color: #cfe0f8; color: #2b64c8; }
.wechat-login-panel .ghost-button:hover { background: #eaf2ff; }

.auth-launcher {
  min-width: 0;
  border: 1px solid #e1e7ef;
  border-radius: 28px;
  padding: 34px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 24px 64px rgba(60, 64, 67, 0.12);
  backdrop-filter: blur(18px);
}
.auth-launcher-heading { margin-bottom: 24px; }
.auth-launcher-heading .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  border-radius: 999px;
  padding: 7px 12px;
  background: #e8f0fe;
  color: #1967d2;
  letter-spacing: 0.1em;
}
.auth-launcher-heading .eyebrow::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4285f4;
  box-shadow: 12px 0 #ea4335, 24px 0 #fbbc04, 36px 0 #34a853;
  content: "";
  margin-right: 36px;
}
.auth-launcher-heading h2 {
  margin: 0;
  color: #202124;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.auth-launcher-heading > p:last-child {
  margin-top: 9px;
  color: #5f6368;
  font-size: 14px;
  line-height: 1.6;
}
.auth-launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.auth-launcher-grid button {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 118px;
  place-items: center;
  align-content: center;
  gap: 12px;
  overflow: hidden;
  border: 1px solid #e3e7ee;
  border-radius: 22px;
  padding: 14px 8px;
  background: #ffffff;
  color: #3c4043;
  box-shadow: 0 2px 8px rgba(60, 64, 67, 0.06);
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease, color 180ms ease, transform 180ms ease;
}
.auth-launcher-grid button:hover {
  border-color: #d2e3fc;
  color: #1967d2;
  box-shadow: 0 12px 28px rgba(60, 64, 67, 0.14);
  transform: translateY(-4px);
}
.auth-launcher-grid button:focus-visible {
  border-color: #1a73e8;
  outline: 3px solid rgba(26, 115, 232, 0.22);
  outline-offset: 2px;
}
.auth-launcher-grid button:active {
  box-shadow: 0 5px 14px rgba(60, 64, 67, 0.12);
  transform: translateY(-1px);
}
.auth-launcher-grid button:last-child { grid-column: 2; }
.auth-launcher-grid button > span {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 0;
  border-radius: 17px;
  background: #e8f0fe;
  color: #1967d2;
  transition: border-radius 180ms ease, transform 180ms ease;
}
.auth-launcher-grid button:nth-child(2) > span {
  background: #fce8e6;
  color: #c5221f;
}
.auth-launcher-grid button:nth-child(3) > span {
  background: #fef7e0;
  color: #b06000;
}
.auth-launcher-grid button:nth-child(4) > span {
  background: #e6f4ea;
  color: #137333;
}
.auth-launcher-grid button:nth-child(5) > span {
  background: #f3e8fd;
  color: #8430ce;
}
.auth-launcher-grid button:nth-child(6) > span {
  background: #e4f7fb;
  color: #007b83;
}
.auth-launcher-grid button:nth-child(7) > span {
  background: #f1f3f4;
  color: #5f6368;
}
.auth-launcher-grid button:hover > span {
  border-radius: 50%;
  transform: scale(1.06);
}
.auth-launcher-grid button > span svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.auth-launcher-grid button > span .launcher-apps-icon {
  fill: currentColor;
  stroke: none;
}
.auth-launcher-grid button > strong {
  max-width: 100%;
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.auth-launcher-state {
  min-height: 18px;
  margin: 20px 0 0;
  color: #80868b;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 920px) {
  .auth-gate.is-visible { align-items: start; padding: 20px; }
  .auth-layout {
    grid-template-columns: minmax(0, 540px);
    justify-content: center;
    gap: 20px;
  }
  .auth-card { grid-row: 1; }
  .auth-launcher { grid-row: 2; padding: 28px; }
}

@media (max-width: 520px) {
  .auth-gate.is-visible { padding: 14px; }
  .auth-layout {
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    min-width: 0;
  }
  .auth-card,
  .auth-launcher {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .auth-card { border-radius: 24px; padding: 26px 24px; }
  .auth-card h1 { font-size: 24px; }
  .auth-method-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-method-tabs button {
    min-width: 0;
    padding-inline: 8px;
    font-size: 13px;
    white-space: nowrap;
  }
  .auth-input-shell,
  .auth-card .auth-field input { min-width: 0; }
  .auth-launcher { border-radius: 24px; padding: 24px 16px; }
  .auth-launcher-heading h2 { font-size: 23px; }
  .auth-launcher-grid { gap: 8px; }
  .auth-launcher-grid button { min-height: 98px; border-radius: 18px; padding: 10px 5px; }
  .auth-launcher-grid button > span { width: 44px; height: 44px; border-radius: 14px; }
  .auth-launcher-grid button > span svg { width: 23px; height: 23px; }
  .auth-launcher-grid button > strong { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-launcher-grid button,
  .auth-launcher-grid button > span { transition: none; }
}

@media (min-width: 821px) and (max-width: 1120px) {
  .app-shell { grid-template-columns: 240px minmax(0, 1fr); height: 100vh; overflow: hidden; }
  .workspace-panel { position: sticky; height: 100vh; padding: 18px 14px; }
  .main-stage,
  .admin-drawer.is-open,
  .template-workspace,
  .activity-workspace { grid-column: 2; height: 100vh; }
}

@media (max-width: 820px) {
  h2 { font-size: 24px; }
  .app-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    overflow: visible;
  }
  .workspace-panel { padding: 16px; }
  .workspace-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace-tools > p,
  .workspace-menu-divider { grid-column: 1 / -1; }
  .workspace-tool-button { grid-template-columns: 30px minmax(0, 1fr); min-height: 56px; }
  .workspace-tool-button::after { display: none; }
  .sidebar-account { margin-top: 12px; }
  .main-stage,
  .activity-surface,
  .admin-surface,
  .ai-config-surface { padding: 0 16px 16px; }
  .main-stage,
  .activity-workspace,
  .template-workspace,
  .admin-drawer.is-open {
    grid-column: 1;
    width: 100%;
    min-width: 0;
  }
  .main-stage,
  .activity-workspace,
  .admin-drawer.is-open { height: auto; }
  .template-workspace { height: 100vh; }
  .topbar,
  .activity-header,
  .management-page .admin-header { margin: 0 -16px 18px; padding: 18px 16px; }
}

@media (max-width: 520px) {
  .workspace-panel { padding: 12px; }
  .brand-block {
    margin: 0 2px 12px;
    padding-bottom: 12px;
  }
  .brand-mark { width: 42px; height: 42px; }
  .brand-block h1 { font-size: 15px; }
  .brand-block p { font-size: 10px; line-height: 1.35; }
  .workspace-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 10px;
  }
  .workspace-tools > p,
  .workspace-menu-divider { display: none; }
  .workspace-tool-button {
    grid-template-columns: 28px minmax(0, 1fr);
    min-height: 46px;
    padding: 6px 7px;
  }
  .workspace-tool-icon { width: 28px; height: 28px; }
  .workspace-tool-copy { gap: 0; }
  .workspace-tool-copy strong { font-size: 11px; }
  .workspace-tool-copy small { display: none; }
  .sidebar-account {
    grid-template-columns: 34px minmax(0, 1fr);
    margin-top: 0;
    padding: 8px 10px;
  }
  .sidebar-account-avatar { width: 34px; height: 34px; }
  .sidebar-account-copy > span,
  .sidebar-account-name { display: none; }
  .sidebar-account-copy strong { font-size: 12px; }
  .sidebar-account-copy small { font-size: 9px; }
}
