/* ==========================================================================
   riff components — consume semantic tokens only (see tokens.css)
   ========================================================================== */

/* ---------- Base ---------- */

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

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--text-md);
  line-height: var(--leading-md);
  color: var(--color-text);
  background: var(--color-bg-image), var(--color-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: var(--text-xl);
  line-height: var(--leading-xl);
  font-weight: var(--font-medium);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.text-secondary {
  color: var(--color-text-secondary);
}

/* Keeps a label available to screen readers while hiding it visually */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Icon (mask: takes the current text color) ---------- */

.icon {
  flex: none;
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-lg {
  width: 32px;
  height: 32px;
}

/* Icons: Phosphor (https://phosphoricons.com), files in assets/icons/.
   Name = Phosphor name; -fill / -bold = weight. Regular weight is the default. */
.icon-plugs           { --icon: url("../assets/icons/plugs.svg"); }
.icon-plugs-fill      { --icon: url("../assets/icons/plugs-fill.svg"); }
.icon-shield-check    { --icon: url("../assets/icons/shield-check.svg"); }
.icon-polygon         { --icon: url("../assets/icons/polygon.svg"); }
.icon-polygon-fill    { --icon: url("../assets/icons/polygon-fill.svg"); }
.icon-shield-check-fill { --icon: url("../assets/icons/shield-check-fill.svg"); }
.icon-caret-down      { --icon: url("../assets/icons/caret-down.svg"); }
.icon-check           { --icon: url("../assets/icons/check.svg"); }
.icon-desktop         { --icon: url("../assets/icons/desktop.svg"); }
.icon-sun             { --icon: url("../assets/icons/sun.svg"); }
.icon-moon            { --icon: url("../assets/icons/moon.svg"); }
.icon-eye             { --icon: url("../assets/icons/eye.svg"); }
.icon-hand            { --icon: url("../assets/icons/hand.svg"); }
.icon-lightning       { --icon: url("../assets/icons/lightning.svg"); }
.icon-pencil-simple   { --icon: url("../assets/icons/pencil-simple.svg"); }
.icon-plus            { --icon: url("../assets/icons/plus.svg"); }
.icon-pulse           { --icon: url("../assets/icons/pulse.svg"); }
.icon-sign-out        { --icon: url("../assets/icons/sign-out.svg"); }
.icon-trash           { --icon: url("../assets/icons/trash.svg"); }
.icon-slack-logo      { --icon: url("../assets/icons/slack-logo-fill.svg"); }
.icon-dots-three      { --icon: url("../assets/icons/dots-three-bold.svg"); }
.icon-x               { --icon: url("../assets/icons/x.svg"); }
.icon-squares-four    { --icon: url("../assets/icons/squares-four.svg"); }
.icon-squares-four-fill { --icon: url("../assets/icons/squares-four-fill.svg"); }
.icon-sparkle         { --icon: url("../assets/icons/sparkle.svg"); }
.icon-sparkle-fill    { --icon: url("../assets/icons/sparkle-fill.svg"); }
.icon-trend-up        { --icon: url("../assets/icons/trend-up.svg"); }
.icon-trend-down      { --icon: url("../assets/icons/trend-down.svg"); }
.icon-minus           { --icon: url("../assets/icons/minus.svg"); }
.icon-info            { --icon: url("../assets/icons/info.svg"); }
.icon-magnifying-glass { --icon: url("../assets/icons/magnifying-glass.svg"); }
.icon-check-circle-fill { --icon: url("../assets/icons/check-circle-fill.svg"); }
.icon-arrow-square-out { --icon: url("../assets/icons/arrow-square-out.svg"); }

/* ---------- Logo (mask, colored per theme) ---------- */

.logo {
  display: block;
  background-color: var(--color-logo);
  -webkit-mask: url("../assets/logo.svg") center / contain no-repeat;
  mask: url("../assets/logo.svg") center / contain no-repeat;
}

.logo-brand {
  background-color: var(--color-logo-brand);
}

/* ---------- Buttons ----------
   Lit variants layer: fill (padding-box) over stroke (border-box) through a
   transparent 1px border. In light the stroke is transparent, so they read flat. */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  height: var(--control-height);
  padding: var(--space-4) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  font: var(--font-medium) var(--text-md) / var(--leading-md) var(--font-family);
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: filter var(--duration-fast) ease, background-color var(--duration-fast) ease;
}

/* Disabled: flat grey, keeping the hierarchy of each button type. Same disabled colors
   as the "Coming soon" sidebar items; no opacity, glow or lit border; hover does nothing.
     primary (filled)   → grey fill + disabled text
     secondary (outline)→ disabled border + disabled text, no fill
     tertiary (text)    → disabled text only
   .btn.X:disabled outranks every .X:hover. */
.btn:disabled {
  color: var(--btn-disabled-text);
  box-shadow: none;
  filter: none;
  cursor: not-allowed;
}

/* Primary and other filled buttons */
.btn.btn-primary:disabled,
.btn.btn-danger:disabled,
.btn.btn-dark:disabled {
  background: var(--btn-disabled-fill);
}

.btn-primary:disabled::before {
  display: none; /* no lit border */
}

/* Secondary: Connect-style and outlined buttons both become an outline */
.btn.btn-secondary:disabled,
.btn.btn-outline:disabled {
  background: transparent;
  border-color: var(--btn-disabled-stroke);
}

/* Tertiary */
.btn.btn-ghost:disabled,
.btn.btn-icon:disabled {
  background: transparent;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  position: relative;
  background: var(--btn-primary-fill) border-box;
  box-shadow: var(--btn-primary-glow);
  color: var(--btn-primary-text);
}

/* The lit stroke sits on top of the fill (an inside stroke, as in Figma) rather than
   framing it from outside: a 1px ring masked out of a full-size gradient layer. */
.btn-primary::before {
  content: "";
  position: absolute;
  inset: -1px; /* cover the 1px border area too */
  padding: 1px;
  border-radius: inherit;
  background: var(--btn-primary-stroke);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

.btn-primary:hover:not(:disabled) {
  filter: var(--btn-primary-hover);
}

.btn-secondary {
  background: var(--btn-secondary-fill) padding-box, var(--btn-secondary-stroke) border-box;
  box-shadow: var(--btn-secondary-glow);
  color: var(--btn-secondary-text);
}

.btn-secondary:hover:not(:disabled) {
  filter: var(--btn-secondary-hover);
}

.btn-outline {
  background: var(--btn-outline-fill);
  border-color: var(--btn-outline-border);
  color: var(--btn-outline-text);
  font-weight: var(--font-medium);
}

.btn-outline:hover {
  background: var(--btn-ghost-hover);
}

.btn-dark {
  background: var(--btn-dark-fill);
  color: var(--btn-dark-text);
}

.btn-dark:hover {
  background: var(--btn-dark-fill-hover);
}

.btn-danger {
  background: var(--btn-danger-fill);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--btn-danger-fill-hover);
}

.btn-ghost {
  font-weight: var(--font-medium);
}

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

/* Tertiary destructive action (e.g. Delete inside an edit modal) */
.btn-ghost.btn-destructive {
  color: var(--color-error);
}

.btn-ghost.btn-destructive:hover {
  background: var(--btn-destructive-hover);
}

/* Square icon-only button (36×36, 20px icon) */
.btn-icon {
  width: var(--control-height);
  padding: var(--space-4);
  color: var(--color-icon);
}

.btn-icon:hover {
  background: var(--btn-ghost-hover);
}

/* Links that open a new tab get a trailing icon */
.btn[target="_blank"]:not(.btn-dark)::after {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url("../assets/icons/arrow-square-out.svg") center / contain no-repeat;
  mask: url("../assets/icons/arrow-square-out.svg") center / contain no-repeat;
}

/* ---------- Tooltip ([data-tooltip] on icon buttons) ---------- */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  border-radius: 6px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  font: var(--font-medium) var(--text-xs) / var(--leading-xs) var(--font-family);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 2px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

[data-tooltip][data-tooltip-position="bottom"]::after {
  top: calc(100% + 6px);
  bottom: auto;
  transform: translate(-50%, -2px);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
  transition-delay: 0.3s;
}

/* ---------- Form fields ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

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

.field-hint {
  color: var(--color-text-secondary);
}

.input {
  width: 100%;
  height: var(--input-height);
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  font: var(--font-regular) var(--text-md) / var(--leading-md) var(--font-family);
  color: var(--color-text);
  transition: border-color var(--duration-fast) ease;
}

textarea.input {
  height: auto;
  min-height: 88px;
  line-height: var(--leading-lg);
  resize: vertical;
}

.input::placeholder {
  color: var(--color-text-placeholder);
}

.input:focus {
  outline: none;
  border-color: var(--input-border-focus);
}

.input[aria-invalid="true"] {
  border-color: var(--color-error);
}

.form-error {
  color: var(--color-error);
}

/* ---------- Badge ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  line-height: var(--leading-xs);
  font-weight: var(--font-medium);
  white-space: nowrap;
}

.badge-success {
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
  box-shadow: inset 0 0 0 1px var(--badge-success-stroke);
}

.badge-neutral {
  background: var(--badge-neutral-bg);
  color: var(--badge-neutral-text);
  box-shadow: inset 0 0 0 1px var(--badge-neutral-stroke);
}

/* ---------- Panel (sidebar, login card) ---------- */

.panel {
  background: var(--surface-panel);
  border: 1px solid var(--surface-panel-border);
}

/* ---------- Card (connector row) ---------- */

.card {
  background: var(--surface-card);
  border: 1px solid var(--surface-card-border);
  border-radius: var(--radius-md);
}

/* 40×40 white tile holding a third-party brand logo (white in both themes) */
.logo-tile {
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-logo-tile);
}

