/* Refined shell — theme tokens + sidebar/toolbar layout.
   Only active under html[data-shell="refined"]; legacy app is completely unaffected. */

/* ---- Theme tokens (ported verbatim from redesign/styles.css .ah-light/.ah-dark) ---- */
html[data-theme="light"] {
  --bg: #f4f6f6;
  --surface: #ffffff;
  --surface2: #f7f8f8;
  --border: #e5e7e8;
  --border2: #eef0f0;
  --text: #212224;
  --text2: #4d575d;
  /* Secondary text and links keep 4.5:1 on every light surface (V4 contrast rule). */
  --text3: #667075;
  --link: color-mix(in srgb, var(--brand-primary) 88%, #000);
  --accentSoft: #e9f4e9;
  --sidebar: #ffffff;
  --sidebarItem: #f1f3f3;
  --headBorder: #e5e7e8;
  --blue: #2f80ed;
  --blueSoft: #e8f0fc;
  --tan: #a9764f;
  --tanSoft: #f4ece4;
  --chip: #f1f3f3;
  --searchBg: #f7f8f8;
  --railBg: #f7f8f8;
}
html[data-theme="dark"] {
  --bg: #141517;
  --surface: #212224;
  --surface2: #1a1b1c;
  --border: #2f3335;
  --border2: #2c2f31;
  --text: #ffffff;
  --text2: #a7afb3;
  --text3: #8a9499;
  --link: var(--brand-primary-on-dark);
  --accentSoft: rgba(79, 194, 79, 0.14);
  --sidebar: #1d1f21;
  --sidebarItem: #26282a;
  --headBorder: #2c2f31;
  --blue: #5b9bf0;
  --blueSoft: rgba(91, 155, 240, 0.16);
  --tan: #c79b76;
  --tanSoft: rgba(186, 142, 107, 0.16);
  --chip: #1a1b1c;
  --searchBg: #212224;
  --railBg: #1a1b1c;
}

/* ---- Sidebar width variables ---- */
html[data-shell="refined"] {
  --rfd-sidebar-w: 264px;
  --rfd-toolbar-h: 74px;
  --rfd-rail-w: 340px;
  /* Bridge legacy app CSS tokens to refined tokens so existing pages adopt the refined palette */
  --bg-page: var(--bg);
  --bg-card: var(--surface);
  --bg-card-hover: var(--sidebarItem);
  --bg-input: var(--searchBg);
  --bg-input-focus: var(--searchBg);
  --text-primary: var(--text);
  --text-secondary: var(--text2);
  --text-muted: var(--text3);
  --border-light: var(--border);
  --border-medium: var(--border2);
  --font-display: Inter, system-ui, sans-serif;
  /* --accent aliases --link so rfd-chip/rfd-cta colors resolve correctly */
  --accent: var(--link);
  --color-accent: var(--link);
}
html[data-shell="refined"][data-refined-collapsed] {
  --rfd-sidebar-w: 82px;
}

/* ---- Activate sidebar + toolbar only under the flag ---- */
html[data-shell="refined"] [data-refined-sidebar],
html[data-shell="refined"] [data-refined-toolbar] {
  display: flex;
}

/* ---- Hide the legacy chrome in refined mode ---- */
html[data-shell="refined"] .hub-header {
  display: none !important;
}

/* ---- App layout: sidebar | (toolbar + main) ---- */
html[data-shell="refined"] body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: grid;
  grid-template-columns: var(--rfd-sidebar-w) minmax(0, 1fr);
  grid-template-rows: 1fr;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 0.18s ease;
}

html[data-shell="refined"] .rfd-sidebar {
  grid-column: 1;
  grid-row: 1;
}

html[data-shell="refined"] .rfd-toolbar,
html[data-shell="refined"] .hub-header ~ * {
  grid-column: 2;
}

html[data-shell="refined"] #main-content {
  grid-column: 2;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Wrap toolbar + main together in the right column */
html[data-shell="refined"] body > .rfd-toolbar ~ .hub-header {
  display: none !important;
}

/* ---- Hub-page refined overrides: padding + typography closer to design ---- */
html[data-shell="refined"] #main-content {
  background: var(--bg);
}

html[data-shell="refined"] main {
  background: var(--bg);
  max-width: none;
  margin: 0;
  /* Reset legacy padding (hub-page.is-active provides its own padding) */
  padding: 0 !important;
}

html[data-shell="refined"] .hub-page.is-active {
  padding: 44px 48px;
  gap: 0;
}

html[data-shell="refined"] .hub-page__title {
  font-size: clamp(32px, 3.2vw, 42px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}

html[data-shell="refined"] .hub-page__subtitle {
  font-size: 17px;
  color: var(--text2);
  line-height: 1.55;
  max-width: 72ch;
  margin: 8px 0 28px;
}

/* ---- Embeddable shell: content-first chrome suppression ---- */
body[data-embed] .skip-link,
body[data-embed] .hub-header,
body[data-embed] [data-refined-sidebar],
body[data-embed] [data-refined-toolbar],
body[data-embed] [data-refined-rail] {
  display: none !important;
}

html[data-shell="refined"] body[data-embed] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

html[data-shell="refined"] body[data-embed] #main-content {
  grid-column: 1;
  grid-row: 1;
  padding-top: 24px !important;
  padding-right: 0 !important;
}

body[data-embed] .rfd-embed-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 14px 20px 20px;
  font-size: 0.86rem;
}

.rfd-embed-footer__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
}

.rfd-embed-footer__link::after {
  content: "\2197";
}

.rfd-embed-footer__link:hover {
  color: var(--brand-text);
}

.rfd-embed-footer__link:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 3px;
}

/* ---- Right rail panel ---- */
.rfd-rail {
  position: fixed;
  right: 0;
  top: var(--rfd-toolbar-h, 74px);
  bottom: 0;
  width: var(--rfd-rail-w, 340px);
  overflow-y: auto;
  background: var(--railBg, #f7f8f8);
  border-left: 1px solid var(--border2);
  border-radius: 0;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  z-index: 40;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  box-sizing: border-box;
}

html[data-shell="refined"] .rfd-rail {
  display: flex;
}

html[data-shell="refined"][data-refined-rail-open] .rfd-rail {
  transform: translateX(0);
}

/* Shrink main content when rail is open to avoid overlap */
html[data-shell="refined"][data-refined-rail-open] #main-content {
  padding-right: calc(var(--rfd-rail-w, 340px) + 8px);
}

.rfd-rail__heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin: 0 0 14px;
  text-transform: uppercase;
}

.rfd-rail__section {
  display: flex;
  flex-direction: column;
}

.rfd-rail__item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rfd-rail__item-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.rfd-rail__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  transition: background 0.1s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font: inherit;
}

