:root {
  box-sizing: border-box;
}

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

/* ============================================================================
 * MyPortal responsive breakpoints — see docs/MOBILE_UX_GUIDELINES.md
 *   mobile  : max-width 640px  (phones)
 *   tablet  : max-width 1024px (tablets, sidebar still off-canvas)
 *   desktop : min-width 1025px (full layout)
 * Use the utility classes below in templates instead of inventing new media
 * queries so that mobile behaviour stays consistent across the app.
 * ============================================================================ */

/* Hide on mobile only (≤640px) */
.u-hide-mobile {
}
@media (max-width: 640px) {
  .u-hide-mobile {
    display: none !important;
  }
}

/* Show on mobile only (hidden ≥641px) */
.u-only-mobile {
}
@media (min-width: 641px) {
  .u-only-mobile {
    display: none !important;
  }
}

/* Hide on tablet and below (≤1024px) — desktop-only flourishes */
@media (max-width: 1024px) {
  .u-hide-tablet {
    display: none !important;
  }
}

/* Hide low-priority content on phones */
@media (max-width: 640px) {
  .u-priority-low {
    display: none !important;
  }
}

/* Hide secondary content on small phones (≤480px) */
@media (max-width: 480px) {
  .u-priority-secondary {
    display: none !important;
  }
}

/* Standardised data-mobile-hidden — fires at ≤640px in any orientation. */
@media (max-width: 640px) {
  [data-mobile-hidden='true'] {
    display: none !important;
  }
}

/* Opt-in portrait-only variant for the rare cases that need it. */
@media (max-width: 720px) and (orientation: portrait) {
  [data-mobile-hidden='portrait'] {
    display: none !important;
  }
}

:root {
  color-scheme: light dark;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #111827;
  color: #f9fafb;
  --space-compact: max(0.35rem, 5px);
  --space-compact-inline: max(0.45rem, 5px);
  --space-gap-tight: max(0.35rem, 5px);
  --space-gap-base: max(0.5rem, 5px);
  --space-gap-roomy: max(0.65rem, 7px);
}

body {
  margin: 0;
  background: linear-gradient(135deg, #0f172a, #1f2937);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

html {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.layout {
  display: flex;
  width: 100%;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.layout__sidebar {
  width: clamp(240px, 22vw + 120px, 280px);
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  padding: var(--space-compact-inline);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
  max-height: 100vh;
  overflow-y: auto;
}

.layout__scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.layout--sidebar-open .layout__scrim {
  opacity: 1;
  pointer-events: auto;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
  margin-bottom: var(--space-gap-base);
}

.brand__logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.2);
}

.brand__name {
  font-size: 1.25rem;
  font-weight: 600;
}

.company-switcher {
  margin-bottom: var(--space-gap-base);
  padding: var(--space-compact);
  border-radius: 0.5rem;
  background: rgba(148, 163, 184, 0.08);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.company-switcher__label {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.8);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.company-switcher__field {
  position: relative;
}

.company-switcher__field::after {
  content: '';
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(226, 232, 240, 0.7);
  pointer-events: none;
}

.company-switcher__select {
  width: 100%;
  appearance: none;
  padding: 0.55rem 2rem 0.55rem 0.6rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.85);
  color: #f8fafc;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 2.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.company-switcher__select:focus {
  outline: none;
  border-color: rgba(125, 211, 252, 0.65);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.menu__item a {
  color: #e5e7eb;
  text-decoration: none;
  padding: var(--space-compact) var(--space-compact-inline);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
  background: rgba(148, 163, 184, 0.08);
  transition: background 0.2s ease;
}

.menu__item a:hover,
.menu__item a:focus {
  background: rgba(148, 163, 184, 0.25);
}

.menu__icon {
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu__icon svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
  opacity: 0.85;
}

.menu__label {
  font-weight: 500;
}

.menu__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: var(--space-gap-tight);
  padding: 0 var(--space-gap-tight);
  min-width: 1.5rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  color: #f8fafc;
  font-size: 0.75rem;
  line-height: 1.6;
}

.menu__item--impersonation {
  padding: var(--space-gap-tight) var(--space-compact-inline);
  background: rgba(148, 163, 184, 0.08);
  border-radius: 0.75rem;
}

.menu__divider {
  height: 1px;
  margin: 0.25rem 0;
  background: rgba(148, 163, 184, 0.35);
}

.menu__spacer {
  height: 0.75rem;
}

.menu__heading {
  padding: 0.25rem var(--space-compact-inline);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(226, 232, 240, 0.7);
}


.sidebar__footer {
  margin-top: auto;
  padding-top: var(--space-gap-base);
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
}

.sidebar__footer-link,
.sidebar__footer-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  color: #e5e7eb;
  background: rgba(148, 163, 184, 0.08);
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar__footer-button {
  border: none;
  padding: 0;
  cursor: pointer;
}

.sidebar__footer-link:hover,
.sidebar__footer-link:focus-visible,
.sidebar__footer-button:hover,
.sidebar__footer-button:focus-visible {
  background: rgba(148, 163, 184, 0.25);
  color: #f8fafc;
  outline: none;
}

.sidebar__footer-button:focus-visible {
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.4);
}

.sidebar__footer-icon {
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  min-height: 1.25rem;
  max-width: 1.25rem;
  max-height: 1.25rem;
  flex: 0 0 1.25rem;
  aspect-ratio: 1 / 1;
  display: block;
  fill: currentColor;
}

.impersonation-exit {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.impersonation-exit__button {
  width: 100%;
  justify-content: center;
}

.impersonation-exit__context {
  margin: 0;
  font-size: 0.85rem;
  color: #fef2f2;
  line-height: 1.4;
}

.impersonation-exit__separator {
  margin: 0 0.35rem;
}

.impersonation-access-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.impersonation-access-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.button,
.button-link {
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
}

.button {
  padding: var(--space-gap-tight) calc(var(--space-gap-roomy) * 1.2);
  color: #0f172a;
  background: #38bdf8;
  border: none;
  box-shadow: 0 18px 30px -18px rgba(56, 189, 248, 0.8);
}

.button--icon {
  padding: 0.35rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.button--icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

.button:focus,
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 36px -16px rgba(56, 189, 248, 0.9);
}

.button:focus-visible {
  outline: 3px solid rgba(148, 163, 184, 0.35);
  outline-offset: 2px;
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button-link {
  background: none;
  border: none;
  color: #38bdf8;
  padding: 0;
  text-decoration: none;
}

.button-link:hover,
.button-link:focus {
  color: #7dd3fc;
  text-decoration: underline;
}

.button-link:focus-visible {
  outline: 2px solid rgba(148, 163, 184, 0.6);
  outline-offset: 2px;
}

.auth-card {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 1.25rem;
  padding: calc(var(--space-gap-roomy) * 2.5);
  box-shadow: 0 30px 60px -30px rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.auth-card__header {
  margin-bottom: calc(var(--space-gap-roomy) * 2);
}

.auth-card__title {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

.auth-card__subtitle {
  margin: var(--space-gap-tight) 0 0;
  color: rgba(226, 232, 240, 0.85);
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-roomy);
}

.auth-form.is-loading {
  opacity: 0.85;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
  min-width: 0;
}

.form-field__label {
  font-weight: 600;
  color: #e2e8f0;
  font-size: 0.95rem;
}

.form-field__hint {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.85);
  margin: 0;
  line-height: 1.4;
}

.form-label {
  font-weight: 600;
  color: #e2e8f0;
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-gap-tight);
}

.form-input-wrapper {
  position: relative;
}

.form-input {
  width: 100%;
  padding: var(--space-gap-tight) var(--space-gap-base);
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.75);
  color: #f8fafc;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rich-text-editor {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.6);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.rich-text-editor:focus-within {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.rich-text-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.4rem 0.5rem;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.rich-text-editor__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.35rem 0.55rem;
  border: none;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.rich-text-editor__button:hover,
.rich-text-editor__button:focus-visible {
  background: rgba(56, 189, 248, 0.2);
  color: #f8fafc;
  outline: none;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35);
}

.rich-text-editor__button span {
  pointer-events: none;
}

.rich-text-editor [data-rich-text-content] {
  display: none;
}

.rich-text-editor--enhanced [data-rich-text-content] {
  display: block;
}

.rich-text-editor--enhanced [data-rich-text-fallback] {
  display: none;
}

.rich-text-editor__surface {
  min-height: 10.5rem;
  padding: var(--space-gap-base);
  color: #f8fafc;
  line-height: 1.6;
  font-size: 1rem;
  background: rgba(15, 23, 42, 0.3);
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  resize: vertical;
}

.rich-text-editor__fallback {
  min-height: 10.5rem;
  font: inherit;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.3);
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  padding: 0.85rem 1rem;
  resize: vertical;
}

.rich-text-editor__surface a {
  color: #38bdf8;
  text-decoration: underline;
}

.rich-text-editor__surface code {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 0.4rem;
  padding: 0.1rem 0.35rem;
  font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
}

.rich-text-editor__surface pre {
  background: rgba(15, 23, 42, 0.75);
  border-radius: 0.6rem;
  padding: 0.75rem;
  overflow-x: auto;
  font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
}

.rich-text-editor__surface--empty::before {
  content: attr(data-placeholder);
  color: rgba(148, 163, 184, 0.75);
  pointer-events: none;
}

.rich-text-viewer {
  color: #e2e8f0;
  line-height: 1.6;
  font-size: 0.975rem;
  display: grid;
  gap: 0.75rem;
}

.rich-text-viewer p {
  margin: 0;
}

.rich-text-viewer ul,
.rich-text-viewer ol {
  margin: 0;
  padding-left: 1.4rem;
  display: grid;
  gap: 0.4rem;
}

.rich-text-viewer blockquote {
  margin: 0;
  padding-left: 1rem;
  border-left: 3px solid rgba(148, 163, 184, 0.4);
  color: rgba(226, 232, 240, 0.85);
  font-style: italic;
}

.rich-text-viewer code {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 0.4rem;
  padding: 0.15rem 0.4rem;
  font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
}

.rich-text-viewer pre {
  margin: 0;
  background: rgba(15, 23, 42, 0.75);
  border-radius: 0.6rem;
  padding: 0.85rem;
  overflow-x: auto;
  font-family: "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9rem;
}

.rich-text-viewer a {
  color: #38bdf8;
  text-decoration: underline;
}

.ticket-reference-link,
.ticket-reference-link:visited,
.rich-text-viewer a.ticket-reference-link,
.rich-text-viewer a.ticket-reference-link:visited {
  color: #f8fafc !important;
}

.ticket-reference-link:hover,
.ticket-reference-link:focus,
.rich-text-viewer a.ticket-reference-link:hover,
.rich-text-viewer a.ticket-reference-link:focus {
  color: #ffffff !important;
}

.rich-text-viewer table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(15, 23, 42, 0.55);
  border-radius: 0.6rem;
  overflow: hidden;
}

.rich-text-viewer th,
.rich-text-viewer td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  text-align: left;
}

.rich-text-viewer tr:last-child th,
.rich-text-viewer tr:last-child td {
  border-bottom: none;
}

.input {
  padding: var(--space-gap-tight) var(--space-gap-base);
  border-radius: 0.8rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.7);
  color: #f8fafc;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.form-input:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.form-help {
  margin: -0.5rem 0 0;
  color: rgba(148, 163, 184, 0.85);
  font-size: 0.9rem;
  line-height: 1.4;
}

.form-checkboxes {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
  margin-top: 0.5rem;
}

.form-checkbox {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: var(--space-gap-base);
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.form-checkbox:hover {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.7);
}

.form-checkbox input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.form-checkbox > span:first-of-type {
  display: flex;
  align-items: center;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.95);
}

.form-checkbox > span:last-of-type {
  margin-left: 1.625rem;
  font-size: 0.875rem;
  color: rgba(148, 163, 184, 0.75);
  line-height: 1.4;
}

.form-checkboxes--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-gap-base);
  margin-top: 0.5rem;
}

@media (max-width: 768px) {
  .form-checkboxes--grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .form-checkboxes--grid {
    grid-template-columns: 1fr;
  }
}

.form-error,
.form-success,
.form-reset-prompt {
  border-radius: 0.85rem;
  padding: var(--space-gap-tight) var(--space-gap-base);
  font-weight: 600;
}

.form-error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.form-reset-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-gap-base);
  background: rgba(96, 165, 250, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.38);
  color: #dbeafe;
}

.form-reset-prompt p {
  margin: 0;
}

.form-success {
  background: rgba(134, 239, 172, 0.16);
  border: 1px solid rgba(134, 239, 172, 0.38);
  color: #bbf7d0;
}

.form-error[hidden],
.form-success[hidden],
.form-reset-prompt[hidden] {
  display: none;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: var(--space-gap-roomy);
  justify-content: flex-end;
}

.form-actions__group {
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
}

.automation-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.automation-action {
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  overflow: hidden;
}

.automation-action__header {
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
  padding: var(--space-gap-tight) var(--space-gap-base);
}

.automation-action__header-note {
  flex: 1 1 auto;
  min-width: 0;
}

.automation-action__toggle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 0.5rem;
  cursor: pointer;
  color: #94a3b8;
  padding: 0.3rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.automation-action__toggle:hover {
  color: #f8fafc;
  border-color: rgba(148, 163, 184, 0.6);
}

.automation-action__toggle svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.2s ease;
  display: block;
}

.automation-action__toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.automation-action__body {
  padding: var(--space-gap-tight) var(--space-gap-base) var(--space-gap-base);
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.automation-action__body[hidden] {
  display: none;
}

.automation-action__columns {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

@media (min-width: 720px) {
  .automation-action__columns {
    flex-direction: row;
    align-items: flex-start;
  }
}

.automation-action__left {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
  width: 100%;
}

@media (min-width: 720px) {
  .automation-action__left {
    width: 140px;
    flex: 0 0 140px;
  }
}

.automation-action__right {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
  flex: 1 1 auto;
  min-width: 0;
}

.automation-action__payload {
  resize: vertical;
  width: 100%;
  min-height: 80px;
  box-sizing: border-box;
}

.automation-action__remove {
  margin-top: auto;
}

.form-quick-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-gap-tight);
  margin-bottom: var(--space-gap-tight);
}

.form-quick-add__select {
  flex: 1 1 220px;
  min-width: 200px;
}

.form-quick-add .button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.form-help--error,
.form-help[data-action-error]:not([hidden]) {
  color: #fecaca;
}

.form-actions--inline {
  justify-content: flex-start;
}

.form-input--textarea {
  resize: vertical;
  min-height: 140px;
}

.form-input--multiselect {
  min-height: 160px;
  padding: 0.5rem;
}

.form-input--multiselect option {
  padding: 0.25rem 0.5rem;
}

.form-actions--stacked {
  justify-content: flex-start;
}

.form-grid {
  display: grid;
  gap: calc(var(--space-gap-roomy) * 1.25);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.staff-form-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.staff-form-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.22), transparent 55%);
  pointer-events: none;
}

.staff-form-card > * {
  position: relative;
  z-index: 1;
}

.staff-form {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  width: 100%;
}

.staff-form .form-field,
.staff-form .form-field--checkbox {
  margin: 0;
}

.staff-form__section {
  grid-column: 1 / -1;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.85rem;
  padding: var(--space-gap-base);
  margin: 0;
}

.staff-form__section-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-gap-base);
}

.staff-custom-field-row {
  display: flex;
  gap: var(--space-gap-base);
  flex-wrap: wrap;
}

.staff-form > .staff-custom-field-row {
  grid-column: 1 / -1;
}

.staff-custom-field-row > .form-field,
.staff-custom-field-row > .form-field--checkbox {
  flex: 1 1 0;
  min-width: 0;
}

.staff-custom-field-row + .staff-custom-field-row {
  margin-top: var(--space-gap-base);
}

.staff-form__actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .staff-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .auth-card {
    padding: 1.75rem;
  }

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

  .layout__header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-gap-roomy);
  }
}

.layout__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: calc(100vw - 280px);
}

.layout__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-compact) var(--space-compact-inline);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  gap: var(--space-gap-tight);
  position: relative;
  z-index: 100;
}

.header__leading {
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
  min-width: 0;
  flex: 1 1 auto;
}

.header__title {
  font-size: 1.1rem;
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
  flex-wrap: wrap;
  overflow: visible;
}

.header__title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
}

.header__title-button {
  flex: 0 0 auto;
  max-width: 100%;
}

.header__title-link {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.header__title-content {
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
  min-width: 0;
  width: 100%;
}

.header__title-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-gap-tight);
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header__title-actions .header__title-button {
  margin-left: 0;
}

.header__title-content--spread {
  width: 100%;
}

.header__title-content--spread .header__title-button {
  margin-inline-start: auto;
}

.header__title-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
}

.header__title-content .header__title-button {
  margin-left: auto;
}

.header__title > * {
  min-width: 0;
}

.header-title-menu {
  display: inline-flex;
  align-items: center;
  gap: var(--space-gap-tight);
  width: 100%;
}

.header-title-menu__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-title-menu__dropdown {
  position: relative;
  flex: 0 0 auto;
}

.header-title-menu__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 0.75rem;
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: #e2e8f0;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1.2;
  font-weight: 500;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease,
    box-shadow 0.2s ease;
  list-style: none;
}

.header-title-menu__toggle:hover,
.header-title-menu__toggle:focus-visible {
  background: rgba(148, 163, 184, 0.24);
  border-color: rgba(148, 163, 184, 0.4);
  color: #f8fafc;
  box-shadow: 0 0 0 2px rgba(94, 234, 212, 0.18);
  outline: none;
}

.header-title-menu__toggle::-webkit-details-marker,
.header-title-menu__toggle::marker {
  display: none;
}

.header-title-menu__icon {
  width: 0.9rem;
  height: 0.9rem;
  transition: transform 0.2s ease;
}

[data-header-menu][open] .header-title-menu__icon {
  transform: rotate(180deg);
}

.header-title-menu__list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 13rem;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 0.75rem;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 40;
  overflow: hidden;
}

.header-title-menu__item {
  list-style: none;
}

.header-title-menu__form {
  display: contents;
}

.header-title-menu__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.6rem;
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s ease, color 0.2s ease;
  background-color: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
}

button.header-title-menu__link,
.header-title-menu__form .header-title-menu__link {
  width: 100%;
}

.header-title-menu__link--danger {
  color: #fecaca;
}

.header-title-menu__link--danger:hover,
.header-title-menu__link--danger:focus-visible {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}

.header-title-menu__link--danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.header-title-menu__link:hover,
.header-title-menu__link:focus-visible {
  background: rgba(148, 163, 184, 0.18);
  color: #f8fafc;
  outline: none;
}

@media (max-width: 768px) {
  .header-title-menu {
    flex-wrap: wrap;
  }

  .header-title-menu__label {
    flex-basis: 100%;
    white-space: normal;
  }
  white-space: nowrap;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
}

.layout__mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.8rem;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.layout__mobile-toggle svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: currentColor;
}

.layout__mobile-toggle:hover,
.layout__mobile-toggle:focus-visible {
  background: rgba(148, 163, 184, 0.25);
  border-color: rgba(148, 163, 184, 0.4);
  transform: translateY(-1px);
  outline: none;
}

.layout__mobile-toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35);
}

.header-actions .input {
  min-width: 220px;
}

.layout__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  --layout-content-padding-top: var(--space-compact);
  --layout-content-padding-inline: var(--space-compact-inline);
  --layout-content-padding-bottom: var(--space-compact);
  padding: var(--layout-content-padding-top)
    var(--layout-content-padding-inline)
    var(--layout-content-padding-bottom);
  overflow-y: auto;
  max-width: 100%;
  overflow-x: hidden;
}

.pull-refresh-banner {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 0 var(--space-gap-tight);
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(14, 116, 144, 0.9);
  color: #f0f9ff;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 8px 20px -16px rgba(12, 74, 110, 0.8);
}