.logo-tile img {
  width: 24px;
  height: 24px;
}

.divider {
  height: 1px;
  border: 0;
  margin: 0;
  background: var(--divider);
}

/* ---------- Navigation item ---------- */

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--control-height);
  padding: var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: var(--font-medium);
  color: var(--nav-idle-text);   /* idle */
  text-decoration: none;
  transition: filter var(--duration-fast) ease, color var(--duration-fast) ease;
}

/* Hover applies to real links only, not locked items */
a.nav-item:hover {
  background: var(--nav-hover-fill) padding-box, var(--nav-hover-stroke) border-box;
  box-shadow: var(--nav-hover-glow);
  color: var(--color-text);
}

.nav-item[aria-current="page"],
a.nav-item[aria-current="page"]:hover {
  background: var(--nav-active-fill) padding-box, var(--nav-active-stroke) border-box;
  box-shadow: var(--nav-active-glow);
}

a.nav-item[aria-current="page"] {
  color: var(--color-text);   /* selected */
}

a.nav-item[aria-current="page"]:hover {
  filter: var(--nav-active-hover);
}

/* Sections that aren't available yet */
.nav-item[aria-disabled="true"] {
  padding-right: 0;
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

.nav-label {
  flex: 1;
  min-width: 0;
}

/* ---------- Icon tile (page header) ---------- */

.icon-tile {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--icon-tile-fill) padding-box, var(--icon-tile-stroke) border-box;
  box-shadow: var(--icon-tile-glow);
  color: var(--icon-tile-color);
}