.rfd-rail__item:hover {
  background: var(--surface2, rgba(0,0,0,.05));
}

.rfd-rail__item-badge {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface2, rgba(0,0,0,.06));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  flex-shrink: 0;
}

.rfd-rail__item-badge svg {
  width: 16px;
  height: 16px;
}

.rfd-rail__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font: inherit;
  font-size: 18px;
  line-height: 1;
}

.rfd-rail__remove:hover {
  background: var(--surface2, rgba(0,0,0,.05));
  color: var(--text);
}

.rfd-rail__remove:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 1px;
}

.rfd-rail__item-meta {
  flex: 1;
  min-width: 0;
}

.rfd-rail__item-title {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.rfd-rail__item-type {
  font-size: 11px;
  color: var(--text3);
  display: block;
  margin-top: 1px;
}

/* Loading skeletons */
.rfd-rail__item--skeleton {
  cursor: default;
  pointer-events: none;
}

.rfd-rail__item--skeleton .rfd-rail__item-badge {
  animation: rfd-shimmer 1.5s ease-in-out infinite;
}

.rfd-rail__item--skeleton .rfd-rail__item-title,
.rfd-rail__item--skeleton .rfd-rail__item-type {
  background: var(--surface2, rgba(0,0,0,.06));
  border-radius: 4px;
  color: transparent;
  animation: rfd-shimmer 1.5s ease-in-out infinite;
  width: 75%;
}

.rfd-rail__item--skeleton .rfd-rail__item-type { width: 40%; margin-top: 4px; }

@keyframes rfd-shimmer {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1;   }
}

/* New-item indicator dot */
.rfd-rail__item-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 6px;
}

/* Status pills for My Submissions */
.rfd-rail__status {
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.rfd-rail__status--pending  { background: #fef3c7; color: #92400e; }
.rfd-rail__status--approved { background: #d1fae5; color: #065f46; }
.rfd-rail__status--rejected { background: #fee2e2; color: #991b1b; }

.rfd-rail__empty {
  margin: 0;
  list-style: none;
  font-size: 13px;
  color: var(--text3);
}

/* ---- Search hidden (client-side filter) ---- */
.rfd-search-hidden {
  display: none !important;
}

/* ---- Search input inside toolbar search container ---- */
.rfd-search input[type="search"] {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  flex: 1;
  min-width: 0;
  padding: 0;
  /* The full V4 placeholder ends in an ellipsis where the bar is narrower (about 1024px). */
  text-overflow: ellipsis;
  /* Hide native clear button in webkit */
  -webkit-appearance: none;
}

.rfd-search input[type="search"]::placeholder {
  color: var(--text3);
}

.rfd-search input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

/* ---- Sidebar component ---- */
.rfd-sidebar {
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid var(--border2);
  padding: 26px 16px;
  flex-shrink: 0;
  width: var(--rfd-sidebar-w, 264px);
  height: 100vh;
  overflow: clip; /* clips visual overflow without creating scroll context; avoids clipping the collapse button */
  transition: width 0.18s ease;
  position: relative;
  z-index: 45;
  box-sizing: border-box;
}

/* ---- Brand row ---- */
.rfd-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 30px;
  gap: 10px;
}

.rfd-brand__home {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
}

.rfd-brand__home:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

.rfd-brand__mark {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.rfd-brand__name {
  flex: 1;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  color: var(--text);
  overflow: hidden;
}

/* ---- Nav ---- */
.rfd-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow: hidden;
}

.rfd-nav__divider {
  display: block;
  height: 1px;
  background: var(--border2);
  margin: 12px 13px;
}

.rfd-navlink {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 13px;
  border-radius: 9px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text2);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.rfd-navlink:hover {
  color: var(--text);
  background: var(--sidebarItem);
}

/* The neutral text colour also on focus, so hover and focus together stay readable: the generic a:hover green is
   only 2.49:1 on the dark hover background. */
.rfd-navlink:focus-visible {
  color: var(--text);
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

.rfd-navlink.is-active {
  font-weight: 600;
  color: var(--text);
  background: var(--sidebarItem);
}

.rfd-navlink__bar {
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--link);
  display: none;
}

.rfd-navlink.is-active .rfd-navlink__bar {
  display: block;
}

.rfd-navlink__icon {
  display: flex;
  flex-shrink: 0;
}

/* ---- Collapsed sidebar ---- */
html[data-shell="refined"][data-refined-collapsed] .rfd-label {
  display: none;
}

/* In collapsed mode hide the brand home link so only the toggle button remains;
   centre it so it doesn't overflow the narrow 82px column */
html[data-shell="refined"][data-refined-collapsed] .rfd-brand__home {
  display: none;
}
html[data-shell="refined"][data-refined-collapsed] .rfd-brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
html[data-shell="refined"][data-refined-collapsed] [data-refined-collapse] {
  /* ensure the toggle is fully visible and clickable in collapsed mode */
  position: relative;
  z-index: 50;
}

html[data-shell="refined"][data-refined-collapsed] .rfd-navlink {
  justify-content: center;
}

.rfd-navlink--admin {
  margin-top: 8px;
  color: var(--brand-text);
}
.rfd-navlink--admin .rfd-navlink__icon { color: inherit; }

html[data-shell="refined"][data-refined-collapsed] .rfd-userfoot {
  justify-content: center;
}

/* ---- User footer ---- */
.rfd-userfoot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--border2);
  position: relative;
}

.rfd-signin {
  background: var(--link);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

/* Account trigger (matches design handoff: green circle + name + org) */
.rfd-account {
  position: relative;
  min-width: 0;
  width: 100%;
}

.rfd-avatar-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  min-width: 0;
  width: 100%;
  padding: 8px;
  margin: -8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.rfd-avatar-chip:hover,
.rfd-avatar-chip[aria-expanded="true"] {
  background: var(--sidebarItem);
}

.rfd-avatar-chip:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

.rfd-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}

.rfd-avatar-info {
  flex: 1;
  line-height: 1.3;
  overflow: hidden;
}

.rfd-avatar-name {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rfd-avatar-org {
  display: block;
  font-size: 11.5px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rfd-account__chevron {
  margin-inline-start: auto;
  flex-shrink: 0;
  color: var(--text3);
  transition: transform 0.16s ease;
}

.rfd-avatar-chip[aria-expanded="true"] .rfd-account__chevron {
  transform: rotate(180deg);
}

.rfd-account-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 14px);
  z-index: 80;
  padding: 6px;
  border: 1px solid var(--border2);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.22);
}

.rfd-account-menu[hidden] {
  display: none;
}

.rfd-account-menu__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
}

.rfd-account-menu__item:hover,
.rfd-account-menu__item:focus-visible {
  background: var(--sidebarItem);
}

