/* A two-finger sideways swipe on a Mac trackpad is browser back/forward. The
   add-in is a single page with no history of its own, so the gesture can only
   throw the pane away mid-edit — and it fires from anywhere the swipe is not
   consumed by a scroller. Refuse it for every surface that loads this file
   (taskpane, dialog, standalone, Google Docs). Horizontal strips inside the app
   keep scrolling normally: this stops only overscroll that reaches the page. */
html,
body {
    overscroll-behavior-x: none;
}

body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#loading-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.spinner {
    border: 4px solid var(--pgw-boot-spinner-track, #f3f3f3);
    border-top: 4px solid var(--pgw-boot-spinner-arc, #3498db);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#container {
    overflow-x: hidden;
}

/* Dark mode styles */
#loading.dark-mode {
    color: white;
}

/* Loading text styles */
#loading-text {
    color: var(--pgw-boot-text, #3498db);
    font-family: Arial, sans-serif;
    font-size: 16px;
}

/* pgw#3200 — shown in place of the spinner when Office.onReady never calls back. */
.boot-failure-text {
    color: var(--pgw-boot-failure-text, #323130);
    font-family: Arial, sans-serif;
    font-size: 14px;
    max-width: 260px;
    margin: 0 auto 12px;
}

.boot-failure-reload {
    font-family: Arial, sans-serif;
    font-size: 14px;
    padding: 6px 20px;
    border: none;
    border-radius: 4px;
    background: var(--pgw-boot-button, #3498db);
    color: var(--pgw-boot-button-text, #ffffff);
    cursor: pointer;
}

/*
 * "Segoe UI Web (West European)" (pgw#5108 slice 3f). The Fluent v9 font stack
 * (`fontFamilyBase`, the Classic theme and the `--pgw-font-ui` of Classic)
 * names this family after "Segoe UI". On a computer without a local Segoe UI
 * (macOS, Linux, and Word on the web there) the browser uses it.
 *
 * Fluent v8 registered these faces when `@fluentui/react` loaded
 * (`@fluentui/theme` `registerDefaultFontFaces`, West European set). Slice 3f
 * removed v8, so this file keeps the same faces from the same Microsoft CDN
 * folder. Without it, Classic text there falls back to the system font.
 *
 * The add-in CSP allows `font-src https:`. Segoe UI is a Microsoft font: it is
 * not copied into this repository.
 */

@font-face {
  font-family: "Segoe UI Web (West European)";
  src: local("Segoe UI Light"),
    url("https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/fonts/segoeui-westeuropean/segoeui-light.woff2") format("woff2"),
    url("https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/fonts/segoeui-westeuropean/segoeui-light.woff") format("woff");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Segoe UI Web (West European)";
  src: local("Segoe UI SemiLight"),
    url("https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/fonts/segoeui-westeuropean/segoeui-semilight.woff2") format("woff2"),
    url("https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/fonts/segoeui-westeuropean/segoeui-semilight.woff") format("woff");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Segoe UI Web (West European)";
  src: local("Segoe UI"),
    url("https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/fonts/segoeui-westeuropean/segoeui-regular.woff2") format("woff2"),
    url("https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/fonts/segoeui-westeuropean/segoeui-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Segoe UI Web (West European)";
  src: local("Segoe UI SemiBold"),
    url("https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/fonts/segoeui-westeuropean/segoeui-semibold.woff2") format("woff2"),
    url("https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/fonts/segoeui-westeuropean/segoeui-semibold.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Segoe UI Web (West European)";
  src: local("Segoe UI Bold"),
    url("https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/fonts/segoeui-westeuropean/segoeui-bold.woff2") format("woff2"),
    url("https://res-1.cdn.office.net/files/fabric-cdn-prod_20230815.002/assets/fonts/segoeui-westeuropean/segoeui-bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/*
 * Self-hosted Noetpad fonts (pgw#5108 D11). The add-in CSP allows fonts from
 * its own origin only (`font-src 'self'`), so a Google Fonts link is blocked.
 * Webpack emits these files under `assets/fonts/` with a content hash.
 *
 * Files: Fontsource variable builds (Inter 5.3.0, Domine 5.3.0), Google Fonts
 * subsets with their unicode ranges. A browser downloads a file only when the
 * page shows a character of its range in that family. Licence: SIL OFL 1.1,
 * `LICENSE-Inter` and `LICENSE-Domine` in this folder.
 *
 * The family names are the ones `theme/tokens.json → type.families` names.
 * The Noetpad themes use Inter as the Fluent `fontFamilyBase`. Classic does not
 * name these families, so Classic keeps Segoe UI: `segoe-ui-web.css` holds the
 * Segoe UI web faces that Fluent v8 registered before pgw#5108 slice 3f.
 */

/* Inter, upright, weights 100-900 */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(assets/fonts/inter-latin-wght-normal.4f2981d8.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(assets/fonts/inter-latin-ext-wght-normal.8bff79fb.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(assets/fonts/inter-greek-wght-normal.4f908aee.woff2) format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* Inter, italic, weights 100-900 */
@font-face {
  font-family: "Inter";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url(assets/fonts/inter-latin-wght-italic.01235bf2.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url(assets/fonts/inter-latin-ext-wght-italic.af1a781b.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url(assets/fonts/inter-greek-wght-italic.2899560c.woff2) format("woff2");
  unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}

/* Domine, upright, weights 400-700 (the family has no italic and no Greek) */
@font-face {
  font-family: "Domine";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url(assets/fonts/domine-latin-wght-normal.e4c96661.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Domine";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url(assets/fonts/domine-latin-ext-wght-normal.1b8f340e.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/*
 * A title in the Noetpad style (MAPPING-SPEC: "Domine only through an explicit
 * className on titles"). `--pgw-font-title` is Domine in the Noetpad themes and
 * today's Segoe UI stack in Classic, so a title that takes this class does not
 * change in Classic.
 */
.pgw-title {
  font-family: var(--pgw-font-title);
}

/* Enhanced Progress Dialog Styles for Draft */

.draft-progress {
  text-align: center;
  padding: 20px;
  max-width: 500px;
  font-family: var(--pgw-progress-font);
  animation: fadeIn 0.3s ease-out;
}

.draft-progress .progress-header {
  margin-bottom: 8px;
}

.draft-progress .progress-header h3 {
  margin: 0;
  color: var(--pgw-progress-accent-ink);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.draft-progress .progress-phase {
  font-size: 12px;
  color: var(--pgw-progress-text-meta);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 15px;
}

.draft-progress .progress-bar-container {
  margin: 15px 0 20px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.draft-progress .progress-bar {
  flex: 1;
  height: 8px;
  background-color: var(--pgw-progress-track);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.draft-progress .progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pgw-progress-accent), var(--pgw-progress-accent-deep));
  transition: width 0.5s ease-out;
  border-radius: 4px;
}

.draft-progress .progress-percentage {
  font-weight: 600;
  color: var(--pgw-progress-accent-ink);
  min-width: 45px;
  font-size: 14px;
}

.draft-progress .progress-message {
  margin: 5px 0 8px 0;
  color: var(--pgw-progress-accent-ink);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  min-height: 20px;
  text-align: center;
}

.draft-progress .progress-details {
  margin: 8px 0;
  color: var(--pgw-progress-text-meta);
  font-size: 12px;
  font-style: italic;
  line-height: 1.6;
  min-height: 16px;
  white-space: pre-line;
  text-align: left;
  font-family: 'Courier New', monospace;
  padding: 8px 12px;
  background-color: var(--pgw-progress-log);
  border-radius: 4px;
  max-height: 120px;
  overflow-y: auto;
}

.draft-progress .progress-details.hidden,
.draft-progress .progress-time-remaining.hidden {
  display: none !important;
}

.draft-progress .progress-time-remaining {
  margin: 5px 0;
  color: var(--pgw-progress-text-faint);
  font-size: 11px;
  font-weight: 500;
}

.draft-progress .progress-phases {
  display: flex;
  justify-content: space-between;
  margin-top: 25px;
  padding: 0 10px;
  position: relative;
}

.draft-progress .progress-phases::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 50px;
  right: 50px;
  height: 2px;
  background-color: var(--pgw-progress-track);
  z-index: 0;
}

.draft-progress .phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
  background-color: var(--pgw-progress-card);
  padding: 0 8px;
}

.draft-progress .phase.active {
  opacity: 1;
  color: var(--pgw-progress-accent-ink);
  transform: scale(1.05);
}

.draft-progress .phase.completed {
  opacity: 1;
  color: var(--pgw-progress-accent-ink);
}

.draft-progress .phase.completed .phase-icon {
  background-color: var(--pgw-progress-accent);
  color: var(--pgw-progress-on-fill);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.draft-progress .phase.active .phase-icon {
  background-color: var(--pgw-progress-accent);
  color: var(--pgw-progress-on-fill);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  animation: draftPulse 2s infinite;
}

.draft-progress .phase-icon {
  font-size: 16px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.draft-progress .phase-label {
  font-size: 10px;
  text-align: center;
  max-width: 70px;
  line-height: 1.2;
  font-weight: 500;
}

.draft-progress .progress-cancel-note {
  margin-top: 15px;
  font-size: 11px;
  color: var(--pgw-progress-text-meta);
  font-style: italic;
}

/* Animations */
@keyframes draftPulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--pgw-progress-accent) 70%, transparent);
  }
  70% {
    box-shadow: 0 0 0 10px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* SweetAlert2 custom class overrides */
.draft-progress-popup {
  border-radius: 8px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
}

.draft-progress-popup .swal2-content {
  padding: 0 !important;
  margin: 0 !important;
}

.draft-progress-popup .swal2-title {
  font-size: 20px !important;
  color: var(--pgw-progress-accent-ink) !important;
  margin-bottom: 10px !important;
}

.draft-progress-popup .swal2-cancel {
  background-color: var(--pgw-progress-surface) !important;
  color: var(--pgw-progress-text) !important;
  border: 1px solid var(--pgw-progress-rule) !important;
}

.draft-progress-popup .swal2-cancel:hover {
  background-color: var(--pgw-progress-surface-hover) !important;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .draft-progress {
    padding: 15px;
    max-width: 100%;
  }

  .draft-progress .progress-phases {
    padding: 0 5px;
  }

  .draft-progress .phase-label {
    font-size: 9px;
    max-width: 60px;
  }

  .draft-progress .progress-header h3 {
    font-size: 16px;
  }
}

/* Draft All Instruction Context */
.draft-all-instruction-context {
  background-color: var(--pgw-progress-surface);
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 6px;
  border-left: 3px solid var(--pgw-progress-accent-ink);
  text-align: left;
}

.draft-all-instruction-context .instruction-counter {
  font-size: 11px;
  color: var(--pgw-progress-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 4px;
}

.draft-all-instruction-context .instruction-title {
  font-size: 14px;
  color: var(--pgw-progress-text);
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Custom spinner - positioned at the top, below main Drafting title */
.draft-progress .progress-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0 15px 0;
  min-height: 40px;
}

.draft-progress .spinner-circle {
  width: 32px;
  height: 32px;
  border: 3px solid var(--pgw-progress-track);
  border-top-color: var(--pgw-progress-accent-ink);
  border-radius: 50%;
  animation: spinRotate 0.8s linear infinite;
}

@keyframes spinRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Hide SweetAlert2 default loader */
.draft-progress-popup .swal2-loader {
  display: none !important;
}

.managed-progress-dialog {
  --managed-progress-width: min(520px, 90vw);
}

.managed-progress-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: var(--managed-progress-width);
  margin: 0 auto;
  gap: 12px;
}

.managed-progress-content .progress-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.managed-progress-content .progress-bar-container {
  width: 100%;
  max-width: var(--managed-progress-width);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.managed-progress-content .progress-bar {
  width: 100%;
  height: 8px;
  background: var(--pgw-progress-track-soft);
  border-radius: 4px;
  overflow: hidden;
}

.managed-progress-content .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pgw-progress-accent), var(--pgw-progress-accent-deep));
  border-radius: 4px;
  transition: width 0.3s ease-out;
}

/* Work in flight (#2869). The fill is a REAL fraction — finished units only —
   so it stands still for minutes at a time while one unit works. This is what
   says the run is alive in between: a sheen travelling across the track, which
   never stops and never claims a number the app cannot measure. */
.progress-bar--working {
  position: relative;
}

.progress-bar--working::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--pgw-progress-accent) 28%, transparent) 50%,
    transparent 100%
  );
  animation: junior-progress-sheen 1.6s ease-in-out infinite;
}

@keyframes junior-progress-sheen {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* Motion is decoration here — the fill still carries the real progress. */
@media (prefers-reduced-motion: reduce) {
  .progress-bar--working::after {
    animation: none;
  }
}

.managed-progress-content .progress-message,
.managed-progress-content .progress-details,
.managed-progress-content .progress-phase,
.managed-progress-content .progress-time-remaining {
  width: 100%;
}

.managed-progress-content .progress-details.hidden,
.managed-progress-content .progress-time-remaining.hidden {
  display: none !important;
}

.managed-progress-dialog .fui-DialogActions {
  justify-content: center;
}

/* DraftButton.css */

:root {
	--primary-color: #0078d4;
	--primary-hover-color: #106EBE;
	--disabled-color: #a19f9d;
	--disabled-bg-color: #f3f2f1;
	--white: #ffffff;
	--light-blue: #e6f2ff;
	--gold: #bd9847;
  }
  
  .custom-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 16px;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	border: none;
	min-width: auto;
	height: auto;
  }

  .custom-button-height {
	height: 44px;
  }
  
  .custom-button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	background-color: var(--disabled-bg-color);
	border-color: var(--disabled-color);
	color: var(--disabled-color);
  }
  
  .custom-button .button-icon {
	font-size: 20px;
	color: var(--gold);
  }

  .custom-button .button-icon:not(:only-child) {
	margin-right: 10px;
  }

  .custom-button .button-text {
	font-size: 14px;
	font-weight: 600;
  }
  
  /* Primary Button */
  .primary-button {
	background-color: var(--primary-color);
	color: var(--white);
  }
  
  .primary-button:hover:not(:disabled) {
	background-color: var(--primary-hover-color);
  }
  
  /* Secondary Button */
  .secondary-button {
	background-color: var(--white);
	color: var(--primary-color);
	border: 1px solid var(--primary-color);
  }
  
  .secondary-button:hover:not(:disabled) {
	background-color: var(--light-blue);
  }
  
  .secondary-button .button-icon {
	color: var(--primary-color);
  }
  
  /* Junior Primary Button and Draft Button shared styles */
  .junior-primary-button,
  .draft-button {
	background-color: var(--white);
	color: var(--primary-color);
	border: 2px solid var(--primary-color);
  }
  
  .junior-primary-button:hover:not(:disabled),
  .draft-button:hover:not(:disabled) {
	background-color: var(--light-blue);
  }
  
  .junior-primary-button-content,
  .draft-button-content {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
  }
  
  /* Draft Button specific styles */
  .draft-button-icon-container {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-right: 10px;
  }
  
  .draft-button-icon {
	width: 24px;
	height: 24px;
  }
  
  /* Disabled state for icons and text */
  .custom-button:disabled .button-icon,
  .custom-button:disabled .button-text,
  .draft-button:disabled .draft-button-icon {
	opacity: 0.5;
  }
  

  /* Red Button */
.red-button {
	background-color: #ffffff;
	color: #8B0000;
	border: 2px solid #8B0000;
  }
  
  .red-button:hover:not(:disabled) {
	background-color: #FFEEEE;
  }
  
  .red-button:active:not(:disabled) {
	background-color: #8B0000;
	color: #ffffff;
  }
  
  .red-button:disabled {
	background-color: var(--disabled-bg-color);
	border-color: var(--disabled-color);
	color: var(--disabled-color);
  }
/* Enhanced Progress Dialog Styles for Erase JR's Memory */

.deletion-progress {
  text-align: center;
  padding: 20px;
  max-width: 500px;
  font-family: var(--pgw-progress-font);
  animation: fadeIn 0.3s ease-out;
}

.deletion-progress .progress-header {
  margin-bottom: 20px;
}

.deletion-progress .progress-header h3 {
  margin: 0 0 8px 0;
  color: var(--pgw-progress-danger);
  font-size: 18px;
  font-weight: 600;
}

.deletion-progress .progress-phase {
  font-size: 12px;
  color: var(--pgw-progress-text-meta);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

.deletion-progress .progress-bar-container {
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.deletion-progress .progress-bar {
  flex: 1;
  height: 8px;
  background-color: var(--pgw-progress-track);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.deletion-progress .progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pgw-progress-danger), var(--pgw-progress-danger-deep));
  transition: width 0.5s ease-out;
  border-radius: 4px;
}

.deletion-progress .progress-percentage {
  font-weight: 600;
  color: var(--pgw-progress-danger);
  min-width: 45px;
  font-size: 14px;
}

.deletion-progress .progress-message {
  margin: 15px 0 10px 0;
  color: var(--pgw-progress-text-strong);
  font-size: 14px;
  line-height: 1.4;
  min-height: 20px;
}

.deletion-progress .progress-details {
  margin: 8px 0;
  color: var(--pgw-progress-text-meta);
  font-size: 12px;
  font-style: italic;
  line-height: 1.3;
  min-height: 16px;
}

.deletion-progress .progress-time-remaining {
  margin: 5px 0;
  color: var(--pgw-progress-text-faint);
  font-size: 11px;
  font-weight: 500;
}

.deletion-progress .progress-details.hidden,
.deletion-progress .progress-time-remaining.hidden {
  display: none !important;
}

.deletion-progress .progress-phases {
  display: flex;
  justify-content: space-between;
  margin-top: 25px;
  padding: 0 10px;
  position: relative;
}

.deletion-progress .progress-phases::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 50px;
  right: 50px;
  height: 2px;
  background-color: var(--pgw-progress-track);
  z-index: 0;
}

.deletion-progress .phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
  background-color: var(--pgw-progress-card);
  padding: 0 8px;
}

.deletion-progress .phase.active {
  opacity: 1;
  color: var(--pgw-progress-danger);
  transform: scale(1.05);
}

.deletion-progress .phase.completed {
  opacity: 1;
  color: var(--pgw-progress-success-ink);
}

.deletion-progress .phase.completed .phase-icon {
  background-color: var(--pgw-progress-success);
  color: var(--pgw-progress-on-fill);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.deletion-progress .phase.active .phase-icon {
  background-color: var(--pgw-progress-danger);
  color: var(--pgw-progress-on-fill);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  animation: pulse 2s infinite;
}

.deletion-progress .phase-icon {
  font-size: 16px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.deletion-progress .phase-label {
  font-size: 10px;
  text-align: center;
  max-width: 70px;
  line-height: 1.2;
  font-weight: 500;
}

.deletion-progress .progress-error {
  background-color: var(--pgw-progress-danger-tint);
  border: 1px solid var(--pgw-progress-danger);
  border-radius: 4px;
  padding: 12px;
  margin: 15px 0;
  color: var(--pgw-progress-danger);
  font-size: 13px;
  text-align: left;
}

.deletion-progress .progress-error-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.deletion-progress .progress-success {
  background-color: var(--pgw-progress-success-tint);
  border: 1px solid var(--pgw-progress-success-ink);
  border-radius: 4px;
  padding: 12px;
  margin: 15px 0;
  color: var(--pgw-progress-success-ink);
  font-size: 13px;
}

.deletion-progress .progress-cancel-note {
  margin-top: 15px;
  font-size: 11px;
  color: var(--pgw-progress-text-meta);
  font-style: italic;
}

/* Animations */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--pgw-progress-danger) 70%, transparent);
  }
  70% {
    box-shadow: 0 0 0 10px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* SweetAlert2 custom class overrides */
.deletion-progress-popup {
  border-radius: 8px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
}

.deletion-progress-popup .swal2-content {
  padding: 0 !important;
  margin: 0 !important;
}

.deletion-progress-popup .swal2-title {
  font-size: 20px !important;
  color: var(--pgw-progress-danger) !important;
  margin-bottom: 10px !important;
}

.deletion-progress-popup .swal2-cancel {
  background-color: var(--pgw-progress-surface) !important;
  color: var(--pgw-progress-text) !important;
  border: 1px solid var(--pgw-progress-rule) !important;
}

.deletion-progress-popup .swal2-cancel:hover {
  background-color: var(--pgw-progress-surface-hover) !important;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .deletion-progress {
    padding: 15px;
    max-width: 100%;
  }

  .deletion-progress .progress-phases {
    padding: 0 5px;
  }

  .deletion-progress .phase-label {
    font-size: 9px;
    max-width: 60px;
  }

  .deletion-progress .progress-header h3 {
    font-size: 16px;
  }
}
/* Keyframes for suggest button animations */
@keyframes sparkle-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

@keyframes button-spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Suggest button specific styles */
.suggest-button-suggesting {
  color: var(--pgw-css-suggest-busy) !important;
  position: relative;
}

.suggest-button-suggesting svg {
  color: var(--pgw-css-suggest-busy) !important;
  animation: sparkle-pulse 1.5s ease-in-out infinite;
  -webkit-animation: sparkle-pulse 1.5s ease-in-out infinite;
  -moz-animation: sparkle-pulse 1.5s ease-in-out infinite;
  -o-animation: sparkle-pulse 1.5s ease-in-out infinite;
}

.suggest-button-suggesting::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top: 2px solid var(--pgw-css-suggest-busy);
  border-right: 1px solid var(--pgw-css-suggest-busy);
  animation: button-spin 1s linear infinite;
  -webkit-animation: button-spin 1s linear infinite;
  -moz-animation: button-spin 1s linear infinite;
  -o-animation: button-spin 1s linear infinite;
  transform: translate(-50%, -50%);
  opacity: 0.6;
  pointer-events: none;
}

/* Delete button specific styles */
.delete-button-deleting {
  color: #d13438 !important;
  position: relative;
}

.delete-button-deleting svg {
  color: #d13438 !important;
  animation: spin 1s linear infinite;
  -webkit-animation: spin 1s linear infinite;
  -moz-animation: spin 1s linear infinite;
  -o-animation: spin 1s linear infinite;
}

.delete-button-deleting::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top: 2px solid #d13438;
  border-right: 1px solid #d13438;
  animation: button-spin 1s linear infinite;
  -webkit-animation: button-spin 1s linear infinite;
  -moz-animation: button-spin 1s linear infinite;
  -o-animation: button-spin 1s linear infinite;
  transform: translate(-50%, -50%);
  opacity: 0.6;
  pointer-events: none;
}
/* Enhanced Progress Dialog Styles for Suggest Prompt */

.suggest-prompt-progress {
  text-align: center;
  padding: 20px;
  max-width: 500px;
  font-family: var(--pgw-progress-font);
  animation: fadeIn 0.3s ease-out;
}

.suggest-prompt-progress .progress-header {
  margin-bottom: 8px;
}

.suggest-prompt-generate-now {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.suggest-prompt-generate-now-copy {
  font-size: 12px;
  color: var(--pgw-progress-text-meta);
  line-height: 1.4;
  text-align: center;
  max-width: 320px;
}

.suggest-prompt-progress .progress-header h3 {
  margin: 0;
  color: var(--pgw-progress-accent-ink);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

.suggest-prompt-progress .progress-phase {
  font-size: 12px;
  color: var(--pgw-progress-text-meta);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
  text-align: center;
  margin-bottom: 15px;
}

/* Custom spinner - positioned at the top, below main title */
.suggest-prompt-progress .progress-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 0 15px 0;
  min-height: 40px;
}

.suggest-prompt-progress .spinner-circle {
  width: 32px;
  height: 32px;
  border: 3px solid var(--pgw-progress-track);
  border-top-color: var(--pgw-progress-accent-ink);
  border-radius: 50%;
  animation: suggestSpinRotate 0.8s linear infinite;
}

@keyframes suggestSpinRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Hide SweetAlert2 default loader */
.suggest-prompt-progress-popup .swal2-loader {
  display: none !important;
}

.suggest-prompt-progress .progress-bar-container {
  margin: 15px 0 20px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.suggest-prompt-progress .progress-bar {
  flex: 1;
  height: 8px;
  background-color: var(--pgw-progress-track);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.suggest-prompt-progress .progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pgw-progress-accent), var(--pgw-progress-accent-deep));
  transition: width 0.5s ease-out;
  border-radius: 4px;
}

.suggest-prompt-progress .progress-percentage {
  font-weight: 600;
  color: var(--pgw-progress-accent-ink);
  min-width: 45px;
  font-size: 14px;
}

.suggest-prompt-progress .progress-message {
  margin: 5px 0 8px 0;
  color: var(--pgw-progress-accent-ink);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  min-height: 20px;
  text-align: center;
}

.suggest-prompt-progress .progress-details {
  margin: 8px 0;
  color: var(--pgw-progress-text-meta);
  font-size: 12px;
  font-style: italic;
  line-height: 1.3;
  min-height: 16px;
}

.suggest-prompt-progress .progress-time-remaining {
  margin: 5px 0;
  color: var(--pgw-progress-text-faint);
  font-size: 11px;
  font-weight: 500;
}

.suggest-prompt-progress .progress-details.hidden,
.suggest-prompt-progress .progress-time-remaining.hidden {
  display: none !important;
}

.suggest-prompt-progress .progress-phases {
  display: flex;
  justify-content: space-between;
  margin-top: 25px;
  padding: 0 10px;
  position: relative;
}

.suggest-prompt-progress .progress-phases::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 50px;
  right: 50px;
  height: 2px;
  background-color: var(--pgw-progress-track);
  z-index: 0;
}

.suggest-prompt-progress .phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
  background-color: var(--pgw-progress-card);
  padding: 0 8px;
}