.update-banner {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.85);
  padding: var(--space-gap-tight);
  margin-bottom: var(--space-gap-base);
  box-shadow: 0 18px 35px -25px rgba(15, 23, 42, 0.8);
}

.update-banner__body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-gap-tight);
}

.update-banner__copy {
  flex: 1 1 240px;
  color: #e2e8f0;
}

.update-banner__title {
  margin: 0 0 0.15rem;
  font-weight: 700;
  font-size: 1rem;
}

.update-banner__message {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(226, 232, 240, 0.8);
}

.update-banner__actions {
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .update-banner__actions {
    width: 100%;
    justify-content: flex-start;
  }
}

.dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2.5rem) clamp(1rem, 3vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: clamp(var(--space-gap-base), 1.75vw, 1.75rem);
  box-sizing: border-box;
}

.dashboard__section--agent {
  margin-bottom: clamp(var(--space-gap-base), 2vw, 2rem);
}

.agent-panel {
  display: flex;
  flex-direction: column;
  gap: clamp(var(--space-gap-tight), 1vw, var(--space-gap-base));
}

.agent-panel--busy {
  opacity: 0.85;
}

.agent-panel__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.agent-panel__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.agent-panel__subtitle {
  margin: 0;
  color: rgba(226, 232, 240, 0.75);
  font-size: 0.92rem;
  max-width: 60ch;
}

.agent-panel__form {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.agent-panel__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.65);
}

.agent-panel__controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-tight);
  align-items: stretch;
}

.agent-panel__input {
  flex: 1 1 280px;
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  color: #f8fafc;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.agent-panel__input:focus-visible {
  outline: none;
  border-color: rgba(56, 189, 248, 0.65);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}

.agent-panel__input:disabled {
  opacity: 0.75;
}

.agent-panel__submit {
  padding-inline: clamp(1rem, 2vw, 1.65rem);
  min-height: 2.75rem;
}

.agent-panel__hint {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.6);
}

.agent-panel__status {
  min-height: 1.5rem;
  font-size: 0.85rem;
  color: rgba(248, 250, 252, 0.85);
}

.agent-panel__results {
  display: flex;
  flex-direction: column;
  gap: clamp(var(--space-gap-tight), 1vw, var(--space-gap-base));
}

.agent-answer {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.agent-answer__heading,
.agent-sources__heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.agent-answer__body {
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(248, 250, 252, 0.92);
  white-space: pre-wrap;
}

.agent-answer__paragraph {
  margin: 0 0 var(--space-gap-tight);
}

.agent-sources {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.agent-sources__lists {
  display: grid;
  gap: clamp(var(--space-gap-tight), 1vw, var(--space-gap-base));
}

.agent-sources__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.agent-sources__title {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.75);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.agent-sources__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-gap-tight);
}

.agent-sources__item {
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(248, 250, 252, 0.88);
}

.agent-sources__item a {
  color: #38bdf8;
  text-decoration: none;
}

.agent-sources__item a:hover,
.agent-sources__item a:focus-visible {
  text-decoration: underline;
}

.agent-sources__meta {
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: rgba(226, 232, 240, 0.65);
}

.agent-panel__actions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(226, 232, 240, 0.1);
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

@media (max-width: 720px) {
  .agent-panel__controls {
    flex-direction: column;
  }

  .agent-panel__submit {
    width: 100%;
  }

  .agent-panel__input {
    width: 100%;
  }
}

.dashboard__lead {
  font-size: 1rem;
  color: rgba(229, 231, 235, 0.85);
}

.dashboard__grid {
  display: grid;
  gap: clamp(var(--space-gap-base), 1.5vw, 1.5rem);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: rgba(30, 41, 59, 0.85);
  border-radius: 0.75rem;
  padding: clamp(0.9rem, 2vw, 1.5rem);
  box-shadow: 0 16px 32px -28px rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.card--full {
  grid-column: 1 / -1;
}

.card--panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.card-collapsible {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-gap-base);
}

.card__title-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.card__header--stacked {
  flex-direction: column;
  align-items: stretch;
}

.card__header--collapsible {
  list-style: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
}

.card__header--collapsible::-webkit-details-marker {
  display: none;
}

.card__header--collapsible:focus-visible {
  outline: 3px solid rgba(148, 163, 184, 0.35);
  outline-offset: 2px;
  border-radius: 0.75rem;
}

.card__collapsible-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.card__toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: rgba(226, 232, 240, 0.9);
  transition: transform 0.2s ease, background 0.2s ease;
  font-size: 0.9rem;
}

.card__toggle-icon::before {
  content: '\25BC';
}

.card__header--collapsible:hover .card__toggle-icon,
.card__header--collapsible:focus-visible .card__toggle-icon {
  background: rgba(148, 163, 184, 0.3);
}

.card-collapsible[open] .card__toggle-icon {
  transform: rotate(180deg);
}

.card-collapsible__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
  min-width: 0;
}

.ticket-description-summary {
  align-items: flex-start;
}

.ticket-description-summary__main {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  gap: 0.75rem;
}

.ticket-description-summary__preview {
  display: -webkit-box;
  max-height: 7.5em;
  overflow: hidden;
  color: rgba(226, 232, 240, 0.82);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
}

.ticket-description-summary__preview > :first-child {
  margin-top: 0;
}

.ticket-description-summary__preview > :last-child {
  margin-bottom: 0;
}

.card-collapsible[open] .ticket-description-summary__preview {
  display: none;
}

@media (max-width: 1024px) {
  .layout {
    overflow: visible;
  }

  .layout__sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: min(280px, 82vw);
    max-width: 82vw;
    z-index: 1100;
    padding-top: calc(var(--space-gap-roomy) * 2.8);
    padding-bottom: calc(var(--space-gap-roomy) * 2.8);
    box-shadow: 0 25px 45px -30px rgba(15, 23, 42, 0.9);
  }

  .layout--sidebar-open .layout__sidebar {
    transform: translateX(0);
  }

  .layout__main {
    max-width: 100%;
    width: 100%;
  }

  .layout__header {
    position: sticky;
    top: 0;
    z-index: 900;
  }

  .layout__mobile-toggle {
    display: inline-flex;
  }
}

@media (max-width: 720px) {
  .layout__sidebar {
    width: min(260px, 86vw);
  }

  .layout,
  .layout__main,
  .layout__content {
    width: 100%;
    max-width: 100vw;
  }
}

.card__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.card__subtitle {
  margin: 0.35rem 0 0;
  color: rgba(226, 232, 240, 0.75);
  font-size: 0.95rem;
}

.dashboard__section {
  display: flex;
  flex-direction: column;
  gap: clamp(var(--space-gap-tight), 1vw, 1.25rem);
}

.dashboard__section-header {
  display: flex;
  flex-direction: column;
  gap: clamp(var(--space-gap-tight), 1vw, 1rem);
}

.dashboard__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.dashboard__heading {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.dashboard__subtitle {
  margin: 0;
  color: rgba(226, 232, 240, 0.7);
  font-size: 0.85rem;
}

.dashboard__grid--summary {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.dashboard__grid--company {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.dashboard__grid--metrics {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.dashboard__column {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.summary-card {
  display: grid;
  gap: clamp(var(--space-compact), 0.9vw, var(--space-gap-base));
  min-height: 100%;
  align-content: start;
}

.summary-card--compact {
  gap: clamp(var(--space-compact), 0.75vw, var(--space-gap-tight));
}

.summary-card__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(226, 232, 240, 0.7);
}

.summary-card__value {
  font-size: 1.4rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.4;
  display: block;
}

.summary-card__meta {
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.72);
  line-height: 1.45;
  display: block;
}

.status-card {
  display: flex;
  flex-direction: column;
  gap: clamp(0.6rem, 1vw, 1.1rem);
}

.status-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.status-card__highlight {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f8fafc;
}

.status-card__meta {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.65);
}

.status-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.status-list--compact {
  gap: 0.25rem;
}

.status-list__row,
.status-list__item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.status-list__label,
.status-list__value,
.status-list__row dt,
.status-list__row dd {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.85);
}

.status-list__value,
.status-list__row dd {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #f8fafc;
}

.dashboard__empty {
  margin: 0;
  padding: var(--space-compact) var(--space-compact-inline);
  border-radius: 0.5rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(148, 163, 184, 0.3);
  color: rgba(226, 232, 240, 0.7);
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .dashboard__section-header {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: clamp(var(--space-gap-tight), 1vw, 1rem);
  }

  .dashboard__subtitle {
    font-size: 0.9rem;
  }
}

.card__controls {
  display: flex;
  align-items: center;
  gap: var(--space-gap-roomy);
}

.card__controls--align-end {
  justify-content: flex-end;
}

.card__control {
  margin: 0;
}

.invoice-summary {
  display: grid;
  gap: var(--space-gap-roomy);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  padding-top: 0.5rem;
}

.invoice-summary__item {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.9rem;
  padding: var(--space-gap-base) var(--space-gap-roomy);
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.invoice-summary__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(148, 163, 184, 0.75);
}

.invoice-summary__value {
  font-size: 1.35rem;
  font-weight: 600;
}

.invoice-summary__value--warning {
  color: #fca5a5;
}

.asset-summary {
  display: grid;
  gap: var(--space-gap-roomy);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.asset-summary__item {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.9rem;
  padding: var(--space-gap-base) var(--space-gap-roomy);
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.asset-summary__label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(148, 163, 184, 0.75);
}

.asset-summary__value {
  font-size: 1.35rem;
  font-weight: 600;
}

.asset-summary__value--warning {
  color: #fca5a5;
}

.asset-columns {
  position: relative;
}

.asset-columns__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.asset-columns__chevron {
  font-size: 0.75rem;
  opacity: 0.7;
}

.asset-columns__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 220px;
  padding: 1rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35);
  z-index: 20;
}

.asset-columns__panel[hidden] {
  display: none;
}

.asset-columns__title {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.9);
}

.asset-columns__options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.asset-columns__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.asset-columns__option input[type='checkbox'] {
  width: 1.1rem;
  height: 1.1rem;
}

.asset-columns--open .asset-columns__toggle {
  background: rgba(148, 163, 184, 0.2);
}

.asset-columns--open .asset-columns__chevron {
  transform: rotate(180deg);
}

.ticket-columns {
  position: relative;
}

.ticket-columns__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.ticket-columns__chevron {
  font-size: 0.75rem;
  opacity: 0.7;
}

.ticket-columns__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 220px;
  padding: 1rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.35);
  z-index: 20;
}

.ticket-columns__panel[hidden] {
  display: none;
}

.ticket-columns__title {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.9);
}

.ticket-columns__options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ticket-columns__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.ticket-columns__option input[type='checkbox'] {
  width: 1.1rem;
  height: 1.1rem;
}

.ticket-columns--open .ticket-columns__toggle {
  background: rgba(148, 163, 184, 0.2);
}

.ticket-columns--open .ticket-columns__chevron {
  transform: rotate(180deg);
}

.ticket-group-by__hint {
  margin: -0.25rem 0 0.75rem;
  color: var(--muted-text, #64748b);
  font-size: 0.85rem;
  line-height: 1.35;
}

.ticket-group-by__clear {
  width: 100%;
  margin-top: 0.75rem;
}

.ticket-group-header__title--nested {
  color: var(--muted-text, #64748b);
  font-weight: 600;
}

.invoice-row--overdue td {
  background: rgba(248, 113, 113, 0.08);
}

.admin-grid {
  display: grid;
  gap: 2rem;
}

.admin-grid--columns {
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  align-items: flex-start;
}

@media (min-width: 1500px) {
  .admin-grid--columns {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-gap-roomy);
}

.stat {
  padding: 0.75rem 1rem;
  border-radius: 0.85rem;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat__label {
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat__value {
  font-size: 1.4rem;
  font-weight: 600;
  color: #f8fafc;
}

@media (max-width: 1080px) {
  .admin-grid--columns {
    grid-template-columns: 1fr;
  }
}

.table-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-roomy);
}

.table-toolbar .inline-form {
  margin-left: auto;
}

.table-wrapper {
  overflow-x: auto;
}

.table-pagination {
  margin-top: var(--space-gap-roomy);
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-gap-roomy);
}

.table-pagination--active {
  display: flex;
}

.table-pagination__group {
  display: flex;
  align-items: center;
  gap: var(--space-gap-base);
}

.table-pagination__button {
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
}

.table-pagination__status {
  font-size: 0.95rem;
  color: rgba(226, 232, 240, 0.8);
  min-height: 1.5rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.table tbody tr {
  transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.table tbody tr:hover {
  background: rgba(56, 189, 248, 0.1);
  box-shadow: inset 3px 0 0 rgba(56, 189, 248, 0.45);
}

.table tbody tr:has(a:hover, button:hover, input:hover, select:hover, textarea:hover) {
  background: rgba(56, 189, 248, 0.12);
}

.tickets-table {
  min-width: 680px;
}

.tickets-table__cell,
.tickets-table__column {
  vertical-align: middle;
}

.tickets-table a,
.table a {
  color: #f8fafc;
  text-decoration: none;
  transition: color 0.2s ease;
}

.tickets-table a:hover,
.table a:hover {
  color: #7dd3fc;
}

.tickets-table a:visited,
.table a:visited {
  color: #e5e7eb;
}

@media (max-width: 640px) {
  .tickets-table {
    min-width: 0;
  }

  .tickets-table__column--select,
  .tickets-table__cell--select,
  .tickets-table__column--status,
  .tickets-table__cell--status,
  .tickets-table__column--priority,
  .tickets-table__cell--priority,
  .tickets-table__column--company,
  .tickets-table__cell--company,
  .tickets-table__column--assigned,
  .tickets-table__cell--assigned,
  .tickets-table__column--updated,
  .tickets-table__cell--updated,
  .tickets-table__column--actions,
  .tickets-table__cell--actions {
    display: none;
  }

  .tickets-table__cell--subject {
    white-space: normal;
  }

  .tickets-table__cell--subject a {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
  }

  .tickets-table__cell--id {
    white-space: nowrap;
  }
}

.table th,
.table td {
  padding: var(--space-gap-tight) var(--space-gap-base);
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

@media (max-width: 720px) {
  .table-wrapper {
    overflow-x: visible;
  }

  .table {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .table th,
  .table td {
    white-space: normal;
    word-break: break-word;
    padding: var(--space-gap-tight) var(--space-gap-tight);
  }
}

/* Note: [data-mobile-hidden='true'] is defined globally near the top of this
 * file (≤640px, any orientation). The rare portrait-only variant uses
 * [data-mobile-hidden='portrait']. */

.table th {
  font-weight: 600;
  color: rgba(248, 250, 252, 0.85);
  cursor: pointer;
  user-select: none;
}

.table th:hover {
  color: #38bdf8;
}

.table__actions {
  text-align: right;
}

.table__col--truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-drag-handle {
  display: inline-flex;
  align-items: center;
  cursor: grab;
  touch-action: none;
  color: rgba(249, 250, 251, 0.4);
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 0.15s;
}

.sidebar-drag-handle:hover {
  color: rgba(249, 250, 251, 0.8);
}

.sidebar-drag-handle:active {
  cursor: grabbing;
}

.sidebar-row--dragging {
  opacity: 0.4;
}

.sidebar-row--drag-over {
  outline: 2px solid rgba(99, 102, 241, 0.7);
  outline-offset: -2px;
}

.table__action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-gap-tight);
}

.table__checkbox {
  width: 3rem;
  text-align: center;
}

.table__checkbox input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
}

.table__empty {
  text-align: center;
  padding: calc(var(--space-gap-roomy) * 2.5);
  color: rgba(148, 163, 184, 0.85);
}

.ticket-assets-linked {
  margin-top: var(--space-gap-base);
  padding: var(--space-gap-base);
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.35);
}

.ticket-assets-linked__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.ticket-assets-linked__item {
  position: relative;
  padding: var(--space-gap-base) calc(var(--space-gap-roomy) * 1.75) var(--space-gap-base) var(--space-gap-base);
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.55);
  box-shadow: 0 16px 32px -22px rgba(14, 165, 233, 0.45);
}

.ticket-assets-linked__name {
  color: #e2e8f0;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-gap-tight);
}

.ticket-assets-linked__name:hover,
.ticket-assets-linked__name:focus {
  text-decoration: underline;
}

.ticket-assets-linked__meta {
  margin: 0;
  color: rgba(148, 163, 184, 0.8);
  font-size: 0.9rem;
}

.ticket-assets-linked__remove {
  position: absolute;
  top: var(--space-gap-tight);
  right: var(--space-gap-tight);
}

.ticket-assets-linked__empty {
  margin: var(--space-gap-base) 0 0;
  color: rgba(148, 163, 184, 0.75);
  font-size: 0.95rem;
}

.ticket-assets-linked__item--actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-gap-base);
  padding-right: var(--space-gap-base);
}

.ticket-assets-linked__item--actions .ticket-assets-linked__name,
.ticket-assets-linked__item--actions .ticket-assets-linked__meta {
  grid-column: 1;
}

.ticket-assets-linked__actions {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: inline-flex;
  align-items: center;
  gap: var(--space-gap-tight);
}

.ticket-assets-linked__action[disabled],
.ticket-assets-linked__action[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.ticket-assets-linked__actions .ticket-assets-linked__remove {
  position: static;
}

@media (max-width: 640px) {
  .ticket-assets-linked__item--actions {
    grid-template-columns: 1fr;
  }

  .ticket-assets-linked__actions {
    grid-column: 1;
    grid-row: auto;
    justify-content: flex-start;
  }
}

.button--ghost {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.4);
  color: #e2e8f0;
  padding: var(--space-gap-tight) var(--space-gap-roomy);
}

.button--ghost:hover,
.button--ghost:focus {
  background: rgba(148, 163, 184, 0.15);
}

.button--danger {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.6);
  padding: var(--space-gap-tight) var(--space-gap-roomy);
}

.button--danger:hover,
.button--danger:focus {
  background: rgba(248, 113, 113, 0.35);
}

.button--secondary {
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: none;
}

.button--secondary:hover,
.button--secondary:focus {
  background: rgba(148, 163, 184, 0.28);
  border-color: rgba(148, 163, 184, 0.45);
  color: #f8fafc;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-base);
  align-items: center;
}

.inline-form--submitting {
  opacity: 0.7;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.inline-form__fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-base);
  align-items: center;
}

.inline-form--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: calc(var(--space-gap-roomy) * 1.1);
}

.ticket-status {
  display: inline-flex;
  width: 100%;
}

.ticket-status__form {
  width: 100%;
}

.ticket-status__form .form-input {
  width: 100%;
  min-width: 10rem;
}

.inline-panel {
  margin-top: var(--space-gap-roomy);
  padding: calc(var(--space-gap-roomy) * 1.1);
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-gap-roomy) * 1.1);
}

.inline-panel__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.usage-list {
  display: grid;
  gap: var(--space-gap-base);
  padding: 0;
  margin: 0;
  list-style: none;
}

.usage-list li {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 1fr);
  gap: var(--space-gap-base);
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.usage-list li:last-child {
  border-bottom: none;
}

.usage-list__ip {
  font-weight: 600;
}

.usage-list__count {
  color: rgba(226, 232, 240, 0.75);
}

.usage-list__time {
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.9rem;
}

.secret-card {
  border-radius: 0.95rem;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(13, 148, 136, 0.15);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-roomy);
}

.secret-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-gap-roomy);
}

.secret-card__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.secret-card__subtitle {
  margin: 0.25rem 0 0;
  color: rgba(226, 232, 240, 0.85);
}

.secret-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.secret-card__value {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 1.05rem;
  word-break: break-all;
  padding: var(--space-gap-tight) var(--space-gap-base);
  background: rgba(15, 23, 42, 0.8);
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.secret-card__hint {
  margin: 0;
  color: rgba(226, 232, 240, 0.75);
  font-size: 0.95rem;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-roomy);
  margin-top: 0.75rem;
}

.timeline__event {
  padding: var(--space-gap-base) var(--space-gap-roomy);
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.15);
  background: rgba(15, 23, 42, 0.65);
}