.rfd-account-menu__item:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: -1px;
}

.rfd-account-menu__item--danger {
  color: #b42318;
}

[data-theme="dark"] .rfd-account-menu__item--danger {
  color: #ff8a80;
}

.rfd-account-menu__divider {
  height: 1px;
  margin: 5px 7px;
  background: var(--border2);
}

html[data-shell="refined"][data-refined-collapsed] .rfd-account {
  width: auto;
}

html[data-shell="refined"][data-refined-collapsed] .rfd-avatar-chip {
  justify-content: center;
  width: 52px;
}

html[data-shell="refined"][data-refined-collapsed] .rfd-account-menu {
  position: fixed;
  left: 72px;
  right: auto;
  bottom: 24px;
  width: 220px;
}

/* ---- Icon button (collapse + burger) ---- */
.rfd-iconbtn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text3);
  background: var(--sidebarItem);
  border: none;
  flex-shrink: 0;
}

.rfd-iconbtn:hover {
  color: var(--text);
}

.rfd-iconbtn:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

/* ---- Toolbar ---- */
.rfd-toolbar {
  grid-column: 2;
  grid-row: 1;
  height: var(--rfd-toolbar-h, 74px);
  flex-shrink: 0;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  border-bottom: 1px solid var(--headBorder);
  background: var(--surface, #fff);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
}

/* Right column layout: toolbar stacked over main */
html[data-shell="refined"] body {
  grid-template-rows: var(--rfd-toolbar-h) 1fr;
  grid-template-columns: var(--rfd-sidebar-w) minmax(0, 1fr);
}

html[data-shell="refined"] .rfd-sidebar {
  grid-row: 1 / -1; /* span all rows */
}

html[data-shell="refined"] .rfd-toolbar {
  grid-column: 2;
  grid-row: 1;
}

html[data-shell="refined"] #main-content {
  grid-column: 2;
  grid-row: 2;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ---- Toolbar left/right groups ---- */
.rfd-toolbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 0;
  min-width: 0;
}

.rfd-toolbar__right {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
  max-width: 100%;
}

/* ---- Filters button ---- */
.rfd-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 15px;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.rfd-filters:hover {
  color: var(--text);
  background: var(--sidebarItem);
}

.rfd-filters:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

/* ---- Notification bell ---- */
.rfd-notifications {
  position: relative;
  flex-shrink: 0;
}

.rfd-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text3);
  transition: background 0.12s, color 0.12s;
}

.rfd-bell:hover {
  color: var(--text);
  background: var(--sidebarItem);
}

.rfd-bell:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

.rfd-bell__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--brand-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

.rfd-notification-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(380px, calc(100vw - 32px));
  max-height: min(620px, calc(100dvh - var(--rfd-toolbar-h, 74px) - 20px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  border: 1px solid var(--border2);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .2);
  color: var(--text);
  box-sizing: border-box;
  z-index: 60;
}

.rfd-notification-popover[hidden] {
  display: none;
}

.rfd-notification-popover__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.rfd-notification-popover__eyebrow,
.rfd-notification-popover__header h2,
.rfd-notification-popover__content h3,
.rfd-notification-popover__status {
  margin: 0;
}

.rfd-notification-popover__eyebrow {
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.rfd-notification-popover__header h2 {
  margin-top: 3px;
  font-size: 20px;
}

.rfd-notification-popover__header h2:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 3px;
}

.rfd-notification-popover__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font: inherit;
  font-size: 20px;
}

.rfd-notification-popover__close:hover {
  background: var(--sidebarItem);
  color: var(--text);
}

.rfd-notification-popover__close:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 1px;
}

.rfd-notification-popover__status {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text2);
  font-size: 13px;
}

.rfd-notification-popover__content {
  display: grid;
  gap: 20px;
}

.rfd-notification-popover__content h3 {
  margin-bottom: 8px;
  color: var(--text2);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.rfd-notification-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rfd-notification {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface2);
}

.rfd-notification[data-notification-state="unread"] {
  border-left: 4px solid var(--link);
  font-weight: 600;
}

.rfd-notification__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
}

.rfd-notification__icon svg {
  width: 17px;
  height: 17px;
}

.rfd-notification__copy,
.rfd-notification__meta,
.rfd-notification__state {
  display: block;
}

.rfd-notification__copy {
  min-width: 0;
  font-size: 13px;
}

.rfd-notification__meta {
  margin-top: 2px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 400;
}

.rfd-notification__state {
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
}

.rfd-notification-list .rfd-rail__empty {
  padding: 8px 0;
}

/* ---- Rail/side-panel toggle ---- */
.rfd-railbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text3);
  transition: background 0.12s, color 0.12s;
}

.rfd-railbtn:hover,
.rfd-railbtn.is-on {
  color: var(--text);
  background: var(--sidebarItem);
}

.rfd-railbtn:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}
.rfd-search {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--searchBg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 16px;
  width: 100%;
  max-width: 420px;
  min-width: 0;
  box-sizing: border-box;
  color: var(--text3);
  cursor: text;
  font-size: 14px;
}

.rfd-search kbd {
  margin-left: auto;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  font-family: inherit;
  background: transparent;
  color: var(--text3);
}

/* The "/" hint goes once the field is in use, and on touch layouts without a keyboard. */
.rfd-search:focus-within kbd,
.rfd-search input:not(:placeholder-shown) + kbd {
  display: none;
}

@media (max-width: 900px) {
  .rfd-search kbd {
    display: none;
  }
}

/* ---- Global toolbar search dropdown (default-on commandPaletteSearch) ---- */
.rfd-searchbox {
  position: relative;
  display: flex;
  min-width: 0;
  flex: 1 1 420px;
}