.suggest-prompt-progress .phase.active {
  opacity: 1;
  color: var(--pgw-progress-accent-ink);
  transform: scale(1.05);
}

.suggest-prompt-progress .phase.completed {
  opacity: 1;
  color: var(--pgw-progress-success-ink);
}

.suggest-prompt-progress .phase.completed .phase-icon {
  background-color: var(--pgw-progress-success);
  color: var(--pgw-progress-on-fill);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.suggest-prompt-progress .phase.active .phase-icon {
  background-color: var(--pgw-progress-accent);
  color: var(--pgw-progress-on-fill);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  animation: suggestPulse 2s infinite;
}

.suggest-prompt-progress .phase-icon {
  font-size: 16px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.suggest-prompt-progress .phase-label {
  font-size: 10px;
  text-align: center;
  max-width: 70px;
  line-height: 1.2;
  font-weight: 500;
}

.suggest-prompt-progress .progress-cancel-note {
  margin-top: 15px;
  font-size: 11px;
  color: var(--pgw-progress-text-meta);
  font-style: italic;
}

/* Animations */
@keyframes suggestPulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--pgw-progress-accent) 70%, transparent);
  }
  70% {
    box-shadow: 0 0 0 10px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* SweetAlert2 custom class overrides */
.suggest-prompt-progress-popup {
  border-radius: 8px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
}

.suggest-prompt-progress-popup .swal2-content {
  padding: 0 !important;
  margin: 0 !important;
}

.suggest-prompt-progress-popup .swal2-title {
  font-size: 20px !important;
  color: var(--pgw-progress-accent-ink) !important;
  margin-bottom: 10px !important;
}

.suggest-prompt-progress-popup .swal2-cancel {
  background-color: var(--pgw-progress-surface) !important;
  color: var(--pgw-progress-text) !important;
  border: 1px solid var(--pgw-progress-rule) !important;
}

.suggest-prompt-progress-popup .swal2-cancel:hover {
  background-color: var(--pgw-progress-surface-hover) !important;
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .suggest-prompt-progress {
    padding: 15px;
    max-width: 100%;
  }

  .suggest-prompt-progress .progress-phases {
    padding: 0 5px;
  }

  .suggest-prompt-progress .phase-label {
    font-size: 9px;
    max-width: 60px;
  }

  .suggest-prompt-progress .progress-header h3 {
    font-size: 16px;
  }
}

.library-manager-dialog {
  width: 99vw !important;
  height: 99vh !important;
  max-width: 99vw !important;
  max-height: 99vh !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Override Fluent UI Dialog defaults */
.library-manager-dialog .fui-DialogBody {
  flex: 1 !important;
  display: flex !important;
  overflow: hidden !important;
  min-height: 0 !important;
}

.library-manager-dialog .fui-DialogContent {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  min-height: 0 !important;
}

.library-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 4px;
}

.library-manager-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.library-manager-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--colorNeutralStroke1);
  flex-wrap: wrap;
}

.library-manager-search {
  flex: 1 1 200px;
  min-width: 120px;
}

.library-manager-filter {
  min-width: 100px;
  flex: 1 1 auto;
}


.library-manager-extra-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}


.library-manager-persona-badge {
  font-size: 11px;
  opacity: 0.9;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.library-manager-tag-item {
  cursor: default;
  line-height: 1;
  opacity: 0.85;
}

.library-manager-item-tags .library-manager-tag-item {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-top: 3px !important;
  padding-bottom: 5px !important;
}

.library-manager-body {
  padding: 0 !important;
  overflow: hidden;
  flex: 1;
  display: flex;
  min-height: 0;
  margin-bottom: 10px;
}

.library-manager-main {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.library-manager-main--peek[data-density="comfortable"] .library-manager-panel.open {
  position: relative;
  flex: 0 0 50%;
  box-sizing: border-box;
}

.library-manager-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

.library-manager-item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  border: 1px solid var(--colorNeutralStroke1);
  border-radius: 6px;
  background: var(--colorNeutralBackground1);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 12px 16px;
}

.library-manager-item:hover {
  border-color: var(--colorNeutralStroke1Hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.library-manager-item.selected {
  border-color: var(--colorBrandBackground);
  background-color: var(--colorBrandBackground2);
}

.library-manager-item-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.library-manager-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 32px;
  flex-wrap: wrap;
}

/* Badge styling for consistent size and shadow.
 *
 * #3746 removed `opacity: .5` (and the hover/selected rules that undid it).
 * It dimmed every badge in the meta row — level, persona AND tags — until the
 * row was hovered, which is a contrast failure on exactly the metadata this
 * redesign exists to surface, and it was invisible entirely to anyone
 * navigating by keyboard or touch. This is the one genuinely shared visual
 * change in #3746: it improves all four consumers of this component.
 *
 * Note the selector targets `.fui-Badge` (a Fluent internal) INSIDE
 * `.library-manager-item-meta`, so any badge moved out of that container also
 * loses the data-level colour overrides below. */
.library-manager-item-meta .fui-Badge {
  min-width: 60px;
  text-align: center;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  line-height: 1;
  padding-top: 3px;
  padding-bottom: 5px;
}

/* Custom badge colors for level types */
.library-manager-item-meta .fui-Badge[data-level="user"] {
  background-color: var(--pgw-chat-panel-badge-user) !important;
  color: var(--pgw-chat-panel-badge-user-ink) !important;
}

.library-manager-item-meta .fui-Badge[data-level="company"] {
  background-color: var(--pgw-chat-panel-badge-company) !important;
  color: var(--pgw-chat-panel-badge-ink) !important;
}

.library-manager-item-meta .fui-Badge[data-level="system"] {
  background-color: var(--pgw-chat-panel-badge-system) !important;
  color: var(--pgw-chat-panel-badge-ink) !important;
}

.library-manager-item-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* #3746 row anatomy ------------------------------------------------------- */

/* The shell is a sibling wrapper so a row-level control (the favourite star)
 * can sit BESIDE the row button rather than inside it — nested buttons are
 * invalid HTML and break singular role queries. With no such control it is an
 * inert div and the row looks exactly as it did. */
.library-manager-item-shell {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
}

.library-manager-item-shell .library-manager-item {
  flex: 1;
  min-width: 0;
}

.library-manager-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The category monogram, in place of the level icon when a consumer supplies
 * one. 22px matches the design canvas. */
.library-manager-item-glyph {
  width: 22px;
  height: 22px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: var(--colorBrandBackground2);
  border: 1px solid var(--colorBrandStroke2);
  color: var(--colorBrandForeground2);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* The defect this work exists to fix: one line of summary, on the row, always
 * visible. Clamped to a single line so row height stays predictable — the list
 * is not virtualized and a ragged row height makes 78 rows hard to scan. */
.library-manager-item-summary {
  padding-left: 32px;
  margin-bottom: 6px;
  color: var(--colorNeutralForeground2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  line-clamp: 1;
}

.library-manager-item-usage {
  margin-left: auto;
  color: var(--colorNeutralForeground3);
}

/* Visually hidden, still announced. The result count lives here so a screen
 * reader hears "12 prompts" after a search settles. */
.library-manager-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Sliding panel from right */
.library-manager-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  height: 100%;
  background: var(--colorNeutralBackground1);
  overflow: hidden;
  transition: width 0.3s ease;
  display: flex;
  flex-direction: column;
}

.library-manager-panel.open {
  width: 50%;
  border-left: 1px solid var(--colorNeutralStroke1);
}

/* #3746: the panel overlays the list, and the list's sticky group headers carry
 * z-index: 1 so rows scroll beneath them. Without a z-index here the panel sat
 * in the auto layer BELOW those headers, so a pinned header painted across the
 * panel's own header and swallowed clicks on its close button — measured with
 * elementFromPoint, the X resolved to the group header. */
.library-manager-panel {
  z-index: 2;
}

.library-manager-list--grouped {
  padding-top: 0;
}

.library-manager-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--colorNeutralStroke1);
  flex-shrink: 0;
}

.library-manager-panel-actions {
  display: flex;
  gap: 4px;
}

.library-manager-panel-content {
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}

.library-manager-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  flex: 1;
}

