/* -------------------------------------------------------------------------- */
/* Tailwind Extensions                                                        */
/* Centralized overrides extending Tailwind’s theme, utility, and component   */
/* layers with project-specific design tokens and helper classes.             */
/* -------------------------------------------------------------------------- */

/* Keep layout widths stable between short and long pages/tabs. */
html {
  overflow-y: scroll;
}

@supports (scrollbar-gutter: stable) {
  html {
    overflow-y: auto;
    scrollbar-gutter: stable;
  }
}

/* -------------------------------------------------------------------------- */
/* Theme tokens                                                               */
/* Define additional CSS custom properties that Tailwind utilities can use.   */
/* -------------------------------------------------------------------------- */
@layer theme {
  :root,
  :host {
    --color-fuchsia-50: oklch(97.7% 0.017 320.058);
    --color-fuchsia-100: oklch(94.8% 0.043 319.998);
    --color-fuchsia-200: oklch(89.8% 0.089 319.892);
    --color-fuchsia-300: oklch(83% 0.145 321.021);
    --color-fuchsia-800: oklch(41.3% 0.199 322.123);
    --color-fuchsia-900: oklch(34.7% 0.19 323.563);
    --color-fuchsia-950: oklch(24.8% 0.144 324.369);

    --color-sky-50: oklch(97.7% 0.013 236.62);
    --color-sky-100: oklch(95.1% 0.026 236.824);
    --color-sky-200: oklch(90.1% 0.058 230.902);
    --color-sky-300: oklch(82.8% 0.111 230.318);
    --color-sky-400: oklch(74.6% 0.16 232.661);
    --color-sky-600: oklch(58.8% 0.158 241.966);
    --color-sky-700: oklch(50% 0.134 242.749);
    --color-sky-800: oklch(44.3% 0.11 240.79);
    --color-sky-950: oklch(29.3% 0.066 243.157);

    --color-rose-700: oklch(51.4% 0.222 16.935);
    --color-amber-400: oklch(82.8% 0.189 84.429);
    --color-amber-500: oklch(76.9% 0.188 70.08);
    --color-slate-400: oklch(70.4% 0.04 256.788);
    --color-slate-500: oklch(55.4% 0.046 257.417);

    /* IQ aurora dark-mode background palette.
       Declared locally because the default Tailwind palette vars these mirror
       (e.g. --color-slate-950) are not reliably emitted in the compiled CSS. */
    --color-aurora-blue-950: oklch(0.282 0.091 267.935);
    --color-aurora-fuchsia-950: oklch(0.293 0.136 325.661);
    --color-aurora-slate-950: oklch(0.129 0.042 264.695);
    --color-aurora-sky-950: oklch(0.293 0.066 243.157);

    --success: var(--color-green-600);
    --success-foreground: var(--color-white);
    --warning: var(--color-amber-500);
    --warning-foreground: var(--color-zinc-950);
    --info: var(--color-violet-500);
    --info-foreground: var(--color-white);

    --color-success: var(--success);
    --color-warning: var(--warning);
    --color-info: var(--info);
  }

  .dark {
    --success: var(--color-green-500);
    --success-foreground: var(--color-zinc-950);
    --warning: var(--color-amber-400);
    --warning-foreground: var(--color-zinc-950);
    --info: var(--color-sky-400);
    --info-foreground: var(--color-white);

    /* IQ glass surface tokens (dark only).
       The dark background (zinc-950, ~oklch 0.141 hue 286) lifted a few steps
       brighter, kept translucent so the aurora bleeds through and tints it —
       mirrors the Cisco IQ login box. Hue/chroma stay in the background family
       so panels read as "a brighter version of the background," not flat grey.
       --highlight is a 1px top rim-light that gives the panel its "pop". */
    --iq-surface: color-mix(in oklab, oklch(0.245 0.009 286) 45%, transparent);
    --iq-surface-border: color-mix(in oklab, white 12%, transparent);
    --iq-surface-highlight: color-mix(in oklab, white 7%, transparent);
  }
}