.rfd-searchresults {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 40;
  width: min(560px, calc(100vw - 32px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
  padding: 8px;
  box-sizing: border-box;
}

.rfd-searchresults[hidden] {
  display: none;
}

.rfd-searchresults__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 4px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.rfd-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  background: var(--surface);
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.rfd-chip:hover {
  color: var(--text);
  background: var(--sidebarItem);
}

.rfd-chip[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

.rfd-chip:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

.rfd-searchresults__status {
  margin: 0;
  padding: 8px 12px;
  color: var(--text3);
  font-size: 13px;
}

.rfd-searchresults__status[hidden] {
  display: none;
}

.rfd-searchresults__status--error {
  color: var(--brand-red, #c0392b);
}

.rfd-searchresults__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.rfd-searchresults__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}

.rfd-searchresults__item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rfd-searchresults__item-kind {
  color: var(--text3);
  font-size: 11px;
  text-transform: capitalize;
  white-space: nowrap;
}

.rfd-searchresults__item-context {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
  color: var(--text3);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rfd-searchresults__item-provenance {
  color: var(--text2);
  font-weight: 500;
}

.rfd-searchresults__item-context mark {
  border-radius: 2px;
  background: var(--chip);
  color: inherit;
  font-weight: 600;
}

.rfd-searchresults__item[aria-selected="true"] .rfd-searchresults__item-context mark,
.rfd-searchresults__item:hover .rfd-searchresults__item-context mark {
  background: var(--surface);
}

.rfd-searchresults__item[aria-selected="true"],
.rfd-searchresults__item:hover {
  background: var(--chip);
}

.rfd-searchresults__empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
  margin: 0;
}

.rfd-searchresults__empty[hidden] {
  display: none;
}

.rfd-searchresults__more {
  margin: 6px 4px 2px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.rfd-searchresults__more:hover {
  color: var(--text);
  background: var(--sidebarItem);
}

.rfd-searchresults__more[hidden] {
  display: none;
}

.rfd-searchresults__more:focus-visible,
.rfd-searchresults__item:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: -2px;
}

/* ---- Theme segmented toggle ---- */
.rfd-themeseg {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px;
  gap: 0;
}

.rfd-segbtn {
  width: 32px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 100px;
  cursor: pointer;
  color: var(--text3);
  background: transparent;
  border: none;
}

.rfd-segbtn:hover {
  color: var(--text);
}

.rfd-segbtn.is-on {
  color: var(--text);
  background: var(--sidebarItem);
}

.rfd-segbtn:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

/* Buttons and form controls use the page font (Inter), not the browser's own (Arial). :where keeps this at zero
   specificity, so any rule that names a font still wins. */
:where(html[data-shell="refined"]) :where(button, input, select, textarea) {
  font-family: inherit;
}

/* ---- Submit button ---- */
/* One line height, so Share is 40px tall as a button in the app and as a link in Admin. */
.rfd-submit {
  background: var(--brand-primary);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  line-height: 18px;
  padding: 11px 20px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.rfd-submit:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.rfd-submit__icon {
  flex: none;
}

/* Admin's Share is a link: the colour here keeps the shared link hover green (a:hover) off the green button. */
.rfd-submit:hover {
  background: var(--brand-primary-strong);
  color: #fff;
}

.rfd-submit:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

/* ---- Burger (mobile only) ---- */
.rfd-burger {
  display: none;
  background: transparent;
  border: none;
}

/* ---- Responsive: off-canvas sidebar at ≤900px ---- */
@media (min-width: 901px) and (max-width: 1440px) {
  html[data-shell="refined"] .rfd-toolbar {
    padding-inline: clamp(16px, 2vw, 28px);
    gap: 10px;
  }

  html[data-shell="refined"] .rfd-toolbar__left {
    gap: 8px;
  }

  html[data-shell="refined"] .rfd-toolbar__right {
    gap: clamp(8px, 1vw, 12px);
  }

  html[data-shell="refined"] .rfd-searchbox {
    flex-basis: 220px;
  }

  html[data-shell="refined"] .rfd-search {
    max-width: none;
  }

  html[data-shell="refined"] .rfd-submit {
    padding-inline: 14px;
  }
}

@media (max-width: 900px) {
  html[data-shell="refined"] body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--rfd-toolbar-h) 1fr;
  }

  html[data-shell="refined"] .rfd-sidebar {
    position: fixed !important;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 45;
    width: 264px !important;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.2);
    grid-row: auto;
  }

  html[data-shell="refined"] .rfd-sidebar.open {
    transform: translateX(0);
  }

  html[data-shell="refined"][data-refined-collapsed] .rfd-account {
    width: 100%;
  }

  html[data-shell="refined"][data-refined-collapsed] .rfd-avatar-chip {
    justify-content: flex-start;
    width: 100%;
  }

  html[data-shell="refined"][data-refined-collapsed] .rfd-account-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 14px);
    width: auto;
  }

  html[data-shell="refined"] .rfd-toolbar {
    grid-column: 1;
    grid-row: 1;
    padding: 0 16px;
  }

  html[data-shell="refined"] .rfd-notification-popover {
    position: fixed;
    top: calc(var(--rfd-toolbar-h, 74px) - 4px);
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100dvh - var(--rfd-toolbar-h, 74px) - 12px);
  }

  html[data-shell="refined"] #main-content {
    grid-column: 1;
    grid-row: 2;
  }

  .rfd-burger {
    display: flex;
  }

  .rfd-search {
    width: auto;
    max-width: none;
    flex: 1;
  }

  .rfd-searchresults {
    position: fixed;
    left: 16px;
    right: 16px;
    width: auto;
    top: calc(var(--rfd-toolbar-h) + 8px);
    max-height: calc(100dvh - var(--rfd-toolbar-h) - 24px);
    overscroll-behavior: contain;
  }

  .rfd-searchresults__item {
    padding: 7px 10px;
  }
}

/* At phone widths the search group and the route-aware primary action need
   separate rows. Letting both compete for the single 74px row collapses the
   left flex item while the search input still paints over the submit button,
   leaving a visible but unclickable CTA. */