.timeline__header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-gap-base);
  margin-bottom: 0.5rem;
  align-items: flex-start;
}

.timeline__header-main {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-base);
  align-items: center;
  flex: 1 1 auto;
}

.timeline__header-controls {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  margin-left: auto;
}

.timeline__timestamp {
  font-weight: 600;
  color: rgba(226, 232, 240, 0.85);
}

.timeline__action {
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.95rem;
}

.timeline__meta {
  color: rgba(148, 163, 184, 0.75);
  font-size: 0.9rem;
}

.timeline__meta-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.timeline__chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.9rem;
  background: rgba(148, 163, 184, 0.12);
  color: rgba(226, 232, 240, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.timeline__chip svg,
.timeline__chip-icon {
  width: 0.9rem;
  height: 0.9rem;
}

.timeline__chip--time {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
}

.timeline__chip--billable {
  background: rgba(74, 222, 128, 0.18);
  border-color: rgba(74, 222, 128, 0.32);
  color: #dcfce7;
}

.timeline__chip--nonbillable {
  background: rgba(251, 113, 133, 0.14);
  border-color: rgba(251, 113, 133, 0.32);
  color: #ffe4e6;
}

.timeline__chip--labour {
  background: rgba(129, 140, 248, 0.16);
  border-color: rgba(129, 140, 248, 0.32);
  color: #e0e7ff;
}

.timeline__body {
  color: rgba(226, 232, 240, 0.85);
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.timeline__message {
  position: relative;
  border-radius: 0.75rem;
  transition: max-height 0.2s ease;
}

.timeline__message-content {
  overflow-wrap: anywhere;
}

.timeline__message-content--collapsed {
  overflow: hidden;
}

.timeline__message--collapsed {
  overflow: hidden;
}

.timeline__message--collapsed::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3rem;
  background: linear-gradient(
    to bottom,
    rgba(15, 23, 42, 0),
    rgba(15, 23, 42, 0.85)
  );
  pointer-events: none;
}

.timeline__message-toggle {
  align-self: flex-start;
}

.timeline__body p {
  margin: 0;
}

.timeline__body pre {
  margin: 0.35rem 0 0;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-compact);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-compact) var(--space-gap-tight);
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.2);
  color: #bae6fd;
  font-size: 0.8rem;
  font-weight: 600;
  gap: 0.25rem;
}

.tag__remove {
  margin-left: 0.25rem;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.tag__remove:hover {
  opacity: 1;
}

.tag__remove:focus {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 2px;
}

.tag__exclude {
  margin-left: 0.25rem;
  background: none;
  border: none;
  color: #f87171;
  opacity: 0.7;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0;
  width: 1rem;
  height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.tag__exclude:hover {
  opacity: 1;
  color: #ef4444;
}

.tag__exclude:focus {
  outline: 2px solid #ef4444;
  outline-offset: 2px;
  border-radius: 2px;
}

.tag--info {
  background: rgba(96, 165, 250, 0.25);
  color: #bfdbfe;
}

.tag--muted {
  background: rgba(148, 163, 184, 0.16);
  color: rgba(226, 232, 240, 0.85);
}

.tag--manual {
  background: rgba(168, 85, 247, 0.24);
  color: #e9d5ff;
}

.kb-admin__manual-tag-form {
  display: inline-flex;
  align-items: center;
  gap: var(--space-compact);
}

.kb-admin__manual-tag-form .form-input {
  min-width: 12rem;
  width: auto;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: var(--space-compact) var(--space-gap-tight);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status__label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.status--active {
  background: rgba(134, 239, 172, 0.18);
  color: #bbf7d0;
}

.status--invited {
  background: rgba(253, 186, 116, 0.18);
  color: #fed7aa;
}

.status--suspended {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}

.status--processing {
  background: rgba(96, 165, 250, 0.2);
  color: #bfdbfe;
}

.status--error {
  background: rgba(248, 113, 113, 0.22);
  color: #fecaca;
}

.status--operational {
  background: rgba(134, 239, 172, 0.18);
  color: #bbf7d0;
}

.status--maintenance {
  background: rgba(253, 224, 71, 0.2);
  color: #fef3c7;
}

.status--degraded {
  background: rgba(251, 191, 36, 0.18);
  color: #fde68a;
}

.status--partial_outage {
  background: rgba(251, 146, 60, 0.2);
  color: #fed7aa;
}

.status--outage {
  background: rgba(239, 68, 68, 0.22);
  color: #fecaca;
}

.text-muted {
  color: var(--text-muted, rgba(148, 163, 184, 0.85));
  font-size: 0.9rem;
}

.text-success {
  color: #bbf7d0;
}

.text-danger {
  color: #fca5a5;
}

.stacked {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.divider {
  border: none;
  height: 1px;
  background: rgba(148, 163, 184, 0.15);
  margin: 1.5rem 0;
}

.info-grid {
  display: grid;
  gap: var(--space-gap-roomy);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.info-grid--compact {
  margin: 0.85rem 0 1rem;
}

.info-grid__item {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
}

.info-grid__label {
  color: var(--text-muted, rgba(148, 163, 184, 0.85));
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.filter-grid {
  display: grid;
  gap: var(--space-gap-roomy);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.code-block {
  margin-top: 0.75rem;
  background: rgba(15, 23, 42, 0.65);
  border-radius: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.15);
  max-height: 220px;
  overflow: auto;
}

.code-block pre {
  margin: 0.35rem 0 0.85rem;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.details summary {
  cursor: pointer;
  color: #38bdf8;
  font-weight: 600;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Ticket filtering and grouping visibility classes */
.ticket-filtered-hidden {
  display: none !important;
}

.ticket-group-hidden {
  display: none !important;
}

/* Table search filter visibility class */
.table-search-hidden {
  display: none !important;
}
.page-grid {
  display: grid;
  gap: 2rem;
}

.shop-layout {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-roomy);
  flex: 1;
  min-height: 0;
}

.shop-layout__content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.shop-layout__content .table-wrapper {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.package-products .package-product + .package-product {
  margin-top: var(--space-gap-base);
}

.shop-categories {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-gap-tight);
  margin: 0;
}

.shop-categories__link {
  display: flex;
  align-items: center;
  gap: var(--space-gap-base);
  padding: var(--space-compact) var(--space-gap-base);
  border-radius: 0.75rem;
  text-decoration: none;
  color: inherit;
  font-weight: 500;
  background: rgba(148, 163, 184, 0.08);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.shop-categories__link:hover,
.shop-categories__link:focus-visible {
  background: rgba(148, 163, 184, 0.18);
}

.shop-categories__link.is-active {
  background: rgba(56, 189, 248, 0.18);
  color: #e0f2fe;
}

.shop-categories__icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.65);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.shop-categories__icon::before {
  content: "🗂";
  font-size: 0.95rem;
}

.shop-categories__icon--packages::before {
  content: "🎁";
}

.shop-categories__link.is-active .shop-categories__icon {
  background: rgba(56, 189, 248, 0.45);
}

.shop-category-select-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 20rem;
}

.shop-category-select {
  width: 100%;
  padding: var(--space-compact) var(--space-gap-base);
  font-weight: 500;
  cursor: pointer;
}


.shop-toolbar {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.shop-card-header {
  justify-content: flex-start;
}

.shop-card-header__title {
  flex: 0 0 auto;
}

.shop-search-form {
  display: flex;
  align-items: center;
  gap: var(--space-gap-base);
  flex-wrap: wrap;
}

.shop-search-form .form-input[type="search"] {
  min-width: min(18rem, 100%);
}

.shop-out-of-stock-toggle {
  white-space: nowrap;
}

.cart-card .table-wrapper {
  margin-bottom: var(--space-gap-roomy);
}

.cart-checkout {
  margin-top: calc(var(--space-gap-roomy) * 1.25);
  gap: calc(var(--space-gap-roomy) * 1.25);
  align-items: flex-end;
}

.cart-checkout__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-gap-tight);
}

.cart-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: calc(var(--space-gap-roomy) * 1.25);
  gap: calc(var(--space-gap-roomy) * 1.25);
}

.cart-footer__left {
  display: flex;
  align-items: flex-start;
  padding-top: var(--space-gap-tight);
}

.cart-footer__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-gap-tight);
}

.cart-summary {
  display: flex;
  justify-content: flex-end;
}

.cart-summary__totals {
  display: flex;
  gap: 2rem;
  margin: 0;
}

.cart-summary__totals dt {
  font-weight: 600;
  color: #fff;
}

.cart-summary__totals dd {
  margin: 0;
  font-weight: 700;
  color: #fff;
}

.cart-table__image img {
  max-width: 60px;
  border-radius: 0.75rem;
}

.cart-recommendations {
  margin-top: calc(var(--space-gap-roomy) * 1.25);
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-gap-base) * 2);
}

.cart-recommendations__section {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.cart-recommendations__heading {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.85);
}

.cart-recommendations__grid {
  display: grid;
  gap: calc(var(--space-gap-base) * 1.5);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

@media (min-width: 1200px) {
  .cart-recommendations__grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.cart-recommendations__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
  padding: calc(var(--space-gap-base) * 1.5);
  border-radius: 1rem;
  background: rgba(148, 163, 184, 0.08);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.1);
}

.cart-recommendations__image {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.35);
  padding: 0.75rem;
}

.cart-recommendations__name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.cart-recommendations__price {
  margin: 0;
  font-weight: 600;
  color: #fff;
}

.cart-recommendations__meta {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.65);
}

.cart-recommendations__form {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

.orders-summary {
  display: grid;
  gap: calc(var(--space-gap-roomy) * 1.25);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: calc(var(--space-gap-roomy) * 1.25);
}

.orders-summary__panel {
  padding: calc(var(--space-gap-roomy) * 1.25);
  border-radius: 1rem;
  background: rgba(148, 163, 184, 0.08);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.orders-summary__panel--total {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.3), rgba(59, 130, 246, 0.25));
  box-shadow: inset 0 0 0 1px rgba(191, 219, 254, 0.3);
}

.orders-summary__heading {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(226, 232, 240, 0.9);
  font-weight: 600;
}

.orders-summary__count {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.1;
}

.orders-summary__meta {
  margin: 0;
  color: rgba(226, 232, 240, 0.75);
}

.orders-summary__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-gap-tight);
}

.orders-summary__item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-gap-roomy);
}

.orders-summary__label {
  font-weight: 500;
}

.orders-summary__value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.orders-summary__percentage {
  color: rgba(226, 232, 240, 0.7);
  font-size: 0.85rem;
  margin-left: 0.35rem;
}

.orders-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
  width: 100%;
}

.orders-toolbar__form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-base);
  align-items: flex-end;
}

.orders-toolbar__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
  min-width: 160px;
}

.orders-toolbar__actions {
  display: flex;
  gap: var(--space-gap-tight);
  align-items: center;
}

.orders-toolbar__search {
  min-width: 220px;
}

.tickets-toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-gap-base);
  width: 100%;
}

.tickets-toolbar__form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-base);
  align-items: flex-end;
}

.tickets-toolbar__field {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
  min-width: 160px;
}

.tickets-toolbar__actions {
  display: flex;
  gap: var(--space-gap-tight);
  align-items: center;
}

.tickets-toolbar__search {
  min-width: 220px;
  flex: 1 1 220px;
}

@media (max-width: 1024px) {
  .tickets-toolbar {
    align-items: stretch;
  }

  .tickets-toolbar__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .tickets-toolbar__search {
    width: 100%;
  }
}

.checkbox--table {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.checkbox--table input {
  margin: 0;
}

@media (max-width: 1024px) {
  .shop-toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .shop-toolbar__form {
    width: 100%;
  }

  .orders-toolbar {
    align-items: stretch;
  }

  .orders-toolbar__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .orders-toolbar__search {
    width: 100%;
  }

  .cart-checkout {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .cart-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .cart-footer__right {
    align-items: stretch;
  }

  .cart-summary {
    justify-content: flex-start;
  }
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-roomy);
  align-items: flex-end;
}

.filters--compact {
  gap: var(--space-gap-base);
}

.filters__group {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
  min-width: 180px;
}

.filters__group--wide {
  flex: 1 1 260px;
  min-width: 240px;
}

.filters__group--checkbox {
  flex-direction: row;
  align-items: center;
  gap: var(--space-gap-tight);
  min-width: auto;
}

.filters__group--actions {
  flex-direction: row;
  gap: var(--space-gap-base);
  align-items: center;
  min-width: auto;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-gap-tight);
  cursor: pointer;
  font-weight: 500;
}

.checkbox input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
}

.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  color: inherit;
}

.toggle input[type='checkbox'] {
  position: absolute;
  left: 0;
  top: 50%;
  width: 2.75rem;
  height: 1.45rem;
  margin: 0;
  transform: translateY(-50%);
  opacity: 0;
  cursor: inherit;
}

.toggle span {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-left: calc(2.75rem + var(--space-gap-tight));
  gap: var(--space-gap-tight);
  font-weight: 600;
}

.toggle span::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 2.75rem;
  height: 1.45rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.28);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.3);
  transform: translateY(-50%);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.toggle span::after {
  content: '';
  position: absolute;
  left: 0.18rem;
  top: 50%;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.45);
  transform: translate(0, -50%);
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.toggle input[type='checkbox']:checked + span::before {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.92), rgba(59, 130, 246, 0.92));
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.45), 0 0 8px rgba(56, 189, 248, 0.35);
}

.toggle input[type='checkbox']:checked + span::after {
  transform: translate(1.45rem, -50%);
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.5);
}

.toggle input[type='checkbox']:focus-visible + span::before {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35), inset 0 0 0 1px rgba(56, 189, 248, 0.6);
}

.toggle input[type='checkbox']:disabled + span {
  color: rgba(148, 163, 184, 0.6);
}

.toggle input[type='checkbox']:disabled + span::before {
  background: rgba(148, 163, 184, 0.2);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.25);
}

.toggle input[type='checkbox']:disabled + span::after {
  background: rgba(71, 85, 105, 0.7);
  box-shadow: none;
}

.link-button {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}

.notification-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-base);
  align-items: center;
  justify-content: flex-end;
}

.notification-summary .button {
  margin-left: var(--space-gap-tight);
}

.notification-row--unread td {
  background: rgba(59, 130, 246, 0.08);
}

.notification-event {
  font-weight: 600;
  color: rgba(226, 232, 240, 0.95);
}

.notification-message {
  white-space: pre-wrap;
  word-break: break-word;
}

.notification-metadata {
  margin: 0.5rem 0 0;
  display: grid;
  gap: 0.35rem;
}

.notification-metadata__item {
  display: grid;
  grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
  gap: 0.5rem;
  align-items: start;
}

.notification-metadata__item dt {
  margin: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(148, 163, 184, 0.85);
}

.notification-metadata__item dd {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.95);
}

.notification-pagination {
  margin-top: calc(var(--space-gap-roomy) * 1.25);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-roomy);
  align-items: center;
  justify-content: space-between;
}

.notification-pagination__controls {
  display: flex;
  gap: var(--space-gap-base);
  align-items: center;
}

.notification-pagination__page {
  color: rgba(226, 232, 240, 0.75);
  font-weight: 500;
}

@media screen and (max-width: 960px) {
  .notification-summary {
    justify-content: flex-start;
  }

  .notification-metadata__item {
    grid-template-columns: 1fr;
  }
}

.button--small {
  padding: var(--space-compact) var(--space-gap-base);
  font-size: 0.85rem;
}

.button--compact {
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
}

.button--disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.link-button:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.7);
  outline-offset: 2px;
}

.product-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.package-thumb {
  width: 56px;
  height: 56px;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(56, 189, 248, 0.12);
  font-size: 1.5rem;
}


.package-thumb-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
  max-width: 12rem;
  height: 9rem;
}

.package-thumb-grid__item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.32);
}

.package-thumb-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.package-thumb-grid__placeholder {
  font-size: 1.25rem;
}

.package-name {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.package-meta {
  margin: 0;
  color: rgba(203, 213, 225, 0.85);
  font-size: 0.875rem;
}

.package-details {
  margin: 0;
  font-size: 0.85rem;
}

.package-details summary {
  cursor: pointer;
  color: rgba(125, 211, 252, 0.95);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.package-details[open] summary {
  margin-bottom: 0.35rem;
}

.package-details ul {
  margin: 0;
  padding-left: 1.25rem;
}

.package-details li {
  margin: 0.25rem 0;
}

.product-preview {
  width: 120px;
  height: auto;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: var(--space-gap-tight);
}

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

.list__item {
  padding: var(--space-gap-tight) 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.list__item:last-child {
  border-bottom: none;
}

.list__meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.8);
}

.form-input--sm {
  max-width: 90px;
}

.form-input--inline {
  width: 100%;
  min-width: 160px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-compact) var(--space-gap-tight);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
}

.badge--success {
  background: rgba(134, 239, 172, 0.2);
  color: #bbf7d0;
}

.badge--info {
  background: rgba(96, 165, 250, 0.2);
  color: #bfdbfe;
}

.badge--warning {
  background: rgba(253, 224, 71, 0.18);
  color: #fef3c7;
}

.badge--danger {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
}

.badge--muted {
  background: rgba(148, 163, 184, 0.18);
  color: rgba(229, 231, 235, 0.9);
}

.badge--cis {
  font-size: 0.7rem;
}

.badge-trigger {
  display: inline;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  line-height: inherit;
}

.badge-trigger:hover .badge,
.badge-trigger:focus-visible .badge {
  filter: brightness(1.1);
  text-decoration: underline;
}

.badge-trigger:focus {
  outline: none;
}

.badge-trigger:focus-visible {
  outline: 2px solid var(--color-accent, currentColor);
  outline-offset: 2px;
  border-radius: 0.4rem;
}

.alert {
  border-radius: 0.85rem;
  padding: var(--space-gap-base) var(--space-gap-roomy);
  font-weight: 600;
}

.notification-toast {
  border-radius: 0.85rem;
  padding: var(--space-gap-base) var(--space-gap-roomy);
  font-weight: 600;
}

.alert--error {
  background: rgba(248, 113, 113, 0.2);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.notification-toast--error {
  background: rgba(248, 113, 113, 0.2);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
}

.alert--info {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #bae6fd;
}

.notification-toast--info {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #bae6fd;
}

.alert--success {
  background: rgba(134, 239, 172, 0.2);
  border: 1px solid rgba(134, 239, 172, 0.45);
  color: #bbf7d0;
}

.notification-toast--success {
  background: rgba(134, 239, 172, 0.2);
  border: 1px solid rgba(134, 239, 172, 0.45);
  color: #bbf7d0;
}

.alert--warning {
  background: rgba(253, 224, 71, 0.18);
  border: 1px solid rgba(253, 224, 71, 0.4);
  color: #fef08a;
}

.notification-toast--warning {
  background: rgba(253, 224, 71, 0.18);
  border: 1px solid rgba(253, 224, 71, 0.4);
  color: #fef08a;
}

.notification-stack {
  position: fixed;
  right: var(--space-gap-roomy);
  bottom: var(--space-gap-roomy);
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
  z-index: 1200;
  max-width: min(420px, 90vw);
}

.notification-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-gap-base);
  box-shadow: 0 24px 45px -20px rgba(15, 23, 42, 0.85);
  border-radius: 0.85rem;
}

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

.notification-toast__message {
  flex: 1 1 auto;
  font-weight: 500;
}

.notification-toast__dismiss {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .notification-stack {
    left: var(--space-gap-roomy);
    right: var(--space-gap-roomy);
  }

  .notification-toast {
    flex-direction: column;
    align-items: stretch;
  }

  .notification-toast__dismiss {
    align-self: flex-end;
  }
}