/* ---------- Avatar ---------- */

.avatar {
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--avatar-text);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-transform: uppercase;
}

/* ---------- Segmented control (radio group) ---------- */

.segmented {
  display: inline-flex;
  gap: var(--space-1);
  padding: var(--space-1);
  border: 1px solid var(--surface-card-border);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
}

.segmented label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  height: 32px;
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label:has(input:checked) {
  background: var(--nav-active-fill) padding-box, var(--nav-active-stroke) border-box;
  box-shadow: var(--nav-active-glow);
  color: var(--color-text);
}

.segmented label:has(input:focus-visible) {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

/* ---------- Modal ---------- */

.modal {
  width: calc(100% - 32px);
  max-width: 480px;
  padding: 0;
  border: 1px solid var(--surface-raised-border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  color: var(--color-text);
  box-shadow: var(--shadow-raised);
}

/* Open/close animation for every <dialog class="modal">.
   Closed state = faded, slightly lowered and blurred; @starting-style gives the
   same values as the entry point, and allow-discrete keeps the dialog in the top
   layer until the exit transition finishes. Browsers without support just snap. */
.modal {
  opacity: 0;
  transform: translateY(var(--modal-enter-offset));
  filter: blur(var(--modal-enter-blur));
  transition:
    opacity var(--duration-modal) var(--ease-out),
    transform var(--duration-modal) var(--ease-out),
    filter var(--duration-modal) var(--ease-out),
    overlay var(--duration-modal) allow-discrete,
    display var(--duration-modal) allow-discrete;
}

.modal[open] {
  opacity: 1;
  transform: none;
  filter: none;
}

@starting-style {
  .modal[open] {
    opacity: 0;
    transform: translateY(var(--modal-enter-offset));
    filter: blur(var(--modal-enter-blur));
  }
}

.modal::backdrop {
  background: transparent;
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
  transition:
    background-color var(--duration-modal) var(--ease-out),
    backdrop-filter var(--duration-modal) var(--ease-out),
    -webkit-backdrop-filter var(--duration-modal) var(--ease-out),
    overlay var(--duration-modal) allow-discrete,
    display var(--duration-modal) allow-discrete;
}

.modal[open]::backdrop {
  background: var(--surface-overlay);
  -webkit-backdrop-filter: blur(var(--overlay-blur));
  backdrop-filter: blur(var(--overlay-blur));
}

@starting-style {
  .modal[open]::backdrop {
    background: transparent;
    -webkit-backdrop-filter: blur(0);
    backdrop-filter: blur(0);
  }
}

/* Reduced motion: keep the fade, drop the movement and blur */
@media (prefers-reduced-motion: reduce) {
  .modal,
  .modal[open] {
    transform: none;
  }

  .modal {
    filter: none;
  }

  @starting-style {
    .modal[open] {
      transform: none;
      filter: none;
    }
  }
}

.modal-sm {
  max-width: 400px;
}

.modal-lg {
  max-width: 640px;
}

.modal-form {
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-5);
  padding: var(--space-7) var(--space-7) 0;
}

.modal-title-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-top: var(--space-1);
}