/* -------------------------------------------------------------------------- */
/* Utility extensions                                                         */
/* Hand-crafted utility classes that Tailwind’s generator does not emit by    */
/* default (custom colors, border widths, etc.).                              */
/* -------------------------------------------------------------------------- */
@layer utilities {
  @keyframes notification-badge-ping {
    75%,
    100% {
      transform: scale(1.9);
      opacity: 0.3;
    }
  }

  .animate-notification-ping {
    animation: notification-badge-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
  }

  @media (prefers-reduced-motion: reduce) {
    .animate-notification-ping {
      animation: none;
    }
  }

  .notification-badge {
    position: absolute;
    top: -0.2rem;
    inset-inline-end: -0.2rem;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    min-width: 1rem;
    height: 1rem;
  }

  .notification-badge-ping {
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background-color: var(--primary);
    opacity: 0.35;
  }

  .notification-badge-label {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1rem;
    height: 1rem;
    padding-inline: 0.2rem;
    border-radius: 9999px;
    background-color: var(--primary);
    color: var(--primary-foreground);
    font-size: 10px;
    line-height: 1;
    font-weight: 600;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.22);
  }

  /* --- Fuchsia palette helpers ------------------------------------------ */
  .bg-fuchsia-50 { background-color: var(--color-fuchsia-50); }
  .bg-fuchsia-100 { background-color: var(--color-fuchsia-100); }
  .bg-fuchsia-200 { background-color: var(--color-fuchsia-200); }
  .bg-fuchsia-300 { background-color: var(--color-fuchsia-300); }
  .bg-fuchsia-800 { background-color: var(--color-fuchsia-800); }
  .bg-fuchsia-900 { background-color: var(--color-fuchsia-900); }
  .bg-fuchsia-950 { background-color: var(--color-fuchsia-950); }

  .text-fuchsia-50 { color: var(--color-fuchsia-50); }
  .text-fuchsia-100 { color: var(--color-fuchsia-100); }
  .text-fuchsia-200 { color: var(--color-fuchsia-200); }
  .text-fuchsia-300 { color: var(--color-fuchsia-300); }
  .text-fuchsia-800 { color: var(--color-fuchsia-800); }
  .text-fuchsia-900 { color: var(--color-fuchsia-900); }
  .text-fuchsia-950 { color: var(--color-fuchsia-950); }

  .text-sky-400 { color: var(--color-sky-400); }

  .text-rose-700 { color: var(--color-rose-700); }

  .text-blue-700 { color: var(--color-blue-700); }

  .border-fuchsia-50 { border-color: var(--color-fuchsia-50); }
  .border-fuchsia-100 { border-color: var(--color-fuchsia-100); }
  .border-fuchsia-200 { border-color: var(--color-fuchsia-200); }
  .border-fuchsia-300 { border-color: var(--color-fuchsia-300); }
  .border-fuchsia-800 { border-color: var(--color-fuchsia-800); }
  .border-fuchsia-900 { border-color: var(--color-fuchsia-900); }
  .border-fuchsia-950 { border-color: var(--color-fuchsia-950); }

  /* --- Sky palette helpers ---------------------------------------------- */
  .border-sky-50 { border-color: var(--color-sky-50); }
  .border-sky-100 { border-color: var(--color-sky-100); }
  .border-sky-200 { border-color: var(--color-sky-200); }
  .border-sky-300 { border-color: var(--color-sky-300); }
  .border-sky-400 { border-color: var(--color-sky-400); }
  .border-sky-500 { border-color: var(--color-sky-500); }
  .border-sky-600 { border-color: var(--color-sky-600); }
  .border-sky-700 { border-color: var(--color-sky-700); }
  .border-sky-800 { border-color: var(--color-sky-800); }
  .border-sky-900 { border-color: var(--color-sky-900); }
  .border-sky-950 { border-color: var(--color-sky-950); }

  /* --- Single-color helpers -------------------------------------------- */
  .border-violet-500 { border-color: var(--color-violet-500); }
  .border-green-600 { border-color: var(--color-green-600); }
  .border-cyan-500 { border-color: var(--color-cyan-500); }
  .border-amber-400 { border-color: var(--color-amber-400); }
  .border-amber-500 { border-color: var(--color-amber-500); }
  .border-blue-500 { border-color: var(--color-blue-500); }
  .border-red-500 { border-color: var(--color-red-500); }
  .border-slate-400 { border-color: var(--color-slate-400); }
  .border-slate-500 { border-color: var(--color-slate-500); }

  /* --- Dimensional helpers --------------------------------------------- */
  .size-20 {
    width: calc(var(--spacing) * 20);
    height: calc(var(--spacing) * 20);
  }

  .border-3 {
    border-style: var(--tw-border-style);
    border-width: 3px;
  }

  .border-4 {
    border-style: var(--tw-border-style);
    border-width: 4px;
  }

  /* --- Semantic text colors -------------------------------------------- */
  .text-warning { color: var(--warning); }
  .text-success { color: var(--success); }
  .text-destructive { color: var(--destructive); }
  .text-info { color: var(--info); }
  .text-mono { color: var(--mono); }

  /* --- Semantic text colors with opacity guards ------------------------ */
  .text-warning\/50 {
    color: var(--warning);
    @supports (color: color-mix(in lab, red, red)) {
      color: color-mix(in oklab, var(--warning) 50%, transparent);
    }
  }

  .text-success\/50 {
    color: var(--success);
    @supports (color: color-mix(in lab, red, red)) {
      color: color-mix(in oklab, var(--success) 50%, transparent);
    }
  }

  .text-destructive\/50 {
    color: var(--destructive);
    @supports (color: color-mix(in lab, red, red)) {
      color: color-mix(in oklab, var(--destructive) 50%, transparent);
    }
  }

  .text-info\/50 {
    color: var(--info);
    @supports (color: color-mix(in lab, red, red)) {
      color: color-mix(in oklab, var(--info) 50%, transparent);
    }
  }

  .text-mono\/50 {
    color: var(--mono);
    @supports (color: color-mix(in lab, red, red)) {
      color: color-mix(in oklab, var(--mono) 50%, transparent);
    }
  }

  .text-primary\/50 {
    color: var(--primary);
    @supports (color: color-mix(in lab, red, red)) {
      color: color-mix(in oklab, var(--primary) 50%, transparent);
    }
  }

  /* --- Shift calendar text colors with opacity guards ------------------ */
  .text-red-500\/50 {
    color: var(--color-red-500);
    @supports (color: color-mix(in lab, red, red)) {
      color: color-mix(in oklab, var(--color-red-500) 50%, transparent);
    }
  }

  .text-blue-500\/50 {
    color: var(--color-blue-500);
    @supports (color: color-mix(in lab, red, red)) {
      color: color-mix(in oklab, var(--color-blue-500) 50%, transparent);
    }
  }

  .text-green-500\/50 {
    color: var(--color-green-500);
    @supports (color: color-mix(in lab, red, red)) {
      color: color-mix(in oklab, var(--color-green-500) 50%, transparent);
    }
  }

  /* --- Semantic backgrounds with opacity guards ------------------------ */
  .bg-warning\/10 {
    background-color: var(--warning);
    @supports (color: color-mix(in lab, red, red)) {
      background-color: color-mix(in oklab, var(--warning) 10%, transparent);
    }
  }

  .bg-success\/10 {
    background-color: var(--success);
    @supports (color: color-mix(in lab, red, red)) {
      background-color: color-mix(in oklab, var(--success) 10%, transparent);
    }
  }

  .bg-destructive\/10 {
    background-color: var(--destructive);
    @supports (color: color-mix(in lab, red, red)) {
      background-color: color-mix(in oklab, var(--destructive) 10%, transparent);
    }
  }

  .bg-info\/10 {
    background-color: var(--info);
    @supports (color: color-mix(in lab, red, red)) {
      background-color: color-mix(in oklab, var(--info) 10%, transparent);
    }
  }

  .bg-mono\/10 {
    background-color: var(--mono);
    @supports (color: color-mix(in lab, red, red)) {
      background-color: color-mix(in oklab, var(--mono) 10%, transparent);
    }
  }

  /* --- Badge helpers ---------------------------------------------------- */
  .kt-badge-rose {
    background-color: var(--color-rose-700);
    color: var(--color-white);
  }

  .shift-calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  /* --- IQ aurora dark-mode background ----------------------------------- */
  /* Reusable Cisco IQ-style aurora applied to the app-shell <body>.
     Scoped to .dark only, so light mode keeps its existing bg-background.
     The .dark .iq-aurora-bg selector (specificity 0,2,0) intentionally
     overrides the body's bg-background utility (0,1,0) in dark mode. */
  @keyframes iq-aurora-intro {
    0% {
      background-position:
        center center,
        40% 15%,
        70% 35%,
        35% 80%,
        80% 55%;
    }

    30% {
      background-position:
        center center,
        25% 30%,
        55% 20%,
        50% 65%,
        95% 70%;
    }

    60%,
    100% {
      background-position:
        center center,
        10% 15%,
        70% 5%,
        65% 80%,
        80% 85%;
    }
  }

  .dark .iq-aurora-bg {
    isolation: isolate;
    min-height: 100vh;
    background: #000;
    color-scheme: dark;
  }

  .dark .iq-aurora-bg::before {
    content: "";
    position: fixed;
    inset: -10px;
    z-index: -1;
    pointer-events: none;

    background-image:
      radial-gradient(transparent 0px, transparent 20%),
      radial-gradient(circle at 20% 12%, color-mix(in srgb, var(--color-aurora-blue-950) 70%, transparent) 0px, transparent 30%),
      radial-gradient(circle at 70% 20%, color-mix(in srgb, var(--color-aurora-fuchsia-950) 50%, transparent) 0px, transparent 30%),
      radial-gradient(circle at 50% 80%, color-mix(in srgb, var(--color-aurora-slate-950) 50%, transparent) 0px, transparent 35%),
      radial-gradient(circle at 80% 70%, color-mix(in srgb, var(--color-aurora-sky-950) 50%, transparent) 0px, transparent 25%);

    background-size: 150% 150%;
    background-position:
      center center,
      10% 15%,
      70% 5%,
      65% 80%,
      80% 85%;

    filter: blur(40px) saturate(1.5);
    animation: iq-aurora-intro 8s ease-out forwards;
  }

  @media (prefers-reduced-motion: reduce) {
    .dark .iq-aurora-bg::before {
      animation: none;
    }
  }

  /* --- IQ glass panels (dark) ------------------------------------------- */
  /* Lift cards, the side menu, and the top bar off the aurora with a slightly
     brighter, translucent surface, a light edge, and a top rim-light — the
     same scheme as the Cisco IQ login box. Shapes are untouched; only
     fill/border/shadow change. Selectors are `.dark .<thing>` (specificity
     0,2,0) so they override the bg-background / bg-card utilities (0,1,0)
     without editing any markup.

     No backdrop-filter on cards on purpose: it creates a per-card stacking
     context that traps open dropdowns (e.g. "Select a fire station") beneath
     the next card. The aurora ::before is already blurred (40px), so plain
     translucency gives the soft glass look without the stacking-context bug. */
  .dark .kt-card {
    background-color: var(--iq-surface);
    border-color: var(--iq-surface-border);
    box-shadow: inset 0 1px 0 var(--iq-surface-highlight);
  }

  .dark .kt-sidebar,
  .dark .kt-header {
    background-color: var(--iq-surface);
  }

  .dark .kt-sidebar {
    border-inline-end-color: var(--iq-surface-border);
    box-shadow: inset -1px 0 0 var(--iq-surface-highlight);
  }

  /* Active sidebar item: Metronic's bg-accent/60 (zinc-900) is nearly invisible
     on the glass sidebar in dark mode. Use a translucent --primary pill so the
     current page reads clearly (the active label/bullet are already --primary).
     Specificity (0,5,0) beats Metronic's menu-item-active:bg-accent/60 (0,3,0)
     in the shared utilities layer. */
  .dark .kt-sidebar .kt-menu-item.active > .kt-menu-link {
    background-color: color-mix(in oklab, var(--primary) 22%, transparent);
  }

  /* The header border only renders once the sticky controller adds border-b;
     setting the color here keeps it on-scheme when it appears. */
  .dark .kt-header {
    border-bottom-color: var(--iq-surface-border);
  }
}

