:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #5e6978;
  --line: #d6dbe3;
  --accent: #206a5d;
  --accent-dark: #164f46;
  --status-bg: #eef7f4;
  --status-line: #a9cbc2;
  --status-processing-bg: #fff8e8;
  --status-processing-line: #e6c46c;
  --status-complete-bg: #edf8ef;
  --status-complete-line: #7ec18c;
  --error-bg: #fff1f0;
  --error-text: #9a2a1f;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgb(23 32 42 / 5%);
  --shadow-md: 0 14px 34px rgb(23 32 42 / 10%);
  --touch-target: 44px;
  --page-gutter: 16px;
}

* {
  box-sizing: border-box;
}

*[hidden] {
  display: none !important;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

.app-shell {
  width: min(920px, calc(100vw - (var(--page-gutter) * 2) - env(safe-area-inset-left) - env(safe-area-inset-right)));
  margin: 28px auto;
}

.app-shell.narrow {
  width: min(520px, calc(100vw - 32px));
}

.app-shell.wide {
  width: min(1440px, calc(100vw - (var(--page-gutter) * 2) - env(safe-area-inset-left) - env(safe-area-inset-right)));
}

.workspace {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin: 32px 0 12px;
  font-size: 18px;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
}

.header-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.account-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "email signout"
    "menu signout";
  justify-items: end;
  align-items: center;
  gap: 4px 14px;
  color: var(--muted);
  font-size: 13px;
}

.account-panel > span {
  grid-area: email;
}

.account-panel > form {
  grid-area: signout;
  margin: 0;
}

.account-panel a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.dashboard-icon-menu {
  grid-area: menu;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  position: relative;
}

.dashboard-icon-menu::-webkit-scrollbar {
  display: none;
}

.icon-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--accent);
}

.icon-nav-link:hover,
.icon-nav-link:focus-visible,
.icon-nav-link.is-active {
  border-color: var(--line);
  background: #f7f9fa;
}

.icon-nav-link.is-active {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.icon-nav-link svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.account-panel .menu-tile {
  flex-direction: column;
  gap: 2px;
  inline-size: 62px;
  block-size: 56px;
  padding: 3px 5px 4px;
  border-radius: 8px;
  background: transparent;
  color: #126f62;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.account-panel .menu-tile:hover,
.account-panel .menu-tile:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 35%, #d8e2ea);
  background: #f8fafb;
  outline: none;
}

.account-panel .menu-tile.is-active {
  border-color: var(--accent);
  background: transparent;
  color: #126f62;
}

.account-panel .menu-tile span:not(.sr-only, .menu-glyph) {
  display: block;
  max-width: 56px;
  overflow: hidden;
  color: inherit;
  font-size: 9px;
  font-weight: 850;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-icon-image {
  display: block;
  inline-size: 39px;
  block-size: 39px;
  object-fit: contain;
  flex: 0 0 39px;
  pointer-events: none;
}

.sign-out-form .menu-tile {
  appearance: none;
  font-family: inherit;
}

.menu-glyph {
  position: relative;
  display: block;
  inline-size: 18px;
  block-size: 17px;
  flex: 0 0 17px;
  color: inherit;
}

.menu-glyph-home::before {
  content: "";
  position: absolute;
  inset: 1px 0 0;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 42%, 86% 42%, 86% 100%, 60% 100%, 60% 68%, 40% 68%, 40% 100%, 14% 100%, 14% 42%, 0 42%);
}

.menu-glyph-calendar {
  border: 1.6px solid currentColor;
  border-radius: 3px;
}

.menu-glyph-calendar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  block-size: 5px;
  background: currentColor;
}

.menu-glyph-calendar::after {
  content: "31";
  position: absolute;
  inset: 6px 0 auto;
  font-size: 6px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.menu-glyph-excel {
  border: 1.6px solid currentColor;
  border-radius: 3px;
}

.menu-glyph-excel::before {
  content: "XLS";
  position: absolute;
  inset: 2px 0 auto;
  font-size: 5px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
}

.menu-glyph-excel::after {
  content: "";
  position: absolute;
  inset: 8px 2px 2px;
  opacity: .65;
  background:
    linear-gradient(currentColor 0 0) 0 33% / 100% 1px no-repeat,
    linear-gradient(currentColor 0 0) 0 66% / 100% 1px no-repeat,
    linear-gradient(currentColor 0 0) 33% 0 / 1px 100% no-repeat,
    linear-gradient(currentColor 0 0) 66% 0 / 1px 100% no-repeat;
}

.menu-glyph-settings::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle, transparent 0 25%, currentColor 26% 49%, transparent 50%),
    conic-gradient(currentColor 0 10deg, transparent 10deg 35deg, currentColor 35deg 55deg, transparent 55deg 80deg, currentColor 80deg 100deg, transparent 100deg 125deg, currentColor 125deg 145deg, transparent 145deg 170deg, currentColor 170deg 190deg, transparent 190deg 215deg, currentColor 215deg 235deg, transparent 235deg 260deg, currentColor 260deg 280deg, transparent 280deg 305deg, currentColor 305deg 325deg, transparent 325deg);
}

.menu-glyph-security::before {
  content: "";
  position: absolute;
  inset: 0 2px;
  background: currentColor;
  clip-path: polygon(50% 0, 94% 18%, 90% 58%, 72% 84%, 50% 100%, 28% 84%, 10% 58%, 6% 18%);
}

.menu-glyph-view::before {
  content: "";
  position: absolute;
  inset: 3px 0;
  border-radius: 50%;
  border: 1.7px solid currentColor;
  transform: scaleX(1.35) rotate(-2deg);
}

.menu-glyph-view::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: currentColor;
}

.view-as-menu {
  position: relative;
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 9px;
}

.view-as-menu.is-active {
  border-color: transparent;
  background: transparent;
}

.view-as-trigger {
  appearance: none;
}