.modal-title {
  font-size: var(--text-lg);
  line-height: var(--leading-lg);
  font-weight: var(--font-medium);
}

.modal-subtitle,
.modal-description {
  color: var(--color-text-secondary);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-7);
  padding: var(--space-7);
}

.modal-body > .btn-outline {
  align-self: flex-start;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-7);
  border-top: 1px solid var(--divider);
}

/* A destructive action pinned to the left of the footer (Delete) */
.modal-footer-start {
  margin-right: auto;
}

/* ---------- Numbered steps ---------- */

.steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4);
  padding-left: 32px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--step-bg);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
}

.steps strong {
  font-weight: var(--font-medium);
}

/* ---------- Section header (title + helper + optional action) ---------- */

.section {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
}

.section-header-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.section-heading {
  font-size: var(--text-lg);
  line-height: var(--leading-lg);
  font-weight: var(--font-medium);
}

.section-helper {
  color: var(--color-text-secondary);
}

/* ---------- Entry list (card of one-line rows that open an editor) ---------- */

.entry-card {
  overflow: hidden;
}

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

.entry-list li + li {
  border-top: 1px solid var(--divider);
}

.entry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-7);
  width: 100%;
  min-height: 52px;
  padding: var(--space-5) var(--space-6);
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--duration-fast) ease;
}

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

.entry-row:focus-visible {
  outline-offset: -2px; /* the card clips an outer ring */
}