@media (max-width: 640px) {
  html[data-shell="refined"] {
    --rfd-toolbar-h: 126px;
  }

  html[data-shell="refined"] .rfd-toolbar {
    height: var(--rfd-toolbar-h);
    flex-wrap: wrap;
    align-content: center;
    row-gap: 8px;
  }

  html[data-shell="refined"] .rfd-toolbar__left,
  html[data-shell="refined"] .rfd-toolbar__right {
    flex: 1 0 100%;
    width: 100%;
  }

  html[data-shell="refined"] .rfd-toolbar__left {
    gap: 8px;
  }

  html[data-shell="refined"] .rfd-toolbar__right {
    justify-content: flex-end;
    gap: 12px;
  }

  html[data-shell="refined"] .rfd-searchbox {
    flex: 1 1 auto;
    width: auto;
  }

  html[data-shell="refined"] .rfd-search {
    width: 100%;
    min-width: 0;
  }

  html[data-shell="refined"] .rfd-submit {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rfd-sidebar,
  html[data-shell="refined"] body {
    transition: none !important;
  }
}

.version-history-dialog {
  width: min(48rem, calc(100vw - 2rem));
  max-height: min(48rem, calc(100vh - 2rem));
  overflow: auto;
}
.version-history-eyebrow { margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.version-history-list { display: grid; gap: 1rem; margin: 1rem 0 0; padding: 0; list-style: none; }
.version-history-item, .version-history-note { padding: 1rem; border: 1px solid var(--border, #d6d9df); border-radius: .75rem; overflow-wrap: anywhere; }
.version-history-item h3, .version-history-item p { margin-top: 0; }
.version-history-compare { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; }
.version-history-compare label, .version-history-restore label { display: grid; gap: .35rem; }
.version-history-diff { display: grid; gap: .5rem; }
.version-history-diff > div { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(0, 2fr); gap: .75rem; }
.version-history-diff dt { font-weight: 700; }
.version-history-diff dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.version-history-restore { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-top: .75rem; }
.version-history-restore label { flex: 1 1 16rem; }
@media (max-width: 40rem) {
  .version-history-dialog { width: calc(100vw - 1rem); max-height: calc(100vh - 1rem); }
  .version-history-diff > div { grid-template-columns: 1fr; gap: .25rem; }
  .version-history-compare, .version-history-restore { align-items: stretch; flex-direction: column; }
}

/* ---- Signed-in product feedback ---- */
.product-feedback-panel {
  position: fixed;
  z-index: 1100;
  right: 18px;
  bottom: 18px;
  width: min(473px, calc(100vw - 36px));
}
.product-feedback-panel[hidden], .product-feedback-panel [hidden] { display: none !important; }
.product-feedback-panel .product-feedback-modal__dialog {
  width: 100%;
  max-height: min(78dvh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border2);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 12px 48px #0004;
}
.product-feedback-panel .modal__header { position: sticky; top: 0; z-index: 1; background: var(--surface); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; }
.product-feedback-panel .modal__body { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 0; }
.product-feedback-form__fields { display: grid; gap: 12px; min-height: 0; overflow-y: auto; padding: 0 16px 12px; }
.product-feedback-panel .product-feedback-form__actions { flex-shrink: 0; margin: 0; padding: 12px 16px; border-top: 1px solid var(--border2); background: var(--surface); }
.product-feedback-panel .modal__header { flex-shrink: 0; }
.product-feedback-attachments input::file-selector-button { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border2); border-radius: 8px; padding: 7px 10px; margin-right: 8px; cursor: pointer; }
 .product-feedback-panel .product-feedback-form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.product-feedback-form__actions .product-feedback-form__status { flex: 1 1 130px; min-width: 0; padding: 0; border: 0; background: transparent; font-size: .8rem; }
.product-feedback-form__actions > button { flex: 0 0 auto; }
.product-feedback-case-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.product-feedback-case-actions .action-button { padding: 7px 9px; font-size: .78rem; }
.product-feedback-case-notice { flex: 0 1 auto; min-height: 0; max-height: min(170px, 25dvh); overflow: auto; padding: 10px 16px; border-top: 1px solid var(--border2); font-size: .82rem; }
.product-feedback-case-notice p { margin: 0 0 8px; }
.product-feedback-case-notice blockquote { margin: 0 0 8px; max-height: 70px; overflow: auto; white-space: pre-wrap; }
.product-feedback-panel.is-minimized:has([data-product-feedback-new]:not([hidden])) { width: min(473px, calc(100vw - 36px)); }
.product-feedback-resize { position: absolute; left: -4px; z-index: 3; width: 24px; height: 24px; border: 0; background: transparent; touch-action: none; }
.product-feedback-resize::after { content: ''; position: absolute; left: 5px; width: 9px; height: 9px; border-left: 2px solid var(--text3); }
.product-feedback-resize--top { top: -4px; cursor: nwse-resize; }
.product-feedback-resize--top::after { top: 5px; border-top: 2px solid var(--text3); }
.product-feedback-resize--bottom { bottom: -4px; cursor: nesw-resize; }
.product-feedback-resize--bottom::after { bottom: 5px; border-bottom: 2px solid var(--text3); }
.product-feedback-resize:focus-visible { outline: 2px solid var(--link); border-radius: 5px; }
.product-feedback-panel.is-minimized .product-feedback-resize { display: none; }
@media (max-width: 760px) {
  .product-feedback-panel .product-feedback-form__actions { flex-wrap: wrap; }
  .product-feedback-form__actions .product-feedback-form__status { flex-basis: 100%; }
}
/* A keyboard can leave less room than the fixed header and action area need.
   Keep every control reachable by scrolling the full form in that viewport. */
.product-feedback-panel.is-compact-viewport .modal__body { overflow-y: auto; }
.product-feedback-panel.is-compact-viewport .product-feedback-form__fields { flex: 0 0 auto; overflow: visible; }
.product-feedback-panel.is-compact-viewport .product-feedback-case-notice { flex: 0 0 auto; max-height: none; overflow: visible; }
.product-feedback-panel .modal__title { font-size: 1.1rem; }
.product-feedback-summary { display: none; margin: 4px 0 0; color: var(--text2); font-size: .78rem; }
.product-feedback-panel.is-minimized .product-feedback-summary { display: block; }
.product-feedback-panel.is-minimized { width: min(320px, calc(100vw - 36px)); }
.product-feedback-panel.is-minimized .product-feedback-modal__eyebrow { display: none; }
.product-feedback-panel textarea { resize: vertical; min-height: 90px; max-height: 240px; }
.product-feedback-attachments { display: grid; gap: 8px; min-width: 0; }
.product-feedback-attachments input { max-width: 100%; }
.product-feedback-files img { width: 86px; height: 64px; object-fit: contain; border-radius: 4px; }
@media (max-width: 760px) {
  .product-feedback-panel { right: 10px; bottom: 10px; width: min(380px, calc(100vw - 20px)); }
  .product-feedback-panel .product-feedback-modal__dialog { max-height: min(74dvh, 760px); }
}

.product-feedback-modal__dialog {
  width: min(680px, 100%);
  max-height: min(90vh, 860px);
}

.product-feedback-modal__header > div {
  min-width: 0;
}

.product-feedback-modal__eyebrow {
  margin: 0 0 4px;
  color: var(--link);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-feedback-modal__intro {
  margin: 0;
  color: var(--text2);
  font-size: 0.92rem;
  line-height: 1.55;
}

.product-feedback-form__count {
  color: var(--text3);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.product-feedback-files {
  display: grid;
  gap: 7px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.product-feedback-files:empty {
  display: none;
}

.product-feedback-files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--border2);
  border-radius: 9px;
  background: var(--surface2);
  color: var(--text2);
  font-size: 0.8rem;
}

.product-feedback-files li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-feedback-files button {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.product-feedback-files button:hover,
.product-feedback-files button:focus-visible {
  background: color-mix(in srgb, var(--link) 10%, transparent);
}

.product-feedback-files button:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.product-feedback-diagnostics {
  padding: 14px;
  border: 1px solid var(--border2);
  border-radius: 12px;
  background: var(--surface2);
}

.product-feedback-diagnostics__toggle {
  padding: 0;
  border: 0;
  background: transparent;
}

.product-feedback-diagnostics__details {
  margin: 12px 0 0 28px;
  color: var(--text2);
  font-size: 0.78rem;
  line-height: 1.5;
}

.product-feedback-diagnostics__details[hidden] {
  display: none;
}

.product-feedback-diagnostics__details summary {
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}

.product-feedback-diagnostics__list {
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
  gap: 5px 14px;
  margin: 10px 0;
}

.product-feedback-diagnostics__list dt,
.product-feedback-diagnostics__list dd {
  margin: 0;
}

.product-feedback-diagnostics__list dt {
  color: var(--text3);
}

.product-feedback-diagnostics__list dd {
  color: var(--text);
  overflow-wrap: anywhere;
}

.product-feedback-diagnostics__details p {
  margin: 10px 0 0;
}

.product-feedback-form__status {
  margin: 0;
  padding: 11px 13px;
  border: 1px solid var(--border2);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text2);
  font-size: 0.84rem;
  line-height: 1.45;
}

.product-feedback-form__status[data-tone="success"] {
  border-color: color-mix(in srgb, var(--brand-primary) 35%, var(--border2));
  background: color-mix(in srgb, var(--brand-primary) 8%, var(--surface));
  color: var(--text);
}

.product-feedback-form__status[data-tone="warning"] {
  border-color: #c98b20;
  background: color-mix(in srgb, #c98b20 10%, var(--surface));
  color: var(--text);
}

.product-feedback-form__status[data-tone="error"] {
  border-color: #c93c37;
  background: color-mix(in srgb, #c93c37 8%, var(--surface));
  color: var(--text);
}

@media (max-width: 640px) {
  .product-feedback-modal {
    align-items: flex-end;
    padding: 12px;
  }

  .product-feedback-modal__dialog {
    max-height: calc(100dvh - 24px);
    border-radius: 16px;
  }

  .product-feedback-modal .modal__header {
    padding: 16px 16px 12px;
  }

  .product-feedback-modal .modal__body {
    padding: 16px;
    gap: 16px;
  }

  .product-feedback-diagnostics__details {
    margin-left: 0;
  }

  .product-feedback-diagnostics__list {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .product-feedback-diagnostics__list dd + dt {
    margin-top: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-feedback-modal .modal__backdrop,
  .product-feedback-modal .modal__dialog {
    transition: none !important;
  }
}

/* ============================================================
   REFINED PAGE CARDS — Design-handoff static card grids
   Hidden in legacy mode; shown in refined mode.
   ============================================================ */

/* Visibility gating */
.rfd-page-cards { display: none; }
html[data-shell="refined"] .rfd-page-cards { display: block; }

/* Hide legacy page-specific surfaces in refined mode that are replaced by refined static cards */
html[data-shell="refined"] [data-usecase-empty]  { display: none !important; }

/* Dynamic sections (howto-grid, apps-grid-section) are shown below the design-highlight cards;
   add a visual separator when both sections coexist on the same page */
html[data-shell="refined"] .rfd-page-cards + .howto-grid,
html[data-shell="refined"] .rfd-page-cards + .apps-grid-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border2);
}

/* Skills: use the real API-driven skills-shell; refined CSS wraps it in refined styling */
html[data-shell="refined"] .skills-shell {
  margin-top: 28px;
}
html[data-shell="refined"] .skills-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

/* Category chip row */


/* Card grid */
.rfd-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Base card */
.rfd-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: default;
  transition: box-shadow .15s, transform .15s;
}
.rfd-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  transform: translateY(-1px);
}

.rfd-card__head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.rfd-card__title {
  font: 600 16px/1.3 'Inter', sans-serif;
  color: var(--text);
  margin: 0;
}


.rfd-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 0 0;
}

.rfd-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  margin-top: auto;
  border-top: 1px solid var(--border2, var(--border));
}

/* Badges */
.rfd-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  font: 600 10px/1 'Inter', sans-serif;
  letter-spacing: .05em;
  border-radius: 100px;
  white-space: nowrap;
}
.rfd-badge--level       { background: var(--bg-hover); color: var(--text2); }
.rfd-badge--all         { background: #f1f5f9; color: var(--text2); }

/* Tag chip (category label in card footer) */
.rfd-tag {
  font: 500 12px/1 'Inter', sans-serif;
  color: var(--text2);
}

/* CTA link/button in card footer */
.rfd-cta {
  display: inline-flex;
  align-items: center;
  font: 500 13px/1 'Inter', sans-serif;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.rfd-cta:hover { text-decoration: underline; }

/* Use Case video thumb */
.rfd-usecase-card { cursor: pointer; }
.rfd-usecase-thumb {
  position: relative;
  height: 148px;
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* App card maintenance dimming */

/* Empty state shown when search/filter hides all cards in a section */
.rfd-search-empty {
  display: none;
  padding: 48px 0;
  text-align: center;
  font: 400 15px/1.5 'Inter', sans-serif;
  color: var(--text2);
}
.rfd-search-empty:not([hidden]) { display: block; }

/* Dark-mode badge overrides */
html[data-theme="dark"] .rfd-badge--level       { background: rgba(255,255,255,.07); }
html[data-theme="dark"] .rfd-usecase-thumb      { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); }

/* ---- Real use-case video card embed ---- */
.rfd-usecase-thumb--embed {
  height: 200px;
  background: #0f172a;
}

.rfd-usecase-thumb--embed iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ---- Apps empty state ---- */

/* ---- Command palette (Cmd/Ctrl+K) — assets/refined-shell.js wires it.
   Reuses .modal/.modal__backdrop/.modal__dialog from prompt-library.css
   for the overlay chrome; these rules only adjust size/position and style
   the palette-specific search input + results list. ---- */
.rfd-palette {
  align-items: flex-start;
  padding-top: 15vh;
}

.rfd-palette .modal__dialog {
  width: min(560px, 100%);
  max-height: 60vh;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.rfd-palette__search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text3);
  flex-shrink: 0;
}

.rfd-palette__input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  outline: none;
}

.rfd-palette__input::placeholder {
  color: var(--text3);
}

.rfd-palette__search kbd {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  font-family: inherit;
  color: var(--text3);
}

.rfd-palette__list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
}

