/* =============================================================================
   Option C: Component Design System — Tokens-based, scalable
   ============================================================================= */

/* Token System ---------------------------------------------------------------- */
:root {
  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;
  --space-8: 2.5rem;
  --space-9: 3rem;
  --space-10: 4rem;
  --space-11: 5rem;
  --space-12: 6rem;

  /* Primitive Colors — Gray */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #030712;

  /* Primitive Colors — Blue */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;
  --blue-950: #172554;

  /* Primitive Colors — Primary (neutral gray) */
  --primary-50: #fafafa;
  --primary-100: #f4f4f5;
  --primary-200: #e4e4e7;
  --primary-300: #d4d4d8;
  --primary-400: #a1a1aa;
  --primary-500: #71717a;
  --primary-600: #52525b;
  --primary-700: #3f3f46;
  --primary-800: #27272a;
  --primary-900: #18181b;
  --primary-950: #09090b;

  /* Primitive Colors — Status */
  --red-50: #fef2f2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --green-50: #f0fdf4;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --amber-50: #fffbeb;
  --amber-500: #f59e0b;
  --amber-600: #d97706;

  /* Semantic Colors */
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-surface-raised: #fefefe;
  --color-border: #e4e4e7;
  --color-border-subtle: #f4f4f5;
  --color-text: #18181b;
  --color-text-secondary: #3f3f46;
  --color-text-muted: #a1a1aa;
  --color-accent: #52525b;
  --color-accent-hover: #3f3f46;
  --color-accent-light: #f4f4f5;
  --color-blue: var(--blue-600);
  --color-blue-hover: var(--blue-700);
  --color-red: var(--red-600);
  --color-red-hover: var(--red-500);
  --color-green: var(--green-600);
  --color-green-hover: var(--green-500);
  --color-gray: var(--gray-600);
  --color-gray-hover: var(--gray-700);
  --color-home-bg: var(--gray-50);

  /* Sidebar (dark in light mode) */
  --sidebar-bg: #1c1917;
  --sidebar-text: #a1a1aa;
  --sidebar-text-hover: #fafafa;
  --sidebar-hover-bg: rgb(161 161 170 / 0.1);
  --sidebar-border: rgb(161 161 170 / 0.08);
  --sidebar-active-bg: rgb(161 161 170 / 0.15);
  --sidebar-active-border: #a1a1aa;
  --sidebar-tooltip-bg: #27272a;

  /* Typography */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.875rem;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Radii */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.05);

  /* Widths (Tailwind max-width scale) */
  --w-xs: 20rem;
  --w-sm: 24rem;
  --w-md: 28rem;
  --w-lg: 32rem;
  --w-xl: 36rem;
  --w-2xl: 42rem;
  --w-3xl: 48rem;
  --w-4xl: 56rem;
  --w-5xl: 64rem;
  --w-6xl: 72rem;
  --w-7xl: 80rem;

  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition-normal: 0.2s ease;

  /* Font family */
  font-family:
    'InterVariable',
    'Inter',
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
}

/* Reset & Base ---------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

@view-transition {
  navigation: auto;
}

/* Form Elements --------------------------------------------------------------- */
input,
textarea,
select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: inherit;
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--transition-fast);

  &:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgb(82 82 91 / 0.3);
  }

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  &::placeholder {
    color: var(--color-text-muted);
  }
}

textarea {
  resize: vertical;
  min-height: 4.5rem;
}

input[type='checkbox'],
input[type='radio'] {
  width: auto;
  padding: 0;
}

label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
  margin-top: var(--space-3);

  &:first-child {
    margin-top: 0;
  }
}

/* Viewport -------------------------------------------------------------------- */
.viewport {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr;
  height: 100dvh;
  overflow: hidden;
  background: var(--color-bg);
  color: var(--color-text);
}

/* Nav (dark sidebar) ---------------------------------------------------------- */
.nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  border-right: 1px solid var(--sidebar-border);
  background: var(--sidebar-bg);
  padding: var(--space-2);

  & hr {
    margin-block: var(--space-1);
    border: none;
    border-top: 1px solid var(--sidebar-border);
  }
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  white-space: nowrap;
  color: var(--sidebar-text);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);

  &:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text-hover);
  }

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

  & svg {
    width: var(--space-5);
    height: var(--space-5);
    flex-shrink: 0;
  }

  /* Tooltip — hidden by default */
  &::after {
    content: attr(data-tooltip);
    pointer-events: none;
    position: absolute;
    top: 50%;
    left: 100%;
    z-index: 10;
    margin-left: var(--space-2);
    transform: translateY(-50%);
    border-radius: var(--radius-md);
    border: none;
    background: var(--sidebar-tooltip-bg);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    white-space: nowrap;
    color: #ffffff;
    outline: none;
    display: none;
  }
}