.library-manager-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
  gap: 8px;
  color: var(--colorNeutralForeground3);
  flex: 1;
}

/* Confirmation dialog */
.library-manager-confirmation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  flex: 1;
}

.library-manager-confirmation .confirmation-icon {
  margin-bottom: 8px;
  /* The warning icon strokes with currentColor. */
  color: var(--pgw-chat-panel-warning);
}

.library-manager-confirmation .confirmation-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

/* Panel content sections */
.library-manager-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.library-manager-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.library-manager-section-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.library-manager-section-half {
  flex: 1 1 0;
  min-width: 0;
  max-width: calc(50% - 6px);
  overflow: hidden;
}

/* Ensure dropdowns in half-width sections are constrained and show their expand icon */
.library-manager-section-half .fui-Dropdown {
  width: 100%;
  min-width: 0;
}

.library-manager-section-half .fui-Dropdown__button {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.library-manager-section-flex {
  display: flex;
  flex-direction: column;
}

.library-manager-full-width {
  width: 100%;
}

.library-manager-summary-textarea .fui-Textarea__textarea {
  min-height: 56px;
  max-height: 360px;
  overflow-y: hidden;
  resize: none;
}

.library-manager-error-text {
  color: var(--pgw-chat-panel-error);
  margin-top: 4px;
}

/* Tags editing - NO gap property (unsupported in Word WebView2) */
.library-manager-tags-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.library-manager-tag-badge {
  display: inline-flex;
  align-items: center;
}

.library-manager-tag-wrapper {
  display: inline-block !important;
  white-space: nowrap;
  margin-right: 6px !important;
  margin-bottom: 4px !important;
  box-sizing: border-box;
  vertical-align: middle;
  position: relative;
}

.library-manager-tag-edit-pill {
  display: inline-block !important;
  vertical-align: middle;
}

.library-manager-tags-edit .library-manager-tag-item {
  display: inline-flex !important;
  align-items: center;
  font-size: 11px;
  line-height: 1;
  padding: 0 20px 0 8px !important;
  max-width: none !important;
  width: auto !important;
  white-space: nowrap;
  height: 20px !important;
  min-height: 20px;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.library-manager-tag-remove {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  margin-left: 0 !important;
  cursor: pointer;
  color: var(--colorNeutralForeground3);
  border-radius: 2px;
  width: 12px;
  height: 12px;
  line-height: 1;
}

.library-manager-tag-text {
  display: inline-block;
  margin-right: 2px;
}

.library-manager-tags-edit .library-manager-tag-text {
  max-width: none;
}

.library-manager-tag-remove:hover {
  color: var(--colorNeutralForeground1);
  background: var(--colorNeutralBackground3);
}

.library-manager-tag-remove svg {
  pointer-events: none;
  width: 10px;
  height: 10px;
}

.library-manager-tag-input-wrapper {
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}

.library-manager-tag-input {
  width: 100px;
}

.library-manager-tags-limit {
  color: var(--colorNeutralForeground3);
  font-style: italic;
  flex-basis: 100%;
  margin-top: 4px;
  font-size: 12px;
}

.library-manager-content-box {
  display: block;
  padding: 12px;
  background: var(--colorNeutralBackground2);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  max-height: 150px;
  overflow-y: auto;
  flex-shrink: 1;
  min-height: 0;
}

.library-manager-tags-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Panel layout for top/bottom positioning */
.library-manager-panel-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}

.library-manager-panel-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.library-manager-panel-bottom {
  margin-top: 16px;
  padding-top: 16px;
  flex-shrink: 0;
}

/* Native textarea that auto-expands to show all content */
.library-manager-native-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  border: none;
  border-radius: 4px;
  background: var(--colorNeutralBackground3);
  color: var(--colorNeutralForeground1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  overflow: hidden;
  field-sizing: content;
}

.library-manager-native-textarea:focus {
  background: var(--colorNeutralBackground3Hover);
}

.library-manager-native-textarea::placeholder {
  color: var(--colorNeutralForeground4);
}

/* Style inputs to match */
.library-manager-panel-content input,
.library-manager-section input {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif !important;
  font-size: 14px !important;
}


.library-manager-detail-item {
  padding: 12px;
  background: var(--colorNeutralBackground2);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.library-manager-detail-title {
  font-weight: 600;
  color: var(--colorNeutralForeground1);
}

.library-manager-detail-text {
  display: block;
  color: var(--colorNeutralForeground2);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
}

/* Scrollbar styling */
.library-manager-list::-webkit-scrollbar,
.library-manager-panel-content::-webkit-scrollbar,
.library-manager-content-box::-webkit-scrollbar {
  width: 8px;
}

.library-manager-list::-webkit-scrollbar-track,
.library-manager-panel-content::-webkit-scrollbar-track,
.library-manager-content-box::-webkit-scrollbar-track {
  background: var(--colorNeutralBackground2);
  border-radius: 4px;
}

.library-manager-list::-webkit-scrollbar-thumb,
.library-manager-panel-content::-webkit-scrollbar-thumb,
.library-manager-content-box::-webkit-scrollbar-thumb {
  background: var(--colorNeutralStroke1);
  border-radius: 4px;
}

.library-manager-list::-webkit-scrollbar-thumb:hover,
.library-manager-panel-content::-webkit-scrollbar-thumb:hover,
.library-manager-content-box::-webkit-scrollbar-thumb:hover {
  background: var(--colorNeutralStroke1Hover);
}

/* Density follows the portal's measured content, not the host viewport. */
.library-manager-toolbar--compact {
  flex-wrap: nowrap;
  gap: 4px;
  padding: 8px 0;
}

.library-manager-toolbar--compact .library-manager-search {
  flex: 1 1 0;
  min-width: 0;
}

.library-manager-toolbar--compact .fui-ToolbarButton {
  flex: none;
  min-width: 28px;
}

.library-manager-filter-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.library-manager-filters-popover {
  max-width: min(320px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
}

.library-manager-filters-popover .library-manager-filter-controls {
  flex-direction: column;
  align-items: stretch;
}

.library-manager-filters-popover .library-manager-filter,
.library-manager-filters-popover .library-manager-extra-filters {
  min-width: 0;
  max-width: 100%;
}

.library-manager-main[data-density="compact"] .library-manager-panel.open {
  width: 100%;
  border-left: none;
}

.library-manager-dialog[data-density="compact"] .library-manager-item-usage {
  display: none;
}

.library-manager-dialog[data-density="compact"] .library-manager-list {
  padding: 8px 4px;
}

.library-manager-dialog[data-density="compact"] .library-manager-list--grouped {
  padding-top: 0;
}

.library-manager-dialog[data-density="compact"] .library-manager-panel-header,
.library-manager-dialog[data-density="compact"] .library-manager-panel-content {
  padding: 12px 8px;
}

.library-manager-header .library-manager-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-manager-panel-heading {
  min-width: 0;
  overflow-wrap: anywhere;
}

.library-manager-peek-navigation {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--colorNeutralForeground2);
}

.library-manager-peek-navigation button,
.library-manager-panel-header > button {
  flex: none;
}

.library-manager-active-facets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
}

.library-manager-active-facets .library-manager-chip {
  max-width: 100%;
  height: auto;
  min-height: 26px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

.library-manager-active-facets svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.library-manager-shelf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 8px;
}

.library-manager-shelves {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--colorNeutralStroke1);
}

.library-manager-shelves .library-manager-chip-count {
  margin-left: auto;
}

.library-manager-item-shell--favorite .library-manager-item-name {
  padding-right: 28px;
}

.library-manager-favorite {
  position: absolute !important;
  top: 8px;
  right: 8px;
  width: 24px;
  min-width: 24px !important;
  height: 24px;
  padding: 0 !important;
}

.library-manager-item-shell--tags {
  display: block;
  border: 1px solid var(--colorNeutralStroke1);
  border-radius: 6px;
  background: var(--colorNeutralBackground1);
}

.library-manager-item-shell--tags.selected {
  border-color: var(--colorBrandBackground);
  background: var(--colorBrandBackground2);
}

.library-manager-item-shell--tags .library-manager-item {
  border: none;
  background: transparent;
  padding-bottom: 4px;
}

.library-manager-item-shell--tags > .library-manager-item-meta {
  padding: 0 12px 8px 48px;
  gap: 4px;
}

.library-manager-chip.library-manager-tag-action {
  font-size: 11px;
  height: 24px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-manager-dialog button:focus-visible,
.library-manager-filters-popover button:focus-visible,
.library-manager-native-textarea:focus-visible {
  outline: 2px solid var(--colorStrokeFocus2);
  outline-offset: -2px;
}

/* #3746 taxonomy: chip rail, side rail, group headers ---------------------- */

.library-manager-chip-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--colorNeutralStroke1);
}

/* Scroll on keyboard focus, not merely when a facet is selected. */
.library-manager-dialog[data-density="compact"] .library-manager-chip-rail,
.library-manager-dialog[data-density="compact"] .library-manager-shelf-chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  flex-shrink: 0;
  padding-top: 4px;
}

.library-manager-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--colorNeutralStroke1);
  border-radius: 13px;
  background: var(--colorNeutralBackground1);
  color: var(--colorNeutralForeground1);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.library-manager-chip:hover {
  background: var(--colorNeutralBackground1Hover);
}

.library-manager-chip.selected {
  background: var(--colorBrandBackground2);
  border-color: var(--colorBrandStroke1);
  color: var(--colorBrandForeground2);
  font-weight: 600;
}

.library-manager-chip-count {
  color: var(--colorNeutralForeground3);
  font-size: 11px;
}

.library-manager-chip.selected .library-manager-chip-count {
  color: inherit;
}

/* The side rail from artboard 6. Comfortable width only — renderSideRail
 * returns null below RAIL_MIN_WIDTH, so this never competes with the list and
 * the peek panel for a 350px pane. */
.library-manager-rail {
  width: 184px;
  flex: none;
  border-right: 1px solid var(--colorNeutralStroke1);
  background: var(--colorNeutralBackground2);
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

.library-manager-rail-categories {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.library-manager-rail-heading {
  padding: 4px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--colorNeutralForeground3);
}

.library-manager-rail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 14px;
  border: none;
  border-left: 2px solid transparent;
  background: none;
  font: inherit;
  font-size: 12.5px;
  color: var(--colorNeutralForeground1);
  text-align: left;
  cursor: pointer;
}

.library-manager-rail-item:hover {
  background: var(--colorNeutralBackground1Hover);
}

.library-manager-rail-item.selected {
  background: var(--colorBrandBackground2);
  border-left-color: var(--colorBrandStroke1);
  color: var(--colorBrandForeground2);
  font-weight: 600;
}

.library-manager-rail-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-manager-rail-count {
  color: var(--colorNeutralForeground3);
  font-size: 11px;
}

.library-manager-rail-item.selected .library-manager-rail-count {
  color: inherit;
}

/* Sticky group headers. `top: 0` inside the scrolling list keeps the family
 * name visible while its rows scroll under it — on 78 rows that is the
 * difference between scanning and getting lost. */
.library-manager-group-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 4px;
  border: none;
  border-bottom: 1px solid var(--colorNeutralStroke2);
  background: var(--colorNeutralBackground1);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--colorNeutralForeground1);
  text-align: left;
  cursor: pointer;
}

.library-manager-group-label {
  flex: 1;
}

.library-manager-group-count {
  font-weight: 400;
  color: var(--colorNeutralForeground3);
}

.library-manager-group-chevron {
  transition: transform 0.15s ease;
}

.library-manager-group-chevron.collapsed {
  transform: rotate(-90deg);
}

/* The list is a flex column with a gap; a group has to carry that itself or
 * its rows bunch against the header. */
.library-manager-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/*
 * Rules tab (#3658). Plain CSS, class prefix `rt-` (plan decision D7) — the design
 * needs container queries, ::after tooltips and hover rules that Griffel makes
 * awkward. Precedent: common/library-manager/LibraryManagerDialog.css.
 *
 * Values are a faithful translation of the settled prototype (proto-v9).
 * Width classes `rt-compact` (< 340px) / `rt-wide` (>= 600px) are set by a
 * ResizeObserver on the root, because the taskpane is 320–720+ px wide.
 */

.rt-root {
  /* Paper (#3694, decision D14): the pane and both rulebook screens are white, and
     a card is told apart from the pane by its hairline ring, not by a tint. Every
     surface value lives here so the screens inherit it — no per-screen override.
     pgw#5115: each colour is a theme token (`theme/colourSets/rules.js`). Classic
     writes today's literal; Noets, Light and Dark follow the paper. */
  --rt-pane: var(--pgw-rules-pane);
  --rt-card: var(--pgw-rules-card);
  --rt-card-editing: var(--pgw-rules-card-editing);
  --rt-field: var(--pgw-rules-field);
  --rt-ink: var(--pgw-rules-ink);
  --rt-ink2: var(--pgw-rules-ink2);
  --rt-ink3: var(--pgw-rules-ink3);
  --rt-ink4: var(--pgw-rules-ink4);
  --rt-hair: var(--pgw-rules-hair);
  --rt-hair2: var(--pgw-rules-hair2);
  --rt-brand: var(--pgw-rules-brand);
  --rt-brand-top: var(--pgw-rules-brand-top);
  --rt-brand-deep: var(--pgw-rules-brand-deep);
  --rt-brand-deep-ink: var(--pgw-rules-brand-deep-ink);
  --rt-on-brand: var(--pgw-rules-on-brand);
  --rt-soft: var(--pgw-rules-soft);
  --rt-soft-ink: var(--pgw-rules-soft-ink);
  --rt-soft-edge: var(--pgw-rules-soft-edge);
  --rt-chip-edge: var(--pgw-rules-chip-edge);
  --rt-pick-bg: var(--pgw-rules-pick-bg);
  --rt-pick-ink: var(--pgw-rules-pick-ink);
  --rt-pick-edge: var(--pgw-rules-pick-edge);
  --rt-cell-off: var(--pgw-rules-cell-off);
  --rt-cell-off-ink: var(--pgw-rules-cell-off-ink);
  --rt-cell-hover: var(--pgw-rules-cell-hover);
  --rt-cell-on: var(--pgw-rules-cell-on);
  --rt-cell-on-ink: var(--pgw-rules-cell-on-ink);
  --rt-cell-on-hover: var(--pgw-rules-cell-on-hover);
  --rt-cell-on-hover-ink: var(--pgw-rules-cell-on-hover-ink);
  --rt-track: var(--pgw-rules-track);
  --rt-tip-ink: var(--pgw-rules-tip-ink);
  --rt-error: var(--pgw-rules-error);
  --rt-error-bg: var(--pgw-rules-error-bg);
  --rt-ok: var(--pgw-rules-ok);
  --rt-ok-bg: var(--pgw-rules-ok-bg);
  --rt-foot-action: var(--pgw-rules-foot-action);
  /* A hairline is a BORDER, never a spread shadow. A shadow with spread is a
     border drawn by the compositor: it does not take part in layout, so a 34px
     field with a 1px "border" is 34px of content and 36px of ink, it rounds
     differently from the box it rings, and at a non-integer device pixel ratio it
     renders at a different weight from the real borders beside it. `box-sizing`
     is border-box everywhere in this tab, so every height below is unchanged. */
  --rt-hair-hover: var(--pgw-rules-hair-hover);
  /* Elevation only — no spread, no colour ring. */
  --rt-shadow-rest: 0 1px 2px rgba(28, 27, 26, 0.04);
  --rt-shadow-hover: 0 2px 8px rgba(28, 27, 26, 0.07);
  --rt-shadow-edit: 0 2px 10px color-mix(in srgb, var(--rt-brand) 10%, transparent);
  --rt-row-hover: var(--pgw-rules-row-hover);
  /* The chip strip's end chevron, and with it the solid half of the end fade the
     chevron stands on — one number so the two can never drift apart. */
  --rt-arrow-w: 22px;
  --rt-find-bg: var(--pgw-rules-find-bg);
  --rt-foot-bg: var(--pgw-rules-foot-bg);
  --rt-foot-hair: var(--pgw-rules-foot-hair);
  --rt-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  /* A trackpad swipe over the pane must not reach the host's back/forward
     navigation, which is what Word Online does with a horizontal gesture. */
  overscroll-behavior: contain;
  overscroll-behavior-x: contain;
  background: var(--rt-pane);
  color: var(--rt-ink);
  font-size: 14px;
  line-height: 20px;
}

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