.notification-preference__event {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.notification-preference__name {
  font-weight: 600;
  word-break: break-word;
}

.notification-preference__hint {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  padding: calc(var(--space-gap-roomy) * 2.5);
  z-index: 1000;
}

.modal[hidden] {
  display: none;
}

/* Ensure dialog.modal uses dark colour scheme so native form controls
   (select, textarea, input) render with light text on dark backgrounds. */
dialog.modal {
  color: #f8fafc;
  color-scheme: dark;
}

/* Hide dialog elements with .modal class when not open */
dialog.modal:not([open]) {
  display: none;
}


.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.42);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(92vw, 44rem);
  max-height: min(86vh, 48rem);
  overflow: hidden;
  color: #f8fafc;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1rem;
  box-shadow: 0 30px 80px -24px rgba(2, 6, 23, 0.95), 0 0 0 1px rgba(15, 23, 42, 0.7);
}

.modal__dialog .modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-gap-base);
  padding: calc(var(--space-gap-roomy) * 1.25) calc(var(--space-gap-roomy) * 1.5) var(--space-gap-base);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.modal__dialog .modal__header h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.modal__dialog .modal__body {
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-gap-roomy) calc(var(--space-gap-roomy) * 1.5);
}

.modal__dialog .modal__body p {
  margin: 0;
  color: rgba(226, 232, 240, 0.82);
}

.modal__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-gap-tight);
  padding: var(--space-gap-base) calc(var(--space-gap-roomy) * 1.5) calc(var(--space-gap-roomy) * 1.25);
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.72);
}

.ticket-merge-list {
  display: grid;
  gap: var(--space-gap-tight);
}

.ticket-merge-list__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-gap-tight);
  padding: var(--space-gap-base);
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.76);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 0.75rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.ticket-merge-list__item:hover,
.ticket-merge-list__item:focus-within {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(30, 41, 59, 0.86);
}

.ticket-merge-list__item input {
  margin-top: 0.2rem;
  accent-color: #38bdf8;
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .modal {
    padding: var(--space-gap-base);
  }

  .modal__dialog,
  .modal__panel {
    width: 100%;
    max-height: calc(100dvh - (var(--space-gap-base) * 2));
  }

  .modal__dialog .modal__header,
  .modal__dialog .modal__body,
  .modal__panel > .modal__header,
  .modal__panel > .modal__body,
  .modal__footer {
    padding-left: var(--space-gap-base);
    padding-right: var(--space-gap-base);
  }

  .modal__panel > .modal__footer,
  .modal__panel > .modal__body > .modal__footer {
    margin-right: calc(var(--space-gap-base) * -1);
    margin-left: calc(var(--space-gap-base) * -1);
  }
}

.modal__content {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 1rem;
  padding: calc(var(--space-gap-roomy) * 2.5);
  position: relative;
  box-sizing: border-box;
  width: 90vw;
  max-width: 90vw;
  height: auto;
  max-height: calc(100dvh - (var(--space-gap-roomy) * 5));
  margin: auto;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 24px 50px -20px rgba(15, 23, 42, 0.85);
}

.modal__panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(92vw, 44rem);
  max-height: min(86vh, 48rem);
  overflow: hidden;
  color: #f8fafc;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 1rem;
  box-shadow: 0 30px 80px -24px rgba(2, 6, 23, 0.95), 0 0 0 1px rgba(15, 23, 42, 0.7);
}

.modal__panel--wide {
  width: min(96vw, 76rem);
  max-height: min(90vh, 56rem);
}

.modal__panel > .modal__header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-gap-base);
  padding: calc(var(--space-gap-roomy) * 1.25) calc(var(--space-gap-roomy) * 1.5) var(--space-gap-base);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.modal__panel > .modal__body {
  min-height: 0;
  overflow: auto;
  padding: var(--space-gap-roomy) calc(var(--space-gap-roomy) * 1.5);
}

.modal__panel > .modal__footer,
.modal__panel > .modal__body > .modal__footer {
  margin-right: calc(var(--space-gap-roomy) * -1.5);
  margin-left: calc(var(--space-gap-roomy) * -1.5);
}

.modal__inner,
.modal-content {
  position: relative;
}

.modal__content--compact {
  width: min(90vw, 34rem);
  max-width: 34rem;
  height: auto;
  max-height: calc(100vh - 4rem);
}

.modal .modal__header,
.modal .modal-header {
  position: relative;
  padding-right: calc(var(--space-gap-roomy) * 3);
}

.modal .modal__close,
.modal .modal-close,
.modal .btn-close,
.modal [data-auto-modal-close] {
  position: absolute;
  top: var(--space-gap-tight);
  right: var(--space-gap-roomy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  font-size: 0;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 12px 24px -16px rgba(15, 23, 42, 0.95);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.modal .modal__close:hover,
.modal .modal__close:focus-visible,
.modal .modal-close:hover,
.modal .modal-close:focus-visible,
.modal .btn-close:hover,
.modal .btn-close:focus-visible,
.modal [data-auto-modal-close]:hover,
.modal [data-auto-modal-close]:focus-visible {
  background: rgba(30, 41, 59, 1);
  border-color: rgba(148, 163, 184, 0.55);
  transform: scale(1.03);
}

.modal .modal__close:focus-visible,
.modal .modal-close:focus-visible,
.modal .btn-close:focus-visible,
.modal [data-auto-modal-close]:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.9);
  outline-offset: 2px;
}

.modal .modal__close svg,
.modal .modal-close svg,
.modal .btn-close svg,
.modal [data-auto-modal-close] svg {
  width: 1.25rem;
  height: 1.25rem;
  pointer-events: none;
}

/* Show a × character when no SVG icon is present */
.modal .modal__close::before,
.modal .modal-close::before,
.modal .btn-close::before,
.modal [data-auto-modal-close]::before {
  content: "×";
  font-size: 1.25rem;
  line-height: 1;
  pointer-events: none;
}

.modal .modal__close:has(svg)::before,
.modal .modal-close:has(svg)::before,
.modal .btn-close:has(svg)::before,
.modal [data-auto-modal-close]:has(svg)::before {
  display: none;
}

.modal__title {
  margin-top: 0;
  margin-bottom: var(--space-gap-roomy);
  font-size: 1.5rem;
  font-weight: 600;
}

.modal__subtitle {
  margin: var(--space-gap-roomy) 0 var(--space-gap-tight);
  font-size: 1.1rem;
  font-weight: 600;
}

.modal__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.modal__image {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.modal__text {
  margin: var(--space-compact) 0;
}

.webhook-url-modal__input {
  width: 100%;
}

.webhook-url-modal__status {
  min-height: 1.25rem;
  margin: 0;
  color: rgba(226, 232, 240, 0.85);
}

.webhook-url-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-gap-tight);
}

.modal__content--staff {
  padding: calc(var(--space-gap-roomy) * 1.8);
}

.staff-modal__header {
  position: sticky;
  top: calc(var(--space-gap-roomy) * -1.8);
  z-index: 2;
  margin: calc(var(--space-gap-roomy) * -1.8) calc(var(--space-gap-roomy) * -1.8) var(--space-gap-roomy);
  padding: var(--space-gap-base) calc(var(--space-gap-roomy) * 1.8) var(--space-gap-tight);
  background: rgba(15, 23, 42, 0.98);
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.staff-modal__staff-name {
  margin: 0;
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.9rem;
}

.staff-modal-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-gap-base);
}

.staff-modal-grid .form-field--full {
  grid-column: 1 / -1;
}

.staff-modal__section {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.85rem;
  padding: var(--space-gap-base);
  margin: 0;
  display: grid;
  gap: var(--space-gap-tight);
}

.staff-modal__section + .staff-modal__section {
  margin-top: var(--space-gap-roomy);
}

.staff-modal__group-stack {
  display: grid;
  gap: var(--space-gap-base);
}

.staff-modal__subsection {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 0.75rem;
  padding: var(--space-gap-tight);
  margin: 0;
}

.staff-actions {
  flex-wrap: wrap;
}

.staff-danger-panel {
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(127, 29, 29, 0.18);
  border-radius: 0.75rem;
  padding: var(--space-gap-base);
  display: grid;
  gap: var(--space-gap-tight);
}

.staff-danger-panel__title {
  margin: 0;
  font-size: 1rem;
  color: #fecaca;
}

.staff-modal__footer {
  position: sticky;
  bottom: calc(var(--space-gap-roomy) * -1.8);
  background: rgba(15, 23, 42, 0.98);
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  padding-top: var(--space-gap-base);
  padding-bottom: var(--space-gap-base);
  margin: var(--space-gap-base) calc(var(--space-gap-roomy) * -1.8) calc(var(--space-gap-roomy) * -1.8);
  padding-left: calc(var(--space-gap-roomy) * 1.8);
  padding-right: calc(var(--space-gap-roomy) * 1.8);
}

@media (max-width: 900px) {
  .staff-modal-grid {
    grid-template-columns: 1fr;
  }
}

.layout__content > .forms-layout {
  flex: 1;
  min-height: 0;
}

.forms-layout {
  display: grid;
  gap: calc(var(--space-gap-roomy) * 1.8);
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  align-items: stretch;
}

@media (max-width: 960px) {
  .forms-layout {
    grid-template-columns: 1fr;
  }
  .forms-layout__menu,
  .forms-layout__viewer {
    height: auto;
  }
  .forms-menu {
    max-height: none;
  }
}

.forms-layout__menu,
.forms-layout__viewer {
  height: 100%;
  min-height: 0;
}

.forms-menu {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.forms-menu__button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.forms-menu__button.is-active {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.1);
}

.forms-menu__button:hover,
.forms-menu__button:focus {
  border-color: rgba(148, 163, 184, 0.4);
}

.forms-menu__name {
  font-weight: 600;
}

.forms-menu__description {
  color: rgba(148, 163, 184, 0.85);
  font-size: 0.9rem;
}

.form-viewer {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  gap: var(--space-gap-base);
}

.form-viewer iframe,
.form-viewer .form-frame {
  flex: 1;
  height: 100%;
  min-height: 0;
}

.forms-admin__accordion {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.forms-admin__panel {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.55);
  padding: var(--space-gap-base);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.forms-admin__panel[open] {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.15);
}

.forms-admin__summary {
  list-style: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-gap-base);
  cursor: pointer;
  margin: 0;
}

.forms-admin__summary::-webkit-details-marker {
  display: none;
}

.forms-admin__summary-text {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.forms-admin__summary-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.forms-admin__summary-description {
  margin: 0;
  color: rgba(148, 163, 184, 0.85);
  font-size: 0.9rem;
}

.forms-admin__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-tight);
  justify-content: flex-end;
}

.forms-admin__stat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.85);
}

.forms-admin__stat--compact {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
}

.forms-admin__stat-label {
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.forms-admin__stat-value {
  font-weight: 600;
  color: #f8fafc;
}

.forms-admin__body {
  margin-top: var(--space-gap-base);
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.forms-admin__intro {
  margin: 0;
}

.forms-admin__companies {
  display: grid;
  gap: var(--space-gap-base);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.forms-admin__company {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
  padding: var(--space-gap-base);
  border-radius: 0.75rem;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.14);
  min-height: 0;
}

.forms-admin__company-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-gap-base);
}

.forms-admin__company-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.forms-admin__company-meta {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.8);
}

.forms-admin__users {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
  max-height: 240px;
  overflow: auto;
  padding-right: 0.35rem;
}

.forms-admin__user {
  align-items: flex-start;
  gap: 0.5rem;
}

.forms-admin__actions {
  display: flex;
  gap: var(--space-gap-tight);
  flex-wrap: wrap;
}

.forms-admin__empty {
  color: rgba(148, 163, 184, 0.85);
  font-size: 0.9rem;
  margin: 0;
}

.forms-admin__status {
  min-height: 1.25rem;
  margin: 0;
}

.forms-admin__status--success {
  color: #22c55e;
}

.forms-admin__status--error {
  color: #f87171;
}

.forms-admin__status--pending {
  color: rgba(148, 163, 184, 0.9);
}

.form-frame {
  width: 100%;
  height: 100%;
  min-height: 320px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.6);
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  color: rgba(148, 163, 184, 0.85);
  font-weight: 500;
}

.form-field--checkbox {
  justify-content: flex-end;
}

.form-field--wide {
  grid-column: span 2;
}

@media (max-width: 720px) {
  .form-field--wide {
    grid-column: span 1;
  }
}

.admin-grid__full {
  grid-column: 1 / -1;
}

.category-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.category-list__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 0.75rem;
  padding: var(--space-gap-base) var(--space-gap-roomy);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.category-list__item--empty {
  justify-content: center;
  color: rgba(148, 163, 184, 0.7);
}

.category-list__item--child {
  margin-left: 2rem;
  opacity: 0.9;
}

.category-list__indent {
  color: rgba(148, 163, 184, 0.5);
  margin-right: 0.5rem;
}

.category-list__name {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category-list__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.edit-form {
  margin-top: var(--space-gap-roomy);
  padding: var(--space-gap-roomy);
  background: rgba(15, 23, 42, 0.6);
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.edit-form__title {
  margin: 0 0 var(--space-gap-base) 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.visibility-grid {
  display: grid;
  gap: var(--space-gap-base);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: var(--space-gap-roomy);
}

.visibility-grid__group {
  display: contents;
}

.visibility-grid__group-label {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted, #94a3b8);
  margin: var(--space-gap-base) 0 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.visibility-grid__sku {
  display: block;
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.visibility-grid__item {
  background: rgba(30, 41, 59, 0.75);
  padding: var(--space-gap-base);
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.card h2 {
  margin-top: 0;
  color: #f8fafc;
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
  }

  .layout__sidebar {
    width: 100%;
    padding: var(--space-gap-roomy);
  }

  .layout__main {
    max-width: 100vw;
  }
}

@media (max-width: 720px) {
  .layout__sidebar {
    width: min(260px, 86vw);
    max-width: 86vw;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--space-gap-base);
  }

  .layout__sidebar .brand {
    width: 100%;
    justify-content: flex-start;
  }

  .menu {
    flex-direction: column;
    gap: var(--space-gap-tight);
  }

  .menu__item a {
    width: 100%;
  }
}

.management {
  display: grid;
  grid-template-columns: minmax(240px, 280px) 1fr;
  gap: 1.5rem;
  align-items: start;
}

.management--single {
  grid-template-columns: 1fr;
}

@media (max-width: 960px) {
  .management {
    grid-template-columns: 1fr;
  }
  .management__sidebar {
    order: 2;
  }
}

.management__sidebar {
  background: var(--surface-subtle);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: inset 0 0 0 1px var(--border-muted);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.management__quick-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.management__quick-actions .button {
  justify-content: center;
}

.management__heading {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.management__intro {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.management__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.management__content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.management__header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.management__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.management__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.management__subtitle {
  margin: 0.25rem 0 0;
  color: var(--text-muted);
  max-width: 38rem;
}

.management__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.management__body {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.management__nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.management__nav-link {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.management__nav-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: rgba(148, 163, 184, 0.12);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.management__nav-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.management__nav-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.management__nav-title {
  font-weight: 600;
}

.management__nav-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.management__list-item--current {
  box-shadow: inset 0 0 0 2px rgba(96, 165, 250, 0.45);
}

.management__body--columns {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: flex-start;
}

.management__column--activity,
.management__column--conversation {
  min-width: 0;
}

.management__column-group {
  min-width: 0;
}

.management__column-group--main {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 961px) and (max-width: 1799px) {
  .management__body--ticket-detail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .management__column--details {
    grid-column: 1;
    grid-row: 1;
  }

  .management__column-group--main {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (min-width: 1800px) {
  .management__body--columns {
    grid-template-columns: minmax(280px, 320px) minmax(360px, 1fr) minmax(0, 1fr);
  }

  .management__body--ticket-detail-two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .management__column-group--main {
    display: contents;
  }

  .management__column--content {
    grid-column: 2;
  }

  .management__column--activity,
  .management__column--conversation {
    grid-column: 3;
  }
}

.management__column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}


.profile-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-columns--standard {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1200px) {
  .profile-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .profile-columns {
    grid-template-columns: 1fr;
  }
}

.card__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.card__body--meta {
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  margin-top: 0.5rem;
}

@media (max-width: 960px) {
  .management__body--columns {
    grid-template-columns: 1fr;
  }
}

.management__body--cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.card__header--module {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.card__header--module-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card__header--module-summary .card__title {
  margin: 0;
}

.card__header--module-summary .card__collapsible-meta {
  align-items: center;
}

.card__module-info {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.card__module-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.card__module-icon--summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  min-width: 1.75rem;
}

.card__module-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
}

.card__module-test {
  margin: 0;
}

.card__module-test .button {
  white-space: nowrap;
}

@media (max-width: 720px) {
  .card__header--module {
    flex-direction: column;
    align-items: stretch;
  }

  .card__module-actions {
    align-items: stretch;
  }
}

.management__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 720px) {
  .management__stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--surface-default);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  box-shadow: inset 0 0 0 1px var(--border-muted);
}

.stat-card__title {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.stat-card__value {
  margin: 0.25rem 0 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.management__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.management__toolbar-search {
  flex: 1 1 240px;
}

.management__toolbar-search .form-input {
  width: 100%;
}

.management__bulk-delete {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.management__bulk-delete .button {
  white-space: nowrap;
}

.management__bulk-delete [data-bulk-delete-count] {
  font-size: 0.85rem;
}

.ticket-dashboard__overview {
  display: grid;
  gap: 1.5rem;
}

.ticket-dashboard__filters {
  align-items: stretch;
}

.ticket-dashboard__filters .form-input {
  min-width: 0;
}

@media (min-width: 960px) {
  .ticket-dashboard__overview {
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    align-items: start;
  }
}

@media (max-width: 640px) {
  .ticket-dashboard__filters {
    flex-direction: column;
    align-items: stretch;
  }

  .ticket-dashboard__filters .form-input,
  .ticket-dashboard__filters .button {
    width: 100%;
  }
}

.table__select {
  width: 3rem;
  text-align: center;
}

.table__select input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
}

.management__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.management__list-item {
  background: var(--surface-default);
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: inset 0 0 0 1px var(--border-muted);
}

.management__test {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.management__test-info {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.management__test-icon {
  font-size: 1.5rem;
}

.management__test-description {
  margin: 0.15rem 0;
  color: var(--text-muted);
}

.management__test-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.alert-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.table-wrapper--short {
  flex: 1;
  overflow: auto;
}

.kb-admin {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.kb-admin__form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.kb-admin__fieldset {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-md, 0.5rem);
  padding: 1.25rem;
  margin: 0;
  background-color: rgba(15, 23, 42, 0.4);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.kb-admin__fieldset-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.kb-admin__fieldset-body {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.kb-admin__panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

.kb-admin__link {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 0;
  background: none;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.kb-admin__link:focus,
.kb-admin__link:hover {
  text-decoration: underline;
}

.kb-admin__title {
  font-weight: 600;
  line-height: 1.35;
}

.kb-admin__summary {
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.75);
}

.kb-admin__row--active {
  background: rgba(37, 99, 235, 0.18);
}

.kb-admin__row--active .kb-admin__title {
  color: #dbeafe;
}

.kb-admin__content {
  min-height: 12rem;
}

.kb-admin__sections-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-md, 0.5rem);
  padding: 1.5rem;
  background-color: rgba(17, 24, 39, 0.6);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.kb-admin__sections-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.kb-admin__sections-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.kb-admin__sections-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.kb-admin__sections-help {
  margin: 0;
}

.kb-admin__sections-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.kb-admin__sections {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  counter-reset: kb-section;
}

.kb-admin__sections-empty {
  margin: 0;
  padding: 1.5rem;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-md, 0.5rem);
  text-align: center;
  color: rgba(148, 163, 184, 0.8);
  background-color: rgba(15, 23, 42, 0.4);
}

.kb-admin__section {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-left: 3px solid rgba(96, 165, 250, 0.65);
  border-radius: var(--radius-md, 0.5rem);
  padding: 1.25rem;
  background-color: rgba(30, 41, 59, 0.5);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  counter-increment: kb-section;
}

.kb-admin__section:nth-child(even) {
  background-color: rgba(15, 23, 42, 0.55);
  border-left-color: rgba(167, 139, 250, 0.65);
}

.kb-admin__section::before {
  content: "Section " counter(kb-section);
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(96, 165, 250, 0.9);
  background-color: rgba(96, 165, 250, 0.12);
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}

.kb-admin__section:nth-child(even)::before {
  color: rgba(167, 139, 250, 0.9);
  background-color: rgba(167, 139, 250, 0.12);
}

.kb-admin__section-heading-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.kb-admin__section-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(148, 163, 184, 0.8);
}

.kb-admin__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.kb-admin__toolbar-button {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background-color: rgba(15, 23, 42, 0.4);
  color: inherit;
  border-radius: var(--radius-sm, 0.375rem);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.kb-admin__toolbar-button:hover,
.kb-admin__toolbar-button:focus {
  background-color: rgba(30, 41, 59, 0.6);
  border-color: rgba(96, 165, 250, 0.7);
  color: rgba(96, 165, 250, 0.9);
}

.kb-admin__editor {
  min-height: 12rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-sm, 0.375rem);
  padding: 0.75rem;
  background-color: rgba(15, 23, 42, 0.5);
  line-height: 1.6;
  font-size: 0.95rem;
  overflow-y: auto;
}

.kb-admin__editor:focus {
  outline: 2px solid rgba(96, 165, 250, 0.7);
  outline-offset: 2px;
}

.kb-admin__editor img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-xs);
}

.kb-admin__image-overlay {
  position: absolute;
  border: 2px solid var(--primary);
  pointer-events: none;
  z-index: 2000;
  border-radius: var(--radius-xs);
  box-sizing: border-box;
}

.kb-admin__image-overlay[hidden] {
  display: none;
}

.kb-admin__image-overlay-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 9999px;
  border: 2px solid var(--surface-default);
  background-color: var(--primary);
  bottom: -9px;
  right: -9px;
  cursor: se-resize;
  pointer-events: auto;
  box-shadow: 0 0 0 1px var(--primary);
}

.kb-admin__editor p {
  margin: 0 0 0.75rem;
}

.kb-admin__editor ul,
.kb-admin__editor ol {
  margin: 0 0 0.75rem 1.25rem;
  padding: 0;
}

.kb-admin__editor code,
.kb-admin__editor pre {
  font-family: var(--font-monospace);
  background-color: var(--surface-subtle);
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-sm);
}

.kb-admin__editor kb-if {
  display: block;
  position: relative;
  border: 2px dashed rgba(96, 165, 250, 0.5);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin: 0.5rem 0;
  background-color: rgba(96, 165, 250, 0.05);
}

.kb-admin__editor kb-if::before {
  content: "If company: " attr(company);
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(96, 165, 250, 0.9);
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.5rem;
  background-color: rgba(96, 165, 250, 0.15);
  border-radius: var(--radius-xs);
  width: fit-content;
}

.kb-admin__section-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

.kb-admin__section-company-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background-color: rgba(96, 165, 250, 0.08);
  border-radius: var(--radius-xs);
}

.kb-admin__section-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 10000;
}

.kb-admin__section-modal-content {
  width: min(520px, 92vw);
  max-height: 80vh;
  background: #0b1224;
  color: #e2e8f0;
  border: 1px solid #1f2937;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.kb-admin__section-modal-title {
  margin: 0;
  color: #f8fafc;
}

.kb-admin__section-modal-help {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(226, 232, 240, 0.75);
}

.kb-admin__section-modal-list {
  flex: 1;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  padding: 0.75rem;
  border: 1px solid #1f2937;
  border-radius: var(--radius-sm);
  background: rgba(148, 163, 184, 0.06);
  overflow-y: auto;
  min-height: 280px;
}

.kb-admin__section-modal-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background-color 150ms ease;
}

.kb-admin__section-modal-option:hover,
.kb-admin__section-modal-option:focus-within {
  background-color: rgba(148, 163, 184, 0.15);
}

.kb-admin__section-modal-checkbox {
  accent-color: #60a5fa;
}

.kb-admin__section-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.kb-admin__section-companies-display {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
}

.kb-admin__company-tag {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  background-color: rgba(96, 165, 250, 0.2);
  color: rgba(226, 232, 240, 0.95);
  border-radius: var(--radius-xs);
  font-size: 0.875rem;
}

.kb-admin__no-companies {
  color: rgba(226, 232, 240, 0.6);
  font-size: 0.875rem;
  font-style: italic;
}

.kb-admin__scope-help {
  color: rgba(226, 232, 240, 0.8);
}

.kb-admin__status {
  margin: 0;
  color: rgba(226, 232, 240, 0.85);
}

.kb-admin__status--error {
  color: #fca5a5;
}

.kb-admin__status--success {
  color: #bbf7d0;
}

.button__icon {
  display: inline-flex;
  margin-right: 0.5rem;
  width: 1.1rem;
  height: 1.1rem;
  align-items: center;
  justify-content: center;
}

.button__icon svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.button__label {
  display: inline-flex;
  align-items: center;
}

.button--processing {
  cursor: wait;
  opacity: 0.75;
}

@keyframes spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

.button__spinner,
.status__spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  border: 0.2rem solid currentColor;
  border-top-color: transparent;
  animation: spinner-rotate 0.8s linear infinite;
}

.button__spinner {
  margin-right: 0.5rem;
}

.status__spinner {
  margin-right: 0.35rem;
}


.header-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-search.is-loading {
  opacity: 0.65;
  pointer-events: none;
}

.knowledge-base {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

.knowledge-base__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: calc(100vh - 6rem);
}

.knowledge-base--article {
  max-width: 64rem;
  margin: 0 auto;
  width: 100%;
}

.knowledge-base__filters {
  padding: 0 1.5rem 1rem;
}

.knowledge-base__link {
  color: inherit;
  text-decoration: none;
}

.knowledge-base__link:hover,
.knowledge-base__link:focus {
  text-decoration: underline;
}

.knowledge-base__summary {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.75);
}

.knowledge-base__row--active {
  background: rgba(59, 130, 246, 0.1);
}

.knowledge-base__row--active .knowledge-base__link {
  font-weight: 600;
}

.knowledge-base__content {
  display: grid;
  gap: 1.5rem;
}

.knowledge-base__tags,
.knowledge-base__ai-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-tight);
}