/* Active nav item */
.nav-active {
  border-left: 3px solid var(--sidebar-active-border);
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-hover);
}

/* Show tooltip only when nav is collapsed */
[data-collapsed] .nav-link:hover::after,
[data-collapsed] .nav-link:focus-visible::after {
  display: block;
}

.nav-toggle-btn {
  margin-top: auto;
}

.nav-toggle-icon {
  transition: transform 0.15s ease;
}

[data-collapsed] .nav-toggle-icon {
  transform: rotate(180deg);
}

/* Page Layout ----------------------------------------------------------------- */
.page-main {
  min-height: 0;
  min-width: 0;
}

.page-content {
  height: 100%;
}

/* Home Layout ----------------------------------------------------------------- */
.home-content {
  display: flex;
  height: 100%;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.home-content-header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-home-bg);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);

  & a {
    color: var(--color-text-muted);
    text-decoration: none;

    &:hover {
      color: var(--color-text-secondary);
    }
  }
}

.breadcrumb-sep {
  color: var(--color-border);
}

.header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}

.header-search {
  font-family: inherit;
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  background: var(--color-surface);
  width: 14rem;

  &::placeholder {
    color: var(--color-text-muted);
  }

  &:focus {
    outline: none;
    border-color: var(--color-text-muted);
  }
}

.book-dropdown {
  position: relative;
  display: inline-block;
}

.book-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0;
  border: none;
  font-family: inherit;
  font-size: var(--text-2xl);
  font-weight: var(--font-medium);
  color: var(--color-text);
  background: none;
  cursor: pointer;

  &:hover {
    color: var(--color-text-secondary);
  }
}

.book-dropdown-arrow {
  font-size: 1.2rem;
  color: inherit;
}

.book-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  margin-top: var(--space-1);
  min-width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
}

.book-dropdown:focus-within .book-dropdown-menu {
  display: flex;
  flex-direction: column;
}

.book-dropdown-item {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast);

  &:hover {
    background: var(--color-border-subtle);
  }

  &:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  &:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }
}

.book-dropdown-active {
  background: var(--color-accent-light);
  color: var(--color-accent);
  font-weight: var(--font-medium);
}

.ui-col-layout {
  display: grid;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.ui-col-layout > section {
  overflow-y: auto;
  min-width: 0;
  height: 100%;
  scrollbar-color: var(--gray-400) transparent;
  scrollbar-width: thin;
}

.section-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--color-surface);
}

.ui-col-resize {
  cursor: col-resize;
  position: relative;
  z-index: 1;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 16px;
    height: 100%;
  }

  &::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    background: var(--color-border);
    transition:
      width var(--transition-fast),
      left var(--transition-fast),
      background var(--transition-fast);
  }

  &:hover::after {
    width: 7px;
    left: -3px;
    background: var(--blue-200);
  }
}

/* Section Cards --------------------------------------------------------------- */
.section-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  transition:
    background 0.07s ease,
    color 0.07s ease;

  &:hover {
    background: var(--color-accent-light);
    color: var(--color-text);
  }
}

.section-active {
  background: var(--color-accent-light);
  color: var(--color-text);
}

/* Items / List ---------------------------------------------------------------- */
.item-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);

  &:hover {
    background: #fcfcfc;
  }

  &:has(input:checked) {
    background: transparent;
    box-shadow: inset 0 0 0 3px var(--blue-100);
  }

  &.item-active,
  &.item-active:has(input:checked) {
    background: var(--blue-50);
    box-shadow: inset 0 0 0 3px var(--blue-300);
  }

  & .item-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    margin: calc(-1 * var(--space-2));
    cursor: pointer;
    flex: none;

    & input[type='checkbox'] {
      width: 0.9rem;
      height: 0.9rem;
      accent-color: var(--color-accent);
      cursor: pointer;
    }

    border-radius: var(--radius, 0.375rem);
    transition: background-color 0.15s ease;

    &:hover {
      background-color: var(--blue-200);
    }
  }
}

.item-body {
  min-width: 0;
}

.item-number {
  color: inherit;
}