/* -------------------------------------------------------------------------- */
/* Component extensions                                                       */
/* Higher-level styling for widgets/components that rely on multiple rules.   */
/* Currently focused on Action Text rich text presentation.                   */
/* -------------------------------------------------------------------------- */
@layer components {
  /* --- /events v2 responsive list row ------------------------------------ */
  /* Stacked card on narrow layouts, dense aligned row when the list has room.
     The switch is keyed to the *container* width (the events list region), not
     the viewport: whether the dense row fits depends on the space left after the
     app sidebar, which a viewport breakpoint can't see (a viewport `lg` switch
     turned the row on when the sidebar left only ~700px and the fixed columns
     overlapped). ALL the per-cell show/hide is authored here as component
     classes — NOT Tailwind `@container` variant utilities — so it toggles in the
     same cascade layer as the grid and wins cleanly; the toggled elements carry
     no `display` utility. Keep the 56rem threshold + `eventlist` name in sync
     with the classes in events/_event_list_item.html.erb. */
  .events-list-container {
    container-type: inline-size;
    container-name: eventlist;
  }

  /* Card layout (default / narrow). */
  .event-row-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  .evt-dense-flex,
  .evt-dense-block {
    display: none; /* dense-row-only cells: hidden in the card layout */
  }
  .evt-card-grid {
    display: grid; /* card-only 2x2 detail grid */
  }
  .event-response-cell {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
  }

  /* Dense row layout (list region wide enough for the fixed columns). */
  @container eventlist (min-width: 56rem) {
    .event-row-grid {
      display: grid;
      grid-template-columns: 5.5rem minmax(0, 1fr) 9rem 10rem 16rem;
      align-items: center;
      gap: 1rem;
    }
    .evt-dense-flex { display: flex; }
    .evt-dense-block { display: block; }
    .evt-card-block,
    .evt-card-grid { display: none; } /* card-only bits hidden on the dense row */
    .event-response-cell {
      border-top: 0;
      padding-top: 0;
    }
  }

  /* Segmented quick-response control: three equal toned buttons. */
  .event-response-seg.is-active.tone-success {
    background-color: var(--success-soft, color-mix(in oklab, var(--success) 14%, transparent));
    color: var(--success);
  }
  .event-response-seg.is-active.tone-warning {
    background-color: color-mix(in oklab, var(--warning) 16%, transparent);
    color: var(--warning);
  }
  .event-response-seg.is-active.tone-destructive {
    background-color: color-mix(in oklab, var(--destructive) 16%, transparent);
    color: var(--destructive);
  }
  .event-response-seg:hover {
    background-color: color-mix(in oklab, var(--primary) 8%, transparent);
  }

  .vc-platoon-calendar {
    --vc-platoon-a: rgb(220 38 38);
    --vc-platoon-b: rgb(37 99 235);
    --vc-platoon-c: rgb(22 163 74);
  }

  .vc-platoon-calendar [data-vc-date-btn] {
    min-height: 2.75rem;
    min-width: 2.75rem;
    border-radius: 0.85rem;
    transition:
      background-color 150ms ease,
      border-color 150ms ease,
      box-shadow 150ms ease,
      color 150ms ease,
      opacity 150ms ease;
  }

  .vc-platoon-calendar .vc-platoon-decorated {
    gap: 0.18rem;
  }

  .vc-platoon-calendar .vc-platoon-day-number {
    font-size: 0.9rem;
    font-weight: 600;
  }

  .vc-platoon-calendar .vc-platoon-letter {
    color: currentColor;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    opacity: 0.8;
  }

  .vc-platoon-calendar [data-vc-date-month="current"]:not([data-vc-date-disabled]):not([data-vc-date-selected]) .vc-platoon-decorated[data-platoon-letter="A"] {
    color: var(--vc-platoon-a);
  }

  .vc-platoon-calendar [data-vc-date-month="current"]:not([data-vc-date-disabled]):not([data-vc-date-selected]) .vc-platoon-decorated[data-platoon-letter="B"] {
    color: var(--vc-platoon-b);
  }

  .vc-platoon-calendar [data-vc-date-month="current"]:not([data-vc-date-disabled]):not([data-vc-date-selected]) .vc-platoon-decorated[data-platoon-letter="C"] {
    color: var(--vc-platoon-c);
  }

  .vc-platoon-calendar [data-vc-date-month="current"][data-vc-date-disabled] .vc-platoon-decorated {
    opacity: 0.55;
  }

  .vc-platoon-calendar [data-vc-date-month="current"][data-vc-date-disabled] .vc-platoon-decorated[data-platoon-letter="A"] {
    color: var(--vc-platoon-a);
  }

  .vc-platoon-calendar [data-vc-date-month="current"][data-vc-date-disabled] .vc-platoon-decorated[data-platoon-letter="B"] {
    color: var(--vc-platoon-b);
  }

  .vc-platoon-calendar [data-vc-date-month="current"][data-vc-date-disabled] .vc-platoon-decorated[data-platoon-letter="C"] {
    color: var(--vc-platoon-c);
  }

  .vc-platoon-calendar [data-vc-date-month="current"][data-vc-date-selected] .vc-platoon-decorated[data-platoon-letter="A"] {
    background-color: rgba(220, 38, 38, 0.12);
    box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.28);
    color: var(--vc-platoon-a);
  }

  .vc-platoon-calendar [data-vc-date-month="current"][data-vc-date-selected] .vc-platoon-decorated[data-platoon-letter="B"] {
    background-color: rgba(37, 99, 235, 0.12);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.28);
    color: var(--vc-platoon-b);
  }

  .vc-platoon-calendar [data-vc-date-month="current"][data-vc-date-selected] .vc-platoon-decorated[data-platoon-letter="C"] {
    background-color: rgba(22, 163, 74, 0.12);
    box-shadow: inset 0 0 0 1px rgba(22, 163, 74, 0.28);
    color: var(--vc-platoon-c);
  }

  .vc-platoon-calendar [data-vc-date-month="current"][data-vc-date-today] .vc-platoon-decorated {
    box-shadow: none;
    color: rgb(255 255 255);
  }

  .vc-platoon-calendar [data-vc-date-month="current"][data-vc-date-today] .vc-platoon-decorated[data-platoon-letter="A"] {
    background-color: var(--vc-platoon-a);
  }

  .vc-platoon-calendar [data-vc-date-month="current"][data-vc-date-today] .vc-platoon-decorated[data-platoon-letter="B"] {
    background-color: var(--vc-platoon-b);
  }

  .vc-platoon-calendar [data-vc-date-month="current"][data-vc-date-today] .vc-platoon-decorated[data-platoon-letter="C"] {
    background-color: var(--vc-platoon-c);
  }

  /* --- Action Text (Trix) content --------------------------------------- */
  .trix-content {
    line-height: 1.625;
    font-size: 1rem;
  }

  .trix-content ul,
  .trix-content ol {
    margin: 0.75rem 0 0.75rem 1.5rem;
    padding-left: 1.25rem;
    list-style-position: outside;
  }

  .trix-content ul { list-style-type: disc; }
  .trix-content ol { list-style-type: decimal; }

  .trix-content ul ul,
  .trix-content ul ol,
  .trix-content ol ul,
  .trix-content ol ol {
    margin: 0.5rem 0;
  }

  .trix-content li { margin: 0.25rem 0; }

  .trix-content h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
  }

  .trix-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1.25rem 0 0.75rem;
  }

  .trix-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
  }

  .trix-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem;
  }

  .trix-content h5 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .trix-content h6 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0.5rem 0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .trix-content blockquote {
    border-left: 4px solid rgba(107, 114, 128, 0.4);
    padding-left: 1rem;
    font-style: italic;
    color: rgba(75, 85, 99, 1);
    background-color: rgba(107, 114, 128, 0.08);
    margin: 1rem 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .dark .trix-content blockquote {
    border-left-color: rgba(156, 163, 175, 0.5);
    background-color: rgba(107, 114, 128, 0.15);
    color: rgba(209, 213, 219, 1);
  }

  /* --- Action Text (Trix) toolbar + dialog — dark mode ------------------ */
  /* Default Trix ships black icon SVGs, light-grey group borders, a light-blue
     active state, and a white link dialog — all unreadable or off-theme in
     dark mode. Recolor to the design tokens. These override the unlayered
     trix.css (app/assets/stylesheets/actiontext.css), so rules that compete
     with a trix.css declaration use !important; the icon filter (a property
     trix.css doesn't set) does not need it. */
  .dark trix-toolbar .trix-button--icon::before {
    filter: invert(1);
  }

  .dark trix-toolbar .trix-button-group {
    border-color: var(--border) !important;
  }

  .dark trix-toolbar .trix-button {
    border-bottom-color: var(--border) !important;
    color: var(--foreground) !important;
  }

  .dark trix-toolbar .trix-button:not(:first-child) {
    border-left-color: var(--border) !important;
  }

  .dark trix-toolbar .trix-button:not(:disabled):not(.trix-active):hover {
    background-color: color-mix(in oklab, white 8%, transparent) !important;
  }

  .dark trix-toolbar .trix-button.trix-active {
    background-color: color-mix(in oklab, var(--primary) 35%, transparent) !important;
    color: var(--foreground) !important;
  }

  /* Link dialog → dark surface + readable input (was a white popup). */
  .dark trix-toolbar .trix-dialog {
    background-color: var(--popover) !important;
    border-top-color: var(--border) !important;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7) !important;
    color: var(--foreground);
  }

  .dark trix-toolbar .trix-input--dialog {
    background-color: var(--input) !important;
    border-color: var(--border) !important;
    color: var(--foreground) !important;
  }

}