/*
 * The button reset is wrapped in :where() so it carries ZERO specificity. Written
 * as `.rt-root button` it is 0,1,1 and beats every single-class component rule
 * below: the "All" chip rendered 17px wide with 14px text because `padding: 0` and
 * `font-size: inherit` won over `.rt-chip`. Component rules must win; this only
 * clears the UA defaults.
 */
:where(.rt-root button) {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

/* --- Filters: sticky on the pane colour, with a fade so cards pass under it --- */

.rt-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  /* The root is a flex column: without this the filters and the footer are the
     parts that give way when the list is long — the footer squashed to 33px. */
  flex: none;
}

.rt-white {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--rt-pane) 96%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.rt-fade {
  height: 14px;
  margin-bottom: -14px;
  background: linear-gradient(color-mix(in srgb, var(--rt-pane) 96%, transparent), transparent);
  pointer-events: none;
}

.rt-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
}

.rt-chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  /* Its own edge at rest (transparent in Classic, the field rule on paper), so
     selecting one does not move its label by a pixel. */
  border: 1px solid var(--rt-chip-edge);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rt-ink2);
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background 0.15s, color 0.15s;
}

.rt-chip:hover {
  background: var(--rt-cell-off);
  color: var(--rt-ink);
}

/* The chip already carries a transparent border, so the keyboard colours what is
   there rather than adding a ring outside it. */
.rt-chip:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

.rt-chip.rt-on {
  background: var(--rt-pick-bg);
  color: var(--rt-pick-ink);
  border-color: var(--rt-pick-edge);
}

.rt-sep {
  width: 1px;
  height: 18px;
  background: var(--rt-hair);
  flex: 0 0 auto;
}

/* The fade is an overlay, not a mask: a mask on the scrolling element forces the
   compositor to redraw it every frame, which is what made the chip strip stutter. */
.rt-scroller-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

/* One fade per end, and each is painted only while that end actually hides chips:
   a fade sitting over the last chip reads as a permanent shadow, and it is what
   made the strip look cut off when everything already fitted.

   The outer half is solid, not a gradient: the chevron stands on it, and a chip
   read through a part-transparent white left the glyph unreadable. The solid half
   is `--rt-arrow-w` wide, so the chevron never overhangs the gradient. */
.rt-scroller-wrap::before,
.rt-scroller-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(var(--rt-arrow-w) * 2);
  pointer-events: none;
  display: none;
  background: linear-gradient(90deg, transparent, var(--rt-pane) 50%);
  /* A layer of its own, or only the right-hand fade is ever seen. `.rt-scroller`
     is positioned, and positioned boxes with no z-index paint in tree order:
     ::before, then the scroller, then ::after. So ::before paints UNDER the chips
     and its fade disappears behind them. */
  z-index: 1;
}

/* The left fade is the same gradient mirrored. */
.rt-scroller-wrap::before {
  left: 0;
  background: linear-gradient(270deg, transparent, var(--rt-pane) 50%);
}

.rt-scroller-wrap::after {
  right: 0;
}

.rt-scroller-wrap.rt-more-left::before,
.rt-scroller-wrap.rt-more-right::after {
  display: block;
}

/* The chevron sits over its fade, and only exists while chips are hidden that way:
   on a Mac the overlay scrollbar shows itself while scrolling, so it can never be
   the thing that tells a mouse user there is more strip to reach. */
.rt-strip-arrow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: var(--rt-arrow-w);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--rt-ink3);
  cursor: pointer;
  /* Above BOTH fades: ::after follows the buttons in tree order, so at an equal
     z-index the right-hand fade would paint over the right-hand chevron. */
  z-index: 2;
  outline: none;
}

.rt-strip-arrow:hover {
  color: var(--rt-ink);
}

.rt-strip-arrow svg {
  display: block;
}

.rt-strip-arrow-left {
  left: 0;
}

.rt-strip-arrow-right {
  right: 0;
}

.rt-scroller {
  position: relative;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  will-change: scroll-position;
}

.rt-scroller::-webkit-scrollbar {
  display: none;
}

/* No trailing gutter: the right-hand fade is gone once the last chip is reached,
   so reserved space for it would just be a gap after the list. */
.rt-chips {
  display: flex;
  gap: 2px;
  width: max-content;
}

/* --- Search + New rule row --- */

.rt-act {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
}

.rt-sfield {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  padding: 0 6px 0 11px;
  border-radius: 17px;
  background: var(--rt-field);
  border: 1px solid var(--rt-hair);
  transition: border-color 0.15s;
}

/* ONE ring, and it is the field's own edge. An outline OUTSIDE a border is two
   rings on one control, and the outer one follows the border-box corner radius
   only approximately — in the Word webview it visibly squares off. The input
   inside carries `outline: none` so the UA cannot add a third. */
.rt-sfield:has(:focus-visible) {
  border-color: var(--rt-brand);
}

.rt-sfield .rt-mag {
  display: flex;
  align-items: center;
  color: var(--rt-ink4);
  flex: 0 0 auto;
}

.rt-sfield input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--rt-ink);
  /* pgw#5288 S3: at 320px the field gives way to the book button; its placeholder ends in "…". */
  text-overflow: ellipsis;
}

.rt-sfield input::placeholder {
  color: var(--rt-ink4);
}

.rt-clear {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 11px;
  color: var(--rt-ink3);
  flex: 0 0 auto;
}

.rt-clear:hover {
  background: var(--rt-cell-hover);
  color: var(--rt-ink);
}

/* --- Add From Rulebook: the book button left of New Rule (pgw#5288, D1) ---
   The search field's pill, as a 34px circle. Focus is the one-ring rule: the
   button's own border turns brand, no outline. */

.rt-bookbtn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 17px;
  background: var(--rt-field);
  border: 1px solid var(--rt-hair);
  box-shadow: var(--rt-shadow-rest);
  color: var(--rt-ink2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.rt-bookbtn:hover {
  background: var(--rt-soft);
  color: var(--rt-brand);
}

.rt-bookbtn:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

/* S1: dimmed, and nothing answers a hover except its tooltip. */
.rt-bookbtn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
}

.rt-bookbtn[aria-disabled="true"]:hover {
  background: var(--rt-field);
  color: var(--rt-ink2);
}

/* --- New rule: plain on All, split in a section; same width in both forms --- */

.rt-splitwrap {
  position: relative;
  flex: 0 0 auto;
}

.rt-split {
  display: inline-flex;
  align-items: stretch;
  height: 34px;
  width: 130px;
  border-radius: 17px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--rt-brand-top), var(--rt-brand));
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--rt-brand) 28%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--rt-on-brand) 18%, transparent);
  flex: 0 0 auto;
  position: relative;
}

.rt-split .rt-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  /* Transparent at rest so the keyboard's edge costs no layout. */
  border: 1px solid transparent;
  padding: 0 4px 0 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rt-on-brand);
  white-space: nowrap;
  transition: background 0.15s;
}

.rt-split .rt-main:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* On a brand-filled button a brand edge is invisible, so the ring is drawn in the
   one colour that reads against it. It is still a 1px border on the button's own
   box — no outline, no shadow. */
.rt-split .rt-main:focus-visible,
.rt-split .rt-caret:focus-visible {
  outline: none;
  border-color: var(--rt-on-brand);
}

.rt-split.rt-solo .rt-main {
  padding: 0 12px;
}

/* pgw#5288 S1: a refused New Rule is dimmed like the book button beside it. */
.rt-split.rt-disabled {
  opacity: 0.45;
}

.rt-split.rt-disabled .rt-main,
.rt-split.rt-disabled .rt-caret {
  cursor: default;
}

.rt-split.rt-disabled .rt-main:hover,
.rt-split.rt-disabled .rt-caret:hover {
  background: transparent;
}

.rt-split .rt-caret {
  border: 1px solid transparent;
  display: inline-grid;
  place-items: center;
  width: 30px;
  padding: 0 2px 0 1px;
  flex: 0 0 auto;
  color: var(--rt-on-brand);
  border-left: 1px solid color-mix(in srgb, var(--rt-on-brand) 22%, transparent);
  transition: background 0.15s;
}

.rt-split .rt-caret:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* At 320px the label goes but the caret stays: the reuse menu has no other way in.
   Both forms are the same 62px box, so choosing a section still shifts nothing. */
.rt-compact .rt-split {
  width: 62px;
}

.rt-compact .rt-split .rt-caret {
  width: 22px;
}

.rt-compact .rt-split .rt-main {
  width: 40px;
}

.rt-compact .rt-split .rt-main span,
.rt-compact .rt-split.rt-solo .rt-main span {
  display: none;
}

.rt-compact .rt-split .rt-main,
.rt-compact .rt-split.rt-solo .rt-main {
  padding: 0;
}

.rt-splitpop {
  min-width: 190px;
  border-radius: 10px;
  padding: 4px;
}

/* Fluent aligns a menu row's icon and content to the top, which left both hanging
   at the top of the 34px row. The prototype's rows are one centred line. */
.rt-splitmenu .fui-MenuItem {
  display: flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  column-gap: 9px;
  border-radius: 7px;
  font-size: 13px;
}

.rt-splitmenu .fui-MenuItem:hover {
  background: var(--pgw-rules-row-hover);
}

.rt-splitmenu .fui-MenuItem__icon {
  width: 16px;
  height: 16px;
  font-size: 16px;
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.rt-splitmenu .fui-MenuItem__content {
  padding: 0;
  line-height: 20px;
}

/* --- The list --- */

/* The header's 14px fade sits over the top of the list, so the first card starts
   below it rather than under it. */
.rt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 12px 60px;
}

.rt-compact .rt-list {
  padding: 16px 8px 60px;
}

.rt-empty {
  padding: 26px 12px 10px;
  text-align: center;
  font-size: 13px;
  line-height: 19px;
  color: var(--rt-ink3);
  text-wrap: pretty;
}

.rt-empty .rt-link,
.rt-matter-links .rt-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--rt-brand);
}

.rt-empty .rt-link:hover,
.rt-matter-links .rt-link:hover {
  text-decoration: underline;
}

/* A text button has no box to colour, so it is given one that is invisible until
   the keyboard reaches it. Transparent at rest: focus must not move the text. */
.rt-link {
  border: 1px solid transparent;
  border-radius: 6px;
}

.rt-link:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

/* --- Empty rulebook: its own screen, not a list with a line in it --- */

.rt-empty-state {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 24px 28px;
  text-align: center;
  gap: 0;
  background: var(--rt-pane);
}

.rt-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background: var(--rt-soft);
  color: var(--rt-brand);
  margin-bottom: 16px;
  flex: 0 0 auto;
}

.rt-empty-icon svg {
  width: 28px;
  height: 28px;
}

.rt-empty-title {
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  color: var(--rt-ink);
  margin: 0 0 6px;
}

.rt-empty-body {
  font-size: 13.5px;
  line-height: 20px;
  color: var(--rt-ink3);
  max-width: 340px;
  margin: 0 0 20px;
  text-wrap: pretty;
}

.rt-empty-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* The primary wears the New rule button's gradient, sized to its label. */
.rt-empty-primary {
  width: auto;
}

.rt-empty-primary .rt-main {
  padding: 0 16px;
}

.rt-empty-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  background: var(--rt-field);
  border: 1px solid var(--rt-hair);
  box-shadow: var(--rt-shadow-rest);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rt-brand);
  white-space: nowrap;
  transition: background 0.15s;
}

.rt-empty-secondary:hover {
  background: var(--rt-soft);
}

.rt-empty-secondary:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

/* At 320px the two actions stack, both the width of the text column. */
.rt-compact .rt-empty-actions {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 220px;
}

.rt-compact .rt-empty-primary,
.rt-compact .rt-empty-secondary {
  width: 100%;
}

.rt-compact .rt-empty-primary .rt-main {
  padding: 0 16px;
}

.rt-compact .rt-empty-primary .rt-main span {
  display: inline;
}

/* One quiet line, at the top of the list: a change that failed says so where the
   rules are, instead of replacing them with an error screen. */
.rt-error {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--rt-error-bg);
  color: var(--rt-error);
  font-size: 12px;
  line-height: 18px;
  text-wrap: pretty;
}

.rt-error .rt-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--rt-error);
  text-decoration: underline;
}

.rt-card {
  position: relative;
  background: var(--rt-card);
  border-radius: 12px;
  border: 1px solid var(--rt-hair);
  box-shadow: var(--rt-shadow-rest);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.rt-card:hover {
  border-color: var(--rt-hair-hover);
  box-shadow: var(--rt-shadow-hover);
}

.rt-card.rt-editing {
  background: var(--rt-card-editing);
  border-color: var(--rt-brand);
  box-shadow: var(--rt-shadow-edit);
}

/* The deep-link mark: the same one-pixel brand edge the editing card wears. The
   two never happen at once — a card is marked on arrival from the chat island and
   is editing only once the user has clicked into it. */
.rt-card.rt-highlight {
  border-color: var(--rt-brand);
}

/* A rule the server has not accepted: still readable, still editable, and honest
   about where it stands. Its actions stay on show — there is no hover on touch,
   and the tag has to be visible without one. */
.rt-card.rt-unsaved {
  /* One solid line where there were two stacked translucent ones. */
  border-color: color-mix(in srgb, var(--rt-error) 55%, transparent);
}

.rt-card.rt-unsaved .rt-acts {
  opacity: 1;
}

/* pgw#5633 D49: the pill an external person's read-only Rules tab wears in place of New Rule. */
.rt-readonly-pill {
  flex: none;
  padding: 2px 8px;
  border: 1px solid var(--rt-chip-edge);
  border-radius: 10px;
  font-size: 11px;
  line-height: 14px;
  color: var(--rt-ink4);
  white-space: nowrap;
}

.rt-unsaved-tag {
  font-size: 11px;
  line-height: 18px;
  color: var(--rt-ink4);
  white-space: nowrap;
  padding-right: 2px;
}

.rt-card.rt-fresh {
  animation: rt-drop 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes rt-drop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rt-front {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 12px 12px 13px 14px;
}

.rt-front > .rt-chk {
  position: absolute;
  left: 14px;
  top: 14px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

/*
 * Fluent's circular checkbox, trimmed to the 18px dot the design draws: a white
 * circle with a hairline track border, filled brand when the rule is on. Fluent's
 * own indicator kept a grey border under the brand fill, and its input stretches
 * across the whole control, which put a focus ring across the card.
 */
.rt-chk .fui-Checkbox {
  padding: 0;
  margin: 0;
  min-height: 0;
  width: 18px;
  height: 18px;
}

.rt-chk .fui-Checkbox__input {
  width: 18px;
  height: 18px;
  top: 0;
  left: 0;
  margin: 0;
  border-radius: 50%;
}

.rt-chk .fui-Checkbox__indicator {
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 50%;
  border: 1.5px solid var(--rt-track);
  background: var(--rt-field);
  color: var(--rt-on-brand);
}

.rt-chk .fui-Checkbox__indicator > svg {
  width: 12px;
  height: 12px;
}

.rt-chk .fui-Checkbox:hover .fui-Checkbox__indicator {
  border-color: var(--rt-brand);
}

.rt-chk .fui-Checkbox__input:checked ~ .fui-Checkbox__indicator {
  background: var(--rt-brand);
  border-color: var(--rt-brand);
  color: var(--rt-on-brand);
}

.rt-body {
  min-width: 0;
  flex: 1 1 auto;
}

/* The tour's "Sample" tag under a tour-only rule's text (pgw#5419), in line with the text. */
.rt-sample-tag {
  display: block;
  padding-left: 28px;
  margin-top: 2px;
}

.rt-text {
  display: block;
  width: 100%;
  min-height: 22px;
  font-size: 14px;
  line-height: 22px;
  color: var(--rt-ink);
  cursor: text;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
}

.rt-card.rt-off .rt-text {
  color: var(--rt-ink4);
}

.rt-ta {
  display: block;
  width: 100%;
  min-height: 22px;
  font: inherit;
  font-size: 14px;
  line-height: 22px;
  color: var(--rt-ink);
  border: none;
  outline: none;
  background: transparent;
  resize: none;
  padding: 0;
  margin: 0;
  field-sizing: content;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: hidden;
}

.rt-ta::placeholder {
  color: var(--rt-ink4);
}

.rt-text,
.rt-ta {
  text-indent: 28px;
  padding-right: 24px;
}

/* --- Section bar: one cell per section, All/None + adjust beside it --- */

.rt-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
}

.rt-bar-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 1px;
  flex: 1 1 auto;
  min-width: min(100%, var(--rt-barmin, 0px));
  max-width: var(--rt-barmax, 100%);
}

.rt-seg-cell {
  position: relative;
  container-type: inline-size;
  height: 18px;
  min-width: 0;
  padding: 0;
  /* Transparent at rest: the current cell's edge must not resize the cell. */
  border: 1px solid transparent;
  font-family: var(--rt-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-grid;
  place-items: center;
  background: var(--rt-cell-off);
  color: var(--rt-cell-off-ink);
  transition: background 0.12s, color 0.12s;
}

.rt-seg-cell:first-child {
  border-radius: 5px 0 0 5px;
}

.rt-seg-cell:last-child {
  border-radius: 0 5px 5px 0;
}

.rt-seg-cell:hover {
  background: var(--rt-cell-hover);
  color: var(--rt-ink2);
}

.rt-seg-cell.rt-on {
  background: var(--rt-cell-on);
  color: var(--rt-cell-on-ink);
}

.rt-seg-cell.rt-on:hover {
  background: var(--rt-cell-on-hover);
  color: var(--rt-cell-on-hover-ink);
}

.rt-seg-cell.rt-cur {
  border-color: var(--rt-brand);
}

/* Below ~20px a cell is a colour, not a label. */
@container (max-width: 20px) {
  .rt-seg-cell > .rt-lbl {
    display: none;
  }
}

.rt-seg-cell::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  background: var(--rt-ink);
  color: var(--rt-tip-ink);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s, transform 0.12s;
  z-index: 6;
}

.rt-seg-cell:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.rt-scope.rt-off .rt-bar-strip {
  opacity: 0.5;
}

.rt-cnt {
  display: inline-flex;
  align-items: center;
  height: 22px;
  font-family: var(--rt-mono);
  font-size: 10.5px;
  color: var(--rt-ink4);
  flex: 0 0 auto;
}

.rt-sc-cluster {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 2px;
}

/* Too narrow for both on one line: the strip keeps the row, the cluster takes the
   next one, right-aligned, with the count reading from its start. */
.rt-scope.rt-wrapped .rt-sc-cluster {
  margin-left: auto;
}

/* The link and the adjust icon sit side by side, so they are the same 22px box:
   at 19px the link floated a pixel high against the 22px icon button. */
.rt-sc-link {
  height: 22px;
  line-height: 18px;
  font-size: 11px;
  font-weight: 600;
  color: var(--rt-ink4);
  padding: 2px 0;
  width: 36px;
  text-align: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex: 0 0 auto;
}

.rt-sc-link:hover {
  color: var(--rt-brand);
  background: var(--rt-soft);
}

.rt-sc-adj {
  width: 24px;
  height: 22px;
  border-radius: 5px;
  display: inline-grid;
  place-items: center;
  color: var(--rt-ink4);
  transition: color 0.15s, background 0.15s;
  flex: 0 0 auto;
}

.rt-sc-adj:hover {
  color: var(--rt-brand);
  background: var(--rt-soft);
}

/* Fluent's 16px filled glyph reads far heavier than the prototype's 13px strokes. */
.rt-sc-adj svg {
  width: 13px;
  height: 13px;
}

/* --- "Where does this apply?": replaces the card, no flip, no empty space --- */

.rt-menu {
  animation: rt-fade 0.18s ease;
}

@keyframes rt-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.rt-menu-h {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 8px 0 6px;
  border-bottom: 1px solid var(--rt-hair);
}

.rt-menu-h .rt-t {
  font-size: 13px;
  font-weight: 700;
  color: var(--rt-ink);
}

.rt-menu-h .rt-grow {
  flex: 1 1 auto;
}

.rt-sc-pair {
  display: inline-flex;
  gap: 2px;
}

.rt-menu-find {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  margin: 8px 10px 2px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--rt-find-bg);
  color: var(--rt-ink4);
  font-size: 13px;
}