.item-title {
  font-weight: var(--font-medium);
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-summary {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-pills {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.item-pill {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 9999px;
  white-space: nowrap;
  background: #f9fafb;
  color: #4b5563;
  box-shadow: inset 0 0 0 1px rgb(107 114 128 / 0.1);
}

.item-pill-revised {
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: inset 0 0 0 1px rgb(29 78 216 / 0.1);
}

.item-p {
  padding: var(--space-2);
}

/* Accordion ------------------------------------------------------------------- */
.accordion {
  margin-bottom: var(--space-3);
  cursor: pointer;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  background: var(--color-surface-raised);
  transition:
    border-color var(--transition-normal),
    box-shadow var(--transition-normal);

  &:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-sm);
  }

  &[open] {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
  }

  & summary {
    display: flex;
    list-style: none;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    letter-spacing: 0.025em;
    color: var(--color-text-secondary);
    user-select: none;

    &::-webkit-details-marker {
      display: none;
    }
  }

  & .accordion-body {
    border-top: 1px solid var(--color-border-subtle);
    padding: 0 var(--space-4) var(--space-4);

    & h2 {
      margin-top: var(--space-3);
      font-size: var(--text-base);
      font-weight: var(--font-bold);
      color: var(--color-text);
    }

    & p {
      margin-top: var(--space-1);
      font-size: var(--text-sm);
      line-height: 1.625;
      color: var(--color-text-muted);
    }
  }

  & .accordion-arrow {
    font-size: 10px;
    color: var(--color-text-muted);
    transition: transform var(--transition-normal);
  }

  &[open] .accordion-arrow {
    transform: rotate(180deg);
  }
}

/* MainNav --------------------------------------------------------------------- */
.main-nav {
  container-type: inline-size;
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-4);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.main-nav-toggle-input {
  display: none;
}

.main-nav-toggle {
  display: none;
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--color-accent);
  user-select: none;
}

.main-nav-columns {
  display: contents;
}

.main-nav-col {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-1);
  overflow-y: auto;
  border-right: 1px solid var(--color-border);
  padding-right: var(--space-4);
}

.main-nav-item {
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);

  &:hover {
    background: var(--color-border-subtle);
    color: var(--color-text-secondary);
  }
}

.main-nav-display {
  min-height: 8rem;
  flex: 4 1 0;
  overflow-y: auto;
  padding: var(--space-3);

  & p {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
  }
}

/* Modal ----------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(0 0 0 / 0.4);
  backdrop-filter: blur(4px);
}

.modal {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  min-width: var(--w-xs);
  max-width: min(var(--w-5xl), 90vw);
  max-height: calc(100dvh - var(--space-12));
  box-shadow: var(--shadow-xl);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  margin-bottom: var(--space-1);

  &:empty {
    display: none;
  }
}

.modal-description {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);

  &:empty {
    display: none;
  }
}

.modal-content {
  flex: 1;
  overflow-y: auto;
  margin-top: var(--space-4);
  min-height: 0;
  padding: var(--space-1);
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* UI Slide Panel -------------------------------------------------------------- */
.ui-slide-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  overflow: hidden;
  view-transition-name: slide-overlay;
}

.ui-slide-overlay.no-overlay {
  pointer-events: none;
  justify-content: flex-end;
}

.ui-slide-overlay.no-overlay .ui-slide {
  pointer-events: auto;
}

.ui-slide-backdrop {
  flex: 1;
  background: rgb(0 0 0 / 0.3);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.ui-slide {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  height: 100%;
  background: var(--color-surface);
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  transition:
    width 0.15s ease,
    max-width 0.15s ease;
}

.ui-slide-resize-handle {
  position: absolute;
  top: 0;
  left: -8px;
  width: 16px;
  height: 100%;
  cursor: col-resize;
  z-index: 1;

  &::after {
    content: '';
    position: absolute;
    top: 0;
    right: 8px;
    width: 1px;
    height: 100%;
    background: var(--color-border);
    transition:
      width var(--transition-fast),
      right var(--transition-fast),
      background var(--transition-fast);
  }

  &:hover::after {
    width: 7px;
    right: 5px;
    background: var(--color-border);
  }
}

.ui-slide-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.ui-slide-title {
  flex: 1;
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text);
}

.ui-slide-buttons {
  display: flex;
  flex-shrink: 0;
  gap: var(--space-2);
}

.ui-slide-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  color: var(--color-text-secondary);
}

.ui-slide-content *:focus {
  outline: none;
}

/* UI Panel (inline third column) ---------------------------------------------- */
#policy-panel {
}

.ui-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-surface);
}

.ui-panel-resize-handle {
  position: absolute;
  top: 0;
  left: -8px;
  width: 16px;
  height: 100%;
  cursor: col-resize;
  z-index: 1;

  &::after {
    content: '';
    position: absolute;
    top: 0;
    right: 8px;
    width: 1px;
    height: 100%;
    background: var(--color-border);
    transition:
      width var(--transition-fast),
      right var(--transition-fast),
      background var(--transition-fast);
  }

  &:hover::after {
    width: 7px;
    right: 5px;
    background: var(--color-border);
  }
}

.ui-panel-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.ui-panel-title {
  flex: 1;
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-panel-buttons {
  display: flex;
  flex-shrink: 0;
  gap: var(--space-2);
}

.ui-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  color: var(--color-text-secondary);
}

.ui-panel-expanded {
  width: 100% !important;
  flex: 1;
}

.ui-panel-content *:focus {
  outline: none;
}