.knowledge-base__ai-tags {
  margin-top: var(--space-gap-tight);
}

.knowledge-base__article .card__body {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  font-size: 0.95rem;
  line-height: 1.6;
}

.knowledge-base__body p {
  margin-bottom: 1rem;
}

.knowledge-base__section + .knowledge-base__section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.knowledge-base__section-heading {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  line-height: 1.3;
}

.knowledge-base__section-content > :last-child {
  margin-bottom: 0;
}

.knowledge-base__body pre,
.knowledge-base__body code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.knowledge-base__body pre {
  background: rgba(30, 41, 59, 0.6);
  padding: 1rem;
  border-radius: 0.75rem;
}

.knowledge-base__body--empty {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 12rem;
  color: rgba(226, 232, 240, 0.75);
}

.knowledge-base__results,
.knowledge-base__ollama {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.knowledge-base__results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.knowledge-base__results-item {
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding-bottom: 0.75rem;
}

.knowledge-base__results-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.knowledge-base__empty {
  color: rgba(148, 163, 184, 0.75);
  margin: 0;
}

.knowledge-base__ollama-text {
  white-space: pre-wrap;
  margin: 0;
}

.knowledge-base__ollama-status {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.85);
}

.knowledge-base__feedback-form {
  display: grid;
  gap: 1rem;
}

.knowledge-base__feedback-rating {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.knowledge-base__feedback-rating legend {
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.knowledge-base__feedback-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.knowledge-base__feedback-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.knowledge-base__feedback-status {
  margin: 0;
  color: var(--color-text-muted, #94a3b8);
}

.knowledge-base__feedback-status.is-success {
  color: var(--color-success, #22c55e);
}

.knowledge-base__feedback-status.is-error {
  color: var(--color-danger, #ef4444);
}

.table__row--active {
  background: rgba(59, 130, 246, 0.18);
}

.table__row--active:hover {
  background: rgba(59, 130, 246, 0.28);
}

.attempt-details {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.attempt-details__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #f8fafc;
}

.attempt-details__grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 900px) {
  .attempt-details__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.attempt-details__section {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.75rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.attempt-details__list {
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.attempt-details__list dt {
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.75);
  font-weight: 600;
}

.attempt-details__list dd {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(248, 250, 252, 0.95);
  white-space: pre-wrap;
  word-break: break-word;
}

.attempt-details__code {
  margin: 0;
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 0.65rem;
  max-height: 260px;
  overflow: auto;
  font-family: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', ui-monospace, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
}

@media (prefers-reduced-motion: reduce) {
  .header-search,
  .knowledge-base,
  .knowledge-base__content {
    transition: none;
  }
}

.notification-settings {
  display: grid;
  gap: var(--spacing-lg, 24px);
  grid-template-columns: minmax(220px, 260px) 1fr;
}

.notification-settings__sidebar {
  height: fit-content;
}

.notification-settings__menu .menu__item + .menu__item {
  margin-top: 0.25rem;
}

.notification-settings__menu .menu__link {
  width: 100%;
  text-align: left;
}

.notification-settings__menu .menu__link--active {
  background-color: var(--surface-strong, #eef2ff);
  color: var(--text-strong, inherit);
}

.notification-settings__main {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg, 24px);
}

.notification-settings__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.notification-settings__filters {
  max-width: 320px;
  width: 100%;
}

.notification-settings__content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg, 24px);
}

.notification-preference__description {
  font-size: 0.9rem;
  color: var(--text-muted, #6b7280);
}

.notification-preference__channel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notification-event-form__channels {
  display: grid;
  gap: 0.75rem;
}

.notification-event-form__channel {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.notification-event-form .automation-actions {
  margin-bottom: 0.75rem;
}

.stock-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 2.5rem;
  font-size: 1rem;
  line-height: 1;
}

.stock-status__icon {
  font-size: 1.125rem;
  line-height: 1;
}

.stock-status__label {
  font-size: 0.875rem;
}

.badge--success.stock-status {
  background: transparent;
  color: #22c55e;
}

.badge--warning.stock-status {
  background: transparent;
}

.cart-quantity {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.cart-quantity .stock-status {
  flex-shrink: 0;
}

@media (max-width: 960px) {
  .notification-settings {
    grid-template-columns: 1fr;
  }
}

/* Form field group for input + button layout */
.form-field__group {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.form-field__group .form-input {
  flex: 1;
}

.form-field__group .button {
  flex-shrink: 0;
  padding: var(--space-gap-tight) var(--space-gap-base);
}

/* Success state for form inputs */
.form-input--success {
  border-color: rgba(34, 197, 94, 0.8) !important;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25) !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Spin animation for loading state */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.spin-animation {
  animation: spin 1s linear infinite;
}

/* Task list styles */
.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-list__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.task-list__item:last-child {
  border-bottom: none;
}

.task-list__checkbox {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
}

.task-list__label {
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.5;
  word-break: break-word;
}

/* Ticket View Management Styles */
.ticket-group-header {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 2px solid rgba(148, 163, 184, 0.25);
}

.ticket-group-header td {
  padding: var(--space-gap-base) var(--space-gap-base) !important;
}

.ticket-group-header__content {
  display: flex;
  align-items: center;
  gap: var(--space-gap-base);
}

.ticket-group-header__toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7dd3fc;
  transition: transform 0.2s ease;
}

.ticket-group-header--collapsed .ticket-group-header__toggle {
  transform: rotate(-90deg);
}

.ticket-group-header__icon {
  fill: currentColor;
  width: 20px;
  height: 20px;
}

.ticket-group-header__title {
  font-weight: 600;
  font-size: 1rem;
  color: #f8fafc;
  text-transform: capitalize;
}

.ticket-group-header__count {
  color: rgba(226, 232, 240, 0.7);
  font-size: 0.875rem;
  margin-left: auto;
}

/* Ticket Filters - Redesigned Layout */
.ticket-filters-panel {
  min-width: 0;
}

.ticket-filters-panel__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.ticket-filters-panel__toggle-icon {
  width: 0.75rem;
  height: 0.75rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(135deg);
  transition: transform 0.2s ease;
}

.ticket-filters-panel--collapsed .ticket-filters-panel__toggle-icon {
  transform: rotate(-45deg);
}

.ticket-filters-panel--collapsed .ticket-filters {
  display: none;
}

.ticket-filters-panel--collapsed .ticket-filters-panel__toggle {
  margin-bottom: 0;
}

.ticket-filters {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ticket-filters__section {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
}

.ticket-filters__section-title {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.95);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* View Controls */
.ticket-filters__view-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ticket-filters__view-selector {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ticket-filters__view-selector .form-label {
  font-size: 0.85rem;
  margin-bottom: 0;
}

.ticket-filters__view-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Status Filter Grid */
.ticket-filters__status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
}

.ticket-filters__status-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ticket-filters__status-item:hover {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(148, 163, 184, 0.2);
}

.ticket-filters__status-item input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.ticket-filters__status-label {
  font-size: 0.875rem;
  color: rgba(226, 232, 240, 0.9);
  cursor: pointer;
  user-select: none;
}

/* Horizontal Section for Grouping and Search */
.ticket-filters__section--horizontal {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  padding: 1rem 1.25rem;
}

.ticket-filters__group-control,
.ticket-filters__search-control {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ticket-filters__group-control .form-label,
.ticket-filters__search-control .form-label {
  font-size: 0.85rem;
  margin-bottom: 0;
}

/* Phone Number Search */
.ticket-filters__phone-search {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ticket-filters__phone-search-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Right Column Layout */
.ticket-dashboard__right-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

.ticket-dashboard__right-column .management__toolbar {
  margin-top: -0.5rem;
}

.ticket-dashboard__right-column .management__toolbar-info {
  margin-bottom: 0.5rem;
}

.ticket-dashboard__right-column .table-wrapper {
  margin-top: 0;
}

@media (min-width: 960px) {
  .ticket-dashboard__overview--filters-collapsed {
    grid-template-columns: minmax(0, 3rem) minmax(0, 1fr);
  }

  .ticket-dashboard__overview--filters-collapsed .ticket-filters-panel__toggle {
    width: 100%;
    justify-content: center;
    padding-inline: 0.35rem;
    min-height: 2.5rem;
  }

  .ticket-dashboard__overview--filters-collapsed [data-ticket-filters-toggle-text] {
    display: none;
  }
}

.help {
  --help-sidebar-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.help__layout {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 960px) {
  .help__layout {
    grid-template-columns: minmax(0, var(--help-sidebar-width)) minmax(0, 1fr);
  }
}

.help__sidebar,
.help__content,
.help__content-stack {
  min-width: 0;
}

.help__sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.help__nav-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.help__nav-section + .help__nav-section {
  padding-top: 0.875rem;
  border-top: 1px solid var(--color-border);
}

.help__nav-section-title {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.help__nav-section-title:hover,
.help__nav-section-title:focus-visible {
  color: var(--color-text);
}

.help__nav-list,
.help__article-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}

.help__nav-item,
.help__article-item {
  margin: 0;
}

.help__nav-link,
.help__article-link {
  display: block;
  padding: 0.5rem 0.7rem;
  border-radius: 0.65rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: 0.93rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.help__nav-link:visited,
.help__article-link:visited {
  color: var(--color-text);
}

.help__nav-link:hover,
.help__nav-link:focus-visible,
.help__article-link:hover,
.help__article-link:focus-visible {
  color: var(--color-text-primary);
  background: var(--color-surface-3);
  border-color: var(--color-info);
  outline: none;
}

.help__nav-item--active .help__nav-link {
  color: var(--color-text-primary);
  background: var(--color-surface-3);
  border-color: var(--color-info);
  box-shadow: inset 0 0 0 2px var(--color-info);
}

.help__content-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.help__section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.help__section .card__header {
  margin-bottom: 0;
}

.help__content--placeholder {
  min-height: 10rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.help__placeholder-message {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  line-height: 1.35;
}

.help__article-body {
  min-width: 0;
}

.help__article-body a {
  color: var(--color-info);
}

.help__article-body a:visited {
  color: var(--color-text);
}

/* Legacy styles for backwards compatibility */
/* TODO: These can be removed after verifying no other templates use them */
.status-filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
  padding: var(--space-gap-base);
  background: rgba(15, 23, 42, 0.6);
  border-radius: 0.5rem;
  margin-bottom: var(--space-gap-roomy);
}

.status-filter-group__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.9);
  margin-bottom: var(--space-gap-tight);
}

.status-filter-group__options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-base);
}

.status-filter-option {
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
}

.status-filter-option input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}

.status-filter-option label {
  font-size: 0.9rem;
  color: #e2e8f0;
  cursor: pointer;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: var(--space-gap-base);
  margin-bottom: var(--space-gap-roomy);
}

.view-controls__selector {
  flex: 1;
  max-width: 300px;
}

.view-controls__actions {
  display: flex;
  gap: var(--space-gap-tight);
}

.task-list__label--completed {
  text-decoration: line-through;
  opacity: 0.6;
}

.task-list__actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.task-list__actions .button {
  padding: 0.25rem 0.5rem;
  min-width: auto;
}

/* Dialog styles for subscription change popup */
dialog.dialog {
  border: none;
  border-radius: 1rem;
  padding: 0;
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 24px 50px -20px rgba(15, 23, 42, 0.85);
  max-width: 32rem;
  width: 90vw;
}

dialog.dialog--wide {
  max-width: 64rem;
  width: min(95vw, 64rem);
}

dialog.dialog::backdrop {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
}

.dialog__container {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.dialog__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-gap-base);
  padding: calc(var(--space-gap-roomy) * 1.5) calc(var(--space-gap-roomy) * 1.5) var(--space-gap-base);
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.dialog__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  color: #f8fafc;
}

.dialog__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  border: none;
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  padding: 0;
}

.dialog__close:hover,
.dialog__close:focus-visible {
  background: rgba(148, 163, 184, 0.25);
  color: #f8fafc;
  outline: none;
}

.dialog__body {
  padding: calc(var(--space-gap-roomy) * 1.5);
  color: #e2e8f0;
}

.dialog__body p {
  margin: 0 0 var(--space-gap-roomy) 0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.dialog__footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-gap-base);
  padding: var(--space-gap-base) calc(var(--space-gap-roomy) * 1.5) calc(var(--space-gap-roomy) * 1.5);
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

@media (max-width: 640px) {
  dialog.dialog {
    max-width: 95vw;
    width: 95vw;
  }

  .dialog__header,
  .dialog__body,
  .dialog__footer {
    padding-left: var(--space-gap-roomy);
    padding-right: var(--space-gap-roomy);
  }
}


/* Billing Contacts Section */
.billing-contacts-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.billing-contact-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
}

.billing-contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.billing-contact-email {
  font-weight: 500;
  color: #1e293b;
}

.billing-contact-name {
  font-size: 0.875rem;
  color: #64748b;
}

/* Form collapsible for price change section */
.form-collapsible {
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0;
  margin: 1rem 0;
}

.form-collapsible__summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.form-collapsible__summary::-webkit-details-marker {
  display: none;
}

.form-collapsible__title {
  font-weight: 600;
  color: #1e293b;
}

.form-collapsible__icon {
  width: 1.25rem;
  height: 1.25rem;
  transition: transform 0.2s ease;
}

.form-collapsible__icon::after {
  content: "▼";
  display: block;
  color: #64748b;
  font-size: 0.75rem;
}

.form-collapsible[open] .form-collapsible__icon {
  transform: rotate(180deg);
}

.form-collapsible__content {
  padding: 0 1rem 1rem;
}

/* Business Continuity navigation menu */
.menu__item--expandable {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.menu__toggle {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.65rem var(--space-compact-inline);
  gap: var(--space-gap-tight);
  background: rgba(148, 163, 184, 0.1);
  border: none;
  border-radius: 0.65rem;
  color: rgba(226, 232, 240, 0.85);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.menu__toggle:hover,
.menu__toggle:focus-visible {
  background: rgba(148, 163, 184, 0.22);
  color: #f8fafc;
  outline: none;
}

.menu__item--expanded .menu__toggle {
  background: rgba(56, 189, 248, 0.24);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
  color: #bae6fd;
}

.menu__expand-icon {
  margin-left: auto;
  width: 1.05rem;
  height: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.menu__expand-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.menu__item--expanded .menu__expand-icon {
  transform: rotate(180deg);
}

.menu__submenu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0 0;
}

.menu__submenu--expanded {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.menu__subitem {
  margin: 0;
}

.menu__subitem a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem 0.45rem 2.6rem;
  border-radius: 0.55rem;
  color: rgba(226, 232, 240, 0.78);
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.menu__subitem a:hover,
.menu__subitem a:focus-visible {
  background: rgba(148, 163, 184, 0.22);
  color: #f8fafc;
  outline: none;
}

.menu__subitem a[aria-current='page'] {
  background: rgba(56, 189, 248, 0.28);
  color: #bae6fd;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

/* Business Continuity workspace */
.bc-shell {
  display: grid;
  gap: calc(var(--space-gap-roomy) * 1.5);
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  align-items: start;
}

.bc-shell__sidebar {
  gap: var(--space-gap-base);
  position: sticky;
  top: calc(var(--space-gap-roomy) * 1.2);
}

.bc-shell__heading {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.bc-shell__title {
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.92);
}

.bc-shell__subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.78);
}

.bc-shell__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.bc-shell__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.bc-shell__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.85rem;
  text-decoration: none;
  color: rgba(226, 232, 240, 0.82);
  background: rgba(148, 163, 184, 0.08);
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.bc-shell__link:hover,
.bc-shell__link:focus-visible {
  background: rgba(148, 163, 184, 0.22);
  color: #f8fafc;
  outline: none;
}

.bc-shell__link--active {
  background: rgba(56, 189, 248, 0.22);
  color: #bae6fd;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.bc-shell__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  color: inherit;
}

.bc-shell__icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  opacity: 0.85;
}

.bc-shell__label {
  font-weight: 600;
}

.bc-shell__content {
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-gap-roomy) * 1.2);
}

@media (max-width: 1080px) {
  .bc-shell {
    grid-template-columns: 1fr;
  }

  .bc-shell__sidebar {
    position: relative;
    top: auto;
  }
}

/* Business Continuity common utilities */
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-tight);
}