.rt-menu-find input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  color: var(--rt-ink);
}

.rt-menu-list {
  display: flex;
  flex-direction: column;
  padding: 2px 6px 6px;
}

.rt-mrow {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--rt-ink);
  text-align: left;
  width: 100%;
  transition: background 0.12s;
}

.rt-mrow:hover {
  background: var(--rt-row-hover);
}

.rt-mrow .rt-k {
  font-family: var(--rt-mono);
  font-size: 10.5px;
  color: var(--rt-ink4);
  width: 22px;
  text-align: left;
  flex: 0 0 auto;
}

.rt-mrow .rt-nm {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rt-sq {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--rt-track);
  display: inline-grid;
  place-items: center;
  color: var(--rt-on-brand);
  transition: background 0.12s, border-color 0.12s;
  flex: 0 0 auto;
}

.rt-sq.rt-on {
  background: var(--rt-brand);
  border-color: var(--rt-brand);
}

/* --- Reuse picker: rules from elsewhere, multi-select --- */

.rt-card.rt-picker {
  animation: rt-drop 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  border-color: var(--rt-brand);
  box-shadow: var(--rt-shadow-edit);
}

.rt-picker .rt-menu-h {
  padding-left: 14px;
}

.rt-plist {
  display: flex;
  flex-direction: column;
  padding-top: 4px;
}

.rt-prow {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px 9px 14px;
  border-bottom: 1px solid var(--rt-hair2);
  text-align: left;
  width: 100%;
  font-size: 13.5px;
  line-height: 20px;
  color: var(--rt-ink);
  transition: background 0.12s;
}

.rt-prow:hover {
  background: var(--rt-row-hover);
}

.rt-prow .rt-sq {
  margin-top: 1px;
}

.rt-prow .rt-pt {
  flex: 1 1 auto;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.rt-pmore {
  font-size: 12px;
  color: var(--rt-ink3);
  padding: 8px 14px 0;
}

.rt-pfoot {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 10px 0 14px;
}

.rt-pfoot .rt-grow {
  flex: 1 1 auto;
}

.rt-hint {
  font-size: 11px;
  color: var(--rt-ink4);
}

.rt-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--rt-field);
  color: var(--rt-ink2);
  border: 1px solid var(--rt-hair);
}

.rt-btn:hover {
  background: var(--rt-row-hover);
}

.rt-btn.rt-primary {
  background: var(--rt-brand);
  color: var(--rt-on-brand);
  border-color: var(--rt-brand);
}

.rt-btn.rt-primary:hover {
  background: var(--rt-brand-deep);
  border-color: var(--rt-brand-deep);
}

.rt-btn.rt-primary:disabled {
  opacity: 0.45;
  cursor: default;
  background: var(--rt-brand);
  border-color: var(--rt-brand);
}

.rt-acts {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.rt-front:hover .rt-acts,
.rt-front:focus-within .rt-acts {
  opacity: 1;
}

.rt-ibtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--rt-ink3);
  transition: background 0.15s, color 0.15s;
  flex: 0 0 auto;
}

.rt-ibtn:hover {
  background: var(--rt-cell-off);
  color: var(--rt-ink);
}

.rt-ibtn:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

.rt-acts .rt-ibtn:hover {
  color: var(--rt-error);
  background: var(--rt-error-bg);
}

/* --- Footer: counts left, the rulebook pair right --- */

/* No fixed height: the row is the 32px buttons plus 4px of air, so the footer never
   claims more of the pane than it uses (~40px). */
.rt-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 0 8px 0 16px;
  margin-top: auto;
  background: var(--rt-foot-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--rt-foot-hair);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s;
}

.rt-foot.rt-hide {
  transform: translateY(100%);
  opacity: 0;
}

.rt-foot .rt-count {
  font-size: 12px;
  color: var(--rt-ink4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.rt-foot .rt-grow {
  flex: 1 1 auto;
}

.rt-foot .rt-rare {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rt-foot .rt-rb {
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--rt-foot-action);
  white-space: nowrap;
}

.rt-foot .rt-rb:hover {
  color: var(--rt-brand);
}

.rt-foot .rt-rb:active {
  color: var(--rt-brand-deep-ink);
}

.rt-wide .rt-foot .rt-rb {
  padding: 0 10px 0 8px;
}

.rt-foot .rt-dv {
  width: 1px;
  height: 20px;
  background: var(--rt-hair);
  margin: 0 4px;
}

/* --- Matter rules (#5165): a live group above the document's own rules --- */

.rt-chip-icon {
  margin-right: 4px;
  flex: 0 0 auto;
}

.rt-matter-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--rt-ink2);
  text-align: left;
}

.rt-matter-head:focus-visible {
  outline: none;
  color: var(--rt-ink);
}

/* The groups could not be read: the line and a small bordered button on one row (RuleStates board). */
.rt-group-failed {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}

.rt-group-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--rt-hair);
  border-radius: 8px;
  background: var(--rt-card);
  color: var(--rt-ink);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.rt-group-retry:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

/* A group's heading (pgw#5635): the name gives way first, the count stays whole. */
.rt-group-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rt-group-count {
  flex: 0 0 auto;
  padding-left: 6px;
  margin-left: auto;
  font-weight: 400;
  color: var(--rt-ink3);
}

.rt-matter-note {
  padding: 0 2px;
  font-size: 12px;
  line-height: 18px;
  color: var(--rt-ink3);
  text-wrap: pretty;
}

/* The Matter cards and the document-type cards sit as far apart as the list's
   own cards (#5262): a wrapper is a single .rt-list child, so it needs its own gap. */
.rt-matter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rt-doctype-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rt-doctype-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Folded: the cards stay mounted (an open editor keeps its text), only unseen. */
.rt-doctype-cards[hidden] {
  display: none;
}

.rt-matter-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--rt-ink3);
}

.rt-matter-off {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  border: 1px solid var(--rt-hair);
  font-size: 11px;
  font-weight: 600;
  color: var(--rt-ink2);
}

.rt-matter-off[aria-checked="true"] {
  background: var(--rt-soft);
  color: var(--rt-soft-ink);
  border-color: var(--rt-soft-edge);
}

.rt-matter-off:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

.rt-group-card .rt-text {
  text-indent: 0;
  padding-right: 0;
}

.rt-card.rt-off-here {
  opacity: 0.6;
}

.rt-card-error {
  padding: 4px 12px 8px;
  font-size: 12px;
  line-height: 18px;
  color: var(--rt-error);
}

/* ==========================================================================
   Noetpad shape (pgw#5115 Phase A, frames 88–95 of the handoff canvas, F1–F3).
   The colours above follow every theme through the tokens. These rules change
   only shape and type, and only in the three Noetpad themes: Classic is not in
   the list, so it keeps every rule above unchanged.
   ========================================================================== */

/* The editing card wears the handoff focus ring (`tokens.json → shadow.focus`):
   a 3px gold halo outside its gold edge. It is the editing elevation, not a
   hairline: the edge is still the card's own border. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-root {
  --rt-shadow-edit: 0 0 0 3px var(--pgw-gold-focus-14);
}

/* Bar (F1): the filters sit on a rule. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-white {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--pgw-rule-track);
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-compact .rt-white {
  padding: 10px 8px 8px;
}

/* Section strip (F1): 24px pills with an edge; the picked one is the dark pill. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-strip {
  height: 24px;
  gap: 4px;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-chips {
  gap: 4px;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-chip {
  height: 24px;
  padding: 0 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-sep {
  height: 14px;
}

/* Search, book button and New rule (F1): 30px; New rule is a flat gold split. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-act {
  height: 30px;
  gap: 6px;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-sfield {
  height: 30px;
  border-radius: 15px;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-sfield input {
  font-size: 12.5px;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-bookbtn {
  width: 30px;
  height: 30px;
  border-radius: 15px;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-split {
  height: 30px;
  border-radius: 8px;
  background: var(--rt-brand);
  box-shadow: none;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-split .rt-main {
  font-weight: 700;
}

/* Cards (F1): 10px paper cards, rule text at the body size. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-card {
  border-radius: 10px;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-text,
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-ta {
  font-size: 13px;
  line-height: 20px;
}

/* The on/off box is square in the Noetpad themes, gold when on. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-chk .fui-Checkbox__input,
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-chk .fui-Checkbox__indicator {
  border-radius: 4px;
}

/* A card a rulebook load just wrote (F1): a teal rail on its left edge instead of
   the brand border. An editing, deep-linked or unsaved card keeps its own edge. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"])
  .rt-card.rt-arrived:not(.rt-editing, .rt-highlight, .rt-unsaved, :has(> .rt-menu)) {
  border-color: var(--rt-hair);
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-card.rt-arrived::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--pgw-teal);
  pointer-events: none;
}

/* Scope editor (F2, frame 89): it replaces the card, so the card wears the
   editing edge and ring while it is open; picked rows take the gold tint. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-card:has(> .rt-menu) {
  background: var(--rt-card-editing);
  border-color: var(--rt-brand);
  box-shadow: var(--rt-shadow-edit);
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-menu-find {
  border-radius: 15px;
  background: var(--rt-field);
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-root:not(.rt-compact) .rt-menu-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 6px;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-mrow[aria-pressed="true"] {
  background: var(--rt-soft);
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-sq {
  border-radius: 4px;
}

/* Error line (F2, frame 92): the error tint with its edge. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-error {
  border: 1px solid var(--pgw-error-edge);
}

/* Empty rulebook (F2, frame 91): a gold glyph, the title face, flat buttons. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-empty-icon {
  width: auto;
  height: auto;
  margin-bottom: 10px;
  border-radius: 0;
  background: none;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-empty-icon svg {
  width: 22px;
  height: 22px;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-empty-title {
  font-family: var(--pgw-font-title);
  font-size: 18px;
  line-height: 24px;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-empty-secondary {
  height: 30px;
  border-radius: 8px;
  border-color: var(--rt-soft-edge);
  box-shadow: none;
  color: var(--rt-brand-deep-ink);
}

/* The rule above outranks the base focus rule, so the keyboard edge is restated. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-empty-secondary:focus-visible {
  border-color: var(--rt-brand);
}

/* Footer (F1): 44px of paper under a rule; the two rulebook actions in gold ink. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-foot {
  height: 44px;
  padding: 0 8px 0 12px;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-foot .rt-count {
  font-size: 11.5px;
  color: var(--rt-ink3);
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-foot .rt-rb {
  font-size: 12px;
}

/*
 * Rulebook screens (#3694, decision D14). Plain CSS, the `rt-` prefix continued:
 * `rt-scr-` is the drill-in chrome any screen wears, `rt-rb-` is the rulebook
 * itself. Every one of these rules renders INSIDE `.rt-root`, so the Paper tokens
 * declared there (`RulesTab.css`) are inherited — this file declares no colours of
 * its own. pgw#5115: those tokens follow the theme (`theme/colourSets/rules.js`).
 *
 * Fluent v9 supplies the controls (Button, Input, Dropdown); the layout is CSS.
 * No inline styles, no second FluentProvider.
 */

/* --- The drill-in: header, body, footer --- */

.rt-scr {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.rt-scr-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex: none;
  align-items: center;
  gap: 4px;
  height: 48px;
  padding: 0 12px 0 6px;
  background: color-mix(in srgb, var(--rt-pane) 96%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.rt-scr-back {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  /* Transparent at rest so the keyboard's edge costs no layout. */
  border: 1px solid transparent;
  color: var(--rt-ink2);
  flex: 0 0 auto;
  transition: background 0.15s, color 0.15s;
}

.rt-scr-back:hover {
  background: var(--rt-row-hover);
  color: var(--rt-ink);
}

.rt-scr-back:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

.rt-scr-title {
  font-size: 15px;
  /* The arrow is 32px and the badge 16px: giving the title an explicit line box
     is what puts all three on one centre line rather than on three. */
  line-height: 20px;
  font-weight: 700;
  color: var(--rt-ink);
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The 72px of bottom padding is the 56px footer plus air: the last field must be
   reachable above a sticky footer, not tucked under it. */
.rt-scr-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  padding: 6px 12px 72px;
  min-height: 0;
}

.rt-scr-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  height: 56px;
  padding: 0 12px;
  margin-top: auto;
  background: var(--rt-foot-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--rt-foot-hair);
}

/* --- Save to rulebook --- */

/* What is being saved, stated before anything is asked. */
.rt-rb-what {
  margin: 0;
  font-size: 12.5px;
  line-height: 18px;
  color: var(--rt-ink3);
  text-wrap: pretty;
}

.rt-rb-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rt-rb-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rt-ink2);
}

.rt-rb-hint {
  font-size: 11.5px;
  line-height: 16px;
  color: var(--rt-ink4);
  text-wrap: pretty;
}

/* --- Segmented controls: native radios grouped by `name`, so arrow-key roving
       focus and radiogroup semantics come from the platform, not from a handler. */

.rt-rb-seg {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 9px;
  background: var(--rt-field);
  border: 1px solid var(--rt-hair);
}

.rt-rb-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rt-ink2);
  white-space: nowrap;
  cursor: pointer;
  -webkit-user-select: none;
          user-select: none;
  transition: background 0.15s, color 0.15s;
}

.rt-rb-cell:hover {
  background: var(--rt-row-hover);
  color: var(--rt-ink);
}

.rt-rb-cell.rt-on {
  background: var(--rt-pick-bg);
  color: var(--rt-pick-ink);
}

.rt-rb-cell.rt-on:hover {
  background: var(--rt-pick-bg);
}