/* Setup / New & Edit Buttons -------------------------------------------------- */
.new-btn {
  display: block;
  width: 100%;
  margin-bottom: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: none;
  color: var(--color-accent);
  font-size: var(--text-sm);
  cursor: pointer;
  text-align: left;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast);

  &:hover {
    background: var(--color-accent-light);
    border-color: var(--color-accent);
  }

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

.edit-btn {
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);

  &:hover {
    background: var(--color-border-subtle);
    color: var(--color-text-secondary);
  }

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

.site-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);

  & h3 {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--color-text);
  }

  & .new-btn {
    width: auto;
    margin-bottom: 0;
  }
}

.site-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  margin-bottom: var(--space-2);
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--transition-normal),
    transform var(--transition-normal),
    background var(--transition-normal);

  &:hover {
    background: var(--color-bg);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }
}

.empty-msg {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Sessions -------------------------------------------------------------------- */
.session-content {
  flex: 1;
  overflow: auto;
  padding: var(--space-6);
}

.session-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);

  & th {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    font-weight: var(--font-semibold);
    color: var(--color-text-secondary);
    border-bottom: 2px solid var(--color-border);
  }

  & td {
    cursor: pointer;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border-subtle);
    color: var(--color-text-secondary);
    transition: background var(--transition-fast);
  }

  & tbody tr:hover {
    background: var(--color-accent-light);
  }
}

.session-expired {
  opacity: 0.5;
}

.session-badge {
  display: inline-block;
  margin-left: var(--space-1);
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-weight: var(--font-semibold);
  color: var(--color-accent);
  background: var(--color-accent-light);
  border-radius: var(--radius-sm);
}

/* Buttons --------------------------------------------------------------------- */
.btn-blue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1.25rem;
  cursor: pointer;
  background: var(--color-blue);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-fast);

  &:hover:not(:disabled) {
    background: var(--color-blue-hover);
  }

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

  &:disabled {
    cursor: default;
    box-shadow: none;
    background: var(--color-border);
    color: var(--color-text-muted);
  }
}

.btn-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1.25rem;
  cursor: pointer;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  box-shadow:
    inset 0 0 0 1px var(--color-border),
    var(--shadow-sm);
  transition:
    color var(--transition-fast),
    box-shadow var(--transition-fast);

  &:hover:not(:disabled) {
    color: var(--color-text);
    box-shadow:
      inset 0 0 0 1px var(--color-text-muted),
      var(--shadow-sm);
  }

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

  &:disabled {
    cursor: default;
    box-shadow: none;
    opacity: 0.5;
  }
}

.btn-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1.25rem;
  cursor: pointer;
  background: var(--color-red);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-fast);

  &:hover:not(:disabled) {
    background: var(--color-red-hover);
  }

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

  &:disabled {
    cursor: default;
    box-shadow: none;
    opacity: 0.5;
  }
}

.btn-gray {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1.25rem;
  cursor: pointer;
  background: var(--color-gray);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-fast);

  &:hover:not(:disabled) {
    background: var(--color-gray-hover);
  }

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

  &:disabled {
    cursor: default;
    color: var(--color-text-muted);
  }
}

.btn-green {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1.25rem;
  cursor: pointer;
  background: var(--color-green);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-fast);

  &:hover:not(:disabled) {
    background: var(--color-green-hover);
  }

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

  &:disabled {
    cursor: default;
    box-shadow: none;
    opacity: 0.5;
  }
}

.btn-transparent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1.25rem;
  cursor: pointer;
  background: transparent;
  color: var(--color-text-secondary);
  box-shadow: none;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);

  &:hover:not(:disabled) {
    background: var(--color-border);
    color: var(--color-text);
  }

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

  &:disabled {
    cursor: default;
    color: var(--color-border);
  }
}

/* Admin -------------------------------------------------------------------- */
.admin-list {
  display: flex;
  flex-direction: column;
  padding: var(--space-3);
  gap: var(--space-2);
}

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

.admin-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-1) var(--space-2);

  h3 {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
    margin: 0;
  }
}

.admin-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-2) 0;
}

.admin-badge {
  display: inline-block;
  font-size: var(--text-xs);
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-accent-light);
  color: var(--color-accent);
  margin-left: var(--space-2);
}

.admin-detail {
  padding: var(--space-4);
}

.admin-detail-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.admin-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);

  h3 {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    margin: 0;
  }
}

.admin-detail-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-4);
  font-size: var(--text-sm);

  dt {
    color: var(--color-text-tertiary);
    font-weight: var(--font-medium);
  }

  dd {
    margin: 0;
    color: var(--color-text);
  }
}

.btn-sm {
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
}

/* Mobile Tabs (hidden on desktop) */
.ui-col-tabs {
  display: none;
}

/* Responsive ------------------------------------------------------------------ */