.view-as-popover {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 20;
  display: grid;
  gap: 6px;
  inline-size: min(280px, calc(100vw - 48px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.view-as-option-group {
  display: grid;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid #e7edf2;
}

.view-as-option {
  display: grid;
  gap: 1px;
  padding: 9px 10px;
  border: 1px solid #d8e2ea;
  border-radius: 8px;
  background: #f8fafb;
  color: var(--text);
  text-decoration: none;
}

.view-as-option:hover,
.view-as-option:focus-visible,
.view-as-option.is-active {
  border-color: color-mix(in srgb, var(--accent) 35%, #d8e2ea);
  background: #eef7f4;
  outline: none;
}

.view-as-option.is-active {
  border-color: var(--accent);
}

.view-as-option span {
  font-size: 13px;
  font-weight: 850;
}

.view-as-option small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.view-as-reset {
  background: #fff8e8;
}

.status-box {
  margin-top: 20px;
  border: 1px solid var(--status-line);
  border-radius: 8px;
  background: var(--status-bg);
  padding: 14px 16px;
}

.status-box[data-kind="processing"] {
  border-color: var(--status-processing-line);
  background: var(--status-processing-bg);
}

.status-box[data-kind="complete"] {
  border-color: var(--status-complete-line);
  background: var(--status-complete-bg);
}

.status-box[data-kind="error"] {
  border-color: #f0b8b2;
  background: var(--error-bg);
}

.status-box strong {
  display: block;
  font-size: 15px;
}

.status-box p {
  font-size: 14px;
  line-height: 1.45;
}

.panel-section {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.panel-section h2 {
  margin: 0 0 6px;
  font-size: 17px;
}

.panel-section p {
  margin: 0;
  color: var(--muted);
}

.inline-form {
  margin-top: 12px;
}

.passkey-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-top: 24px;
  border: 1px solid var(--status-line);
  border-radius: 8px;
  background: var(--status-bg);
  padding: 16px;
}

.passkey-panel strong {
  display: block;
  font-size: 16px;
}

.passkey-panel p {
  max-width: 680px;
  font-size: 14px;
  line-height: 1.45;
}

.learn-more {
  display: inline-block;
  margin-left: 4px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: help;
}

.tooltip-button {
  display: inline-flex;
  justify-self: start;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: help;
}

.tooltip-button:hover {
  background: transparent;
  color: var(--accent-dark);
}

.passkey-login-status {
  margin-top: 0;
}

.feed-created {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  border: 1px solid var(--status-complete-line);
  border-radius: 8px;
  background: var(--status-complete-bg);
  padding: 16px;
}

.feed-created strong {
  display: block;
  font-size: 15px;
}

.feed-created p {
  font-size: 14px;
  line-height: 1.45;
}

.converter-form {
  display: grid;
  gap: 22px;
  margin-top: 28px;
}

.feed-builder {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.share-builder {
  margin-top: 28px;
}

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

.section-heading {
  margin-bottom: 16px;
}

.section-heading-actions {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.section-heading-actions .secondary-button {
  flex: 0 0 auto;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.section-heading p {
  max-width: 680px;
  font-size: 14px;
  line-height: 1.45;
}

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

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

.preset-card {
  display: grid;
  align-content: space-between;
  gap: 14px;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.preset-card.is-disabled {
  background: #fafbfc;
}

.preset-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.preset-card p {
  font-size: 13px;
  line-height: 1.45;
}

.preset-existing {
  display: grid;
  gap: 3px;
  border: 1px solid var(--status-complete-line);
  border-radius: 8px;
  background: var(--status-complete-bg);
  padding: 10px;
  font-size: 13px;
}

.preset-existing span {
  color: var(--muted);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.share-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.compact-field {
  max-width: 180px;
}

.field {
  display: grid;
  gap: 8px;
}

label,
legend {
  font-weight: 650;
}

.field-label {
  color: var(--text);
  font-weight: 650;
}

input[type="text"],
input[type="email"],
input[type="file"],
input[type="date"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}

input[type="text"],
input[type="email"],
input[type="file"],
input[type="date"],
select {
  min-height: var(--touch-target);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(32 106 93 / 28%);
  outline-offset: 2px;
}

.feed-url {
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}

.field-note {
  color: var(--muted);
  font-size: 13px;
}

fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.feed-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.option-group {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 10px;
}

.option-group-wide {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

legend {
  padding: 0 6px;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.option-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  min-height: 76px;
  border: 1px solid #e2e7ee;
  border-radius: 8px;
  padding: 12px;
  background: #fafbfc;
  font-weight: 500;
}

.option-card:has(input:checked) {
  border-color: var(--accent);
  background: #f0f7f5;
}

.option-card input {
  margin-top: 3px;
}

.option-card strong,
.option-card small {
  display: block;
}

.option-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.grade-checkbox-group {
  display: grid;
  gap: 12px;
}

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

.grade-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 48px;
  border: 1px solid #e2e7ee;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fafbfc;
  font-weight: 700;
}

.grade-option span,
.grade-option small {
  display: block;
}

.grade-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.grade-option:has(input:checked) {
  border-color: var(--accent);
  background: #f0f7f5;
}

.grade-option input {
  flex: 0 0 auto;
}

.scoped-role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.scoped-role-heading {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

button {
  justify-self: start;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  min-height: var(--touch-target);
  touch-action: manipulation;
}

button:hover {
  background: var(--accent-dark);
}

.form-footer {
  display: flex;
  justify-content: flex-start;
}

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

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  min-height: 38px;
}

.secondary-button:hover {
  background: #eef1f4;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  text-decoration: none;
  font-weight: 700;
}

.danger-button {
  border: 1px solid #e2aaa4;
  background: #fff;
  color: var(--error-text);
  padding: 8px 10px;
  font-size: 13px;
}

.danger-button:hover {
  background: var(--error-bg);
}

.error {
  margin-top: 18px;
  border: 1px solid #f0b8b2;
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error-text);
  padding: 12px 14px;
}

.profile-list {
  margin-top: 26px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.table-note {
  color: var(--muted);
  font-size: 13px;
  background: #fafbfc;
}

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

.feed-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.feed-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.feed-title-row h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.token-chip {
  border: 1px solid #dfe5ec;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  background: #fafbfc;
  font-size: 12px;
  font-weight: 650;
}

.feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.feed-meta span {
  border-radius: 999px;
  background: #eef1f4;
  padding: 4px 8px;
  color: #3d4855;
  font-size: 12px;
  font-weight: 650;
}

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

.feed-stats div {
  min-width: 0;
}

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

.config-role-overview {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.config-matrix {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.config-matrix-secondary {
  margin-top: 16px;
}

.config-policy-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 16px;
  margin-top: 16px;
}

.config-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.config-panel-spaced {
  margin-top: 16px;
}

.config-section-menu {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 18px 0 12px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  padding: 0 0 8px;
}

.config-section-menu a {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 7px 10px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
}

.config-section-menu a.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.config-section-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.config-section-summary strong {
  color: var(--text);
  font-size: 16px;
}

.config-rule-note {
  margin-bottom: 16px;
  border: 1px solid var(--status-line);
  border-radius: 8px;
  background: var(--status-bg);
  padding: 12px 14px;
}

.config-rule-note strong {
  display: block;
}

.org-map {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfd;
}

.org-map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.segmented-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #fff;
}

.segmented-control label {
  display: inline-flex;
  cursor: pointer;
}

.segmented-control input[type="radio"] {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.segmented-control label span {
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.segmented-control input[type="radio"]:checked + span {
  color: #fff;
  background: var(--accent);
}

.segmented-control input[type="radio"]:focus-visible + span {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 2px;
}

.org-plane-button {
  appearance: none;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.org-plane-button.active {
  color: #fff;
  background: var(--accent);
}

.org-fold-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.org-fold-actions .secondary-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

.org-plane-panel[hidden] {
  display: none;
}

.org-plane-description {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.org-tree,
.org-branch {
  margin: 0;
  padding: 0;
  list-style: none;
}

.org-tree {
  display: grid;
  gap: 10px;
}

.org-branch {
  position: relative;
  display: grid;
  gap: 8px;
  margin-top: 8px;
  margin-left: 24px;
  padding-left: 14px;
  border-left: 2px solid #dce7e3;
}

.org-node {
  min-width: 0;
}

.org-branch > .org-node {
  position: relative;
}

.org-branch > .org-node::before {
  content: "";
  position: absolute;
  top: 19px;
  left: -14px;
  width: 14px;
  border-top: 2px solid #dce7e3;
}

.org-node-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 680px;
  border: 1px solid #d7e2df;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}

.org-node-details > summary.org-node-box {
  cursor: pointer;
  list-style: none;
}

.org-node-details > summary.org-node-box::-webkit-details-marker {
  display: none;
}

.org-disclosure {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 1px solid #d0d9e2;
  border-radius: 999px;
  background: #fafbfc;
  position: relative;
}

.org-disclosure::before,
.org-disclosure::after {
  content: "";
  position: absolute;
  background: var(--muted);
}

.org-disclosure::before {
  top: 9px;
  left: 5px;
  width: 8px;
  height: 2px;
}

.org-disclosure::after {
  top: 6px;
  left: 8px;
  width: 2px;
  height: 8px;
}

.org-node-details[open] > summary .org-disclosure::after {
  display: none;
}

.org-node-content {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.org-node-title,
.org-node-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.org-node-title strong {
  min-width: 0;
}

.node-type-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.org-node-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.org-node-meta span {
  border-radius: 999px;
  background: #eef1f4;
  padding: 2px 7px;
}

.authority-map,
.job-title-map {
  display: grid;
  gap: 10px;
}

.job-title-tree,
.job-title-tree-branch {
  margin: 0;
  padding: 0;
  list-style: none;
}

.job-title-tree-branch {
  position: relative;
  display: grid;
  gap: 8px;
  margin-top: 8px;
  margin-left: 22px;
  padding-left: 14px;
  border-left: 2px solid #dce7e3;
}

.job-title-tree-node {
  position: relative;
  min-width: 0;
}

.job-title-tree-branch > .job-title-tree-node::before {
  content: "";
  position: absolute;
  top: 20px;
  left: -14px;
  width: 14px;
  border-top: 2px solid #dce7e3;
}

.authority-node,
.job-title-node {
  display: grid;
  gap: 5px;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
}

.job-title-node-active {
  border-color: var(--status-line);
  background: var(--status-bg);
}

.authority-node-main,
.job-title-node-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.authority-node > span,
.job-title-node > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.role-title-map {
  margin-top: 16px;
  border-top: 1px solid #eef1f4;
  padding-top: 14px;
}

.role-title-map h3 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.25;
}

.role-title-list {
  display: grid;
  gap: 8px;
}

.role-title-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  align-items: start;
  min-width: 0;
  border-top: 1px solid #eef1f4;
  padding-top: 8px;
}

.role-title-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.role-title-row > span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.role-table {
  display: grid;
  gap: 10px;
}

.role-table > div {
  display: grid;
  grid-template-columns: auto minmax(120px, 0.6fr) minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-top: 1px solid #eef1f4;
  padding-top: 10px;
}

.role-table > div:first-child {
  border-top: 0;
  padding-top: 0;
}

.role-table p {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
}

.policy-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.policy-list li + li {
  margin-top: 6px;
}

.compact-role-table > div {
  grid-template-columns: auto minmax(120px, 1fr) minmax(0, 1fr);
}

.config-panel .section-heading {
  margin-bottom: 12px;
}

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

.config-action-list a,
.config-return a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  background: #fafbfc;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.config-action-list a:hover,
.config-return a:hover {
  background: #eef1f4;
}

.config-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.user-filter-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
  background: #fff;
}

.filter-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-top: 20px;
  background: #fff;
}

.user-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

td pre {
  max-width: 36rem;
  max-height: 16rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: #f8fafb;
  white-space: pre-wrap;
}

.user-list-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.user-list-table {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.user-list-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(150px, 0.9fr) minmax(180px, 1fr) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-top: 1px solid #eef1f4;
  background: #fff;
}

.user-list-row:first-child {
  border-top: 0;
}

.user-list-header {
  background: #f7f9fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.user-list-identity {
  display: grid;
  gap: 3px;
}

.user-list-identity span,
.muted-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.user-list-row > div:not(.user-list-identity):not(.user-list-actions) {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-list-actions {
  justify-self: end;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 12px;
  box-shadow: var(--shadow-sm);
}

.dashboard-panel + .dashboard-panel {
  margin-top: 18px;
}

.dashboard-panel-wide {
  grid-column: 1 / -1;
}

.dashboard-heading,
.user-list-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.dashboard-shift-list,
.dashboard-mini-list {
  display: grid;
  gap: 10px;
}

.dashboard-shift-row,
.dashboard-mini-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #eef1f4;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.dashboard-mini-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.dashboard-shift-row > div:first-child,
.dashboard-mini-row > div:first-child {
  display: grid;
  gap: 3px;
}

.dashboard-shift-row span,
.dashboard-mini-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.dashboard-staffing-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.personal-duty-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.personal-duty-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
}

.compact-duty-table {
  min-width: 820px;
}

.compact-duty-table .duty-date-column {
  width: 120px;
}

.compact-duty-table .duty-day-column {
  width: 54px;
}

.compact-duty-table .duty-role-column {
  width: 130px;
}

.compact-duty-table .duty-resident-column {
  width: 92px;
}

.live-duty-table {
  min-width: 860px;
}

.personal-duty-table th,
.personal-duty-table td {
  border-bottom: 1px solid #e8edf1;
  border-left: 1px solid #eef1f4;
  padding: 2px 5px;
  text-align: left;
  vertical-align: middle;
}

.personal-duty-table th:first-child,
.personal-duty-table td:first-child {
  border-left: 0;
}

.personal-duty-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7f9fa;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-transform: none;
}

.personal-duty-table tbody th {
  background: #fbfcfd;
  white-space: nowrap;
}

.personal-duty-table tbody th span {
  display: inline-block;
  width: 30px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.personal-duty-table tbody th strong {
  color: var(--text);
  font-size: 13px;
}

.personal-duty-date-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.personal-duty-date-link:hover strong,
.personal-duty-date-link:focus strong {
  text-decoration: underline;
}

.compact-duty-table tbody th,
.compact-duty-table td {
  height: 26px;
  color: #0f1720;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.1;
  text-align: center;
}

.compact-duty-table tbody th {
  font-size: 13px;
}

.compact-duty-table .duty-role-cell {
  position: relative;
}

.compact-duty-table .duty-role-cell strong {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
}

.compact-duty-table .duty-role-own {
  background: #005eb8;
  color: #fff;
}

.compact-duty-table .duty-role-own strong {
  color: #fff;
  font-weight: 750;
}

.compact-duty-table tr.duty-context-gap-row th,
.compact-duty-table tr.duty-context-gap-row td {
  background: #f8fafc;
  color: #516070;
}

.compact-duty-swap-form {
  position: absolute;
  top: 1px;
  right: 1px;
}

.compact-duty-swap-button {
  min-height: 18px;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 3px;
  padding: 1px 3px;
  background: rgb(255 255 255 / 76%);
  color: #005eb8;
  font-size: 9px;
  font-weight: 750;
  line-height: 1;
  opacity: 0.28;
}

.duty-role-own:hover .compact-duty-swap-button,
.duty-role-own:focus-within .compact-duty-swap-button {
  opacity: 1;
}

.personal-duty-chip-list,
.handover-chip-list,
.consultant-colleague-list,
.resident-name-list,
.resident-summary-list,
.personal-duty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.personal-duty-chip,
.handover-chip,
.resident-summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.resident-summary-chip {
  position: relative;
  border: 1px solid #dbe6ef;
  background: #f8fafc;
  color: var(--text);
  cursor: help;
  justify-content: center;
  min-width: 52px;
  border-radius: 0;
  padding: 2px 5px;
  font-size: 14px;
  font-weight: 500;
}

.resident-summary-chip .resident-hover-detail {
  right: 0;
  left: auto;
  max-width: min(320px, calc(100vw - 24px));
}

.resident-summary-chip strong {
  margin-right: 4px;
}

.personal-duty-chip {
  background: #005eb8;
  color: #fff;
}

.personal-duty-chip strong {
  color: inherit;
}

.handover-chip {
  border: 1px solid #d4deea;
  background: #f8fafc;
  color: var(--text);
}

.handover-in {
  border-color: #bad3f2;
  background: #e8f2ff;
}

.handover-out {
  border-color: #d8c9ef;
  background: #f3ecff;
}

.consultant-colleague-list span,
.resident-name-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
}

.consultant-colleague-list strong,
.resident-name-list strong {
  color: var(--text);
}

.muted-table-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.personal-duty-actions .secondary-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.staffing-chip {
  display: inline-flex;
  border-radius: 999px;
  background: #eef3f6;
  padding: 4px 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.staffing-low {
  background: #fff8e8;
  color: #735412;
}

.staffing-critical {
  background: #fff1f0;
  color: var(--error-text);
}

.view-link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.view-site-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.view-leave-card,
.view-site-card {
  display: grid;
  gap: 10px;
  border: 1px solid #eef1f4;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px;
}

.view-site-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.view-site-heading strong {
  font-size: 17px;
}

.view-site-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.view-tier-list {
  display: grid;
  gap: 6px;
}

.view-leave-card,
.view-tier-list a {
  color: var(--text);
  text-decoration: none;
}

.view-tier-list a {
  display: grid;
  grid-template-columns: minmax(78px, max-content) minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  border-top: 1px solid #eef1f4;
  padding-top: 6px;
}

.view-tier-list a:first-child {
  border-top: 0;
  padding-top: 0;
}

.view-tier-list a strong {
  font-size: 13px;
}

.view-leave-card span,
.view-tier-list a span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fill-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 320px);
  grid-template-rows: repeat(4, minmax(0, auto));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.fill-line-list {
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.fill-line {
  display: grid;
  grid-template-columns: minmax(130px, 0.42fr) minmax(0, 2.7fr);
  gap: 10px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 8px;
}

.fill-line-primary {
  border-color: #b9cfe8;
  background: #fbfdff;
}

.fill-line-label {
  display: grid;
  align-content: center;
  gap: 2px;
  border-right: 1px solid #e6edf3;
  padding-right: 10px;
}

.fill-line-label strong,
.fill-line-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fill-line-label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.fill-period-bars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.fill-period-group {
  display: grid;
  gap: 5px;
  border: 1px solid #e6edf3;
  border-radius: 7px;
  background: #fff;
  padding: 7px;
}

.fill-period-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.fill-tier-bar {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.fill-tier-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.fill-problem-text {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.fill-shift-strips {
  display: grid;
  grid-template-columns: repeat(7, 9px);
  gap: 2px;
  justify-content: start;
  min-height: 11px;
}

.fill-shift-day {
  display: grid;
  grid-template-columns: repeat(2, 4px);
  gap: 1px;
}

.fill-shift-day i {
  display: block;
  width: 4px;
  height: 11px;
  border-radius: 1px;
  background: #dbe4ec;
}

.fill-shift-day i.rayg-red {
  background: #b42318;
}

.fill-shift-day i.rayg-amber {
  background: #d97706;
}

.fill-shift-day i.rayg-yellow {
  background: #f5d451;
}

.fill-shift-day i.rayg-green {
  background: #1f7a4d;
}

.fill-period-muted {
  opacity: 0.78;
  background: #f6f8fa;
}

.fill-period-current {
  background: #fff;
}

.fill-period-light {
  background: #fbfcfd;
}

.fill-card,
.view-link-grid a {
  display: grid;
  gap: 9px;
  border: 1px solid #eef1f4;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
  color: var(--text);
  text-decoration: none;
}

.fill-card > div:first-child {
  display: flex;
  gap: 8px;
  align-items: center;
}

.fill-card-primary {
  border-color: #b9cfe8;
  background: #fbfdff;
}

.fill-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf1;
}

.fill-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.fill-card.rayg-red .fill-meter span {
  background: #b42318;
}

.fill-card.rayg-red {
  border-color: #f0b8b2;
}

.fill-card.rayg-amber .fill-meter span {
  background: #d97706;
}

.fill-card.rayg-amber {
  border-color: #e6c46c;
}

.fill-card.rayg-yellow .fill-meter span {
  background: #f5d451;
}

.fill-card.rayg-yellow {
  border-color: #eadc97;
}

.fill-card.rayg-green .fill-meter span {
  background: #1f7a4d;
}

.fill-card.rayg-green {
  border-color: #cfe5d8;
}

.fill-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.view-link-grid a span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.rota-summary-heading {
  cursor: pointer;
  font-size: 18px;
  font-weight: 800;
}

.rota-summary-heading + .dashboard-shift-list,
.rota-summary-heading + .dashboard-mini-list,
.rota-summary-heading + p {
  margin-top: 14px;
}

.feed-stats dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.feed-stats dd {
  margin: 3px 0 0;
  font-size: 13px;
}

.live-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.live-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-top: 24px;
}

.live-radio-control {
  min-height: var(--touch-target);
}

.contact-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contact-action-row .secondary-button {
  min-height: 34px;
  padding: 6px 10px;
}

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

.live-shift-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 132px;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
  padding: 12px;
}

.live-shift-row.coverage-low {
  border-color: #e6c46c;
  background: #fff8e8;
}

.live-shift-row.coverage-critical,
.live-shift-row.compliance-warning {
  border-color: #f0b8b2;
  background: var(--error-bg);
}

.live-shift-row.swap-requested {
  border-color: var(--status-line);
  background: var(--status-bg);
}

.live-shift-date {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.live-shift-date strong {
  color: var(--text);
  font-size: 14px;
}

.live-shift-main {
  display: grid;
  gap: 10px;
}

.live-shift-context,
.metadata-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.live-shift-context {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.live-shift-main label {
  display: grid;
  gap: 4px;
}

.live-shift-main label > span,
.live-shift-actions {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.live-shift-main textarea {
  min-height: 58px;
  resize: vertical;
}

.metadata-checkboxes label {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.live-shift-actions {
  display: grid;
  gap: 8px;
}

.consultant-grid-panel {
  margin-top: 18px;
}

.consultant-grid-filter-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.consultant-grid-filter-status[hidden] {
  display: none;
}

.consultant-grid-filter-status .secondary-button {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.consultant-grid-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.consultant-rota-grid {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

.cx-consultant-rota-grid {
  min-width: 640px;
}

.consultant-rota-grid .rayg-column {
  width: 74px;
}

.consultant-rota-grid .date-column {
  width: 88px;
}

.consultant-rota-grid .day-column {
  width: 54px;
}

.consultant-rota-grid .leave-person-column {
  width: 170px;
}

.consultant-rota-grid .count-column {
  width: 70px;
}

.consultant-rota-grid .role-column {
  width: 88px;
}

.consultant-rota-grid .wide-shift-column {
  width: auto;
}

.live-rota-grid {
  min-width: max(
    760px,
    calc(
      50px + 112px + (var(--live-shift-columns, 3) * 146px) +
      (var(--resident-count-columns, 2) * 84px)
    )
  );
  table-layout: fixed;
}

.live-rota-grid .rayg-column {
  width: 50px;
}

.live-rota-grid .date-column {
  width: 112px;
}

.live-rota-grid .count-column {
  width: 84px;
}

.live-rota-grid .wide-shift-column {
  width: 146px;
}

.live-rota-grid th:nth-child(2),
.live-rota-grid td:nth-child(2) {
  left: 50px;
}

.consultant-rota-grid th,
.consultant-rota-grid td {
  border-bottom: 1px solid #e8edf1;
  border-left: 1px solid #eef1f4;
  padding: 7px 8px;
  text-align: left;
  vertical-align: middle;
}

.consultant-rota-grid th:first-child,
.consultant-rota-grid td:first-child {
  border-left: 0;
}

.consultant-rota-grid th:nth-child(1),
.consultant-rota-grid td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 3;
}

.consultant-rota-grid th:nth-child(2),
.consultant-rota-grid td:nth-child(2) {
  position: sticky;
  left: 74px;
  z-index: 3;
}

.consultant-rota-grid th:nth-child(3),
.consultant-rota-grid td:nth-child(3) {
  position: sticky;
  left: 162px;
  z-index: 3;
}

.consultant-rota-grid thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f7f9fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cx-consultant-rota-grid thead tr {
  height: 32px;
}

.cx-consultant-rota-grid thead tr:nth-child(2) th {
  top: 32px;
}

.cx-consultant-rota-grid thead tr:nth-child(3) th {
  top: 64px;
}

.cx-consultant-rota-grid thead tr:not(:first-child) th {
  left: auto;
}

.cx-consultant-rota-grid thead th[rowspan] {
  top: 0;
  z-index: 5;
  vertical-align: middle;
}

.cx-consultant-rota-grid thead th {
  text-align: center;
}

.cx-consultant-rota-grid .consultant-grid-day-heading {
  background: #fbf8f8;
  color: var(--text);
}

.cx-consultant-rota-grid .consultant-grid-night-heading,
.cx-consultant-rota-grid .consultant-night-cell {
  background: #e3eef9;
}

.cx-consultant-rota-grid th,
.cx-consultant-rota-grid td {
  border-bottom-color: #dce5ed;
  border-left-color: #dfe7ee;
}

.cx-consultant-rota-grid .rayg-column {
  width: 80px;
}

.cx-consultant-rota-grid .date-column {
  width: 70px;
}

.cx-consultant-rota-grid .day-column {
  width: 46px;
}

.cx-consultant-rota-grid .count-column {
  width: 68px;
}

.cx-consultant-rota-grid .role-column {
  width: 78px;
}

.cx-consultant-rota-grid th:nth-child(2),
.cx-consultant-rota-grid td:nth-child(2) {
  left: 80px;
}

.cx-consultant-rota-grid th:nth-child(3),
.cx-consultant-rota-grid td:nth-child(3) {
  left: 126px;
}

.cx-fill-count {
  margin-left: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.all-site-referral-grid {
  min-width: max(860px, calc(112px + (var(--all-site-count, 3) * 2 * 136px)));
  table-layout: fixed;
}

.all-site-referral-grid .date-column {
  width: 112px;
}

.all-site-referral-grid .wide-shift-column {
  width: 136px;
}

.all-site-referral-grid th:nth-child(2),
.all-site-referral-grid td:nth-child(2),
.all-site-referral-grid th:nth-child(3),
.all-site-referral-grid td:nth-child(3) {
  position: static;
  left: auto;
  z-index: auto;
}

.all-site-referral-grid thead tr:nth-child(2) th {
  top: 32px;
}

.all-site-referral-grid thead th {
  text-align: center;
}

.all-site-referral-cell {
  vertical-align: top;
}

.all-site-referral-list {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.all-site-referral-chip {
  position: relative;
  display: inline-flex;
  max-width: 100%;
  min-height: 28px;
  align-items: center;
  width: max-content;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  background: #f8fafb;
  padding: 3px 7px;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
}

.all-site-referral-chip strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.all-site-referral-chip:hover,
.all-site-referral-chip:focus {
  border-color: var(--accent);
  outline: 0;
  background: var(--status-bg);
}

.all-site-referral-chip:hover .consultant-hover-detail,
.all-site-referral-chip:focus .consultant-hover-detail,
.all-site-referral-chip:focus-within .consultant-hover-detail {
  display: block;
}

.consultant-rota-grid tbody th {
  background: #fbfcfd;
}

.consultant-rota-grid td:nth-child(1),
.consultant-rota-grid td:nth-child(2),
.consultant-rota-grid td:nth-child(3),
.consultant-rota-grid tbody th:nth-child(1),
.consultant-rota-grid tbody th:nth-child(2),
.consultant-rota-grid tbody th:nth-child(3) {
  box-shadow: 1px 0 0 #e8edf1;
}

.consultant-rota-grid tbody th span,
.consultant-rota-grid tbody th strong {
  display: inline-block;
}

.consultant-rota-grid tbody th span {
  width: 34px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.consultant-rota-grid tbody th strong {
  color: var(--text);
  font-size: 13px;
}

.consultant-day-cell {
  background: #fbfcfd;
  text-align: center;
}

.consultant-filter-token {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.consultant-filter-token:hover,
.consultant-filter-token:focus-visible {
  color: var(--brand);
  text-decoration: underline;
}

.consultant-rota-grid tr.weekend-row th,
.consultant-rota-grid tr.weekend-row td {
  background: #fffaf0;
}

.consultant-rota-grid tr.rayg-red th,
.consultant-rota-grid tr.rayg-red td {
  background: #fff1f0;
}

.consultant-rota-grid tr.rayg-amber th,
.consultant-rota-grid tr.rayg-amber td {
  background: #fff4dc;
}

.consultant-rota-grid tr.rayg-yellow th,
.consultant-rota-grid tr.rayg-yellow td {
  background: #fff8e8;
}

.cx-consultant-rota-grid tr:not(.weekend-row) .consultant-night-cell {
  background: #e3eef9;
}

.cx-consultant-rota-grid tr.weekend-row .consultant-night-cell {
  background: #f5eedf;
}

.leave-rota-grid {
  min-width: 1060px;
}

.leave-rota-grid .leave-type-column,
.leave-rota-grid .leave-site-column,
.leave-rota-grid .leave-tier-column {
  width: max(5ch, 64px);
}

.leave-rota-grid .leave-role-column {
  width: 124px;
}

.leave-rota-grid .leave-requested-column {
  width: 96px;
}

.leave-rota-grid .leave-cover-column {
  width: 138px;
}

.leave-rota-grid .leave-comment-column {
  width: 150px;
}

.leave-rota-grid .leave-authorisation-column {
  width: 126px;
}

.leave-rota-grid-verbose {
  min-width: 1260px;
}

.leave-rota-grid-verbose .leave-type-column {
  width: 138px;
}

.leave-rota-grid-verbose .leave-site-column {
  width: 180px;
}

.leave-rota-grid-verbose .leave-role-column {
  width: 160px;
}

.leave-rota-grid-verbose .leave-comment-column {
  width: 190px;
}

.leave-rota-grid td,
.leave-rota-grid th {
  overflow-wrap: anywhere;
}

.leave-rota-grid thead th {
  position: sticky;
  top: 0;
  z-index: 8;
  background: #f7f9fa;
}

.leave-rota-grid thead th:nth-child(1),
.leave-rota-grid thead th:nth-child(2),
.leave-rota-grid thead th:nth-child(3) {
  left: auto;
}

.leave-rota-grid tbody th:nth-child(1),
.leave-rota-grid tbody td:nth-child(1),
.leave-rota-grid tbody td:nth-child(2),
.leave-rota-grid tbody td:nth-child(3) {
  position: static;
  left: auto;
  z-index: auto;
}

.leave-rota-grid tbody th:nth-child(1),
.leave-rota-grid tbody td:nth-child(2),
.leave-rota-grid tbody td:nth-child(3) {
  box-shadow: none;
}

.leave-rota-grid tr.leave-attention th,
.leave-rota-grid tr.leave-attention td {
  background: #fff8e8;
}

.leave-person,
.leave-type,
.leave-required,
.leave-authorised,
.muted-table-text {
  display: block;
}

.leave-person {
  color: var(--text);
  font-weight: 850;
}

.leave-person-tbc {
  color: #8a1f17;
}

.muted-table-text {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.leave-date-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.leave-date-link:hover strong,
.leave-date-link:focus strong {
  text-decoration: underline;
}

.leave-type {
  width: max-content;
  border-radius: 999px;
  background: #eef4f8;
  padding: 3px 8px;
  color: #1f3a4d;
  font-size: 12px;
  font-weight: 850;
}

.leave-type-sickness,
.leave-required {
  color: #8a1f17;
}

.leave-type-sickness {
  background: #ffe5e1;
}

.leave-type-annual_leave {
  background: #e7f4ee;
  color: #17613d;
}

.leave-type-study_leave,
.leave-type-exam_leave,
.leave-type-professional_leave {
  background: #eef2ff;
  color: #334188;
}

.leave-type-bank_holiday_leave {
  background: #fff4ce;
  color: #684800;
}

.leave-type-discretionary_leave {
  background: #fff1e6;
  color: #8a3f00;
}

.leave-required {
  font-weight: 850;
}

.leave-authorised {
  color: #17613d;
  font-weight: 850;
}

.leave-cover {
  display: inline-block;
  width: max-content;
  max-width: 100%;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.leave-cover-critical {
  background: #ffe5e1;
  color: #8a1f17;
}

.leave-cover-amber {
  background: #fff1d6;
  color: #8a4a00;
}

.leave-cover-yellow {
  background: #fff8bf;
  color: #665000;
}

.leave-cover-covered,
.leave-cover-not-needed {
  background: #e7f4ee;
  color: #17613d;
}

.leave-cover-unknown {
  background: #eef3f6;
  color: var(--muted);
}

.leave-cover-surplus {
  background: #e6f0ff;
  color: #1f4d8f;
}

.consultant-rayg-cell {
  white-space: nowrap;
}

.live-rota-grid .consultant-rayg-cell {
  text-align: center;
}

.staff-count-cell {
  position: relative;
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

.resident-count {
  min-width: 36px;
  min-height: 24px;
  border: 0;
  border-radius: 999px;
  padding: 2px 8px;
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  cursor: help;
}

.resident-count.rayg-red {
  background: #b42318;
}

.resident-count.rayg-amber {
  background: #d97706;
}

.resident-count.rayg-yellow {
  background: #f5d451;
  color: #392700;
}

.resident-count.rayg-green {
  background: #1f7a4d;
}

.resident-hover-detail {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 10;
  display: none;
  min-width: 220px;
  max-width: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgb(23 32 42 / 14%);
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
}

.resident-hover-detail strong,
.resident-hover-detail span {
  display: block;
}

.staff-count-cell:last-child .resident-hover-detail {
  right: 0;
  left: auto;
}

.staff-count-cell:hover .resident-hover-detail,
.resident-count:focus + .resident-hover-detail,
.cx-card-residents:hover .resident-hover-detail,
.cx-card-residents:focus .resident-hover-detail,
.resident-summary-chip:hover .resident-hover-detail,
.resident-summary-chip:focus .resident-hover-detail,
.resident-summary-chip:focus-within .resident-hover-detail {
  display: block;
}

.cx-consultant-card-list {
  display: none;
}

.cx-consultant-day-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.cx-card-date {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  color: var(--text);
}

.cx-card-date > div {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cx-card-fill {
  border-radius: 999px;
  background: #eef3f6;
  color: var(--muted);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.cx-card-section {
  display: grid;
  gap: 7px;
}

.cx-card-section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.cx-card-section-night {
  border-top: 1px solid #d9e7f7;
  background: #f3f8fe;
  margin: 0 -10px -10px;
  padding: 9px 10px 10px;
}

.cx-card-shift-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.cx-card-shift {
  display: grid;
  grid-template-columns: minmax(44px, auto) minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.cx-card-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.cx-card-residents {
  position: relative;
  justify-content: center;
  width: max-content;
}

.rayg-indicator,
.rayg-count {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 850;
}

.rayg-indicator {
  min-width: 52px;
  justify-content: center;
}

.rayg-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  vertical-align: middle;
}

.rayg-dot.rayg-red {
  background: #b42318;
}

.rayg-dot.rayg-amber {
  background: #d97706;
}

.rayg-dot.rayg-yellow {
  background: #f5d451;
}

.rayg-dot.rayg-green {
  background: #1f7a4d;
}

.rayg-count {
  margin-left: 4px;
  background: rgb(255 255 255 / 72%);
  color: var(--muted);
}

.rayg-indicator.rayg-red {
  background: #b42318;
  color: #fff;
}

.rayg-indicator.rayg-amber {
  background: #d97706;
  color: #fff;
}

.rayg-indicator.rayg-yellow {
  background: #f5d451;
  color: #392700;
}

.rayg-indicator.rayg-green {
  background: #1f7a4d;
  color: #fff;
}

.consultant-shift-cell {
  position: relative;
  display: flex;
  min-height: 32px;
  align-items: center;
  gap: 4px;
}

.consultant-neighbour {
  min-width: 24px;
  color: #8a94a3;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.consultant-initials {
  min-width: 36px;
  min-height: 26px;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  background: #f8fafb;
  color: var(--text);
  padding: 3px 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
  cursor: context-menu;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shift-chip-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.live-rota-grid .consultant-shift-cell {
  position: relative;
  min-width: 0;
  min-height: 28px;
}

.live-rota-grid .shift-chip-cluster {
  align-items: center;
}

.live-rota-grid[data-active-display="terse"] .consultant-initials,
.live-rota-grid[data-active-display="firstname"] .consultant-initials,
.live-rota-grid[data-active-display="surname"] .consultant-initials,
.live-rota-grid[data-active-display="verbose"] .consultant-initials {
  white-space: normal;
  overflow-wrap: anywhere;
}

.consultant-initials:hover,
.consultant-initials:focus {
  border-color: var(--accent);
  outline: 0;
  background: var(--status-bg);
}

.consultant-shift-cell.is-mine .consultant-initials {
  border-color: #003f87;
  background: #005eb8;
  box-shadow: 0 0 0 2px rgb(0 94 184 / 18%);
  color: #fff;
}

.consultant-shift-cell.is-mine .consultant-initials:hover,
.consultant-shift-cell.is-mine .consultant-initials:focus {
  border-color: #002f66;
  background: #004b94;
  color: #fff;
}

.consultant-shift-cell.swap-requested .consultant-initials {
  border-color: #e6c46c;
  background: #fff8e8;
}

.consultant-cell-flag {
  border-radius: 999px;
  background: #fff1d6;
  padding: 2px 6px;
  color: #735412;
  font-size: 10px;
  font-weight: 850;
}

.consultant-empty-cell {
  display: block;
  min-height: 28px;
  color: transparent;
}

.consultant-empty-slot,
.consultant-leave-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 26px;
  border: 1px dashed #cfd8e3;
  border-radius: 6px;
  background: #fff;
  color: transparent;
}

.consultant-leave-slot {
  border-style: solid;
  background: #f4f6f8;
  color: #6b7785;
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 800;
}

.consultant-hover-detail {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 10;
  display: none;
  min-width: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgb(23 32 42 / 14%);
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.consultant-hover-detail strong,
.consultant-hover-detail span {
  display: block;
}

.consultant-hover-detail strong {
  color: var(--text);
  font-size: 13px;
}

.consultant-shift-cell:hover .consultant-hover-detail,
.consultant-initials:focus + .consultant-hover-detail {
  display: block;
}

.consultant-context-menu {
  position: fixed;
  z-index: 1000;
  display: grid;
  width: 190px;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 36px rgb(23 32 42 / 18%);
  padding: 8px;
}

.consultant-context-menu[hidden] {
  display: none;
}

.consultant-context-menu strong,
.consultant-context-menu span {
  padding: 0 4px;
}

.consultant-context-menu span {
  color: var(--muted);
  font-size: 12px;
}

.consultant-context-menu button {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f7f9fa;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.consultant-context-menu button:hover {
  border-color: var(--status-line);
  background: var(--status-bg);
}

.swap-candidate-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.swap-candidate-list form {
  display: grid;
  grid-template-columns: minmax(160px, 0.8fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--status-line);
  padding-top: 8px;
}

@media (max-width: 680px) {
  .section-heading-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    padding: 20px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .share-grid {
    grid-template-columns: 1fr;
  }

  .compact-field {
    max-width: none;
  }

  .header-row {
    display: grid;
  }

  .account-panel {
    justify-items: start;
  }

  fieldset {
    display: grid;
  }

  .feed-options,
  .option-group-wide,
  .grade-option-grid,
  .scoped-role-grid,
  .user-filter-grid,
  .user-list-row,
  .feed-row,
  .preset-grid,
  .subscription-grid,
  .passkey-panel,
  .config-grid,
  .config-matrix,
  .config-policy-grid,
  .dashboard-grid,
  .dashboard-shift-row,
  .dashboard-mini-row,
  .fill-line,
  .fill-grid,
  .view-link-grid,
  .view-site-grid,
  .config-action-list,
  .role-table > div,
  .feed-stats {
    grid-template-columns: 1fr;
  }

  .live-shift-row {
    grid-template-columns: 1fr;
  }

  .fill-period-bars {
    grid-template-columns: 1fr;
  }

  .fill-line-label {
    border-right: 0;
    border-bottom: 1px solid #e6edf3;
    padding-right: 0;
    padding-bottom: 6px;
  }

  .swap-candidate-list form {
    grid-template-columns: 1fr;
  }

  .org-branch {
    margin-left: 10px;
  }

  .org-map-toolbar,
  .org-fold-actions,
  .segmented-control {
    width: 100%;
  }

  .org-plane-button,
  .org-fold-actions .secondary-button {
    flex: 1 1 auto;
  }
}

/* Local responsive display framework: phones, tablets, desktop. */
@media (max-width: 1100px) {
  :root {
    --page-gutter: 12px;
  }

  .app-shell,
  .app-shell.wide {
    margin-top: 18px;
    margin-bottom: 18px;
  }

  .workspace {
    padding: 22px;
  }

  .dashboard-grid,
  .config-matrix,
  .config-policy-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-panel-wide {
    grid-column: auto;
  }

  .view-link-grid,
  .view-site-grid,
  .subscription-grid,
  .preset-grid,
  .config-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .header-row {
    display: grid;
    gap: 14px;
  }

  .account-panel {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "email"
      "menu"
      "signout";
    justify-content: flex-start;
    justify-items: start;
    align-items: center;
    gap: 8px;
  }

  .account-panel > span {
    flex-basis: auto;
  }

  .account-panel > form {
    grid-area: signout;
  }

  .dashboard-icon-menu {
    justify-content: flex-start;
    inline-size: 100%;
  }

  .dashboard-heading,
  .user-list-heading {
    align-items: flex-start;
  }

  .fill-grid {
    grid-auto-flow: column;
    grid-auto-columns: minmax(230px, 42vw);
    grid-template-rows: repeat(4, minmax(0, auto));
    grid-template-columns: none;
  }

  .fill-line {
    min-width: 0;
  }

  .consultant-rota-grid {
    min-width: 1040px;
  }

  .cx-consultant-rota-grid {
    min-width: 640px;
  }

  .live-rota-grid {
    min-width: max(
      760px,
      calc(
        50px + 112px + (var(--live-shift-columns, 3) * 146px) +
        (var(--resident-count-columns, 2) * 84px)
      )
    );
  }

  .live-filter-form {
    position: sticky;
    top: 0;
    z-index: 20;
    margin-right: -8px;
    margin-left: -8px;
    border-bottom: 1px solid var(--line);
    background: rgb(255 255 255 / 94%);
    padding: 10px 8px;
  }
}

@media (max-width: 760px) {
  .cx-consultant-table-scroll {
    display: none;
  }

  .cx-consultant-card-list {
    display: grid;
    gap: 10px;
  }

  .consultant-grid-panel {
    border: 0;
    padding: 0;
  }

  .cx-card-shift .consultant-shift-cell {
    min-height: 0;
  }

  .cx-card-shift .consultant-initials {
    min-width: 40px;
    width: max-content;
  }

  .cx-consultant-card-list-terse .cx-card-label {
    max-width: 54px;
  }
}

@media (max-width: 560px) {
  :root {
    --page-gutter: 0px;
  }

  body {
    background: #fff;
  }

  .app-shell,
  .app-shell.narrow,
  .app-shell.wide {
    width: 100%;
    margin: 0;
  }

  .workspace {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 14px max(12px, env(safe-area-inset-right)) 18px max(12px, env(safe-area-inset-left));
  }

  h1 {
    font-size: 24px;
  }

  h2,
  .section-heading h2,
  .rota-summary-heading {
    font-size: 17px;
  }

  .dashboard-panel,
  .config-panel,
  .status-box,
  .passkey-panel,
  .feed-row,
  .preset-card {
    border-radius: var(--radius-md);
    padding: 12px;
  }

  .dashboard-heading,
  .user-list-heading,
  .share-grid,
  .passkey-panel,
  .feed-row,
  .dashboard-shift-row,
  .dashboard-mini-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .view-link-grid,
  .view-site-grid,
  .subscription-grid,
  .preset-grid,
  .config-grid,
  .field-grid,
  .grade-option-grid,
  .user-filter-grid,
  .user-list-row,
  .role-table > div,
  .feed-stats {
    grid-template-columns: 1fr;
  }

  .fill-grid {
    grid-auto-columns: minmax(220px, 86vw);
    grid-template-rows: repeat(4, minmax(0, auto));
    margin-right: -12px;
    margin-left: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .consultant-grid-scroll,
  .table-wrap {
    margin-right: -12px;
    margin-left: -12px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .consultant-rota-grid {
    min-width: 980px;
  }

  .cx-consultant-rota-grid {
    min-width: 640px;
  }

  .live-rota-grid {
    min-width: max(
      760px,
      calc(
        50px + 112px + (var(--live-shift-columns, 3) * 146px) +
        (var(--resident-count-columns, 2) * 84px)
      )
    );
  }

  .consultant-rota-grid th,
  .consultant-rota-grid td {
    padding: 6px 7px;
  }

  .consultant-rota-grid .rayg-column {
    width: 68px;
  }

  .consultant-rota-grid .date-column {
    width: 82px;
  }

  .consultant-rota-grid .day-column {
    width: 50px;
  }

  .consultant-rota-grid th:nth-child(2),
  .consultant-rota-grid td:nth-child(2) {
    left: 68px;
  }

  .consultant-rota-grid th:nth-child(3),
  .consultant-rota-grid td:nth-child(3) {
    left: 150px;
  }

  .cx-consultant-rota-grid th:nth-child(2),
  .cx-consultant-rota-grid td:nth-child(2) {
    left: 68px;
  }

  .cx-consultant-rota-grid th:nth-child(3),
  .cx-consultant-rota-grid td:nth-child(3) {
    left: 118px;
  }

  .consultant-initials {
    min-width: 36px;
  }

  .consultant-neighbour {
    min-width: 20px;
  }

  .live-filter-form {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .compact-field {
    min-width: 142px;
  }

  .view-tier-list a {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (pointer: coarse) {
  .consultant-initials,
  .resident-count,
  .token-chip,
  .secondary-button,
  .danger-button,
  .link-button {
    min-height: var(--touch-target);
  }

  .consultant-shift-cell {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  button,
  .secondary-button,
  .danger-button,
  .consultant-initials,
  .resident-count,
  .fill-meter span {
    transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  }
}