/* -------------------------------------------------------------------------- */
/* Toast opacity                                                              */
/* -------------------------------------------------------------------------- */
/* Toasts float over arbitrary page content (tables, avatar stacks, cards), so
   their background must be fully opaque or that content bleeds through and the
   toast looks like it is rendering *under* the page. KTUI's `kt-alert-light`
   styling is built for inline alerts sitting on a solid surface, so it leaves
   some variants translucent: destructive/primary mix their tint at 5% over
   `transparent` in every theme, and all variants do so (at 30%) in dark mode.
   Re-mix the exact same tints over the solid page background instead of
   `transparent` — identical color, but opaque. Scoped to `.kt-toast` so inline
   alerts (which are fine on a solid surface) are untouched. Higher specificity
   than KTUI's rules + loaded after styles.css, so these win within the layer. */
@layer components {
  .kt-toast.kt-alert-light.kt-alert-destructive {
    background-color: color-mix(in oklab, var(--destructive) 5%, var(--background));
  }
  .kt-toast.kt-alert-light.kt-alert-primary {
    background-color: color-mix(in oklab, var(--primary) 5%, var(--background));
  }

  .dark .kt-toast.kt-alert-light.kt-alert-success {
    background-color: color-mix(in oklab, var(--color-green-950) 30%, var(--background));
  }
  .dark .kt-toast.kt-alert-light.kt-alert-warning {
    background-color: color-mix(in oklab, var(--color-yellow-950) 30%, var(--background));
  }
  .dark .kt-toast.kt-alert-light.kt-alert-info {
    background-color: color-mix(in oklab, var(--color-violet-950) 30%, var(--background));
  }
  .dark .kt-toast.kt-alert-light.kt-alert-destructive {
    background-color: color-mix(in oklab, var(--destructive) 5%, var(--background));
  }
  .dark .kt-toast.kt-alert-light.kt-alert-primary {
    background-color: color-mix(in oklab, var(--primary) 5%, var(--background));
  }

  /* Respect reduced-motion: KTUI animates toasts in with a slide+fade
     (`kt-toast-in`), animates them out on close, and transitions their position
     as the stack shifts. Disable all of it for users who ask for less motion.
     The base `.kt-toast` starts at opacity:0 and relies on the animation to fade
     in, so pin opacity:1 or the toast would never appear. KTUI's JS sets both
     the close animation (`element.style.animation = "kt-toast-out ..."`) and the
     reposition `transition` inline, so `animation`/`transition` need `!important`
     to override them. */
  @media (prefers-reduced-motion: reduce) {
    .kt-toast {
      animation: none !important;
      opacity: 1;
      transition: none !important;
    }
  }
}