.rt-rb-cell svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.rt-rb-cell .rt-lbl {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Keyboard focus colours the whole CONTROL's own edge — never one cell inside it,
   and never a second ring outside it. An outline over a border is two rings on one
   control, and the outer one only approximates the border-box radius: in the Word
   webview it squares off at the corners. */
.rt-rb-seg:has(:focus-visible) {
  border-color: var(--rt-brand);
}

/* The group's edge is the ring, so the radio itself never draws one — a UA ring on
   a 1px clipped input, or on a visible radio inside a bordered row, is the second
   of the two rings this design does not have. */
.rt-rb-vh:focus,
.rt-rb-vh:focus-visible,
.rt-rb-opt input:focus,
.rt-rb-opt input:focus-visible {
  outline: none;
}

/* Hidden to the eye, present to the a11y tree and focusable: this is what makes
   the group a real radiogroup. */
.rt-rb-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Name field --- */

/* A plain input, wearing the same Paper field the tab's search box wears. Fluent's
   Input brought its own underline and focus outline, which read as a second design
   inside a screen that has one. */
.rt-rb-name {
  width: 100%;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--rt-hair);
  border-radius: 8px;
  background: var(--rt-field);
  box-shadow: var(--rt-shadow-rest);
  font: inherit;
  font-size: 14px;
  color: var(--rt-ink);
}

.rt-rb-name::placeholder {
  color: var(--rt-ink4);
}

.rt-rb-name:focus-visible {
  border-color: var(--rt-brand);
}

/* The field's own edge is the ring; the UA's would be the second one. */
.rt-rb-name:focus,
.rt-rb-name:focus-visible {
  outline: none;
}

/* --- Applies-to --- */

.rt-rb-applies .fui-Dropdown,
.rt-rb-applies.fui-Dropdown {
  min-width: 0;
  height: 34px;
  border-radius: 8px;
  background: var(--rt-field);
  border: 1px solid var(--rt-hair);
}

.rt-rb-applies.fui-Dropdown::after,
.rt-rb-applies .fui-Dropdown::after {
  display: none;
}

.rt-rb-applies button {
  font-size: 13px;
}

/* --- Footer buttons: the primary wears the tab's one filled look --- */

.rt-rb-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border-radius: 17px;
  background: linear-gradient(180deg, var(--rt-brand-top), var(--rt-brand));
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--rt-brand) 28%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--rt-on-brand) 18%, transparent);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rt-on-brand);
  white-space: nowrap;
  flex: 0 0 auto;
  border: 1px solid transparent;
  transition: filter 0.15s;
}

.rt-rb-primary:hover {
  filter: brightness(0.96);
}

/* A brand edge on a brand fill is invisible, so the ring is drawn in the one
   colour that reads against it. Still a 1px border on the button's own box. */
.rt-rb-primary:focus-visible {
  outline: none;
  border-color: var(--rt-on-brand);
}

.rt-rb-primary:disabled,
.rt-rb-primary[aria-disabled='true'] {
  opacity: 0.45;
  cursor: default;
  filter: none;
}

.rt-rb-cancel {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rt-ink2);
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background 0.15s, color 0.15s;
}

.rt-rb-cancel:hover {
  background: var(--rt-row-hover);
  color: var(--rt-ink);
}

/* Every quiet button carries a transparent edge at rest, so the keyboard colours
   what is already there instead of adding a ring outside it. */
.rt-rb-cancel,
.rt-rb-del,
.rt-rb-undo,
.rt-rb-ok-x {
  border: 1px solid transparent;
}

.rt-rb-cancel:focus-visible,
.rt-rb-del:focus-visible,
.rt-rb-undo:focus-visible,
.rt-rb-ok-x:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

/* --- The one line the list shows after a save --- */

.rt-rb-ok {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 12px;
  border-radius: 12px;
  background: var(--rt-ok-bg);
  color: var(--rt-ok);
  font-size: 13px;
  line-height: 18px;
  text-wrap: pretty;
}

.rt-rb-ok svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.rt-rb-ok .rt-grow {
  flex: 1 1 auto;
  min-width: 0;
}

/* The same line, saying the opposite thing: an undo that did not happen. It keeps
   the shape so the eye finds it in the same place, and changes colour so it is not
   mistaken for the success it replaces. */
.rt-rb-ok.rt-bad {
  background: var(--rt-error-bg);
  color: var(--rt-error);
}

.rt-rb-ok.rt-bad .rt-rb-undo,
.rt-rb-ok.rt-bad .rt-rb-ok-x {
  color: var(--rt-error);
}

.rt-rb-ok-x {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--rt-ok);
  flex: 0 0 auto;
  transition: background 0.15s;
}

.rt-rb-ok-x:hover {
  background: color-mix(in srgb, var(--rt-ok) 10%, transparent);
}

/* --- A write the server refused: the form stays, nothing typed is thrown away --- */

.rt-rb-error {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--rt-error-bg);
  color: var(--rt-error);
  font-size: 12px;
  line-height: 18px;
  text-wrap: pretty;
}

/* --- Update branch: the rulebooks this user may overwrite --- */

.rt-rb-update {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* The search field appears only past six rulebooks, so it never sits above a list
   short enough to read. Find-field grey, not a card: it filters, it holds nothing. */
.rt-rb-find {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--rt-find-bg);
  color: var(--rt-ink4);
  font-size: 13px;
}

.rt-rb-find svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.rt-rb-find input {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  color: var(--rt-ink);
}

.rt-rb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Names are not unique (D5): the row is 50px tall because the meta line under the
   name is what tells two rulebooks of the same name apart.
   A grid rather than nested boxes, so the name and the meta stay direct children
   of the label and the radio keeps them as its accessible name. */
.rt-rb-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: 2px 8px;
  min-height: 50px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--rt-card);
  border: 1px solid var(--rt-hair);
  box-shadow: var(--rt-shadow-rest);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.rt-rb-row:hover {
  background: var(--rt-row-hover);
  border-color: var(--rt-hair-hover);
}

/* Picked: the soft fill and a one-pixel brand edge. The 1.5px it replaces could
   only ever be a shadow, and a 1.5px border renders unevenly. */
.rt-rb-row.rt-on {
  background: var(--rt-soft);
  border-color: var(--rt-brand);
}

/* The row's own edge is the ring. A picked row is already brand, so reaching it
   with the keyboard changes nothing — which is right: it is already marked. */
.rt-rb-row:has(:focus-visible) {
  border-color: var(--rt-brand);
}

.rt-rb-row-name {
  grid-column: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--rt-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rt-rb-row-meta {
  grid-column: 1 / -1;
  font-size: 11.5px;
  line-height: 16px;
  color: var(--rt-ink4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The level, in one word. Tinted from the level's own colour so the pill reads at
   10px without a border. */
.rt-rb-badge {
  display: inline-flex;
  grid-column: 2;
  align-items: center;
  align-self: center;
  height: 16px;
  line-height: 16px;
  padding: 0 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* The badge tint is the level's own ink at 12%. */
.rt-rb-badge.rt-mine {
  background: color-mix(in srgb, var(--pgw-rules-badge-mine) 12%, transparent);
  color: var(--pgw-rules-badge-mine);
}

.rt-rb-badge.rt-firm {
  background: color-mix(in srgb, var(--pgw-rules-badge-firm) 12%, transparent);
  color: var(--pgw-rules-badge-firm);
}

.rt-rb-badge.rt-global {
  background: color-mix(in srgb, var(--pgw-rules-badge-global) 12%, transparent);
  color: var(--pgw-rules-badge-global);
}

/* --- What the update will do, in numbers, before it is done --- */

.rt-rb-sum {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--rt-card);
  border: 1px solid var(--rt-hair);
  box-shadow: var(--rt-shadow-rest);
}

.rt-rb-sum-icon {
  display: inline-grid;
  place-items: center;
  color: var(--rt-ink3);
  flex: 0 0 auto;
}

.rt-rb-sum-icon svg {
  width: 20px;
  height: 20px;
}

.rt-rb-sum-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.rt-rb-sum-line {
  font-size: 12.5px;
  line-height: 17px;
  color: var(--rt-ink);
  text-wrap: pretty;
}

.rt-rb-sum-quiet {
  font-size: 12px;
  line-height: 16px;
  color: var(--rt-ink3);
  text-wrap: pretty;
}

.rt-rb-sum .rt-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--rt-brand);
}

.rt-rb-sum .rt-link:hover {
  text-decoration: underline;
}

/* --- ≥640px: the same form, anchored over the footer's Save button (D12) --- */

/* pgw#5558 A5: the scrim and the popover open through a portal: on the editor page
   in the side bar's layer, whose layout containment makes it the box `fixed` fills;
   in Word on the body, where the task pane is the window. The wrapper carries the
   `.rt-root` colour names and draws no box of its own. */
.rt-root.rt-portal {
  display: contents;
}

/* A button, not a div: clicking away closes the form, and what the mouse can do
   the keyboard must be able to do too.

   FIXED, not absolute: `.rt-root` is the scroll container, so an absolutely
   positioned scrim is anchored to the scrolled CONTENT and slides away from the
   viewport as the list moves under it. Fixed is the side bar (layer) or the pane. */
.rt-rb-scrim {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: block;
  width: 100%;
  height: 100%;
  background: color-mix(in srgb, var(--rt-ink) 6%, transparent);
}

/* Fixed for the same reason as the scrim: the popover is anchored over the
   FOOTER, which is itself fixed to the bottom of the pane, not over a point in a
   list that scrolls. */
.rt-rb-pop {
  position: fixed;
  right: 12px;
  bottom: 58px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(360px, calc(100% - 24px));
  max-height: calc(100% - 96px);
  padding: 14px 14px 12px;
  border-radius: 12px;
  background: var(--rt-card);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.14);
}

.rt-rb-pop-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
}

.rt-rb-pop-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: none;
}

/* ==========================================================================
   Open rulebook (#3694, F3): the list, the detail, and the two side by side.
   ========================================================================== */

/* --- The list --- */

.rt-rb-lbody {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* The search field keeps its own height. In a flex COLUMN the default
   `flex-shrink: 1` lets a long list squeeze it into a line; `align-self: stretch`
   is deliberately not set for the same reason. It is a field, not a spacer. */
.rt-rb-lbody .rt-sfield {
  flex: 0 0 auto;
}

/* How many rulebooks sit behind a segment, in the tab's monospace face so three
   counts line up under three labels of different widths. */
/* The count is 10.5px monospace beside a 12.5px label: its own line box would sit
   it low, so it is given none of its own and centred on the cell's. */
.rt-rb-count {
  font-family: var(--rt-mono);
  font-size: 10.5px;
  line-height: 1;
  align-self: center;
  opacity: 0.7;
  flex: 0 0 auto;
}

.rt-rb-lrows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 52px because the meta line under the name is what tells two rulebooks of the
   same name apart (names are free text — D5). */
.rt-rb-lrow {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--rt-card);
  border: 1px solid var(--rt-hair);
  box-shadow: var(--rt-shadow-rest);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.rt-rb-lrow:hover {
  background: var(--rt-row-hover);
  border-color: var(--rt-hair-hover);
}

/* Only ≥640px has a persistent selection to show: below it a tap leaves for the
   detail screen and there is no row left on screen to mark. */
.rt-rb-lrow.rt-on {
  background: var(--rt-soft);
  border-color: var(--rt-brand);
}

.rt-rb-lrow:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

.rt-rb-lrow-name {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--rt-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rt-rb-lrow-meta {
  min-width: 0;
  font-size: 11.5px;
  line-height: 16px;
  color: var(--rt-ink4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The whole library is empty: not a list with nothing in it, but a screen that
   says what a rulebook is FOR and offers the one way to make the first one. The
   circle, the title and the body are the tab's own empty screen (`RulesTab.css`):
   one empty state, two places. */
.rt-rb-empty {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 28px;
  text-align: center;
}

/* One level has nothing in it while others do. There is a control right above it
   to answer that, so this says which level and gets out of the way. */
.rt-rb-none {
  padding: 26px 12px;
  font-size: 13px;
  line-height: 20px;
  color: var(--rt-ink3);
  text-align: center;
}

/* One line, said once: nothing here yet, still loading, or it would not load. */
.rt-rb-quiet {
  padding: 10px 2px;
  font-size: 12.5px;
  line-height: 18px;
  color: var(--rt-ink3);
  text-wrap: pretty;
}

/* --- The detail --- */

.rt-rb-dtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* At ≥640px the "Rulebook" header is shared with the list, so the name sits at the
   top of the pane instead of in a header of its own. */
.rt-rb-dhead {
  display: flex;
  flex: none;
  align-items: center;
  min-height: 32px;
  padding: 0 0 2px;
}

.rt-rb-dmeta {
  font-size: 12.5px;
  line-height: 17px;
  color: var(--rt-ink3);
  text-wrap: pretty;
}

.rt-rb-dbody {
  gap: 12px;
}

/* Every rule in ONE card: a rulebook is one thing, and twelve cards would read as
   twelve. The rows are told apart by a hairline, not by a gap. */
.rt-rb-rules {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background: var(--rt-card);
  border: 1px solid var(--rt-hair);
  box-shadow: var(--rt-shadow-rest);
  overflow: hidden;
}

.rt-rb-rule {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px 8px 14px;
  font-size: 13.5px;
  line-height: 20px;
  color: var(--rt-ink);
}

.rt-rb-rule + .rt-rb-rule {
  border-top: 1px solid var(--rt-hair2);
}

/* A rule is written as it will be drafted: its line breaks are part of it. */
.rt-rb-rule-text {
  flex: 1 1 auto;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Already in the user's rules: shown, because the rulebook contains it, but quiet,
   because loading will not write it again. */
.rt-rb-rule.rt-here .rt-rb-rule-text {
  color: var(--rt-ink4);
}

.rt-rb-tag {
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  color: var(--rt-ink4);
  white-space: nowrap;
  flex: 0 0 auto;
}

/* --- Add or Replace, with what each would do --- */

.rt-rb-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rt-rb-opt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2px 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--rt-card);
  border: 1px solid var(--rt-hair);
  box-shadow: var(--rt-shadow-rest);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.rt-rb-opt:hover {
  background: var(--rt-row-hover);
  border-color: var(--rt-hair-hover);
}

.rt-rb-opt.rt-on {
  background: var(--rt-soft);
  border-color: var(--rt-brand);
}

.rt-rb-opt:has(:focus-visible) {
  border-color: var(--rt-brand);
}

.rt-rb-opt input {
  grid-row: 1 / span 2;
  margin: 0;
  accent-color: var(--rt-brand);
}

.rt-rb-opt-name {
  grid-column: 2;
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
  color: var(--rt-ink);
}

/* The consequence, in the same numbers the primary carries. */
.rt-rb-opt-why {
  grid-column: 2;
  font-size: 11.5px;
  line-height: 16px;
  color: var(--rt-ink3);
  text-wrap: pretty;
}

/* Quiet, and away from the primary: deleting is not what this screen is for. */
.rt-rb-del {
  display: inline-flex;
  align-items: center;
  height: 30px;
  margin-right: auto;
  padding: 0 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
  color: var(--rt-ink3);
  white-space: nowrap;
  flex: 0 0 auto;
  transition: background 0.15s, color 0.15s;
}

.rt-rb-del:hover {
  background: var(--rt-error-bg);
  color: var(--rt-error);
}

/* --- The line a load leaves, and the way back out of it --- */

.rt-rb-undo {
  font-size: 13px;
  font-weight: 600;
  color: var(--rt-ok);
  text-decoration: underline;
}

/* --- ≥640px: list | detail under one header --- */

.rt-rb-split {
  display: flex;
  flex: 1 1 auto;
  gap: 12px;
  padding: 6px 12px 12px;
  min-height: 0;
}

/* Nothing to show on the right (an empty library, or an empty level): the one
   thing there IS to show takes the width rather than sitting in a 292px column
   beside an empty pane. */
.rt-rb-split.rt-full {
  display: block;
  overflow-y: auto;
}

.rt-rb-split-list {
  display: flex;
  flex: 0 0 292px;
  flex-direction: column;
  width: 292px;
  min-height: 0;
  overflow-y: auto;
}

.rt-rb-split-detail {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* The detail is a pane here, not the pane: its body scrolls inside the column.
   It has no footer of its own — the split carries ONE, under both columns, so the
   hairline above it spans the screen instead of stopping at the column edge. */
.rt-rb-detail.rt-embedded .rt-scr-body {
  padding: 0;
  overflow-y: auto;
}

/* Neither column draws a top edge: the header's own surface is the only line
   above them, and a second one boxed each column in. */
.rt-rb-split-list,
.rt-rb-split-detail {
  border: none;
}

/* --- The cards a load just wrote --- */

/* pgw#5288 S2: a steady 1px brand border on the card's own edge, until the user
   leaves the list (screen change or document type change). No fade: a ring that
   settles into the hairline in 1.2s is gone before the user has scrolled to it. */
.rt-card.rt-arrived {
  border-color: var(--rt-brand);
}

/* ==========================================================================
   Noetpad shape (pgw#5115 Phase A, frames 93 and 94 of the handoff canvas, F3).
   Shape and type only, and only in the three Noetpad themes; the colours come
   from the tokens in every theme. Classic keeps every rule above unchanged.
   These selectors outrank the focus rules above, so a rule here that sets a
   border restates its keyboard edge.
   ========================================================================== */

/* Screen titles in the title face: "Open a rulebook" (93), "Save to rulebook" (94). */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-scr-title {
  font-family: var(--pgw-font-title);
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
}

/* Paper rows; the picked one has a gold edge on the gold tint. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-rb-lrow,
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-rb-row {
  border-radius: 10px;
  box-shadow: none;
}

/* The Firm tag (93): a teal pill with its edge, in sentence case. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-rb-badge {
  height: 18px;
  line-height: 16px;
  border-radius: 9px;
  border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

/* Level segmented (94): the picked level is the dark pill, the others outlined. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-rb-seg {
  gap: 8px;
  padding: 0;
  border: 1px solid transparent;
  background: none;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-rb-seg:has(:focus-visible) {
  border-color: var(--rt-brand);
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-rb-cell {
  border-radius: 8px;
  border: 1px solid var(--pgw-rule-field);
  font-weight: 700;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-rb-cell.rt-on {
  border-color: var(--rt-pick-edge);
}

/* Name field (94): the editing paper; the keyboard edge stays the gold border above. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-rb-name {
  height: 32px;
  box-shadow: none;
  background: var(--rt-card-editing);
}

/* Footer buttons (93, 94): flat gold primary, outlined secondary, 8px corners. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-rb-primary {
  height: 32px;
  border-radius: 8px;
  background: var(--rt-brand);
  box-shadow: none;
  font-weight: 700;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-rb-cancel {
  height: 32px;
  border-radius: 8px;
  border-color: var(--pgw-rule-field);
  color: var(--rt-ink);
  font-weight: 700;
}

:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-rb-cancel:focus-visible {
  border-color: var(--rt-brand);
}

/* The 56px drill-in footer on the same paper as the tab footer. */
:root:is([data-pgw-theme="noets"], [data-pgw-theme="light"], [data-pgw-theme="dark"]) .rt-scr-foot {
  border-top-color: var(--pgw-rule-field);
}

/*
 * pgw#5527 — the Header & Footer screens. They wear the rulebook screens' frame (`rt-scr`, `rt-rb-pop`,
 * `rt-rb-seg`, ... from `rules-tab/RulebookScreens.css`) and its paper tokens (`--rt-*`, from
 * `.rt-root`, which follow the theme: `theme/colourSets/rules.js`). This file adds only what a design
 * screen has that a rulebook screen has not: the page preview, the chip slots and the library cards.
 * It declares no colour of its own.
 */

/*
 * The drill-in takes the pane. It mounts through Fluent's Portal, whose node is an absolute box of
 * no height, so the drill-in is absolute at its top and as tall as the window: the task pane in
 * Word, the full-height side bar in the Noets Editor (pgw#5558: a fixed box would escape the side
 * bar there).
 */
.rt-root.hf-drill {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100vh;
}

/* The drill-in scrolls as one page: the form keeps its height so the sticky footer stays at the bottom. */
.hf-drill > .rt-scr {
  min-height: 100%;
}

.hf-drill .rt-scr-body {
  flex-shrink: 0;
}

/* The popover at 640px and wider is wider than the rulebook's 360px form: three slots a row fit. */
.rt-rb-pop.hf-pop {
  width: min(480px, calc(100% - 24px));
  max-height: calc(100% - 48px);
  bottom: 24px;
  padding: 0;
  gap: 0;
}

.hf-pop .rt-scr {
  min-height: 0;
  overflow: hidden;
  border-radius: 12px;
}

.hf-pop .rt-scr-body {
  overflow-y: auto;
}

.rt-scr-head .hf-scr-sub {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rt-ink2);
}

.hf-scr-sub .hf-scr-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hf-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hf-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hf-group-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--rt-ink);
}

.hf-insert {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--rt-card);
  border: 1px solid var(--rt-hair);
  font-size: 13px;
  font-weight: 500;
  color: var(--rt-ink);
  box-shadow: var(--rt-shadow-rest);
}

.hf-insert:hover {
  background: var(--rt-row-hover);
}

.hf-insert:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

.hf-insert:disabled {
  opacity: 0.45;
  cursor: default;
}

/* --- A slot: label left, the line right --- */

.hf-slot-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.hf-slot-label {
  font-size: 13px;
  color: var(--rt-ink3);
}

.hf-slot-wrap {
  position: relative;
  min-width: 0;
}

.hf-slot {
  display: block;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--rt-hair);
  border-radius: 8px;
  background: var(--rt-field);
  box-shadow: var(--rt-shadow-rest);
  font-size: 14px;
  line-height: 20px;
  color: var(--rt-ink);
  white-space: pre;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.hf-slot:focus,
.hf-slot:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
  box-shadow: var(--rt-shadow-edit);
}