.entry-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Right-hand slot: the date, replaced by "Edit" while the row is hovered or focused.
   Both sit in the same grid cell so the slot never changes width. */
.entry-meta {
  flex: none;
  display: grid;
  justify-items: end;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.entry-meta > * {
  grid-area: 1 / 1;
}

.entry-date {
  color: var(--color-text-secondary);
}

.entry-edit {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--font-medium);
  color: var(--color-text);
  visibility: hidden;
}

.entry-row:hover .entry-date,
.entry-row:focus-visible .entry-date {
  visibility: hidden;
}

.entry-row:hover .entry-edit,
.entry-row:focus-visible .entry-edit {
  visibility: visible;
}

.empty-state {
  padding: var(--space-6);
  color: var(--color-text-secondary);
}

/* ---------- Select menu (pill trigger + custom listbox; js/select-menu.js) ---------- */

.select-menu {
  position: relative;
  flex: none;
}

.select-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--control-height);
  padding: 0 var(--space-5) 0 14px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-pill);
  background: transparent;
  font: var(--font-medium) var(--text-md) / var(--leading-md) var(--font-family);
  color: var(--color-text);
  cursor: pointer;
  transition: background-color var(--duration-fast) ease;
}

.select-menu-trigger:hover {
  background: var(--btn-ghost-hover);
}

.select-menu-caret {
  color: var(--color-text-secondary);
  transition: transform var(--duration-fast) ease;
}

.select-menu-trigger[aria-expanded="true"] .select-menu-caret {
  transform: rotate(180deg);
}

.select-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 260px;
  margin: 0;
  padding: var(--space-2);
  list-style: none;
  border: 1px solid var(--surface-raised-border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  box-shadow: var(--shadow-raised);
  animation: select-menu-in var(--duration-fast) var(--ease-out);
}

/* Opens upward when there's no room below (set by js/select-menu.js) */
.select-menu-list.is-above {
  top: auto;
  bottom: calc(100% + 6px);
}

/* Heading above each group of options */
.select-menu-group {
  padding: var(--space-4) var(--space-4) var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  line-height: var(--leading-xs);
  font-weight: var(--font-medium);
}

.select-menu-group:not(:first-child) {
  margin-top: var(--space-2);
  border-top: 1px solid var(--divider);
}

.select-menu-list:focus {
  outline: none; /* the active option shows where focus is */
}

@keyframes select-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.select-menu-option {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--control-height);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  cursor: pointer;
}

.select-menu-option-label {
  flex: 1;
  white-space: nowrap;
}

/* Keyboard-active or hovered option */
.select-menu-option.is-active {
  background: var(--btn-ghost-hover);
}

.select-menu-option[aria-disabled="true"] {
  color: var(--color-text-disabled);
  cursor: not-allowed;
}

.select-menu-option[aria-disabled="true"].is-active {
  background: transparent;
}

.select-menu-check {
  visibility: hidden;
}

.select-menu-option[aria-selected="true"] .select-menu-check {
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  .select-menu-list {
    animation: none;
  }
}

/* Touch screens: bigger targets */
@media (pointer: coarse) {
  .btn,
  .select-menu-trigger {
    min-height: 44px;
  }

  .btn-icon {
    width: 44px;
  }
}

/* ---------- Banner (purple promo — identical in both themes) ---------- */

.banner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6);
  border-radius: var(--radius-md);
  /* Concentric arcs recreated from the Figma image fill */
  background:
    radial-gradient(circle 313px at 642px 103px, var(--banner-arc-edge) 99.6%, transparent 100%),
    radial-gradient(circle 414px at 654px 153px, var(--banner-arc-2) 81%, var(--banner-arc-edge) 99.6%, transparent 100%),
    radial-gradient(circle 646px at 697px 291px, var(--banner-arc-1) 80%, var(--banner-arc-edge) 99.7%, transparent 100%),
    var(--banner-fill);
  color: var(--banner-text);
  overflow: hidden;
}

.banner-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.banner-title {
  font-weight: var(--font-medium);
}