.filter-group .form-input,
.filter-group .form-select {
  min-width: 180px;
}

.table-sort {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.table-sort__icon::after {
  content: '⇅';
  font-size: 0.75rem;
  opacity: 0.4;
}

.table-sort--asc .table-sort__icon::after {
  content: '↑';
  opacity: 0.95;
  color: #bae6fd;
}

.table-sort--desc .table-sort__icon::after {
  content: '↓';
  opacity: 0.95;
  color: #bae6fd;
}

.badge--disaster_recovery {
  background: rgba(248, 113, 113, 0.22);
  color: #fecaca;
}

.badge--incident_response {
  background: rgba(253, 224, 71, 0.2);
  color: #fef3c7;
}

.badge--business_continuity {
  background: rgba(56, 189, 248, 0.2);
  color: #bae6fd;
}

.badge--neutral {
  background: rgba(148, 163, 184, 0.2);
  color: rgba(229, 231, 235, 0.85);
}

.status--warning {
  background: rgba(253, 224, 71, 0.2);
  color: #fef3c7;
}

.status--info {
  background: rgba(56, 189, 248, 0.2);
  color: #bae6fd;
}

.status--neutral {
  background: rgba(148, 163, 184, 0.18);
  color: rgba(229, 231, 235, 0.88);
}

.status--xero {
  background: rgba(19, 181, 234, 0.18);
  color: #7de8fc;
}

.plan-header {
  display: flex;
  align-items: center;
  gap: var(--space-gap-base);
  flex-wrap: wrap;
}

.action-menu {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-tight);
  align-items: center;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-tight);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  margin-bottom: calc(var(--space-gap-roomy) * 1.2);
}

.tabs__tab {
  padding: 0.75rem 1.1rem;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  border-radius: 0.75rem 0.75rem 0 0;
  color: rgba(148, 163, 184, 0.78);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.tabs__tab:hover,
.tabs__tab:focus-visible {
  color: #f8fafc;
  background: rgba(148, 163, 184, 0.16);
  outline: none;
}

.tabs__tab--active {
  color: #bae6fd;
  border-bottom-color: #38bdf8;
  background: rgba(56, 189, 248, 0.18);
}

.tab-panels {
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-gap-roomy) * 1.2);
}

.tab-panel {
  display: none;
}

.tab-panel--active {
  display: block;
}

.service-status {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-roomy);
}

.service-status__summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.service-status__summary-header {
  margin-bottom: 0.5rem;
}

.service-status__summary-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #f8fafc;
}

.service-status__summary-subtitle {
  margin: 0;
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.95rem;
}

.service-status__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.service-status__stat {
  position: relative;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  background: rgba(15, 23, 42, 0.65);
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.service-status__stat::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.25;
}

.service-status__stat--total::before {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.7), rgba(37, 99, 235, 0.6));
}

.service-status__stat--operational::before {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.7), rgba(22, 163, 74, 0.6));
}

.service-status__stat--maintenance::before {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.7), rgba(217, 119, 6, 0.6));
}

.service-status__stat--degraded::before {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.7), rgba(234, 179, 8, 0.6));
}

.service-status__stat--partial_outage::before {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.7), rgba(249, 115, 22, 0.6));
}

.service-status__stat--outage::before {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.7), rgba(220, 38, 38, 0.6));
}

.service-status__stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.3);
}

.service-status__stat-label {
  position: relative;
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  z-index: 1;
}

.service-status__stat-value {
  position: relative;
  font-size: 2rem;
  font-weight: 700;
  color: #f9fafb;
  line-height: 1;
  z-index: 1;
}

.service-status__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-gap-roomy);
}

.service-status__empty {
  padding: 2rem;
  border-radius: var(--radius-large);
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.15);
  text-align: center;
}

.service-card {
  position: relative;
  border-radius: var(--radius-large);
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: var(--space-gap-roomy);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  transition: opacity 0.2s ease;
}

.service-card--operational::before {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.9), rgba(22, 163, 74, 0.8));
}

.service-card--operational {
  border-color: rgba(34, 197, 94, 0.3);
}

.service-card--maintenance::before {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.9), rgba(217, 119, 6, 0.8));
}

.service-card--maintenance {
  border-color: rgba(245, 158, 11, 0.3);
}

.service-card--degraded::before {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.9), rgba(234, 179, 8, 0.8));
}

.service-card--degraded {
  border-color: rgba(251, 191, 36, 0.3);
}

.service-card--partial_outage::before {
  background: linear-gradient(90deg, rgba(251, 146, 60, 0.9), rgba(249, 115, 22, 0.8));
}

.service-card--partial_outage {
  border-color: rgba(251, 146, 60, 0.3);
}

.service-card--outage::before {
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.9), rgba(220, 38, 38, 0.8));
}

.service-card--outage {
  border-color: rgba(239, 68, 68, 0.3);
}

.service-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.4);
}

.service-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-gap-base);
}

.service-card__title {
  margin: 0;
  font-size: 1.1rem;
}

.service-card__message {
  margin: 0;
  font-weight: 600;
  color: #f1f5f9;
}

.service-card__message--muted {
  color: rgba(148, 163, 184, 0.9);
  font-weight: 500;
}

.service-card__description {
  margin: 0;
  color: rgba(148, 163, 184, 0.85);
}

.service-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.service-card__tags .tag {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  background: rgba(100, 116, 139, 0.2);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: rgba(203, 213, 225, 0.9);
}

.service-card__footer {
  margin-top: auto;
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.9);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.service-card__ai-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(139, 92, 246, 0.9);
  text-decoration: none;
  cursor: default;
}

a.service-card__ai-icon {
  cursor: pointer;
}

a.service-card__ai-icon:hover {
  color: rgba(167, 139, 250, 1);
  text-decoration: none;
}

.service-status-admin__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-gap-tight);
}

.service-status-admin__stat {
  background: rgba(15, 23, 42, 0.8);
  border-radius: var(--radius-medium);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.service-status-admin__stat-label {
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.9);
}

.service-status-admin__stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f8fafc;
}

.service-status-admin__stat--total .service-status-admin__stat-value {
  color: #38bdf8;
}

.service-status-admin__companies {
  margin: 0;
  padding-left: 1.2rem;
  color: rgba(148, 163, 184, 0.9);
}

.service-status-admin__companies li {
  margin-bottom: 0.15rem;
}

.service-status-admin__companies li:last-child {
  margin-bottom: 0;
}

.service-status-admin__name {
  font-weight: 600;
}

@media (max-width: 960px) {
  .service-status__grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.detail-list {
  display: grid;
  gap: calc(var(--space-gap-roomy) * 1.1);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-bottom: calc(var(--space-gap-roomy) * 1.4);
}

.detail-list__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(148, 163, 184, 0.78);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.detail-list__value {
  font-size: 0.95rem;
  color: #f8fafc;
}

.plan-content {
  padding-top: calc(var(--space-gap-roomy) * 1.2);
  border-top: 1px solid rgba(148, 163, 184, 0.16);
}

.plan-content h3 {
  margin: 0 0 var(--space-gap-base);
  font-size: 1.05rem;
  color: #f8fafc;
}

.rich-text {
  line-height: 1.65;
  color: rgba(226, 232, 240, 0.88);
}

.timeline {
  position: relative;
  padding-left: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-roomy);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.85rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(148, 163, 184, 0.2);
}

.timeline__item {
  position: relative;
  padding-left: 0.75rem;
}

.timeline__marker {
  position: absolute;
  left: -0.45rem;
  top: 0.4rem;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  border: 2px solid rgba(15, 23, 42, 0.85);
  box-shadow: 0 0 0 4px rgba(15, 23, 42, 0.75);
}

.timeline__marker--active {
  background: #38bdf8;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.25);
}

.timeline--conversation {
  position: static;
  padding-left: 0;
}

.timeline--conversation::before {
  display: none;
}

.version-card,
.review-card {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.85rem;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.version-card__header,
.review-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-gap-tight);
  flex-wrap: wrap;
}

.version-card__title,
.review-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #f8fafc;
}

.version-card__meta,
.review-card__meta {
  margin: 0;
  color: rgba(148, 163, 184, 0.78);
  font-size: 0.85rem;
}

.version-card__actions {
  display: flex;
  gap: var(--space-gap-tight);
  flex-wrap: wrap;
}

.version-card__summary,
.review-card__notes {
  margin: 0;
  color: rgba(226, 232, 240, 0.85);
  font-size: 0.9rem;
}

.review-card__status {
  display: inline-flex;
  align-items: center;
  padding: var(--space-compact) var(--space-gap-tight);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.review-card__status--approved {
  background: rgba(134, 239, 172, 0.22);
  color: #bbf7d0;
}

.review-card__status--changes_requested {
  background: rgba(253, 224, 71, 0.22);
  color: #fef3c7;
}

.attachments-grid {
  display: grid;
  gap: var(--space-gap-roomy);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.attachment-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-gap-base);
  padding: 0.9rem 1.1rem;
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.attachment-card__icon {
  width: 2.5rem;
  height: 2.5rem;
  color: rgba(148, 163, 184, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.attachment-card__icon svg {
  width: 100%;
  height: 100%;
}

.attachment-card__content {
  flex: 1 1 auto;
  min-width: 0;
}

.attachment-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
}

.attachment-card__name {
  margin: 0 0 0.25rem;
  font-weight: 600;
  color: #f8fafc;
  flex: 1 1 auto;
  min-width: 0;
}

.attachment-card__name a {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

.attachment-card__meta {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(148, 163, 184, 0.78);
}

.attachment-card__actions {
  display: flex;
  align-items: center;
  gap: var(--space-compact);
}

.attachment-card__action {
  flex-shrink: 0;
}

.dropdown {
  position: relative;
}

.dropdown__menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  min-width: 12rem;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 22px 40px -24px rgba(15, 23, 42, 0.9);
  padding: 0.25rem 0;
  display: none;
  z-index: 60;
}

.dropdown__menu--open {
  display: block;
}

.dropdown__item {
  width: 100%;
  padding: 0.65rem 1rem;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.9);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.dropdown__item:hover,
.dropdown__item:focus-visible {
  background: rgba(56, 189, 248, 0.2);
  color: #bae6fd;
  outline: none;
}

.dropdown__item--checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.empty-message {
  text-align: center;
  color: rgba(148, 163, 184, 0.78);
  padding: calc(var(--space-gap-roomy) * 1.4) 0;
}

.acknowledgment-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
  margin: calc(var(--space-gap-roomy) * 1.4) 0;
  padding: 1.5rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(56, 189, 248, 0.32);
  background: rgba(56, 189, 248, 0.12);
}

.ack-summary__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-gap-tight);
  flex-wrap: wrap;
}

.ack-summary__header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: #bae6fd;
}

.ack-summary__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-tight);
}

.ack-summary__stats {
  display: grid;
  gap: var(--space-gap-base);
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.bc-shell__content .stat-card {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 0.85rem;
  padding: 0.9rem 1rem;
}

/* Compliance pages */
.compliance .card--panel {
  gap: 1.25rem;
}

.compliance__header {
  align-items: flex-start;
  gap: 1.5rem;
}

.compliance__header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.compliance-summary-card {
  gap: 1.25rem;
}

.compliance-summary__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.compliance-summary__item {
  background: rgba(15, 23, 42, 0.75);
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: 1rem 1.25rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.bc-shell__content .stat-card--loading {
  animation: bc-pulse 1.2s ease-in-out infinite alternate;
  opacity: 0.7;
}

.bc-shell__content .stat-card__value {
  font-size: 1.6rem;
  font-weight: 600;
  color: #f8fafc;
}

.bc-shell__content .stat-card__label {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.78);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ack-summary__pending {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.85rem;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.ack-pending__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-gap-tight);
  flex-wrap: wrap;
}

.ack-pending__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.ack-pending__empty {
  text-align: center;
  color: rgba(148, 163, 184, 0.78);
  padding: 0.85rem 0;
}

.ack-pending__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-gap-tight);
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.ack-pending__item:last-child {
  border-bottom: none;
}

.ack-pending__user {
}

.compliance-summary__item--accent {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.22), rgba(59, 130, 246, 0.1));
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 18px 36px -24px rgba(56, 189, 248, 0.45);
}

.compliance-summary__label {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.72);
}

.compliance-summary__value {
  font-size: 1.75rem;
  font-weight: 600;
  color: #f8fafc;
}

.ack-pending__email {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.78);
}

.ack-pending__actions {
  display: flex;
  gap: var(--space-gap-tight);
}

.ack-pending__actions button {
  background: none;
  border: none;
  color: #38bdf8;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
}

.ack-pending__actions button:hover,
.ack-pending__actions button:focus-visible {
  color: #bae6fd;
  outline: none;
  text-decoration: underline;
}

@keyframes bc-pulse {
  from {
    opacity: 0.6;
  }

  to {
    opacity: 1;
  }
}

/* Plan editor */
.plan-editor {
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-gap-roomy) * 1.2);
}

.form-group--full {
  grid-column: 1 / -1;
}

.autosave-indicator {
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.78);
  min-height: 1rem;
}

.autosave-indicator--saving {
  color: #bae6fd;
}

.autosave-indicator--saved {
  color: #bbf7d0;
}

.editor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-tight);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  overflow-x: auto;
}

.editor-tabs__tab {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: rgba(148, 163, 184, 0.78);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 0.75rem 0.75rem 0 0;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.editor-tabs__tab:hover,
.editor-tabs__tab:focus-visible {
  color: #f8fafc;
  background: rgba(148, 163, 184, 0.16);
  outline: none;
}

.editor-tabs__tab--active {
  color: #bae6fd;
  border-bottom-color: #38bdf8;
  background: rgba(56, 189, 248, 0.18);
}

.editor-panels {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-roomy);
}

.editor-panel {
  display: none;
}

.editor-panel--active {
  display: block;
}

.section-description {
  margin-top: 0.25rem;
  color: rgba(148, 163, 184, 0.78);
}

.rich-text-editor {
  min-height: 180px;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.75);
  color: #f8fafc;
  line-height: 1.6;
}

.rich-text-editor:focus {
  outline: none;
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.table-editor {
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  overflow: hidden;
}

.table--editable th,
.table--editable td {
  background: rgba(15, 23, 42, 0.78);
}

.table--editable input {
  width: 100%;
}

.file-upload {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.file-upload__input {
  display: none;
}

.file-upload__label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-gap-tight);
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  background: rgba(148, 163, 184, 0.18);
  color: rgba(226, 232, 240, 0.9);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.file-upload__label:hover,
.file-upload__label:focus-visible {
  background: rgba(56, 189, 248, 0.22);
  color: #bae6fd;
  outline: none;
}

.file-upload__files {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-gap-tight);
  padding: 0.6rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.file-item__name {
  color: rgba(226, 232, 240, 0.9);
  font-size: 0.85rem;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-gap-tight);
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.88);
}

.switch input[type='checkbox'] {
  accent-color: #38bdf8;
  width: 2.5rem;
  height: 1.25rem;
}

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.85rem 1.1rem;
  border-radius: 0.85rem;
  color: #f8fafc;
  font-weight: 600;
  box-shadow: 0 20px 40px -25px rgba(15, 23, 42, 0.9);
  z-index: 3000;
}

.toast--success {
  background: rgba(34, 197, 94, 0.85);
}

/* Template builder */
.template-editor {
  display: flex;
  flex-direction: column;
  gap: calc(var(--space-gap-roomy) * 1.4);
}

.section-builder {
  display: grid;
  grid-template-columns: 18rem 1fr;
  gap: var(--space-gap-roomy);
  min-height: 28rem;
}

.section-builder__sidebar {
  border-radius: 0.85rem;
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.78);
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.section-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.section-list__item {
  border: 1px solid transparent;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: rgba(15, 23, 42, 0.65);
  color: #f8fafc;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.section-list__item:hover,
.section-list__item:focus-visible {
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
  outline: none;
}

.section-list__item--active {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.section-list__name {
  font-weight: 600;
}

.section-list__meta {
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.78);
}

.section-builder__content {
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.78);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.builder-panel {
  display: none;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.builder-panel--active {
  display: flex;
}

.builder-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-gap-tight);
  flex-wrap: wrap;
}

.builder-panel__title {
  margin: 0;
  font-size: 1.2rem;
  color: #f8fafc;
}

.builder-panel__description {
  margin: 0;
  color: rgba(148, 163, 184, 0.78);
}

.field-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.field-card {
  border-radius: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.75);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-tight);
}

.field-card__heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-gap-tight);
}

.field-card__name {
  font-weight: 600;
  color: #f8fafc;
}

.field-card__meta {
  font-size: 0.75rem;
  color: #bae6fd;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.field-card__description {
  margin: 0;
  color: rgba(226, 232, 240, 0.82);
  font-size: 0.9rem;
}

.field-card__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-gap-tight);
}

@media (max-width: 1024px) {
  .section-builder {
    grid-template-columns: 1fr;
  }

  .section-builder__content {
    margin-top: 1.25rem;
  }
}

.link-primary {
  color: #38bdf8;
  text-decoration: none;
  transition: color 0.2s ease;
}

.link-primary:hover,
.link-primary:focus-visible {
  color: #bae6fd;
  text-decoration: underline;
  outline: none;
}

/* Reports */
.stats-grid {
  display: grid;
  gap: var(--space-gap-base);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: calc(var(--space-gap-roomy) * 1.2);
}

.report-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
  margin-bottom: calc(var(--space-gap-roomy) * 1.4);
}

.report-options__title,
.recent-reports__title {
  margin: 0;
  font-size: 1.05rem;
  color: #f8fafc;
}

.recent-reports {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.compliance-summary__hint,
.compliance-summary__value small {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.85);
}

.compliance-table-card {
  overflow: hidden;
}