.hf-slot[aria-readonly="true"] {
  opacity: 0.6;
}

.hf-slot.hf-refused {
  border-color: var(--rt-error);
}

.hf-count {
  position: absolute;
  right: 8px;
  bottom: -9px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--rt-card);
  font-family: var(--rt-mono);
  font-size: 10.5px;
  line-height: 14px;
  color: var(--rt-ink4);
}

.hf-count.hf-count-full {
  color: var(--rt-error);
}

/* A chip is one unit: a tinted pill with its menu label (S2). */
.hf-chip {
  display: inline-block;
  margin: 0 1px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--pgw-draft-pill);
  border: 1px solid var(--pgw-draft-brand);
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  color: var(--pgw-draft-brand-ink);
  -webkit-user-select: all;
          user-select: all;
  white-space: nowrap;
  vertical-align: baseline;
}

/* --- The page preview --- */

.hf-preview {
  display: flex;
  flex-direction: column;
  min-height: 132px;
  border-radius: 8px;
  background: var(--rt-card);
  border: 1px solid var(--rt-hair);
  box-shadow: var(--rt-shadow-rest);
  font-family: var(--pgw-font-title, serif);
  font-size: 11px;
  line-height: 16px;
  color: var(--rt-ink);
}

.hf-pv-header,
.hf-pv-footer {
  display: flex;
  min-height: 26px;
  padding: 8px 12px 4px;
}

.hf-pv-header {
  border-bottom: 1px dashed var(--rt-hair);
}

.hf-pv-footer {
  border-top: 1px dashed var(--rt-hair);
  margin-top: auto;
}

.hf-pv-cell {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* S3: one used slot takes the full width; Left and Right alone are halves; else three equal cells. */
.hf-pv-cells-1 .hf-pv-cell {
  width: 100%;
}

.hf-pv-cells-2 .hf-pv-cell {
  width: 50%;
}

.hf-pv-cells-3 .hf-pv-cell {
  width: 33.333%;
}

.hf-pv-left {
  text-align: left;
}

.hf-pv-center {
  text-align: center;
}

.hf-pv-right {
  text-align: right;
}

.hf-pv-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
}

.hf-pv-body i {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--rt-hair2);
}

.hf-pv-body i:nth-child(even) {
  width: 88%;
}

/* --- First Page, This Document --- */

.rt-rb-cell.rt-off {
  opacity: 0.45;
  cursor: default;
}

.hf-values {
  display: grid;
  grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.hf-values .rt-rb-name {
  min-width: 0;
}

.hf-value-label {
  font-size: 13px;
  color: var(--rt-ink3);
}

/* --- Footer buttons beside the primary --- */

.hf-foot-quiet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 17px;
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--rt-ink2);
  white-space: nowrap;
}

.hf-foot-quiet:hover {
  background: var(--rt-row-hover);
  color: var(--rt-ink);
}

.hf-foot-quiet:focus-visible {
  outline: none;
  border-color: var(--rt-brand);
}

.hf-foot-quiet.hf-foot-boxed {
  border-color: var(--rt-hair);
  background: var(--rt-card);
}

.hf-foot-quiet:disabled {
  opacity: 0.45;
  cursor: default;
}

.rt-scr-foot .hf-foot-spacer {
  flex: 1 1 auto;
}

/* The pane is often narrower than the three buttons: wrap instead of pushing Open Design off the left edge. */
.hf-drill .rt-scr-foot {
  flex-wrap: wrap;
  height: auto;
  min-height: 56px;
  padding-block: 8px;
  row-gap: 6px;
}

/* --- Open Design --- */

.hf-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--rt-card);
  border: 1px solid var(--rt-hair);
  box-shadow: var(--rt-shadow-rest);
  text-align: left;
}

.hf-card.hf-card-on {
  background: var(--rt-soft);
  border-color: var(--rt-brand);
}

.hf-card-pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0 8px;
  text-align: left;
  cursor: pointer;
}

.hf-card-pick:focus-visible {
  outline: none;
}

.hf-card:has(.hf-card-pick:focus-visible) {
  border-color: var(--rt-brand);
}

.hf-card-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: var(--rt-ink);
}

.hf-card-meta {
  grid-column: 1 / -1;
  font-size: 11.5px;
  line-height: 16px;
  color: var(--rt-ink4);
}

.hf-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.hf-card-actions .hf-card-gap {
  flex: 1 1 auto;
}

.hf-star-on svg {
  color: var(--rt-brand);
}

.hf-save-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Styling for ValidationSwalManager's legacy HTML dialogs rendered via showLegacyHtmlDialog(). */

.js-fix-cross-figure-modal .js-confirm-dialog-title,
.js-ignore-warning-modal .js-confirm-dialog-title,
.js-ignored-warnings-modal .js-confirm-dialog-title {
  display: none;
}

.js-fix-cross-figure-container,
.js-ignore-warning-container,
.js-ignored-warnings-container {
  text-align: left;
}

.js-confirm-dialog-message {
  font-size: 13px;
  color: var(--pgw-drawings-validation-ink);
  line-height: 1.4;
}

.info-text {
  margin-top: 8px;
  font-size: 12px;
  color: var(--pgw-drawings-validation-ink-muted);
  line-height: 1.4;
}

/* Fix Cross-Figure dialog */
.js-fix-cross-figure-modal .description-options {
  margin: 16px 0;
  border: 1px solid var(--pgw-drawings-validation-rule-soft);
  border-radius: 6px;
  background: var(--colorNeutralBackground1);
}

.js-fix-cross-figure-modal .description-option {
  display: flex;
  align-items: flex-start;
  padding: 12px;
  border-bottom: 1px solid var(--pgw-drawings-validation-rule-soft);
  transition: background-color 0.15s ease;
}

.js-fix-cross-figure-modal .description-option:last-child {
  border-bottom: none;
}

.js-fix-cross-figure-modal .description-option:hover {
  background-color: var(--pgw-drawings-validation-accent-wash);
}

.js-fix-cross-figure-modal .description-option input[type="radio"] {
  margin: 4px 10px 0 0;
  flex-shrink: 0;
}

.js-fix-cross-figure-modal .description-label {
  flex: 1;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.js-fix-cross-figure-modal .description-text {
  font-weight: 600;
  color: var(--pgw-drawings-validation-ink);
  line-height: 1.4;
}

.js-fix-cross-figure-modal .description-meta {
  font-size: 12px;
  color: var(--pgw-drawings-validation-ink-muted);
  line-height: 1.3;
}

/* Ignore Warning dialog */
.js-ignore-warning-modal .warning-details {
  margin: 16px 0;
  padding: 12px;
  background: var(--pgw-drawings-validation-warn-tint);
  border: 1px solid var(--pgw-drawings-validation-warn);
  border-radius: 6px;
}

.js-ignore-warning-modal .warning-message {
  font-weight: 600;
  color: var(--pgw-drawings-validation-ink);
  margin-bottom: 8px;
  line-height: 1.4;
}

.js-ignore-warning-modal .warning-figures {
  font-size: 12px;
  color: var(--pgw-drawings-validation-ink-muted);
  line-height: 1.3;
}

/* Ignored Warnings dialog */
.js-ignored-warnings-modal .js-ignored-warnings-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.js-ignored-warnings-modal .ignored-warnings-list {
  overflow-y: auto;
  margin: 16px 0 8px;
  border: 1px solid var(--pgw-drawings-validation-rule-soft);
  border-radius: 6px;
  background: var(--colorNeutralBackground1);
  max-height: 50vh;
}

.js-ignored-warnings-modal .ignored-warning-item {
  display: flex;
  align-items: flex-start;
  padding: 12px;
  border-bottom: 1px solid var(--pgw-drawings-validation-rule-soft);
  transition: background-color 0.15s ease;
}

.js-ignored-warnings-modal .ignored-warning-item:last-child {
  border-bottom: none;
}

.js-ignored-warnings-modal .ignored-warning-item:hover {
  background-color: var(--pgw-drawings-validation-accent-wash);
}

.js-ignored-warnings-modal .ignored-warning-item input[type="checkbox"] {
  margin: 4px 10px 0 0;
  flex-shrink: 0;
}

.js-ignored-warnings-modal .warning-item-label {
  flex: 1;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.js-ignored-warnings-modal .warning-item-message {
  font-weight: 600;
  color: var(--pgw-drawings-validation-ink);
  line-height: 1.4;
}

.js-ignored-warnings-modal .warning-item-meta {
  font-size: 12px;
  color: var(--pgw-drawings-validation-ink-muted);
  line-height: 1.3;
}

.js-ignored-warnings-modal .ignored-warnings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--pgw-drawings-validation-rule-soft);
}

.js-ignored-warnings-modal .select-all-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--pgw-drawings-validation-outline);
  background: transparent;
  color: var(--pgw-drawings-validation-outline);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.js-ignored-warnings-modal .select-all-btn:hover {
  background-color: var(--pgw-drawings-validation-accent-wash);
  border-color: var(--pgw-drawings-validation-outline-hover);
  color: var(--pgw-drawings-validation-ink);
}


/* Guided Tour overlay — ported from Universe (web/frontend GuidedTour.css).
   Universe relies on a --jr-* design-token system that junior does not have, so
   the colours are `--pgw-tour-*` tokens (theme/colourSets/tour.js): Classic keeps
   the gold accent palette, the other themes follow the paper (pgw#5117). */

.is-tour-target {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--pgw-tour-ring) 85%, transparent), 0 0 0 7px color-mix(in srgb, var(--pgw-tour-ring) 20%, transparent);
  border-radius: 8px;
}

.guided-tour {
  position: fixed;
  inset: 0;
  /* Above the Fluent provider's portal layer (z-index 1000000), where every dialog and menu opens:
     the tour walks through dialogs (Load Library, Save as Skill) and its card must stay on top. */
  z-index: 1000001;
  /* The overlay mounts on the page body, outside the Fluent provider that sets the UI font. */
  font-family: var(--pgw-font-ui);
  pointer-events: none;
}

.guided-tour__spotlight {
  position: absolute;
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.45);
  border: 2px solid color-mix(in srgb, var(--pgw-tour-ring) 90%, transparent);
  /* The overlay sets the ring's outer box (target + pad); the border is drawn inside it, or the
     ring would overshoot the target by 4 px at the right and bottom. */
  box-sizing: border-box;
  /* Animate only the dim/border, NOT position/size. Transitioning geometry made the
     spotlight visibly chase its target on busy screens (and lag a step behind). */
  transition: box-shadow 0.22s ease, border-color 0.22s ease;
}

.guided-tour__spotlight--hidden {
  display: none;
}

/* Hugs an inline control (e.g. a button) so the spotlight gets a correct rect
   without an inline style attribute. */
.guided-tour-inline-anchor {
  display: inline-flex;
}

.guided-tour__card {
  position: absolute;
  width: min(340px, calc(100vw - 24px));
  background: var(--pgw-tour-card-bg);
  border: 1px solid var(--pgw-tour-card-rule);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.28);
  padding: 0.8rem;
  display: grid;
  gap: 0.45rem;
  pointer-events: auto;
  box-sizing: border-box;
}

.guided-tour__card::after {
  content: "";
  position: absolute;
  /* Set by the overlay to the target's centre on the card; the centre until it is placed. */
  left: var(--guided-tour-arrow-x, 50%);
  width: 12px;
  height: 12px;
  background: var(--pgw-tour-card-bg);
  border-left: 1px solid var(--pgw-tour-card-rule);
  border-top: 1px solid var(--pgw-tour-card-rule);
  transform: translateX(-50%) rotate(45deg);
}

.guided-tour__card.is-bottom::after {
  top: -7px;
}

.guided-tour__card.is-top::after {
  bottom: -7px;
  transform: translateX(-50%) rotate(225deg);
}