.rfd-palette__item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}

.rfd-palette__item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rfd-palette__item-kind {
  color: var(--text3);
  font-size: 11px;
  text-transform: capitalize;
}

.rfd-palette__item-context {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: hidden;
  color: var(--text3);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rfd-palette__item-provenance {
  color: var(--text2);
  font-weight: 500;
}

.rfd-palette__item-context mark {
  border-radius: 2px;
  background: var(--chip);
  color: inherit;
  font-weight: 600;
}

.rfd-palette__item[aria-selected="true"] .rfd-palette__item-context mark {
  background: var(--surface);
}

.rfd-palette__item[aria-selected="true"] {
  background: var(--chip);
}

.rfd-palette__empty {
  padding: 24px 18px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
  margin: 0;
}

/* ---- First-run orientation ---- */
.onboarding-tour {
  z-index: 1250;
}

.onboarding-tour__dialog {
  width: min(620px, 100%);
  max-height: min(90vh, 720px);
  /* The height the dialog keeps from step to step (refined-shell.js measures it) never exceeds the screen: a taller
     minimum would beat max-height and push the top and the buttons out of view. When the screen is lower than the
     content, only the body scrolls; the header with the close button and the buttons stay in view. */
  min-height: min(var(--onboarding-min-height, 0px), 90vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.onboarding-tour__header,
.onboarding-tour__actions {
  flex: 0 0 auto;
}

.onboarding-tour__header {
  align-items: flex-start;
}

.onboarding-tour__eyebrow,
.onboarding-tour__step-number {
  margin: 0 0 4px;
  color: var(--link);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.onboarding-tour__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  gap: 20px;
}

.onboarding-tour__description {
  margin: 0;
  color: var(--text2);
  line-height: 1.55;
}

.onboarding-tour__progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.onboarding-tour__progress li {
  border-top: 3px solid var(--border);
  color: var(--text3);
  font-size: .78rem;
  font-weight: 650;
  padding-top: 7px;
}

.onboarding-tour__progress li[aria-current="step"] {
  border-color: var(--link);
  color: var(--text);
}

/* The steps share one grid cell. refined-shell.js shows them all for a moment to measure the tallest, and keeps the
   dialog at that height. The hidden attribute is what hides a step: the page has a global [hidden] rule with
   !important, so a hidden step cannot hold its own space. */
.onboarding-tour__panels {
  display: grid;
}

.onboarding-tour__panels section {
  grid-area: 1 / 1;
  min-height: 150px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface2);
}

.onboarding-tour__panels h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.onboarding-tour__panels p:last-child {
  margin: 0;
  color: var(--text2);
  line-height: 1.6;
}

.onboarding-tour__panels kbd {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font: inherit;
  font-size: .85em;
}

.onboarding-tour__actions {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 16px 24px 22px;
}

.onboarding-tour__nav {
  display: flex;
  gap: 8px;
}

/* Skip is a quiet text action, not a third button. */
.onboarding-tour__skip {
  appearance: none;
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  background: none;
  color: var(--text2);
  font: inherit;
  font-size: .9rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.onboarding-tour__skip:hover {
  color: var(--text);
}

/* Three dots beside "Step 1 of 3" on a narrow screen, where the list of step names is left out. */
.onboarding-tour__dots {
  display: none;
}

.onboarding-tour__narrow {
  display: none;
}

/* The focus ring shows for keyboard use only (refined-shell.js marks the tour on a key press): the tour opens on its
   own and moves focus to Next, which a phone drew as a ring. The second selector outranks the mobile focus outline
   (mobile-surfaces.css). */
.onboarding-tour:not([data-onboarding-keyboard]) :focus-visible,
html[data-shell="refined"] body:not(.admin-page) .onboarding-tour:not([data-onboarding-keyboard]) :focus-visible {
  outline: none;
  box-shadow: none;
}

@media (max-width: 900px) {
  /* The menu is at the bottom here. */
  .onboarding-tour__wide {
    display: none;
  }

  .onboarding-tour__narrow {
    display: block;
  }
}

.agent-hotel-card[data-agent-target="true"] {
  outline: 3px solid var(--link);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--link) 18%, transparent), var(--shadow-elevation-2);
}

@media (max-width: 560px) {
  /* A sheet at the bottom of the screen, as the other mobile sheets. */
  .onboarding-tour {
    align-items: flex-end;
    padding: 0;
  }

  .onboarding-tour__dialog {
    width: 100%;
    max-height: calc(100dvh - 24px);
    min-height: min(var(--onboarding-min-height, 0px), calc(100dvh - 24px));
    border-bottom: 0;
    border-radius: 20px 20px 0 0;
  }

  .onboarding-tour__body {
    gap: 16px;
    padding: 16px 20px 8px;
  }

  .onboarding-tour__progress {
    display: none;
  }

  .onboarding-tour__step-number {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .onboarding-tour__dots {
    display: inline-flex;
    gap: 6px;
  }

  .onboarding-tour__dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border);
  }

  .onboarding-tour__dots .is-current {
    background: var(--link);
  }

  .onboarding-tour__panels section {
    min-height: 0;
    padding: 16px;
  }

  .onboarding-tour__actions {
    align-items: stretch;
    flex-direction: column-reverse;
    gap: 4px;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .onboarding-tour__nav .action-button {
    flex: 1 1 0;
  }

  .onboarding-tour__skip {
    align-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .onboarding-tour .modal__backdrop,
  .onboarding-tour .modal__dialog {
    transition: none !important;
  }
}

/* Authentication is a fail-closed first paint in every shell and viewport. */
body.auth-required:not(.is-authenticated) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(100dvh, 1fr) !important;
  width: 100%;
  min-height: 100dvh !important;
  height: 100dvh !important;
  overflow: hidden;
}

body.auth-required:not(.is-authenticated) > :not(.auth-gate):not([data-sr-announcements]) {
  display: none !important;
}

body.auth-required:not(.is-authenticated) > .auth-gate {
  grid-column: 1 !important;
  grid-row: 1 !important;
  width: 100%;
  min-height: 100dvh;
}

.product-feedback-capture-preview { border: 1px solid var(--border2); border-radius: 8px; padding: 10px; }
.product-feedback-capture-preview img { display: block; width: 100%; height: 180px; object-fit: contain; }

/* Mobile navigation reuses the permission-aware sidebar as its More sheet. */
.rfd-mobile-nav { display: none; }
@media (max-width: 900px) {
  html[data-shell="refined"] body:not(.admin-page) { --rfd-mobile-nav-h: calc(64px + env(safe-area-inset-bottom, 0px)); }
  html[data-shell="refined"] body:not(.admin-page) { --rfd-mobile-shell-h: 100vh; position: relative; height: 100vh; height: var(--rfd-mobile-shell-h); min-height: 0; grid-template-rows: var(--rfd-toolbar-h) minmax(0, 1fr) var(--rfd-mobile-nav-h); }
  html[data-shell="refined"] body:not(.admin-page) .rfd-mobile-nav {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-column: 1; grid-row: 3; z-index: 46; min-width: 0;
    background: var(--sidebar); border-top: 1px solid var(--border2);
    padding: 4px max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px));
  }
  html[data-shell="refined"] body:not(.admin-page) .rfd-mobile-nav .rfd-navlink {
    min-width: 0; min-height: 52px; padding: 4px; gap: 3px;
    flex-direction: column; justify-content: center; font: inherit; font-size: .75rem;
    border: 0; cursor: pointer; color: var(--text); background: transparent;
  }
  html[data-shell="refined"] body:not(.admin-page) .rfd-mobile-nav .is-active { color: var(--accent); background: var(--sidebarItem); }
  html[data-shell="refined"] body:not(.admin-page) .rfd-mobile-nav .rfd-navlink__bar { display: none; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-mobile-nav .rfd-label,
  html[data-shell="refined"][data-refined-collapsed] body:not(.admin-page) .rfd-sidebar .rfd-label { display: inline; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-burger,
  html[data-shell="refined"] body:not(.admin-page) [data-refined-collapse] { display: none; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-sidebar {
    position: absolute !important; top: auto; bottom: calc(var(--rfd-mobile-nav-h) + 8px); left: 0; right: 0;
    width: 100% !important; height: auto; max-height: calc(var(--rfd-mobile-shell-h, 100vh) - var(--rfd-toolbar-h) - var(--rfd-mobile-nav-h) - 16px);
    padding: 16px; overflow-y: auto; overscroll-behavior: contain;
    border-radius: 18px 18px 0 0; border: 1px solid var(--border2);
    /* Focus must never target an offscreen animation frame and scroll the document. */
    transform: none; transition: none; visibility: hidden;
  }
  html[data-shell="refined"] body:not(.admin-page) .rfd-sidebar.open { transform: none; visibility: visible; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-sidebar .rfd-nav { flex: none; overflow: visible; }
  html[data-shell="refined"][data-refined-collapsed] body:not(.admin-page) .rfd-sidebar .rfd-brand__home { display: flex; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-rail { bottom: var(--rfd-mobile-nav-h); width: min(340px, 100vw); }
  html[data-shell="refined"] body:not(.admin-page) .product-feedback-panel .product-feedback-modal__dialog { max-height: calc(100dvh - var(--rfd-mobile-nav-h) - 24px); }
  html[data-shell="refined"] body:not(.admin-page) .rfd-sidebar .rfd-navlink { min-height: 44px; justify-content: flex-start; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-sidebar .rfd-brand { margin-bottom: 8px; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-sidebar .rfd-userfoot { padding-top: 12px; }
  html[data-shell="refined"] body:not(.admin-page) #main-content { min-height: 0; scroll-padding-block: 16px; }
  html[data-shell="refined"] body:not(.admin-page) .hub-page.is-active { padding: 20px 16px; }
  html[data-shell="refined"] body:not(.admin-page) .hub-page__subtitle { margin-bottom: 12px; }
  html[data-shell="refined"] body:not(.admin-page) .skills-shell { margin-top: 8px; }
  html[data-shell="refined"] body:not(.admin-page) .product-feedback-panel { bottom: calc(var(--rfd-mobile-nav-h) + 8px); max-height: calc(100dvh - var(--rfd-mobile-nav-h) - 24px); }
  html[data-shell="refined"] body:not(.admin-page) :is(.rfd-searchresults, .rfd-notification-popover) { max-height: calc(100dvh - var(--rfd-toolbar-h) - var(--rfd-mobile-nav-h) - 24px); }
  html[data-shell="refined"] body:not(.admin-page)[data-embed] { grid-template-rows: minmax(0, 1fr); }
  body[data-embed] .rfd-mobile-nav { display: none !important; }
}

@supports (height: 100svh) {
  @media (max-width: 900px) {
    html[data-shell="refined"] body:not(.admin-page) { --rfd-mobile-shell-h: 100svh; }
  }
}

@media (max-width: 900px) {
  html[data-shell="refined"] body:not(.admin-page) .rfd-toolbar :is(.rfd-iconbtn, .rfd-segbtn, .rfd-railbtn, .rfd-bell) { min-width: 44px; min-height: 44px; flex-shrink: 0; }
  html[data-shell="refined"] body:not(.admin-page) :is(.rfd-filters, .rfd-search, .rfd-submit) { min-height: 44px; }
}

/* Mobile keeps the primary actions in one row; secondary controls reuse More. */
.rfd-mobile-tool-label { display: none; }
.rfd-rail-close { display: none; align-self: flex-end; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; }
@media (max-width: 900px) {
  html[data-shell="refined"] body:not(.admin-page) { --rfd-toolbar-h: 64px; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-toolbar { flex-wrap: nowrap; padding: 8px; gap: 8px; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-toolbar__left { flex: 1 1 auto; width: auto; min-width: 0; gap: 0; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-toolbar__right { flex: 0 0 auto; width: auto; gap: 8px; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-searchbox { width: 100%; min-width: 0; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-search { padding: 10px; gap: 6px; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-search kbd { display: none; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-submit { width: auto; max-width: 112px; min-height: 44px; padding: 4px 8px; white-space: normal; overflow: visible; text-overflow: clip; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-rail { transition: none; }
  html[data-shell="refined"] body:not(.admin-page) .rfd-rail-close { display: block; }
  html[data-shell="refined"] body:not(.admin-page) .sticky-filter-bar { z-index: 1; }
  .rfd-mobile-tools { padding-bottom: 16px; border-bottom: 1px solid var(--border2); margin-bottom: 12px; }
  .rfd-mobile-tools h2 { margin: 0 0 8px; font-size: .875rem; }
  .rfd-mobile-tools__controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .rfd-mobile-tools .rfd-mobile-tool-label { display: inline; color: var(--text2); }
  .rfd-mobile-tools :is(.rfd-iconbtn, .rfd-segbtn, .rfd-filters, .rfd-railbtn) { width: 100%; min-width: 0; min-height: 44px; height: auto; gap: 8px; padding: 8px; justify-content: flex-start; font-size: .875rem; }
  .rfd-mobile-tools .rfd-themeseg { grid-column: 1 / -1; display: flex; padding: 0; width: 100%; }
  .rfd-mobile-tools .rfd-segbtn { flex: 1; }
  .rfd-mobile-tools [data-refined-settings] { grid-column: 1 / -1; }
}

/* Retain the requested pair of cards on the narrowest supported phones too. */
@media (min-width: 320px) and (max-width: 383px) {
  html[data-shell="refined"] body:not(.admin-page) .hub-page :is(.agent-hotel-grid, .skills-list, .prompt-grid, .apps-grid, .howto-grid, .rfd-card-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  html[data-shell="refined"] body:not(.admin-page) .hub-page :is(.agent-hotel-card, .skill-card, .prompt-card, .app-card, .howto-card, .rfd-card) { min-width: 0; overflow-wrap: anywhere; }
}

/* Green text uses the contrast-safe link token in both themes. */
html[data-shell="refined"] :is(.results-count span:first-child, .results-count span:nth-child(3), .agent-hotel__grid-meta a, .agent-hotel-card__prompts-list a) {
  color: var(--link);
}