.compliance-table__control {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.compliance-table__control-title {
  display: block;
  font-weight: 600;
}

.compliance-table__description {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.85);
}

.compliance-table__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.compliance-table__ml-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.badge--status-not_started {
  background: rgba(148, 163, 184, 0.18);
  color: rgba(226, 232, 240, 0.82);
}

.badge--status-in_progress {
  background: rgba(59, 130, 246, 0.22);
  color: #bfdbfe;
}

.badge--status-compliant {
  background: rgba(34, 197, 94, 0.22);
  color: #bbf7d0;
}

.badge--status-non_compliant {
  background: rgba(248, 113, 113, 0.22);
  color: #fecaca;
}

.badge--status-not_applicable {
  background: rgba(148, 163, 184, 0.16);
  color: rgba(226, 232, 240, 0.78);
}

.badge--maturity-ml0 {
  background: rgba(148, 163, 184, 0.16);
  color: rgba(226, 232, 240, 0.8);
}

.badge--maturity-ml1 {
  background: rgba(253, 224, 71, 0.18);
  color: #fef3c7;
}

.badge--maturity-ml2 {
  background: rgba(96, 165, 250, 0.2);
  color: #bfdbfe;
}

.badge--maturity-ml3 {
  background: rgba(16, 185, 129, 0.22);
  color: #bbf7d0;
}

.compliance__note {
  margin-top: 1rem;
}

.compliance-requirements {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.compliance-requirements__group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.compliance-requirements__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.compliance-requirements__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.compliance-requirements__list {
  display: flex;
  flex-direction: column;
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.55);
  overflow: hidden;
}

.requirement-item {
  width: 100%;
}

.requirement-item.card-collapsible {
  gap: 0;
}

.requirement-item + .requirement-item {
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.requirement-item__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.requirement-item__header:hover,
.requirement-item.is-expanded .requirement-item__header,
.requirement-item[open] .requirement-item__header {
  background: rgba(148, 163, 184, 0.1);
}

.requirement-item__number {
  flex: 0 0 auto;
  width: 2.5rem;
  text-align: center;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.75);
}

.requirement-item__description {
  flex: 1 1 240px;
  margin: 0;
  color: #f8fafc;
  line-height: 1.5;
}

.requirement-item__status {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  min-width: 150px;
}

.requirement-item__details {
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.7);
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.compliance-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 820px;
}

.compliance-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.requirement-item__ticket-form {
  display: inline-flex;
  margin: 0;
}

.requirement-item__help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--color-info, #38bdf8);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.requirement-item__help-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  color: var(--color-info, #38bdf8);
}

.compliance-toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  padding: 0.9rem 1.25rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #f8fafc;
  box-shadow: 0 18px 36px -24px rgba(15, 23, 42, 0.95);
  z-index: 1600;
  animation: compliance-toast-in 0.25s ease;
}

.compliance-toast--success {
  background: rgba(22, 101, 52, 0.88);
  border-color: rgba(34, 197, 94, 0.45);
  color: #bbf7d0;
}

.compliance-toast--error {
  background: rgba(127, 29, 29, 0.88);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

@keyframes compliance-toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .compliance-summary__grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}

@media (max-width: 720px) {
  .compliance-table__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .requirement-item__status {
    order: 2;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .requirement-item.card-collapsible .card__collapsible-meta {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
}

/* ============================================
   BCP UI/UX Polish & Accessibility Styles
   ============================================ */

/* Form Components - Consistent Styling */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.form-label.required::after {
  content: " *";
  color: #ef4444;
}

.form-help {
  display: inline-block;
  margin-left: 0.375rem;
  color: #94a3b8;
  font-weight: 400;
  font-size: 0.8125rem;
}

.form-help-text {
  display: block;
  margin-top: 0.375rem;
  color: #94a3b8;
  font-size: 0.8125rem;
  line-height: 1.4;
}

.form-input,
.form-textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.625rem 0.875rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.375rem;
  background: rgba(30, 41, 59, 0.5);
  color: #f1f5f9;
  font-size: 0.9375rem;
  transition: all 0.2s;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(30, 41, 59, 0.7);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input:disabled,
.form-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.management__column--details .form-input,
.management__column--details .form-textarea {
  max-width: 90%;
}

.company-edit-page .form-input,
.company-edit-page .form-textarea {
  max-width: 85%;
}

.ticket-reply-form .form-input,
.ticket-reply-form .form-textarea,
.ticket-reply-form .rich-text-editor {
  max-width: 98%;
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  user-select: none;
}

input.form-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: #3b82f6;
}

.form-checkbox-text {
  color: #e2e8f0;
  font-size: 0.9375rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}

/* Table Components - Sticky Headers & Consistent Styling */
.table-container {
  overflow-x: auto;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.data-table tbody tr {
  transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.data-table--sticky thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
}

.data-table th {
  padding: 0.875rem;
  text-align: left;
  font-weight: 600;
  color: #cbd5e1;
  border-bottom: 2px solid rgba(148, 163, 184, 0.2);
  white-space: nowrap;
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 2rem;
}

.data-table th.sortable:hover {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.05);
}

.data-table th.sortable:focus {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

.sort-indicator {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0.3;
}

.data-table th.sortable:hover .sort-indicator {
  opacity: 0.6;
}

.data-table th.sorted-asc .sort-indicator {
  border-bottom: 6px solid currentColor;
  opacity: 1;
}

.data-table th.sorted-desc .sort-indicator {
  border-top: 6px solid currentColor;
  opacity: 1;
}

.data-table td {
  padding: 0.875rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  color: #e2e8f0;
}

.data-table tbody tr:hover {
  background: rgba(56, 189, 248, 0.1);
  box-shadow: inset 3px 0 0 rgba(56, 189, 248, 0.45);
}

.data-table tbody tr:has(a:hover, button:hover, input:hover, select:hover, textarea:hover) {
  background: rgba(56, 189, 248, 0.12);
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* CSV Export Button */
.csv-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #94a3b8;
}

.empty-state-icon {
  margin-bottom: 1rem;
}

.empty-state-message {
  font-size: 1rem;
  margin: 0 0 1.5rem 0;
  color: #cbd5e1;
}

/* Badge Component */
.badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.badge-default {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.badge-primary {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.badge-success {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.badge-warning {
  background: rgba(251, 146, 60, 0.2);
  color: #fdba74;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.badge-high {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.badge-medium {
  background: rgba(251, 146, 60, 0.2);
  color: #fdba74;
}

.badge-low {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  gap: 1rem;
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(148, 163, 184, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-message {
  color: #94a3b8;
  font-size: 0.9375rem;
}

/* Help Card Component */
.help-card {
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.help-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1rem;
  font-weight: 600;
  color: #93c5fd;
  margin: 0 0 0.75rem 0;
}

.help-text {
  color: #cbd5e1;
  line-height: 1.6;
  font-size: 0.9375rem;
}

.help-text ul {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.help-text li {
  margin: 0.375rem 0;
}

/* Responsive Mobile-First BCP Pages */
@media (max-width: 768px) {
  /* Mobile: Stack tabs vertically */
  .tabs {
    flex-direction: column;
    gap: 0.25rem;
    border-bottom: none;
  }
  
  .tab {
    justify-content: flex-start;
    border-bottom: none;
    border-left: 3px solid transparent;
    margin-bottom: 0;
  }
  
  .tab.active {
    border-left-color: #2563eb;
    border-bottom-color: transparent;
  }
  
  /* Mobile: Show checklist first, hide others by default */
  .mobile-tab-content {
    display: none;
  }
  
  .mobile-tab-content.active {
    display: block;
  }
  
  /* Make heatmap cells larger on mobile for touch */
  .heatmap-cell {
    min-width: 60px;
    min-height: 60px;
  }
  
  /* Stack form actions vertically on mobile */
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions > * {
    width: 100%;
  }
  
  /* Stack page actions on mobile */
  .page-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .page-actions > * {
    width: 100%;
  }
}

/* Keyboard Navigation & Focus States */
.checklist-item {
  position: relative;
}

.checklist-item:focus-within {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 0.375rem;
}

.checkbox:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

.heatmap-cell:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Skip Link for Accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #3b82f6;
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  border-radius: 0 0 0.375rem 0;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Ensure all interactive elements have visible focus */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .form-input,
  .form-textarea {
    border-width: 2px;
  }
  
  .data-table th,
  .data-table td {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .spinner {
    animation: none;
    border-top-color: transparent;
  }
}

/* User permissions modal styles */
.modal__content--large {
  width: 90vw;
  max-width: 1200px;
  height: 90vh;
  max-height: 90vh;
}

.permissions-display {
  padding: var(--space-gap-base);
  background: rgba(30, 41, 59, 0.5);
  border-radius: 0.5rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-gap-base);
}

.permission-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-gap-roomy);
  background: rgba(30, 41, 59, 0.5);
  border: 2px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.permission-card:hover {
  background: rgba(51, 65, 85, 0.6);
  border-color: rgba(148, 163, 184, 0.4);
}

.permission-card input[type="checkbox"] {
  margin-bottom: var(--space-gap-tight);
}

.permission-card input[type="checkbox"]:checked ~ .permission-card__title {
  color: #60a5fa;
}

.permission-card input[type="checkbox"]:checked + .permission-card__title,
.permission-card input[type="checkbox"]:checked ~ .permission-card__description {
  color: inherit;
}

.permission-card__title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: var(--space-gap-tight);
  color: #e2e8f0;
}

.permission-card__description {
  font-size: 0.875rem;
  color: #94a3b8;
  line-height: 1.4;
}

/* Optional accessories table image column */
.table__col-image {
  width: 72px;
  text-align: center;
}

.table__image-btn {
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 0.5rem;
  transition: opacity 0.15s ease;
}

.table__image-btn:hover,
.table__image-btn:focus-visible {
  opacity: 0.8;
  outline: 2px solid var(--color-primary, #60a5fa);
  outline-offset: 2px;
}

.table__thumbnail--lg {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 0.375rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.5);
}

.table__no-image {
  color: rgba(148, 163, 184, 0.5);
}

/* Image preview modal */
.modal__content--image-preview {
  width: auto;
  max-width: min(90vw, 720px);
  height: auto;
  max-height: 90vh;
}

.modal__content--image-preview .modal__image {
  max-height: 60vh;
  width: auto;
  max-width: 100%;
}

/* ============================================================================
 * Mobile primitives — .table--stack-mobile, mobile-collapsible, header
 * action overflow, tap-target sizing. See docs/MOBILE_UX_GUIDELINES.md.
 * ============================================================================ */

/* Card-stack table pattern: any <table class="table table--stack-mobile">
 * automatically reflows into stacked cards under 640px, using the
 * data-label="…" attribute already present on most <td>s. */
@media (max-width: 640px) {
  .table--stack-mobile,
  .table--stack-mobile thead,
  .table--stack-mobile tbody,
  .table--stack-mobile tfoot,
  .table--stack-mobile tr,
  .table--stack-mobile th,
  .table--stack-mobile td {
    display: block;
    width: 100%;
  }

  .table--stack-mobile thead {
    position: absolute;
    left: -9999px;
    top: -9999px;
    height: 0;
    overflow: hidden;
  }

  .table--stack-mobile tr {
    margin: 0 0 var(--space-gap-base);
    padding: var(--space-gap-tight) var(--space-gap-base);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0.85rem;
    background: rgba(15, 23, 42, 0.45);
  }

  .table--stack-mobile td {
    border: none;
    padding: 0.25rem 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-gap-tight);
    text-align: right;
  }

  .table--stack-mobile td[data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    color: rgba(226, 232, 240, 0.75);
    text-align: left;
    flex: 0 0 40%;
    word-break: break-word;
  }

  .table--stack-mobile td:not([data-label]) {
    justify-content: flex-start;
    text-align: left;
  }

  .table--stack-mobile td.table__actions,
  .table--stack-mobile td.table__checkbox {
    justify-content: flex-end;
  }
}

/* Mobile-collapsible: <details class="mobile-collapsible"> stays expanded on
 * desktop and collapses to a tap-to-expand on phones. */
.mobile-collapsible {
  border: none;
  margin: 0;
  padding: 0;
}

.mobile-collapsible > summary {
  list-style: none;
  cursor: default;
  display: block;
}

.mobile-collapsible > summary::-webkit-details-marker {
  display: none;
}

@media (min-width: 641px) {
  .mobile-collapsible[open],
  .mobile-collapsible {
    /* Always show contents on desktop regardless of open state. */
  }
  .mobile-collapsible > summary {
    cursor: default;
  }
  /* Hide the visual toggle chip on desktop — content is always visible. */
  .mobile-collapsible__toggle {
    display: none;
  }
  /* Always render content on desktop, even when <details> is closed. */
  .mobile-collapsible:not([open]) > *:not(summary) {
    display: revert;
  }
}

@media (max-width: 640px) {
  .mobile-collapsible > summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-gap-tight);
    padding: var(--space-gap-tight) var(--space-gap-base);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.4);
    color: rgba(248, 250, 252, 0.92);
    font-weight: 600;
    user-select: none;
  }
  .mobile-collapsible > summary::after {
    content: '▾';
    font-size: 0.75rem;
    color: rgba(148, 163, 184, 0.85);
    transition: transform 0.2s ease;
  }
  .mobile-collapsible[open] > summary::after {
    transform: rotate(180deg);
  }
  .mobile-collapsible[open] > *:not(summary) {
    margin-top: var(--space-gap-tight);
  }
}

/* Header actions overflow — collapses 3+ inline buttons into a "More" menu
 * on phones. Pages opt-in by adding the .header__actions--overflow modifier
 * and wrapping secondary buttons in .header__actions-secondary. */
.header__actions--overflow .header__actions-overflow-toggle {
  display: none;
}

@media (max-width: 640px) {
  .header__actions--overflow {
    position: relative;
  }
  .header__actions--overflow .header__actions-secondary {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 0.35rem);
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-gap-tight);
    padding: var(--space-gap-tight);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 18px 36px -22px rgba(15, 23, 42, 0.95);
    min-width: 200px;
    z-index: 950;
  }
  .header__actions--overflow.is-open .header__actions-secondary {
    display: flex;
  }
  .header__actions--overflow .header__actions-overflow-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 0.65rem;
    border-radius: 0.7rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.55);
    color: #e2e8f0;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
  }
  .header__actions--overflow .header__actions-overflow-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35);
  }
}

/* Tap-target sizing — ensure interactive controls inside data tables and
 * action bars meet the 44×44 minimum on phones. */
@media (max-width: 640px) {
  .table .button,
  .table__actions .button,
  .header__actions .button,
  .header-actions .button {
    min-height: 44px;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }
}

/* ===========================================================================
 * Standardised page-layout primitives.
 * See docs/ui_layout_standards.md and templates/macros/{header,counters,tables}.html.
 * =========================================================================== */

/* --- Utility ---------------------------------------------------------------- */

.is-hidden {
  display: none !important;
}

/* --- Stat strip (counter strip) -------------------------------------------- */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: var(--space-gap-comfortable, 1.25rem);
}

.stat-strip__stat {
  position: relative;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  background: rgba(15, 23, 42, 0.65);
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
}

a.stat-strip__stat:focus-visible {
  outline: 2px solid var(--color-accent, #38bdf8);
  outline-offset: 2px;
}

.stat-strip__stat::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.25;
}

.stat-strip__stat--total::before {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.7), rgba(37, 99, 235, 0.6));
}

.stat-strip__stat--operational::before,
.stat-strip__stat--success::before {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.7), rgba(22, 163, 74, 0.6));
}

.stat-strip__stat--maintenance::before,
.stat-strip__stat--info::before {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.7), rgba(217, 119, 6, 0.6));
}

.stat-strip__stat--degraded::before,
.stat-strip__stat--warning::before {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.7), rgba(234, 179, 8, 0.6));
}

.stat-strip__stat--partial_outage::before {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.7), rgba(249, 115, 22, 0.6));
}

.stat-strip__stat--outage::before,
.stat-strip__stat--danger::before {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.7), rgba(220, 38, 38, 0.6));
}

.stat-strip__stat--neutral::before {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.4), rgba(100, 116, 139, 0.3));
}

.stat-strip__stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.3);
}

.stat-strip__stat-label {
  position: relative;
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  z-index: 1;
}

.stat-strip__stat-value {
  position: relative;
  font-size: 2rem;
  font-weight: 700;
  color: #f9fafb;
  line-height: 1;
  z-index: 1;
}

/* --- Header menu (Actions ▾ disclosure) ------------------------------------ */

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.header-menu {
  position: relative;
  display: inline-flex;
}

.header-menu__button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.header-menu__chevron {
  transition: transform 0.15s ease;
}

.header-menu--open .header-menu__chevron {
  transform: rotate(180deg);
}

.header-menu__panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 14rem;
  max-width: min(90vw, 22rem);
  padding: 0.35rem;
  border-radius: 0.6rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface, rgba(15, 23, 42, 0.95));
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  z-index: 60;
}

.header-menu__panel[hidden] {
  display: none;
}

.header-menu__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.4rem;
  background: transparent;
  border: 0;
  color: var(--color-text, #e2e8f0);
  font-size: 0.9rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}

.header-menu__item:hover,
.header-menu__item:focus-visible {
  background: rgba(148, 163, 184, 0.15);
  outline: none;
}

.header-menu__item:disabled,
.header-menu__item[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.header-menu__item--danger {
  color: #fca5a5;
}

.header-menu__item--danger:hover,
.header-menu__item--danger:focus-visible {
  background: rgba(239, 68, 68, 0.15);
}

.header-menu__item--reset {
  margin-top: 0.25rem;
  border-top: 1px solid var(--color-border);
  border-radius: 0;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-menu__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
}

.header-menu__form {
  margin: 0;
  padding: 0;
  display: contents;
}

.header-menu__check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text, #e2e8f0);
}

.header-menu__check:hover {
  background: rgba(148, 163, 184, 0.15);
}

.header-menu__panel--checks {
  max-height: 24rem;
  overflow-y: auto;
}

/* --- Page toolbar (filters/search row directly under page header) --------- */

.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: var(--space-gap-comfortable, 1.25rem);
}

/* --- Standard table toolbar (search + filters + menus) -------------------- */

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.table-toolbar__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  flex: 1 1 auto;
}

.table-toolbar__field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 8rem;
}

.table-toolbar__field--search {
  flex: 1 1 16rem;
  min-width: 12rem;
}

.table-toolbar__field--narrow {
  min-width: 6rem;
}

.table-toolbar__field label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.table-toolbar__menus {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* Tighten spacing between header and first content section so pages that
 * drop their redundant card subheader still look balanced. */
.layout__content > .stat-strip:first-child,
.layout__content > .page-toolbar:first-child,
.layout__content > .card:first-child {
  margin-top: 0;
}

/* --- Backwards-compatibility aliases -------------------------------------- */

/* Keep the legacy Service Status class names working while pages migrate to
 * the generic .stat-strip primitives. The selectors below intentionally
 * mirror the rules above so pages using either class name look identical. */
.service-status__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.service-status__stat-label,
.stat-strip__stat .service-status__stat-label {
  position: relative;
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  z-index: 1;
}

.service-status__stat-value,
.stat-strip__stat .service-status__stat-value {
  position: relative;
  font-size: 2rem;
  font-weight: 700;
  color: #f9fafb;
  line-height: 1;
  z-index: 1;
}

/* ==========================================================================
   Dashboard (server-rendered, fixed sections)
   ========================================================================== */

.dashboard-summary {
  display: grid;
  gap: var(--space-4, 1rem);
}

.dashboard-summary__greeting {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3, 0.75rem);
}

.dashboard-summary__title {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  line-height: 1.2;
}

.dashboard-summary__meta {
  margin: 0;
  color: var(--color-text-muted, #94a3b8);
  font-size: 0.9rem;
}

.dashboard-summary__section-header {
  margin-bottom: var(--space-3, 0.75rem);
}

.dashboard-summary__section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.dashboard-summary__empty {
  margin: 0;
  color: var(--color-text-muted, #94a3b8);
  font-size: 0.95rem;
}

.dashboard-summary__attention-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2, 0.5rem);
}