.guided-tour__step {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pgw-tour-step);
  font-weight: 700;
  /* One line, as the boards draw it: a long chapter name ends in "…" (Ch10, Pane320). */
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.guided-tour__title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--pgw-tour-title);
}

.guided-tour__desc {
  font-size: 0.84rem;
  margin: 0;
  color: var(--pgw-tour-desc);
  line-height: 1.35;
}

.guided-tour__blocked {
  margin: 0;
  font-size: 0.8rem;
  color: var(--pgw-tour-blocked);
}

.guided-tour__optout {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--pgw-tour-desc);
  cursor: pointer;
}

.guided-tour__optout input {
  margin: 0;
  cursor: pointer;
}

.guided-tour__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.guided-tour__btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.32rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.guided-tour__btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.guided-tour__btn--ghost {
  background: var(--pgw-tour-ghost-bg);
  color: var(--pgw-tour-desc);
  border-color: var(--pgw-tour-ghost-rule);
}

.guided-tour__btn--ghost:not(:disabled):hover {
  background: color-mix(in srgb, var(--pgw-tour-ghost-hover) 6%, transparent);
}

.guided-tour__btn--primary {
  background: var(--pgw-tour-primary);
  color: var(--pgw-tour-on-primary);
  border-color: var(--pgw-tour-primary);
}

.guided-tour__btn--primary:not(:disabled):hover {
  background: var(--pgw-tour-primary-hover);
  border-color: var(--pgw-tour-primary-hover);
}

/* Card head: eyebrow left, chapter button and ✕ right (pgw#5419). */
.guided-tour__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.guided-tour__head-end {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.guided-tour__chapter-btn {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  color: var(--pgw-tour-desc);
  background: var(--pgw-tour-ghost-bg);
  border: 1px solid var(--pgw-tour-card-rule);
}

.guided-tour__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--pgw-tour-desc);
  cursor: pointer;
}

.guided-tour__chapter-btn:focus-visible,
.guided-tour__close:focus-visible,
.guided-tour__link:focus-visible,
.guided-tour__info:focus-visible,
.guided-tour__row-main:focus-visible {
  outline: 2px solid var(--pgw-tour-primary);
  outline-offset: 1px;
}

.guided-tour__title:focus,
.guided-tour__oneline:focus {
  outline: none;
}

.guided-tour__title--with-info {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.guided-tour__info {
  display: inline-flex;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--pgw-tour-desc);
  cursor: pointer;
}

.guided-tour__oneline {
  font-size: 0.84rem;
}

/* A card with no target: centred in the pane, nothing dimmed. */
.guided-tour__card.is-centred {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* The Welcome card with its chapter list open must fit a short window. */
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}

.guided-tour__card.is-centred::after,
.guided-tour__card.is-free::after {
  display: none;
}

.guided-tour__btn--secondary {
  background: var(--pgw-tour-card-bg);
  color: var(--pgw-tour-title);
  border-color: var(--pgw-tour-card-rule);
}

.guided-tour__link {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--pgw-tour-step);
  text-decoration: underline;
  cursor: pointer;
}

.guided-tour__finish-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

.guided-tour__finish-link {
  margin-right: auto;
}

.guided-tour__loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@keyframes guided-tour-spin {
  to {
    transform: rotate(360deg);
  }
}

.guided-tour__spinner {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  border: 2px solid var(--pgw-tour-card-rule);
  border-top-color: var(--pgw-tour-primary);
}

@media (prefers-reduced-motion: no-preference) {
  .guided-tour__spinner {
    animation: guided-tour-spin 0.8s linear infinite;
  }
}

/* Chapter list: a 280px popover under the chapter button, or inline in a centred card. */
.guided-tour__list {
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  display: grid;
  gap: 0.1rem;
  max-height: 60vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.guided-tour__list--popover {
  position: absolute;
  top: 2.4rem;
  right: 0;
  width: min(280px, calc(100vw - 24px));
  box-sizing: border-box;
  z-index: 1;
  background: var(--pgw-tour-card-bg);
  border: 1px solid var(--pgw-tour-card-rule);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.28);
}

.guided-tour__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 6px;
}

.guided-tour__row.is-current {
  background: color-mix(in srgb, var(--pgw-tour-ring) 12%, transparent);
}

.guided-tour__row-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  font: inherit;
  font-size: 0.84rem;
  text-align: left;
  padding: 0.3rem 0.4rem;
  border: none;
  background: transparent;
  color: var(--pgw-tour-title);
  cursor: pointer;
}

.guided-tour__row-main:disabled {
  color: var(--pgw-tour-desc);
  cursor: default;
}

.guided-tour__row-number {
  width: 1.3rem;
  font-size: 0.72rem;
  color: var(--pgw-tour-desc);
}

.guided-tour__row-note {
  font-size: 0.72rem;
  color: var(--pgw-tour-desc);
}

.guided-tour__row-load {
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
}

.guided-tour__row-state {
  width: 1.3rem;
  text-align: center;
  color: var(--pgw-tour-done);
}

.guided-tour__row-dot::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--pgw-tour-primary);
}

/* Launcher icon */
.guided-tour-trigger {
  position: relative;
  z-index: 11;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--pgw-tour-trigger-hi) 92%, transparent), color-mix(in srgb, var(--pgw-tour-trigger-lo) 80%, transparent)),
    color-mix(in srgb, var(--pgw-tour-trigger-tint) 4%, transparent);
  color: var(--pgw-tour-trigger-ink);
  border: 1px solid color-mix(in srgb, var(--pgw-tour-trigger-tint) 28%, transparent);
  flex-shrink: 0;
}

.guided-tour-trigger:hover {
  background: linear-gradient(180deg, color-mix(in srgb, var(--pgw-tour-trigger-hi) 98%, transparent), color-mix(in srgb, var(--pgw-tour-trigger-lo-hover) 84%, transparent)),
    color-mix(in srgb, var(--pgw-tour-trigger-tint) 8%, transparent);
  border-color: color-mix(in srgb, var(--pgw-tour-trigger-tint) 42%, transparent);
}

.guided-tour-trigger:focus-visible {
  outline: 2px solid var(--pgw-tour-primary);
  outline-offset: 1px;
}

.guided-tour-trigger__icon {
  width: 1.05rem;
  height: 1.05rem;
  filter: drop-shadow(0 1px 2px rgba(2, 6, 23, 0.16));
}

/* pgw#5118 S7 (MAPPING §1): on the Noetpad binder strip the launcher is a
   22 × 24 ghost icon with the 13px flag glyph. Classic keeps the tile above. */
:root[data-pgw-theme]:not([data-pgw-theme="classic"]) [data-pane-tab-bar] .guided-tour-trigger {
  width: 22px;
  min-width: 22px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--pgw-ink-muted);
}

:root[data-pgw-theme]:not([data-pgw-theme="classic"]) [data-pane-tab-bar] .guided-tour-trigger:hover {
  background: var(--pgw-paper-hover);
  border: none;
}

:root[data-pgw-theme]:not([data-pgw-theme="classic"]) [data-pane-tab-bar] .guided-tour-trigger__icon {
  width: 13px;
  height: 13px;
  filter: none;
}

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

/* First-time prominence (#2504): a small "new" badge dot + a gentle pulse ring.
   The badge is the always-on signal; the pulse only runs when motion is allowed. */
.guided-tour-trigger__badge {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pgw-tour-primary);
  box-shadow: 0 0 0 1.5px var(--pgw-tour-badge-ring);
  pointer-events: none;
}

@keyframes guided-tour-trigger-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--pgw-tour-pulse) 45%, transparent);
  }
  70% {
    box-shadow: 0 0 0 6px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* Pulse animates box-shadow only (never size/transform) so it can't change the
   flex item's box and re-trigger tab overflow. Off when the user prefers reduced
   motion — the badge dot still conveys "new". */
@media (prefers-reduced-motion: no-preference) {
  .guided-tour-trigger--prompt {
    animation: guided-tour-trigger-pulse 2.2s ease-out infinite;
  }
}

.guided-tour-trigger::before,
.guided-tour-trigger::after {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 2;
}

/* Tooltip renders BELOW the icon: the launcher sits at the very top of the task
   pane (sticky top:0), so an above-anchored bubble would be clipped above the fold.
   The launcher also sits at the pane's right edge, so the bubble is right-anchored
   (extends leftward) to avoid spilling past the viewport; the arrow stays centered
   under the icon. */
.guided-tour-trigger::before {
  content: "";
  top: calc(100% + 0.15rem);
  left: 50%;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid color-mix(in srgb, var(--pgw-tour-tip) 96%, transparent);
  transform: translate(-50%, -4px);
}

.guided-tour-trigger::after {
  content: attr(data-tooltip);
  top: calc(100% + 0.55rem);
  right: 0;
  transform: translateY(-4px);
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pgw-tour-tip) 96%, transparent);
  color: var(--pgw-tour-tip-ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.28);
}

.guided-tour-trigger:hover::before,
.guided-tour-trigger:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

.guided-tour-trigger:hover::after,
.guided-tour-trigger:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

/* Permission card (pgw#5419 1.1): the two buttons wrap onto their own rows, each label on one line. */
.guided-tour__actions--permission {
  flex-wrap: wrap;
}

.guided-tour__actions--permission .guided-tour__btn {
  white-space: nowrap;
}

.error-modal-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--pgw-css-error-scrim);
}

.error-modal-header {
  background-color: var(--pgw-css-error-header);
  color: var(--pgw-css-error-header-text);
  padding: 10px;
}

.error-modal-body {
  padding: 20px;
}

.error-modal-footer {
  padding: 10px;
  text-align: right;
}

.button-container {
  display: flex;
  justify-content: left;
  margin-bottom: 20px;
}

/* Clear default button styles */
.clear-button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

/* Update in junior/src/taskpane/components/global.css */

.section-title {
  font-size: 1em;
  font-weight: bold;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  height: 28px;
  margin-top: 5px;
  text-transform: uppercase;
}

.section-dropdown-container {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}

.section-dropdown {
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: auto;
  min-width: 200px;
  width: 100%;
}

.spinner-container {
  width: 30px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

button.swal2-confirm.swal2-styled {
  background-color: var(--pgw-css-swal-confirm);
  border-color: var(--pgw-css-swal-confirm);
}
div:where(.swal2-container) h2:where(.swal2-title) {
  font-size: 1.375em;
}

/* Custom beat loader */
.beat-loader {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--pgw-css-beat);
  box-shadow: 16px 0 var(--pgw-css-beat), -16px 0 var(--pgw-css-beat);
  position: relative;
  animation: flash 0.5s ease-out infinite alternate;
}

@keyframes flash {
  0% {
    background-color: var(--pgw-css-beat-faint);
    box-shadow: 16px 0 var(--pgw-css-beat-faint), -16px 0 var(--pgw-css-beat);
  }
  50% {
    background-color: var(--pgw-css-beat);
    box-shadow: 16px 0 var(--pgw-css-beat-faint), -16px 0 var(--pgw-css-beat-faint);
  }
  100% {
    background-color: var(--pgw-css-beat-faint);
    box-shadow: 16px 0 var(--pgw-css-beat), -16px 0 var(--pgw-css-beat-faint);
  }
}

/* Debug Control */
.debug-container {
  text-align: left;
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
}
.debug-item {
  margin: 5px 0;
  display: flex;
  align-items: flex-start;
}
.debug-key {
  font-weight: bold;
  margin-right: 10px;
  min-width: 150px;
}
.debug-preview {
  position: relative;
  display: inline-block;
}
.debug-hover {
  color: var(--pgw-css-debug-link);
  text-decoration: underline;
  cursor: help;
}
.debug-hover:hover::after {
  content: attr(title);
  position: absolute;
  left: 0;
  top: 100%;
  background: var(--pgw-css-debug-surface);
  border: 1px solid var(--pgw-css-debug-rule);
  padding: 5px;
  max-width: 300px;
  word-wrap: break-word;
  z-index: 1000;
  white-space: pre-wrap;
}
.debug-template-info {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pgw-css-debug-rule);
}
.debug-template-name {
  font-size: 1.1em;
  color: var(--pgw-css-debug-title);
}
.no-cache {
  color: var(--pgw-css-debug-alert);
  font-weight: bold;
}

/* Utility: visually hidden/offscreen element for non-intrusive DOM operations */
.u-offscreen {
  position: fixed !important;
  top: -9999px !important;
  left: -9999px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Refresh button spin animation */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.refresh-spinning {
  animation: spin 1s linear infinite;
}

/*
 * The Noetpad shell of every Fluent v9 dialog, menu and toast (pgw#5117 Phase A,
 * MAPPING-SPEC §1b B5/B6 and §9; frames 26, 28, 30).
 *
 * One rule set for every tab: it styles the Fluent parts by their stable
 * `fui-*` class names, so a dialog, menu or toast in any tab takes the same
 * shell without its own className. Colours come from the Fluent theme
 * (`colorNeutralBackground1` = the paper card) and the paper tokens.
 *
 * Scope: the Noetpad themes only. Classic (today's look) does not match
 * `:not([data-pgw-theme="classic"])`, so Classic keeps Fluent's own shell.
 * `PgwThemeProvider` imports this sheet; `applyPaperTheme` writes
 * `data-pgw-theme` on <html>. The two shadows are sheet-local (`--noetpad-*`),
 * not paper tokens: Classic has no value for them.
 */

:root[data-pgw-theme]:not([data-pgw-theme="classic"]) {
  --noetpad-shadow-dialog: 0 24px 50px -16px rgba(42, 36, 25, 0.5);
  --noetpad-shadow-menu: 0 14px 34px rgba(42, 36, 25, 0.2);
  /* `auto` is not the text colour on a Mac: WebKit (Safari 17+, Word for Mac,
     macOS Sonoma) paints an `auto` caret and native checkbox / radio / range in
     the system accent colour, blue by default (pgw#5394). Name both. Inherited,
     so every input, textarea and contenteditable in the theme takes them. */
  caret-color: var(--pgw-ink);
  accent-color: var(--pgw-gold);
}

/* The browser's own focus ring (`outline: auto`) is blue, and on a Mac the
   system accent (pgw#5394). `:where()` keeps this at one class of specificity,
   so a component's own focus style still wins. */
:where(:root[data-pgw-theme]:not([data-pgw-theme="classic"])) :focus-visible {
  outline-color: var(--pgw-gold);
}

:root[data-pgw-theme="dark"] {
  /* The handoff shadows are ink-brown on light paper; on the dark paper the
     same alpha of black reads as the same lift. */
  --noetpad-shadow-dialog: 0 24px 50px -16px rgba(0, 0, 0, 0.7);
  --noetpad-shadow-menu: 0 14px 34px rgba(0, 0, 0, 0.45);
}

/* Dialogs: paper, 12px radius, card rule, Domine 17px title. */
:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .fui-DialogSurface {
  border: 1px solid var(--pgw-rule-card);
  border-radius: 12px;
  box-shadow: var(--noetpad-shadow-dialog);
}

:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .fui-DialogTitle {
  font-family: var(--pgw-font-title);
  font-size: 17px;
  line-height: 24px;
  color: var(--pgw-ink);
}

/* Menus: paper card, 10px radius, 6px inset, 30px rows. */
:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .fui-MenuPopover {
  background-color: var(--pgw-paper-card);
  border: 1px solid var(--pgw-rule-card);
  border-radius: 10px;
  padding: 6px;
  box-shadow: var(--noetpad-shadow-menu);
}

:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .fui-MenuItem,
:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .fui-MenuItemCheckbox,
:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .fui-MenuItemRadio {
  min-height: 30px;
  border-radius: 6px;
}

:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .fui-MenuDivider {
  background-color: var(--pgw-rule-row);
}

/* Toasts: a paper card with a 1px rule; the intent icon reads as the dot. */
:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .fui-Toast {
  background-color: var(--pgw-paper-card);
  border: 1px solid var(--pgw-rule-card);
  border-radius: 10px;
  box-shadow: var(--noetpad-shadow-menu);
  color: var(--pgw-ink);
}

:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .fui-ToastBody {
  color: var(--pgw-ink-muted);
}

/* The outline button (`JuniorButton` default, e.g. SSO Login, Remove those
   files, Not now): paper card, 1px card rule, ink label (frames 26-28). */
:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .pgw-outline-button {
  background-color: var(--pgw-paper-card);
  border: 1px solid var(--pgw-rule-card);
  border-radius: 8px;
  color: var(--pgw-ink);
}

:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .pgw-outline-button:hover:enabled {
  background-color: var(--pgw-paper-hover);
  border-color: var(--pgw-rule-field);
  color: var(--pgw-ink);
}

:root[data-pgw-theme]:not([data-pgw-theme="classic"]) .pgw-outline-button:disabled {
  border-color: var(--pgw-rule-row);
}