/* -------------------------------------------------------------------------- */
/* Event-show admin notice opacity                                            */
/* -------------------------------------------------------------------------- */
/* The "Admin only" / "Admin managed" notice on the event page sits over the
   dark `iq-aurora-bg` gradient. KTUI's `kt-alert-light` tints are translucent
   (mixed over `transparent`), so in dark mode the aurora bleeds through and the
   callout reads muddy and low-contrast. Re-mix the identical tint over the solid
   page background — same color, but opaque — exactly as the `.kt-toast` override
   above. Light mode is already opaque (warning uses yellow-50, and a 5% primary
   tint over the solid light page is fine), so only dark needs this. */
@layer components {
  .dark .event-admin-notice.kt-alert-warning {
    background-color: color-mix(in oklab, var(--color-yellow-950) 30%, var(--background));
  }
  .dark .event-admin-notice.kt-alert-primary {
    background-color: color-mix(in oklab, var(--primary) 5%, var(--background));
  }
}

/* -------------------------------------------------------------------------- */
/* Classic Assignment Planner person colors                                   */
/* -------------------------------------------------------------------------- */
/* The Classic Mode overlay color-codes people like the legacy ColdFusion
   planner: EMSRs blue, ARC participants red (legacy palette). Those exact
   values sit on white; dark mode needs lighter mixes of the same hues to keep
   contrast against the dark modal background. */
@layer components {
  .classic-person-emsr {
    color: rgb(0, 136, 204);
  }
  .classic-person-arc {
    color: rgb(210, 50, 45);
  }
  .dark .classic-person-emsr {
    color: rgb(87, 186, 233);
  }
  .dark .classic-person-arc {
    color: rgb(238, 113, 107);
  }

  /* Published-assignments warning banner at the top of the overlay. This app
     has no `dark:` Tailwind variant; dark mode is styled with `.dark`
     descendant selectors, mixing the tint over the solid background like the
     event-admin-notice above. */
  .classic-published-banner {
    background-color: var(--color-yellow-50);
    border-color: var(--color-yellow-300);
    color: var(--color-yellow-800);
  }
  .dark .classic-published-banner {
    background-color: color-mix(in oklab, var(--color-yellow-950) 30%, var(--background));
    border-color: color-mix(in oklab, var(--color-yellow-500) 35%, var(--background));
    color: var(--color-yellow-300);
  }
}