.dashboard-summary__attention-link {
  display: flex;
  align-items: baseline;
  gap: var(--space-3, 0.75rem);
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  border-radius: var(--radius-md, 0.5rem);
  background: var(--color-surface-2, rgba(148, 163, 184, 0.08));
  color: inherit;
  text-decoration: none;
  border-left: 3px solid var(--color-border, rgba(148, 163, 184, 0.3));
}

.dashboard-summary__attention-link:hover,
.dashboard-summary__attention-link:focus-visible {
  background: var(--color-surface-3, rgba(148, 163, 184, 0.16));
}

.dashboard-summary__attention-item--info .dashboard-summary__attention-link {
  border-left-color: var(--color-info, #38bdf8);
}

.dashboard-summary__attention-item--warning .dashboard-summary__attention-link {
  border-left-color: var(--color-warning, #f59e0b);
}

.dashboard-summary__attention-item--danger .dashboard-summary__attention-link {
  border-left-color: var(--color-danger, #ef4444);
}

.dashboard-summary__attention-count {
  font-weight: 700;
  font-size: 1.25rem;
  min-width: 2ch;
  text-align: right;
}

.dashboard-summary__attention-label {
  flex: 1;
}

.dashboard-summary__attention-detail {
  color: var(--color-text-muted, #94a3b8);
  font-size: 0.85rem;
}

.dashboard-actions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2, 0.5rem);
}

.dashboard-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-2, 0.5rem);
}

.dashboard-activity-list__item {
  padding: var(--space-2, 0.5rem) 0;
  border-top: 1px solid var(--color-border, rgba(148, 163, 184, 0.2));
}

.dashboard-activity-list__item:first-child {
  border-top: none;
  padding-top: 0;
}

.dashboard-activity-list__item--unread .dashboard-activity-list__title {
  font-weight: 600;
}

.dashboard-activity-list__title {
  font-size: 0.95rem;
}

.dashboard-activity-list__subtitle {
  margin-top: 0.125rem;
  color: var(--color-text-muted, #94a3b8);
  font-size: 0.85rem;
}

.dashboard-activity-list__meta {
  margin-top: 0.125rem;
  color: var(--color-text-muted, #94a3b8);
  font-size: 0.8rem;
}

.dashboard-summary__more-link {
  display: inline-block;
  margin-top: var(--space-2, 0.5rem);
  font-size: 0.85rem;
}

.dashboard-summary__more-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3, 0.75rem);
  margin-top: var(--space-3, 0.75rem);
}

.dashboard-health {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: var(--space-3, 0.75rem);
}

.dashboard-health__item {
  padding: var(--space-3, 0.75rem);
  border-radius: var(--radius-md, 0.5rem);
  background: var(--color-surface-2, rgba(148, 163, 184, 0.08));
  text-align: center;
}

.dashboard-health__item--danger {
  background: var(--color-danger-soft, rgba(239, 68, 68, 0.12));
}

.dashboard-health__value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.dashboard-health__label {
  display: block;
  margin-top: 0.25rem;
  color: var(--color-text-muted, #94a3b8);
  font-size: 0.85rem;
}


/* M365 password reveal helpers */
.form-field__input-row {
  display: flex;
  gap: var(--space-2, 0.5rem);
  align-items: center;
}

.form-input--monospace {
  font-family: var(--font-monospace, "Fira Code", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace);
}

/* Webhook instructions in backup jobs */
.webhook-instructions pre {
  background: rgba(15, 23, 42, 0.65);
  border-radius: 0.5rem;
  padding: 0.75rem;
  color: #f1f5f9;
  font-family: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', ui-monospace, monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.webhook-instructions pre code {
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
}

.webhook-instructions p code {
  background: rgba(15, 23, 42, 0.45);
  color: #f1f5f9;
  border-radius: 0.3rem;
  padding: 0.1rem 0.35rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', ui-monospace, monospace;
  font-size: 0.875em;
}

/* Backup grid — cell colour coding (matches stat-strip palette) */
.backup-grid__cell {
  text-align: center;
  vertical-align: middle;
  transition: background 0.15s ease;
}

.backup-grid__cell--success {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(22, 163, 74, 0.12));
}

.backup-grid__cell--warning {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(234, 179, 8, 0.12));
}

.backup-grid__cell--danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.18), rgba(220, 38, 38, 0.12));
}

.backup-grid__cell--neutral {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.12), rgba(100, 116, 139, 0.08));
}

.offboarding-form {
  display: grid;
  gap: calc(var(--space-gap-roomy) * 1.25);
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.9fr);
}

.offboarding-form__main,
.offboarding-form__mail {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-base);
}

.offboarding-form__date-time {
  display: grid;
  gap: var(--space-gap-base);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.offboarding-form__immediate {
  align-items: flex-start;
}

.offboarding-form__status,
.offboarding-form__actions {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  .offboarding-form,
  .offboarding-form__date-time {
    grid-template-columns: 1fr;
  }
}

.permissions-table-wrapper {
  max-height: min(58vh, 42rem);
  overflow: auto;
}

.permissions-table code {
  display: inline-block;
  margin-top: 0.35rem;
  color: var(--color-text-muted, #64748b);
  font-size: 0.8rem;
}

.permission-level {
  display: grid;
  gap: 0.4rem;
  min-width: 16rem;
}

.permission-level label {
  align-items: center;
  border: 1px solid var(--color-border, #d8dee8);
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
}

.permission-level label:has(input:checked) {
  background: var(--color-primary-soft, #e8f1ff);
  border-color: var(--color-primary, #2563eb);
  color: var(--color-primary-strong, #1d4ed8);
}

@media (min-width: 52rem) {
  .permission-level {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.ticket-reply-submit {
  --ticket-reply-submit-height: 2.5rem;
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.ticket-reply-actions {
  justify-content: space-between;
  gap: 1rem;
}

.ticket-page-clock { display: flex; align-items: center; gap: .45rem; font-variant-numeric: tabular-nums; }
.ticket-page-clock__label { color: var(--text-muted, #64748b); font-size: .9rem; }
.ticket-page-clock__menu { position: relative; }
.ticket-page-clock__menu summary { list-style: none; }
.ticket-page-clock__menu summary::-webkit-details-marker { display: none; }
.ticket-page-clock__menu-content { position: absolute; bottom: calc(100% + .4rem); left: 0; z-index: 20; white-space: nowrap; padding: .35rem; border: 1px solid rgba(148,163,184,.3); border-radius: .7rem; background: var(--surface, #fff); box-shadow: 0 12px 30px -16px rgba(15,23,42,.6); }
.ticket-page-clock-dialog { width: min(38rem, calc(100vw - 2rem)); border: 0; border-radius: .9rem; padding: 1.25rem; color: var(--text-color, #0f172a); box-shadow: 0 25px 60px rgba(15,23,42,.45); }
.ticket-page-clock-dialog::backdrop { background: rgba(15,23,42,.45); }
.ticket-page-clock-dialog__header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.ticket-page-clock-history { width: 100%; border-collapse: collapse; }
.ticket-page-clock-history th, .ticket-page-clock-history td { padding: .55rem; border-bottom: 1px solid rgba(148,163,184,.25); text-align: left; }

.ticket-reply-submit__primary {
  display: inline-flex;
  align-items: center;
  min-height: var(--ticket-reply-submit-height);
  box-sizing: border-box;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.ticket-reply-submit__status-menu {
  position: relative;
  display: flex;
}

.ticket-reply-submit__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ticket-reply-submit-height);
  box-sizing: border-box;
  min-width: 2.75rem;
  padding-inline: 0.85rem;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid rgba(15, 23, 42, 0.18);
  list-style: none;
}

.ticket-reply-submit__toggle::-webkit-details-marker {
  display: none;
}

.ticket-reply-submit__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.5rem);
  z-index: 20;
  min-width: 13rem;
  max-height: min(18rem, 60vh);
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 0.9rem;
  background: var(--surface, #ffffff);
  box-shadow: 0 20px 45px -25px rgba(15, 23, 42, 0.55);
}

.ticket-reply-submit__menu-item {
  display: block;
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 0;
  border-radius: 0.65rem;
  background: transparent;
  color: var(--text-color, #0f172a);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.ticket-reply-submit__menu-item:hover,
.ticket-reply-submit__menu-item:focus-visible {
  background: rgba(56, 189, 248, 0.16);
  outline: none;
}

/* Staff admin field configuration tables need enough intrinsic width for
 * labels, inputs, textareas, and action buttons. Keep them inside the card's
 * horizontal scroller instead of letting controls visually overlap. */
.staff-field-config-table,
.staff-custom-fields-table {
  table-layout: fixed;
}

.staff-field-config-table {
  min-width: 980px;
}

.staff-custom-fields-table {
  min-width: 1680px;
}

.staff-field-config-table th,
.staff-field-config-table td,
.staff-custom-fields-table th,
.staff-custom-fields-table td {
  vertical-align: top;
}

.staff-field-config-table .form-input,
.staff-custom-fields-table .form-input {
  min-width: 0;
}

.staff-field-config-table td:nth-child(1) {
  width: 18%;
}

.staff-field-config-table td:nth-child(2) {
  width: 14%;
}

.staff-field-config-table td:nth-child(5) {
  width: 9rem;
}

.staff-custom-fields-table th:nth-child(1),
.staff-custom-fields-table td:nth-child(1) {
  width: 9rem;
}

.staff-custom-fields-table th:nth-child(2),
.staff-custom-fields-table td:nth-child(2),
.staff-custom-fields-table th:nth-child(3),
.staff-custom-fields-table td:nth-child(3),
.staff-custom-fields-table th:nth-child(5),
.staff-custom-fields-table td:nth-child(5),
.staff-custom-fields-table th:nth-child(9),
.staff-custom-fields-table td:nth-child(9),
.staff-custom-fields-table th:nth-child(10),
.staff-custom-fields-table td:nth-child(10) {
  width: 12rem;
}

.staff-custom-fields-table th:nth-child(4),
.staff-custom-fields-table td:nth-child(4) {
  width: 9rem;
}

.staff-custom-fields-table th:nth-child(6),
.staff-custom-fields-table td:nth-child(6) {
  width: 7rem;
}

.staff-custom-fields-table th:nth-child(7),
.staff-custom-fields-table td:nth-child(7) {
  width: 5rem;
  text-align: center;
}

.staff-custom-fields-table th:nth-child(8),
.staff-custom-fields-table td:nth-child(8) {
  width: 16rem;
}

.staff-custom-fields-table th:nth-child(11),
.staff-custom-fields-table td:nth-child(11) {
  width: 9rem;
}

.staff-custom-fields-table .form-field {
  gap: 0.35rem;
  margin: 0 0 var(--space-gap-tight);
}

.staff-custom-fields-table .form-field:last-child {
  margin-bottom: 0;
}

.staff-custom-fields-table .table__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-gap-tight);
}

.staff-custom-fields-table .table__actions .inline-form,
.staff-custom-fields-table .table__actions .button {
  width: 100%;
}

.search-workspace {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.search-workspace__textarea {
  min-height: 8rem;
  resize: vertical;
  line-height: 1.5;
}

@media (max-width: 720px) {
  .search-workspace {
    margin: 0;
  }
}

.ticket-related__summary .button {
  position: relative;
  z-index: 1;
}

.ticket-related__actions {
  align-items: center;
  display: inline-flex;
  gap: 0.5rem;
}

.ticket-related__refresh.is-loading {
  opacity: 0.65;
  pointer-events: none;
}

.ticket-related__status {
  color: var(--color-text-muted, #64748b);
  font-size: 0.9rem;
}

.ticket-related__list {
  display: grid;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ticket-related__link {
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  display: -webkit-box;
  overflow: hidden;
  text-decoration: none;
}

.rag-stat-strip {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.rag-stat-strip__stat {
  min-width: 0;
}

.rag-stat-strip__hint {
  position: relative;
  z-index: 1;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.ticket-split-toolbar {
  align-items: flex-start;
  gap: 1rem;
}

.ticket-split-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.ticket-split-select {
  display: inline-flex;
  align-items: center;
  margin-right: 0.5rem;
}

.ticket-split-select input {
  width: 1rem;
  height: 1rem;
}

.timeline__event--split-hidden {
  border-style: dashed;
  opacity: 0.78;
}

@media (max-width: 640px) {
  .ticket-split-toolbar,
  .ticket-split-toolbar__actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.ticket-mention-menu {
  position: absolute;
  z-index: 30;
  width: min(24rem, 100%);
  max-height: 16rem;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--color-border, rgba(148, 163, 184, 0.35));
  border-radius: 0.75rem;
  background: var(--color-surface, #ffffff);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.rich-text-editor:has(.ticket-mention-menu) {
  position: relative;
}

.ticket-mention-menu__item {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.7rem;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.ticket-mention-menu__item:hover,
.ticket-mention-menu__item.is-active {
  background: var(--color-primary-soft, rgba(37, 99, 235, 0.12));
}

.ticket-mention-menu__name {
  font-weight: 700;
}

.ticket-mention-menu__email {
  color: var(--color-text-muted, #64748b);
  font-size: 0.85rem;
}

.shop-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr));
  gap: var(--space-gap-base);
  align-content: start;
  grid-auto-rows: 1fr;
}

.shop-card-grid--categories {
  grid-template-columns: repeat(auto-fill, minmax(min(18rem, 100%), 1fr));
}

.shop-tile,
.shop-product-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.45);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.shop-tile {
  display: grid;
  grid-template-columns: 6rem 1fr;
  min-height: 7rem;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.shop-tile:hover,
.shop-tile:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(15, 23, 42, 0.62);
}

.shop-tile--special {
  border-color: rgba(56, 189, 248, 0.32);
}

.shop-tile__media,
.shop-product-card__media {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.08);
}

.shop-tile__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shop-tile__media--icon,
.shop-tile__placeholder,
.shop-product-card__placeholder {
  font-size: 2rem;
}

.shop-tile__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  padding: var(--space-gap-base);
  min-width: 0;
}

.shop-tile__title,
.shop-product-card__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-tile__meta,
.shop-product-card__sku {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.shop-product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 24rem;
  height: 100%;
  overflow: hidden;
}

a.shop-product-card {
  color: inherit;
  text-decoration: none;
}

.shop-product-card--navigation {
  border-color: rgba(56, 189, 248, 0.32);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.shop-product-card--navigation:hover,
.shop-product-card--navigation:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(15, 23, 42, 0.62);
}

.shop-product-card__media--navigation {
  background: rgba(56, 189, 248, 0.12);
}

.shop-product-card__media {
  min-height: 10rem;
  padding: var(--space-gap-base);
}

.shop-product-card__media .product-thumb,
.shop-product-card__media .package-thumb {
  width: 100%;
  height: 9rem;
  max-width: 12rem;
}

.shop-product-card__media .link-button {
  width: 100%;
  display: flex;
  justify-content: center;
}

.shop-product-card__body,
.shop-product-card__actions {
  padding: var(--space-gap-base);
}

.shop-product-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.45rem;
}

.shop-product-card__title {
  margin: 0;
  font-size: 1rem;
}

.shop-product-card__sku,
.shop-product-card .package-meta {
  margin: 0;
}

.shop-product-card__meta,
.shop-product-card__actions,
.shop-product-card__cart {
  display: flex;
  align-items: center;
  gap: var(--space-gap-tight);
  flex-wrap: wrap;
}

.shop-product-card__actions {
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  justify-content: space-between;
}

.shop-product-card__cart .form-input--sm {
  width: 4.5rem;
}


@media (min-width: 760px) {
  .shop-product-card--package {
    grid-column: span 2;
  }

  .shop-product-card--package .shop-product-card__media {
    min-height: 20rem;
  }

  .shop-product-card--package .package-thumb-grid {
    height: 18rem;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .shop-tile {
    grid-template-columns: 5rem 1fr;
  }

  .shop-product-card__media {
    min-height: 8rem;
  }

  .shop-product-card {
    min-height: 22rem;
  }
}

.modal__icon-action-form {
  position: absolute;
  top: var(--space-gap-tight);
  right: calc(var(--space-gap-roomy) + 3rem);
  z-index: 2;
  margin: 0;
}

.modal__icon-action-form[hidden] {
  display: none;
}

.modal__icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  cursor: pointer;
  box-shadow: 0 12px 24px -16px rgba(15, 23, 42, 0.95);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.modal__icon-action:hover,
.modal__icon-action:focus-visible {
  background: rgba(30, 41, 59, 1);
  border-color: rgba(148, 163, 184, 0.55);
  transform: scale(1.03);
}

.modal__icon-action:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.9);
  outline-offset: 2px;
}

.modal__icon-action svg {
  width: 1.25rem;
  height: 1.25rem;
  pointer-events: none;
}

.modal__content--product-details {
  max-width: min(72rem, calc(100vw - 2rem));
}

.product-details-modal {
  display: flex;
  flex-direction: column;
  gap: var(--space-gap-roomy);
}

.product-details-modal__section {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 1rem;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.035), rgba(15, 23, 42, 0.01));
  padding: var(--space-gap-roomy);
}

.product-details-modal__hero,
.product-details-modal__related-grid {
  display: grid;
  grid-template-columns: minmax(16rem, 0.9fr) minmax(18rem, 1.1fr);
  gap: var(--space-gap-roomy);
  align-items: stretch;
}

.product-details-modal__related-grid--single {
  grid-template-columns: 1fr;
}

.product-details-modal__media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 20rem;
  border-radius: 0.9rem;
  background: rgba(15, 23, 42, 0.04);
}

.product-details-modal__image {
  max-height: 26rem;
  background: #fff;
}

.product-details-modal__placeholder {
  font-size: 4rem;
}

.product-details-modal__summary,
.product-details-modal__actions,
.product-details-modal__recommendation-list,
.product-details-recommendation-card__body {
  display: flex;
  flex-direction: column;
}

.product-details-modal__summary {
  justify-content: center;
  gap: var(--space-gap-base);
}

.product-details-modal__title {
  margin-bottom: var(--space-gap-tight);
}

.product-details-modal__actions {
  gap: var(--space-gap-base);
  align-items: flex-start;
  margin-top: var(--space-gap-base);
}

.product-details-modal__cart {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-gap-tight);
}

.product-details-modal__cart .form-input--sm {
  width: 5rem;
}

.product-details-modal__details .modal__subtitle,
.product-details-modal__recommendations .modal__subtitle {
  margin-top: 0;
}

.product-details-modal__recommendation-list {
  gap: var(--space-gap-base);
}

.product-details-recommendation-card {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: var(--space-gap-base);
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 0.85rem;
  padding: var(--space-gap-base);
  background: rgba(255, 255, 255, 0.04);
}

.product-details-recommendation-card__image {
  width: 5rem;
  height: 5rem;
  object-fit: contain;
  border-radius: 0.65rem;
  background: #fff;
}

.product-details-recommendation-card__body {
  gap: 0.35rem;
  min-width: 0;
}

.product-details-recommendation-card__price {
  font-weight: 700;
}

.product-details-refresh-form {
  position: absolute;
  top: var(--space-gap-tight);
  right: calc(var(--space-gap-roomy) + 3rem);
}

@media (max-width: 760px) {
  .product-details-modal__hero,
  .product-details-modal__related-grid {
    grid-template-columns: 1fr;
  }

  .product-details-modal__media {
    min-height: 14rem;
  }
}

.ticket-review-date--past {
  color: var(--color-danger, #dc2626);
  font-weight: 600;
}

.ticket-review-date--future {
  color: var(--color-success, #16a34a);
  font-weight: 600;
}

.license-allocation-item {
  border-radius: var(--radius-sm, 0.375rem);
  padding: 0.4rem 0.6rem;
}

.license-allocation-item--shared {
  background: rgba(251, 146, 60, 0.18);
  color: #fed7aa;
}

.license-allocation-item--disabled {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
}