.banner-subtitle {
  color: var(--banner-subtitle);
}

/* ---------- Mode switch (js/mode-switch.js) ----------
   Floating pill at the bottom of every signed-in page: Admin ↔ In your tools,
   plus the tool list in tools mode. Selected items use the active nav treatment.
   Draggable by its grip; once moved it is pinned by left/top (.is-placed). */

.mode-switch {
  position: fixed;
  left: 50%;
  bottom: var(--space-7);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: calc(100vw - 2 * var(--space-6));
  padding: var(--space-2);
  border: 1px solid var(--surface-raised-border);
  border-radius: var(--radius-pill);
  background: var(--surface-raised);
  box-shadow: var(--shadow-raised);
  transform: translateX(-50%);
}

/* On the tool views the default spot is bottom-left, over the tool's sidebar, so it
   doesn't cover the conversation's composer */
.is-tools-page .mode-switch:not(.is-placed) {
  left: var(--space-4);
  bottom: var(--space-4);
  transform: none;
}

.mode-switch.is-placed {
  bottom: auto;
  transform: none;
}

.mode-switch.is-dragging {
  cursor: grabbing;
  user-select: none;
}

/* Grip: a 2×3 dot pattern */
.mode-switch-handle {
  flex: none;
  width: 20px;
  height: 32px;
  margin-left: var(--space-1);
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background-color: transparent;
  background-image: radial-gradient(circle, var(--color-text-disabled) 1.5px, transparent 2px);
  background-size: 6px 6px;
  background-position: center;
  background-repeat: repeat;
  background-clip: content-box;
  padding-block: 10px;
  padding-inline: 4px;
  cursor: grab;
  touch-action: none;
}

.mode-switch-handle:hover {
  background-color: var(--btn-ghost-hover);
}

.mode-switch-handle:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

.mode-switch.is-dragging .mode-switch-handle {
  cursor: grabbing;
}

.mode-switch-group {
  display: flex;
  gap: var(--space-1);
}

.mode-switch-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  height: 32px;
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  color: var(--color-text-secondary);
  font-weight: var(--font-medium);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--duration-fast), color var(--duration-fast);
}

.mode-switch-item:hover {
  background-color: var(--btn-ghost-hover);
  color: var(--color-text);
}

.mode-switch-item[aria-current] {
  background: var(--nav-active-fill) padding-box, var(--nav-active-stroke) border-box;
  box-shadow: var(--nav-active-glow);
  color: var(--color-text);
}

.mode-switch-item:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 1px;
}

/* Tool button: [tool ⌄] in one pill, like the switch items. It stands for the whole
   "in your tools" side; on tools.html it gets the lit "current" treatment */
.mode-switch .select-menu-trigger {
  height: 32px;
  gap: var(--space-3);
  padding: 0 var(--space-4) 0 var(--space-5);
  border-color: transparent;
  color: var(--color-text-secondary);
}

.mode-switch .select-menu-trigger:hover {
  background: var(--btn-ghost-hover);
  color: var(--color-text);
}

.mode-switch-tools.is-current .select-menu-trigger {
  background: var(--nav-active-fill) padding-box, var(--nav-active-stroke) border-box;
  box-shadow: var(--nav-active-glow);
  color: var(--color-text);
}

/* The list opens from the whole switch (not the small chevron), so it stays on screen */
.mode-switch .select-menu {
  position: static;
}

.mode-switch .select-menu-list {
  min-width: 240px;
}

.is-tools-page .mode-switch .select-menu-list {
  left: 0;
  right: auto;
}

.mode-switch-divider {
  flex: none;
  width: 1px;
  height: 20px;
  margin: 0 var(--space-2);
  background: var(--divider);
}

/* Tool logos: full-color images, or masks that take the text color (single-color logos) */
.tool-icon {
  flex: none;
  width: 16px;
  height: 16px;
}

/* The mask image is set inline (a url() in a custom property would resolve against this file) */
.tool-icon-mono {
  background-color: currentColor;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
