/*
 * Admin Dashboard Styles - Tailwind CSS 4.x
 * CSS-first configuration with CSS variables for theming
 */

/* =============================================================================
 * CSS Custom Properties (available for both Tailwind and custom CSS)
 * ============================================================================= */

:root {
  /* Sidebar width - needed for layout calculations */
  --width-sidebar: 16rem;

  /* Animation durations */
  --animate-duration-fast: 150ms;
  --animate-duration-normal: 300ms;

  /* Keep admin-specific aliases mapped to Preline base tokens */
  --color-surface-50: var(--background);
  --color-surface-100: var(--background-1);
  --color-surface-200: var(--border-line-2);
  --color-surface-300: var(--border-line-3);
  --color-surface-400: var(--border-line-4);

  --color-scrollbar-track: var(--scrollbar-track);
  --color-scrollbar-thumb: var(--scrollbar-thumb);
  --color-scrollbar-thumb-hover: var(--scrollbar-thumb);

  --color-success-50: color-mix(in oklab, var(--color-emerald-500) 12%, var(--background));
  --color-success-500: var(--color-emerald-500);
  --color-success-600: var(--color-emerald-600);
  --color-danger-500: var(--destructive);
  --color-danger-600: var(--destructive-hover);
}

trix-toolbar .trix-button-group--file-tools {
  display: none !important;
}

trix-editor {
  min-height: 12rem;
  border: 1px solid var(--border-line-2);
  border-radius: 0.75rem;
  background: var(--background);
  color: var(--foreground);
}

.ui-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.ui-help__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: color-mix(in oklab, var(--foreground) 60%, transparent);
  cursor: help;
  transition: color var(--animate-duration-fast) ease, background-color var(--animate-duration-fast) ease;
}

.ui-help__button:hover,
.ui-help__button:focus-visible {
  color: var(--primary);
  background-color: color-mix(in oklab, var(--primary) 10%, transparent);
  outline: none;
}

.ui-help__bubble {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  z-index: 60;
  width: min(18rem, calc(100vw - 2rem));
  padding: 0.625rem 0.75rem;
  border-radius: 0.75rem;
  background: var(--inverse);
  color: white;
  font-size: 0.75rem;
  line-height: 1.45;
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translateY(0.35rem);
  pointer-events: none;
  transition: opacity var(--animate-duration-fast) ease, transform var(--animate-duration-fast) ease;
}

.ui-help:hover .ui-help__bubble,
.ui-help:focus-within .ui-help__bubble {
  opacity: 1;
  transform: translateY(0);
}

.tasks-ui .ui-help__button {
  color: color-mix(in oklab, var(--foreground) 50%, transparent);
  background: transparent;
}

.tasks-ui .ui-help__button:hover,
.tasks-ui .ui-help__button:focus-visible {
  color: color-mix(in oklab, var(--foreground) 68%, transparent);
  background: transparent;
}

.tasks-ui .ui-help__button svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}

.task-mobile-card {
  border-radius: 1rem;
  border: 1px solid var(--border-line-2);
  background: linear-gradient(180deg, color-mix(in oklab, var(--background-1) 58%, var(--background)) 0%, var(--background) 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.task-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: color-mix(in oklab, var(--foreground) 72%, transparent);
}

.task-meta-row svg {
  flex-shrink: 0;
  color: color-mix(in oklab, var(--foreground) 52%, transparent);
}

.task-panel-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.task-panel-title svg {
  flex-shrink: 0;
  color: var(--primary);
}

.task-comment {
  border-radius: 1rem;
  border: 1px solid var(--border-line-2);
  background: color-mix(in oklab, var(--background-1) 26%, var(--background));
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
  border-left-width: 0.375rem;
}

.task-comment--assignee {
  border-color: color-mix(in oklab, var(--primary) 42%, var(--border-line-2));
  background: color-mix(in oklab, var(--primary) 12%, var(--background));
}

.task-comment--creator {
  border-color: color-mix(in oklab, var(--color-success-500) 38%, var(--border-line-2));
  background: color-mix(in oklab, var(--color-success-500) 14%, var(--background));
}

.task-comment--moderated {
  border-style: dashed;
  border-left-width: 1px;
  background: color-mix(in oklab, var(--background-1) 55%, var(--background));
}

.task-comment--check-in {
  position: relative;
  border-color: color-mix(in oklab, var(--color-sky-500, #0ea5e9) 42%, var(--border-line-2));
  background: color-mix(in oklab, var(--color-sky-500, #0ea5e9) 16%, var(--background));
}

.task-comment--check-in::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 1rem;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 12px,
    color-mix(in oklab, var(--foreground) 6%, transparent) 12px,
    color-mix(in oklab, var(--foreground) 6%, transparent) 18px
  );
  opacity: 0.22;
}

.task-comment__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
}

.task-comment__badge--neutral {
  background: color-mix(in oklab, var(--background-1) 75%, var(--background));
  color: color-mix(in oklab, var(--foreground) 70%, transparent);
}

.task-comment__badge--primary {
  background: color-mix(in oklab, var(--primary) 12%, var(--background));
  color: var(--primary);
}

.task-comment__badge--success {
  background: color-mix(in oklab, var(--color-success-500) 12%, var(--background));
  color: var(--color-success-600);
}

.task-comment__badge--check-in {
  background: color-mix(in oklab, var(--color-sky-500, #0ea5e9) 14%, var(--background));
  color: color-mix(in oklab, var(--color-sky-700, #0369a1) 88%, var(--foreground));
}

.task-comment__body {
  position: relative;
  z-index: 1;
  color: color-mix(in oklab, var(--foreground) 82%, transparent);
  line-height: 1.65;
}

.task-comment--assignee .task-comment__body {
  background: color-mix(in oklab, var(--primary) 8%, var(--background));
  border: 1px solid color-mix(in oklab, var(--primary) 16%, var(--border-line-2));
}

.task-comment--creator .task-comment__body {
  background: color-mix(in oklab, var(--color-success-500) 10%, var(--background));
  border: 1px solid color-mix(in oklab, var(--color-success-500) 18%, var(--border-line-2));
}

.task-comment--check-in .task-comment__body {
  background: color-mix(in oklab, var(--color-sky-500, #0ea5e9) 12%, var(--background));
  border: 1px solid color-mix(in oklab, var(--color-sky-500, #0ea5e9) 22%, var(--border-line-2));
}

.task-comment__kind {
  background: color-mix(in oklab, var(--foreground) 7%, var(--background));
  color: color-mix(in oklab, var(--foreground) 78%, transparent);
}

.task-comment--check-in .task-comment__kind {
  background: color-mix(in oklab, var(--color-sky-500, #0ea5e9) 18%, var(--background));
  color: color-mix(in oklab, var(--color-sky-700, #0369a1) 82%, var(--foreground));
}

.task-comment__body p {
  margin: 0;
}

.task-comment__body p + p {
  margin-top: 0.75rem;
}

/* =============================================================================
 * Base Styles
 * ============================================================================= */

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

.app-shell-locked {
  overflow: hidden;
  touch-action: none;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  border-radius: 0.75rem;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  transform: translateY(-140%);
  transition: transform var(--animate-duration-fast) ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: none;
}

.app-layout,
.admin-layout {
  min-height: 100vh;
  background-color: var(--color-surface-50);
  overflow-x: hidden;
}

/* =============================================================================
 * Global Scrollbars
 * ============================================================================= */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--color-scrollbar-track);
}

*::-webkit-scrollbar-thumb {
  background: var(--color-scrollbar-thumb);
  border-radius: 9999px;
  border: 2px solid var(--color-scrollbar-track);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--color-scrollbar-thumb-hover);
}

/* =============================================================================
 * Sidebar Styles
 * ============================================================================= */

.app-sidebar,
.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: var(--width-sidebar, 16rem);
  height: 100vh;
  background-color: var(--sidebar);
  border-right: 1px solid var(--sidebar-line);
  transition: width var(--animate-duration-normal, 300ms) ease;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.app-sidebar-brand,
.admin-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--sidebar-line);
  height: 4rem;
}

.sidebar-nav {
  padding: 0.75rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.75rem;
  border-top: 1px solid var(--border);
  background-color: inherit;
  flex-shrink: 0;
}

.sidebar-section {
  margin-bottom: 0.75rem;
}

.sidebar-section-title {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.2;
  color: var(--muted-foreground-1);
  transition: opacity var(--animate-duration-fast) ease;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4375rem 0.75rem;
  min-height: 2.375rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--sidebar-nav-foreground);
  text-decoration: none;
  transition: all var(--animate-duration-fast) ease;
}

.sidebar-item:hover {
  background-color: var(--sidebar-nav-hover);
  color: var(--sidebar-nav-foreground);
}

.sidebar-item:focus-visible {
  outline: none;
  background-color: color-mix(in oklab, var(--primary) 10%, var(--sidebar));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 24%, transparent);
}

.sidebar-item.active {
  background-color: color-mix(in oklab, var(--primary) 14%, var(--sidebar));
  color: var(--primary);
}

.sidebar-item.active svg {
  color: var(--primary);
}

.sidebar-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--muted-foreground-1);
}

.sidebar-item:hover .sidebar-icon,
.sidebar-item.active .sidebar-icon {
  color: inherit;
}

.sidebar-label {
  flex: 1;
  white-space: nowrap;
  text-align: left;
  transition: opacity var(--animate-duration-fast) ease;
}

.sidebar-chevron {
  width: 1rem;
  height: 1rem;
  transition: transform var(--animate-duration-fast) ease;
}

.sidebar-item.expanded .sidebar-chevron,
.hs-accordion.active > .sidebar-item .sidebar-chevron {
  transform: rotate(90deg);
}

/* Nested Navigation */
.sidebar-nested {
  overflow: hidden;
  display: none;
}

.sidebar-nested.open,
.hs-accordion.active > .sidebar-nested {
  display: block;
}

.sidebar-nested .sidebar-item {
  padding: 0.375rem 0.75rem;
  padding-left: 2.75rem;
  font-size: 0.8125rem;
  min-height: 2.125rem;
}

/* Normalize ad-hoc nested icons to sidebar rhythm */
.sidebar-nested .sidebar-item svg:not(.sidebar-chevron):not(.sidebar-icon) {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--muted-foreground-1);
  flex-shrink: 0;
}

/* Desktop: reduce vertical spacing for sidebar items */
@media (min-width: 1024px) {
  .sidebar-item {
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
  }
}

.sidebar-nav .space-y-1 > :not([hidden]) ~ :not([hidden]) {
  margin-top: 0.0625rem;
}

/* =============================================================================
 * TopBar Styles
 * ============================================================================= */

.app-topbar,
.admin-topbar {
  position: fixed;
  top: 0;
  left: var(--width-sidebar, 16rem);
  right: 0;
  z-index: 30;
  height: 4rem;
  background-color: var(--navbar);
  border-bottom: 1px solid var(--navbar-line);
  transition: left var(--animate-duration-normal, 300ms) ease;
}

.topbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1.5rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-search {
  position: relative;
  width: 20rem;
}

.topbar-search-input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  background-color: var(--layer);
  border: 1px solid var(--layer-line);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--layer-foreground);
  transition: all var(--animate-duration-fast) ease;
}

.topbar-search-input:focus {
  background-color: var(--layer);
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 28%, transparent);
}

.topbar-search-input::placeholder {
  color: var(--muted-foreground);
}

.topbar-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.125rem;
  height: 1.125rem;
  color: var(--muted-foreground-1);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-search-modal__shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100%;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 1rem 1rem;
  pointer-events: none;
}

.app-search-modal__backdrop {
  position: fixed;
  inset: 0;
  background: color-mix(in oklab, var(--inverse) 50%, transparent);
  backdrop-filter: blur(6px);
}

.app-search-modal__panel {
  width: 100%;
  max-width: 36rem;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  max-height: min(42rem, calc(100vh - 5rem));
}

.app-search-modal__header {
  flex-shrink: 0;
}

.app-search-modal__body {
  flex: 1;
}

.app-search-modal__status {
  min-height: 1rem;
}

.app-search-modal__result {
  display: block;
  border-radius: 0.875rem;
  padding: 0.75rem;
  transition:
    background-color var(--animate-duration-fast) ease,
    box-shadow var(--animate-duration-fast) ease;
}

.app-search-modal__result:hover {
  background: color-mix(in oklab, var(--background-1) 65%, var(--background));
}

.app-search-modal__result:focus-visible {
  outline: none;
  background: color-mix(in oklab, var(--primary) 10%, var(--background));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 22%, transparent);
}

.topbar-button {
  --topbar-control-size: 2.5rem;
  --topbar-icon-size: 1.125rem;

  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--topbar-control-size);
  height: var(--topbar-control-size);
  border-radius: 0.625rem;
  flex-shrink: 0;
  color: var(--navbar-nav-foreground);
  cursor: pointer;
  transition: all var(--animate-duration-fast) ease;
}

.topbar-button:hover {
  background-color: var(--navbar-nav-hover);
  color: var(--foreground);
}

.topbar-button:focus-visible,
.topbar-profile-button:focus-visible,
.dashboard-quick-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 24%, transparent);
}

.topbar-button svg {
  width: var(--topbar-icon-size);
  height: var(--topbar-icon-size);
}

.topbar-badge {
  position: absolute;
  top: 0.125rem;
  right: 0.125rem;
  width: 1rem;
  height: 1rem;
  background-color: var(--color-danger-500);
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--destructive-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-profile-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.625rem;
  cursor: pointer;
  transition: background-color var(--animate-duration-fast) ease;
}

.topbar-profile-button:hover {
  background-color: var(--navbar-nav-hover);
}

.topbar-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 600;
}

.topbar-profile-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.topbar-profile-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
}

.topbar-profile-role {
  font-size: 0.75rem;
  color: var(--muted-foreground-1);
}

/* =============================================================================
 * Main Content Wrapper
 * ============================================================================= */

.app-main,
.admin-main {
  margin-left: var(--width-sidebar, 16rem);
  padding-top: 4rem;
  min-height: 100vh;
  transition: margin-left var(--animate-duration-normal, 300ms) ease;
}

.public-layout {
  min-height: 100vh;
  min-height: 100dvh;
}

.public-main {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}

.public-content {
  width: min(100%, 32rem);
}

.app-content,
.admin-content {
  padding: 1.5rem;
  max-width: 100%;
}

@media (min-width: 1280px) {
  .app-content,
  .admin-content {
    max-width: 1440px;
    margin: 0 auto;
  }

  .admin-content.admin-content--wide {
    max-width: none;
    margin: 0;
  }
}

/* =============================================================================
 * Page Header
 * ============================================================================= */

.app-page-header,
.admin-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.app-page-title,
.admin-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.25;
}

.app-page-subtitle,
.admin-page-subtitle {
  font-size: 0.875rem;
  color: var(--muted-foreground-1);
  margin-top: 0.25rem;
}

.app-page-actions,
.admin-page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Breadcrumbs */
.admin-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.admin-breadcrumb {
  color: var(--muted-foreground-1);
  text-decoration: none;
  transition: color var(--animate-duration-fast) ease;
}

.admin-breadcrumb:hover {
  color: var(--primary);
}

.admin-breadcrumb.current {
  color: var(--foreground);
  font-weight: 500;
}

.admin-breadcrumb-separator {
  color: var(--muted-foreground-2);
}

/* Card Variants */
.app-card {
  border: 1px solid var(--border-line-2);
  border-radius: 0.75rem;
  background: var(--background);
  box-shadow: var(--shadow-sm, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

.app-card__header {
  border-bottom: 1px solid var(--border-line-2);
}

.app-card__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
}

.app-card__subtitle {
  margin-top: 0.125rem;
  font-size: 0.75rem;
  color: color-mix(in oklab, var(--foreground) 60%, transparent);
}

.app-card__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-card__action-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
}

.app-card__action-link:hover {
  color: var(--primary);
}

.app-card__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid var(--border-line-2);
}

.app-card--hoverable,
.hoverable {
  transition: all var(--animate-duration-fast) ease;
}

.app-card--hoverable:hover,
.hoverable:hover {
  box-shadow: 0 10px 25px -5px color-mix(in oklab, var(--foreground) 10%, transparent);
  border-color: var(--border-line-3);
}

.app-card--embedded {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-card--embedded .app-card__header,
.app-card--embedded .app-card__footer {
  border-color: color-mix(in oklab, var(--border-line-2) 80%, transparent);
}

.app-card--shellless {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.app-card--shellless .app-card__header {
  border-bottom: 0;
  padding: 0 0 1rem;
}

.app-card--shellless .app-card__body {
  padding: 0;
}

.app-card--shellless .app-card__footer {
  border-top: 0;
  padding: 1rem 0 0;
}

/* Admin settings workspace */
.settings-workspace {
  --settings-panel-gap: 1.25rem;
}

.settings-section-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--primary);
}

.settings-workspace .settings-tab-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  gap: 0.25rem;
  padding: 0.5rem;
  border: 1px solid var(--border-line-2);
  border-radius: 0.75rem;
  background: color-mix(in oklab, var(--background) 94%, transparent);
  backdrop-filter: blur(12px);
}

.settings-workspace .settings-tab-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  white-space: nowrap;
  border-radius: 0.5rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  color: color-mix(in oklab, var(--foreground) 70%, transparent);
  text-decoration: none;
  transition: background-color var(--animate-duration-fast) ease, color var(--animate-duration-fast) ease;
}

.settings-workspace .settings-tab-link:hover,
.settings-workspace .settings-tab-link:focus-visible,
.settings-workspace .settings-tab-link.active {
  background: var(--background-1);
  color: var(--foreground);
  outline: none;
}

.settings-workspace .settings-tab-link.active {
  box-shadow: inset 0 0 0 1px var(--border-line-2);
}

.settings-tab-panel {
  scroll-margin-top: 6rem;
  display: grid;
  gap: var(--settings-panel-gap);
}

.settings-tab-panel.hidden,
.settings-tab-panel[hidden] {
  display: none;
}

.settings-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.25rem 0.25rem;
}

.settings-section-heading h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--foreground);
}

.settings-section-heading > p {
  max-width: 28rem;
  margin: 0;
  padding-top: 1.45rem;
  text-align: right;
  font-size: 0.875rem;
  line-height: 1.45;
  color: color-mix(in oklab, var(--foreground) 62%, transparent);
}

.settings-workspace .app-card {
  border-radius: 0.75rem;
  box-shadow: none;
}

.settings-workspace .app-card__header {
  padding-block: 1rem;
}

.settings-workspace .app-card__body {
  padding-block: 1rem;
}

.settings-save-bar {
  position: sticky;
  bottom: 1rem;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-line-2);
  border-radius: 0.75rem;
  background: color-mix(in oklab, var(--background) 96%, transparent);
  box-shadow: 0 12px 32px color-mix(in oklab, var(--foreground) 10%, transparent);
  backdrop-filter: blur(12px);
}

@media (max-width: 768px) {
  .settings-workspace .settings-tab-nav {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    overflow: visible;
    padding: 0.5rem;
  }

  .settings-workspace .settings-tab-link {
    min-height: 2.75rem;
    width: 100%;
    justify-content: flex-start;
    white-space: normal;
    border: 1px solid transparent;
    background: color-mix(in oklab, var(--background-1) 55%, transparent);
    padding: 0.625rem 0.75rem;
    text-align: left;
    font-size: 0.8125rem;
  }

  .settings-section-heading,
  .settings-save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-save-bar .app-button,
  .settings-save-bar input[type="submit"] {
    width: 100%;
  }

  .settings-section-heading > p {
    max-width: none;
    padding-top: 0;
    text-align: left;
  }
}

/* =============================================================================
 * Stats Card Component
 * ============================================================================= */

.admin-stat-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
}

.admin-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  flex-shrink: 0;
}

.admin-stat-icon.primary {
  background-color: color-mix(in oklab, var(--primary) 14%, var(--background));
  color: var(--primary);
}

.admin-stat-icon.secondary {
  background-color: color-mix(in oklab, var(--secondary) 16%, var(--background));
  color: var(--secondary);
}

.admin-stat-icon.accent {
  background-color: color-mix(in oklab, var(--accent) 16%, var(--background));
  color: var(--accent);
}

.admin-stat-icon.success {
  background-color: var(--color-success-50);
  color: var(--color-success-600);
}

.admin-stat-icon.warning {
  background-color: color-mix(in oklab, var(--color-amber-500) 14%, var(--background));
  color: color-mix(in oklab, var(--color-amber-700, #b45309) 88%, var(--foreground));
}

.admin-stat-icon.info {
  background-color: color-mix(in oklab, var(--color-sky-500) 14%, var(--background));
  color: color-mix(in oklab, var(--color-sky-700, #0369a1) 88%, var(--foreground));
}

.admin-stat-icon.danger {
  background-color: color-mix(in oklab, var(--destructive) 12%, var(--background));
  color: var(--destructive);
}

.admin-stat-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.admin-stat-content {
  flex: 1;
  min-width: 0;
}

.admin-stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground-1);
}

.admin-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.2;
  margin-top: 0.25rem;
}

.admin-stat-change {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.5rem;
}

.admin-stat-change.positive {
  color: var(--color-success-600);
}

.admin-stat-change.negative {
  color: var(--color-danger-600);
}

/* =============================================================================
 * Empty State Component
 * ============================================================================= */

.admin-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.admin-empty-state-icon {
  width: 3rem;
  height: 3rem;
  color: var(--muted-foreground-2);
  margin-bottom: 1rem;
}

.admin-empty-state-icon svg {
  width: 100%;
  height: 100%;
}

.admin-empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 0.25rem;
}

.admin-empty-state-description {
  font-size: 0.875rem;
  color: var(--muted-foreground-1);
  max-width: 24rem;
}

.app-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

.app-empty-state--compact {
  padding: 1.5rem 1rem;
}

.app-empty-state--surface {
  background: color-mix(in oklab, var(--background-1) 60%, transparent);
  border-radius: 0.75rem;
}

.app-empty-state__icon-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  margin-bottom: 1rem;
  border-radius: 9999px;
  background: color-mix(in oklab, var(--background-1) 60%, transparent);
}

.app-empty-state__icon {
  width: 2rem;
  height: 2rem;
  color: var(--muted-foreground-1);
}

.app-empty-state__icon svg {
  width: 100%;
  height: 100%;
}

.app-empty-state__title {
  margin-bottom: 0.25rem;
  font-size: 1.125rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: var(--foreground);
}

.app-empty-state__description {
  max-width: 24rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: var(--muted-foreground-1);
}

.app-empty-state__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.app-empty-message {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
  text-align: center;
  color: var(--muted-foreground-1);
}

.app-empty-message--compact {
  padding: 0.5rem 0;
}

.worksheet-table {
  table-layout: fixed;
}

/* Shared data table baseline used across admin/app index tables */
.app-table {
  --app-table-cell-py: 0.75rem;
  --app-table-cell-px: 1rem;
  --app-table-header-size: 0.8125rem;
  --app-table-header-weight: 600;
  --app-table-action-btn-size: 2.125rem;
  --app-table-action-icon-size: 1rem;

  border-collapse: separate;
  border-spacing: 0;
}

.app-table :is(thead th, tbody th, tbody td, tfoot th, tfoot td) {
  padding: var(--app-table-cell-py) var(--app-table-cell-px);
  vertical-align: middle;
}

.app-table thead th {
  font-size: var(--app-table-header-size);
  font-weight: var(--app-table-header-weight);
  line-height: 1.2;
  color: var(--muted-foreground-1);
  border-bottom: 1px solid var(--border-line-2);
  background-color: color-mix(in oklab, var(--background) 96%, var(--background-1));
}

.app-table tbody :is(th, td) {
  border-bottom: 1px solid color-mix(in oklab, var(--border-line-2) 75%, transparent);
}

.app-table tbody tr:last-child :is(th, td) {
  border-bottom: 0;
}

.app-table tfoot :is(th, td) {
  border-top: 1px solid var(--border-line-2);
}

.app-table--compact {
  --app-table-cell-py: 0.5rem;
  --app-table-cell-px: 0.75rem;
  --app-table-header-size: 0.8125rem;
  --app-table-action-btn-size: 2rem;
  --app-table-action-icon-size: 0.9375rem;
}

.app-table--comfortable {
  --app-table-cell-py: 0.75rem;
  --app-table-cell-px: 1rem;
  --app-table-header-size: 0.8125rem;
}

.timesheet-report-table--screen {
  width: 100%;
  min-width: 62rem;
  table-layout: fixed;
  font-size: 0.875rem;
}

.timesheet-report-table--screen .timesheet-report-table__employee-col {
  width: 14rem;
}

.timesheet-report-table--screen .timesheet-report-table__day-col {
  width: 7.5rem;
}

.timesheet-report-table--screen .timesheet-report-table__total-col {
  width: 6rem;
}

.timesheet-report-table--screen .timesheet-report-table__employee,
.timesheet-report-table--screen .timesheet-report-table__employee-name {
  position: sticky;
  left: 0;
  text-align: left;
  background: var(--background);
}

.timesheet-report-table--screen .timesheet-report-table__employee {
  z-index: 3;
}

.timesheet-report-table--screen .timesheet-report-table__employee-name {
  z-index: 2;
  font-weight: 600;
  color: var(--foreground);
}

.timesheet-report-table--screen tbody tr:nth-child(even) .timesheet-report-table__employee-name,
.timesheet-report-table--screen tbody tr:nth-child(even) .timesheet-report-table__day-cell,
.timesheet-report-table--screen tbody tr:nth-child(even) .timesheet-report-table__total-cell {
  background: color-mix(in oklab, var(--background) 88%, var(--background-1));
}

.timesheet-report-table--screen .timesheet-report-table__day,
.timesheet-report-table--screen .timesheet-report-table__day-cell,
.timesheet-report-table--screen .timesheet-report-table__day-total,
.timesheet-report-table--screen .timesheet-report-table__total,
.timesheet-report-table--screen .timesheet-report-table__total-cell {
  text-align: center;
}

.timesheet-report-table--screen .timesheet-report-table__day-name,
.timesheet-report-table--screen .timesheet-report-table__day-date,
.timesheet-report-table--screen .timesheet-report-table__time-range,
.timesheet-report-table--screen .timesheet-report-table__day-hours {
  display: block;
}

.timesheet-report-table--screen .timesheet-report-table__day-name {
  color: var(--foreground);
}

.timesheet-report-table--screen .timesheet-report-table__day-date {
  margin-top: 0.125rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground-1);
}

.timesheet-report-table--screen .timesheet-report-table__time-range {
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
}

.timesheet-report-table--screen .timesheet-report-table__day-hours {
  width: fit-content;
  margin: 0.25rem auto 0;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: color-mix(in oklab, var(--primary) 12%, transparent);
}

.timesheet-report-table--screen .timesheet-report-table__day-empty {
  font-weight: 600;
  color: color-mix(in oklab, var(--foreground) 34%, transparent);
}

.timesheet-report-table--screen tfoot .timesheet-report-table__employee-name,
.timesheet-report-table--screen tfoot .timesheet-report-table__day-cell,
.timesheet-report-table--screen tfoot .timesheet-report-table__total-cell {
  background: color-mix(in oklab, var(--background) 82%, var(--background-1));
  font-weight: 700;
  color: var(--foreground);
}

/* Preline-like grouped table actions */
.app-table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.375rem;
}

/* Consistent action icon buttons in admin tables */
.app-table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--app-table-action-btn-size);
  height: var(--app-table-action-btn-size);
  padding: 0;
  flex-shrink: 0;
  border-color: var(--border-line-2) !important;
  background: color-mix(in oklab, var(--background) 92%, var(--background-1)) !important;
  border-radius: 0.625rem;
  box-shadow: 0 1px 2px color-mix(in oklab, var(--foreground) 8%, transparent);
  transition:
    background-color var(--animate-duration-fast) ease,
    border-color var(--animate-duration-fast) ease,
    color var(--animate-duration-fast) ease,
    box-shadow var(--animate-duration-fast) ease,
    transform var(--animate-duration-fast) ease;
}

.app-table-action:hover {
  background: var(--background-1) !important;
  border-color: var(--border-line-3) !important;
  box-shadow: 0 4px 10px -4px color-mix(in oklab, var(--foreground) 16%, transparent);
  transform: translateY(-1px);
}

.app-table-action:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px color-mix(in oklab, var(--primary) 24%, transparent),
    0 1px 2px color-mix(in oklab, var(--foreground) 8%, transparent);
}

.app-table-action svg {
  width: var(--app-table-action-icon-size) !important;
  height: var(--app-table-action-icon-size) !important;
}

/* Shared responsive filter bars */
.app-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  min-width: 0;
}

.app-filters--inline {
  align-items: center;
}

.app-filters__field {
  display: flex;
  flex: 1 1 12rem;
  min-width: 0;
  flex-direction: column;
  gap: 0.375rem;
}

.app-filters__field--compact {
  flex-basis: 10rem;
}

.app-filters__field--search {
  flex-basis: 16rem;
  flex-grow: 2;
}

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

.app-filters__checkbox {
  display: inline-flex;
  min-width: 0;
  flex: 0 1 auto;
  align-items: center;
}

.app-filters__meta {
  min-width: 0;
  flex: 0 1 auto;
}

.app-filters__actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.app-filters__actions--grow {
  flex-grow: 1;
}

.app-tabs {
  display: flex;
  gap: 1.25rem;
  min-width: 0;
}

.app-tabs--underline {
  margin-bottom: -1px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.app-tabs--underline::-webkit-scrollbar {
  display: none;
}

.app-tabs--chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

.app-input,
.app-select,
.app-textarea {
  width: 100%;
  border: 1px solid var(--border-line-2);
  border-radius: 0.625rem;
  background: var(--background);
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  color: var(--foreground);
  box-shadow: var(--shadow-sm, 0 1px 2px 0 rgb(0 0 0 / 0.05));
  transition:
    border-color var(--animate-duration-fast) ease,
    box-shadow var(--animate-duration-fast) ease,
    background-color var(--animate-duration-fast) ease;
}

.app-input:focus,
.app-select:focus,
.app-textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 20%, transparent);
}

.app-input:disabled,
.app-select:disabled,
.app-textarea:disabled {
  border-color: var(--border-line-2);
  background: color-mix(in oklab, var(--foreground) 6%, var(--background-1));
  color: color-mix(in oklab, var(--foreground) 42%, transparent);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

.app-input--with-leading-icon {
  padding-left: 2.75rem;
}

.app-checkbox {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
  border-color: var(--border-line-2);
  color: var(--primary);
}

.app-checkbox:focus {
  --tw-ring-color: color-mix(in oklab, var(--primary) 35%, transparent);
}

.app-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.625rem;
  border: 1px solid transparent;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  transition:
    background-color var(--animate-duration-fast) ease,
    border-color var(--animate-duration-fast) ease,
    color var(--animate-duration-fast) ease,
    box-shadow var(--animate-duration-fast) ease;
}

.app-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 24%, transparent);
}

.app-button--primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.app-button--primary:hover {
  background: color-mix(in oklab, var(--primary) 88%, var(--foreground));
}

.app-button--secondary {
  border-color: var(--border-line-2);
  background: var(--background);
  color: color-mix(in oklab, var(--foreground) 82%, transparent);
}

.app-button--secondary:hover {
  background: color-mix(in oklab, var(--background-1) 72%, var(--background));
}

.app-button--warning {
  border-color: color-mix(in oklab, var(--color-amber-500) 28%, var(--border-line-2));
  background: color-mix(in oklab, var(--color-amber-500) 10%, var(--background));
  color: color-mix(in oklab, var(--color-amber-700, #b45309) 82%, var(--foreground));
}

.app-button--warning:hover {
  background: color-mix(in oklab, var(--color-amber-500) 16%, var(--background));
}

.app-button--danger {
  border-color: color-mix(in oklab, var(--destructive) 30%, var(--border-line-2));
  background: color-mix(in oklab, var(--destructive) 10%, var(--background));
  color: color-mix(in oklab, var(--destructive) 88%, var(--foreground));
}

.app-button--danger:hover {
  background: color-mix(in oklab, var(--destructive) 16%, var(--background));
}

.app-button--ghost {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
}

.app-button--ghost:hover {
  color: color-mix(in oklab, var(--primary) 88%, var(--foreground));
}

.app-button:disabled,
.app-button[aria-disabled="true"] {
  border-color: var(--border-line-2);
  background: color-mix(in oklab, var(--foreground) 8%, var(--background-1));
  color: color-mix(in oklab, var(--foreground) 38%, transparent);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
  pointer-events: none;
}

.worksheet-remove-button:disabled {
  color: color-mix(in oklab, var(--foreground) 32%, transparent);
  cursor: not-allowed;
  opacity: 1;
  pointer-events: none;
}

.app-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.625rem;
  border: 1px solid var(--border-line-2);
  background: var(--background);
  color: color-mix(in oklab, var(--foreground) 80%, transparent);
  transition:
    background-color var(--animate-duration-fast) ease,
    border-color var(--animate-duration-fast) ease,
    color var(--animate-duration-fast) ease,
    box-shadow var(--animate-duration-fast) ease;
}

.app-icon-button:hover {
  background: color-mix(in oklab, var(--background-1) 72%, var(--background));
  color: var(--foreground);
}

.app-icon-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 24%, transparent);
}

.app-segmented-control {
  display: inline-flex;
  align-items: stretch;
  border-radius: 0.75rem;
  border: 1px solid var(--border-line-2);
  background: color-mix(in oklab, var(--background-1) 55%, var(--background));
  padding: 0.25rem;
  gap: 0.25rem;
}

.app-segmented-control__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: color-mix(in oklab, var(--foreground) 72%, transparent);
  transition:
    background-color var(--animate-duration-fast) ease,
    color var(--animate-duration-fast) ease,
    box-shadow var(--animate-duration-fast) ease;
}

.app-segmented-control__button:hover {
  color: var(--foreground);
}

.app-segmented-control__button.is-active {
  background: var(--background);
  color: var(--primary);
  box-shadow: var(--shadow-sm, 0 1px 2px 0 rgb(0 0 0 / 0.05));
}

.app-segmented-control__button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 20%, transparent);
}

.app-surface-link {
  display: block;
  border-radius: 0.625rem;
  border: 1px solid var(--border-line-2);
  background: var(--background);
  transition:
    border-color var(--animate-duration-fast) ease,
    background-color var(--animate-duration-fast) ease,
    box-shadow var(--animate-duration-fast) ease,
    transform var(--animate-duration-fast) ease;
}

.app-surface-link:hover {
  border-color: color-mix(in oklab, var(--primary) 30%, var(--border-line-2));
  background: color-mix(in oklab, var(--background-1) 65%, var(--background));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.app-surface-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 22%, transparent);
}

.app-list-row {
  display: block;
  padding: 1rem;
  transition:
    background-color var(--animate-duration-fast) ease,
    box-shadow var(--animate-duration-fast) ease;
}

.app-list-row--split {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.app-list-row__content {
  min-width: 0;
  flex: 1 1 auto;
}

.app-list-row__meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.app-list-row:hover {
  background: color-mix(in oklab, var(--background-1) 65%, var(--background));
}

.app-list-row--highlight {
  background: color-mix(in oklab, var(--color-sky-500) 8%, var(--background));
}

.app-tone-panel {
  border-radius: 0.75rem;
  border: 1px solid var(--border-line-2);
  background: color-mix(in oklab, var(--background-1) 60%, var(--background));
}

.app-tone-panel--warning {
  border-color: color-mix(in oklab, var(--color-amber-500) 24%, var(--border-line-2));
  background: color-mix(in oklab, var(--color-amber-500) 10%, var(--background));
}

.app-tone-panel--info {
  border-color: color-mix(in oklab, var(--color-sky-500) 24%, var(--border-line-2));
  background: color-mix(in oklab, var(--color-sky-500) 10%, var(--background));
}

.app-tone-title--warning,
.app-tone-label--warning {
  color: color-mix(in oklab, var(--color-amber-700, #b45309) 82%, var(--foreground));
}

.app-tone-help--warning {
  color: color-mix(in oklab, var(--color-amber-600, #d97706) 72%, var(--foreground));
}

.app-choice-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 0.625rem;
  border: 1px solid var(--border-line-2);
  background: var(--background);
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  color: color-mix(in oklab, var(--foreground) 76%, transparent);
  transition:
    background-color var(--animate-duration-fast) ease,
    border-color var(--animate-duration-fast) ease,
    color var(--animate-duration-fast) ease;
}

.app-choice-chip:hover {
  background: color-mix(in oklab, var(--background-1) 72%, var(--background));
}

.app-choice-chip.is-selected {
  border-color: color-mix(in oklab, var(--color-amber-500) 34%, var(--border-line-2));
  background: color-mix(in oklab, var(--color-amber-500) 18%, var(--background));
  color: color-mix(in oklab, var(--color-amber-700, #b45309) 82%, var(--foreground));
  font-weight: 600;
}

.app-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  border: 1px solid var(--border-line-2);
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.app-badge--neutral {
  border-color: var(--border-line-2);
  background: transparent;
  color: color-mix(in oklab, var(--foreground) 76%, transparent);
}

.app-badge--warning {
  border-color: color-mix(in oklab, var(--color-amber-500) 22%, var(--border-line-2));
  background: color-mix(in oklab, var(--color-amber-500) 10%, var(--background));
  color: color-mix(in oklab, var(--color-amber-700, #b45309) 82%, var(--foreground));
}

.app-badge--success {
  border-color: color-mix(in oklab, var(--color-success-500) 22%, var(--border-line-2));
  background: color-mix(in oklab, var(--color-success-500) 10%, var(--background));
  color: color-mix(in oklab, var(--color-success-600) 82%, var(--foreground));
}

.app-badge--info {
  border-color: color-mix(in oklab, var(--color-sky-500) 22%, var(--border-line-2));
  background: color-mix(in oklab, var(--color-sky-500) 10%, var(--background));
  color: color-mix(in oklab, var(--color-sky-700, #0369a1) 80%, var(--foreground));
}

.app-hs-select {
  width: 100% !important;
  justify-content: flex-start !important;
  align-items: flex-start;
  align-content: flex-start;
  text-align: left;
}

.app-hs-select input {
  order: 2;
  flex: 1 0 8rem;
  text-align: left;
}

.app-hs-select [data-tag-value] {
  order: 1;
  max-width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.app-hs-select .selected,
.app-hs-select .hs-select-option-highlighted {
  background: color-mix(in oklab, var(--primary) 12%, var(--background));
  color: var(--primary);
}

.app-hs-select .selected {
  font-weight: 600;
}

@media (max-width: 767px) {
  .app-filters {
    align-items: stretch;
  }

  .app-filters__field,
  .app-filters__checkbox,
  .app-filters__meta,
  .app-filters__actions {
    flex-basis: 100%;
    width: 100%;
  }

  .app-filters__actions > * {
    flex: 1 1 auto;
  }

  .app-tabs {
    gap: 0.75rem;
  }

  .app-tabs--underline {
    flex-wrap: nowrap;
    padding-bottom: 0.125rem;
  }
}

@media (max-width: 767px) {
  .app-table--responsive-ready {
    border-collapse: separate;
    border-spacing: 0;
  }

  .app-table--responsive-ready thead {
    display: none;
  }

  .app-table--responsive-ready tfoot {
    display: none;
  }

  .app-table--responsive-ready tbody {
    display: grid;
    gap: 0.875rem;
  }

  .app-table--responsive-ready tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.625rem;
    overflow: hidden;
    border: 1px solid var(--border-line-2);
    border-radius: 0.875rem;
    background: var(--background);
    box-shadow: var(--shadow-sm, 0 1px 2px 0 rgb(0 0 0 / 0.05));
    padding: 0.75rem;
  }

  .app-table--responsive-ready tbody :is(th, td) {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.25rem 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-align: left !important;
    white-space: normal;
  }

  .app-table--responsive-ready tbody :is(th, td) > * {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .app-table--responsive-ready tbody tr > :first-child:not(.app-table-cell--selection):not(.app-table-cell--actions) {
    grid-column: 1 / -1;
  }

  .app-table--responsive-ready tbody tr > :last-child {
    border-bottom: 0;
  }

  .app-table--responsive-ready tbody :is(th, td)::before {
    content: attr(data-label);
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted-foreground-1);
  }

  .app-table--responsive-ready tbody :is(th, td)[data-label=""]::before {
    content: "";
  }

  .app-table--responsive-ready tbody :is(th, td).app-table-cell--selection {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .app-table--responsive-ready tbody :is(th, td).app-table-cell--actions {
    grid-column: 1 / -1;
    background: transparent;
    border: 0;
    padding: 0.125rem 0 0;
  }

  .app-table--responsive-ready tbody :is(th, td).app-table-cell--actions > *:last-child {
    width: 100%;
  }

  .app-table--responsive-ready tbody :is(th, td).app-table-cell--actions .app-table-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 0.5rem;
  }

  .app-table--responsive-ready tbody :is(th, td).app-table-cell--selection::before,
  .app-table--responsive-ready tbody :is(th, td).app-table-cell--actions::before {
    display: none;
  }
}

/* =============================================================================
 * Responsive Styles
 * ============================================================================= */

/* Mobile overlay */
#sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: color-mix(in oklab, var(--foreground) 30%, transparent);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--animate-duration-normal, 300ms) ease;
}

#sidebar-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 1024px) {
  #sidebar-overlay {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .app-sidebar,
  .admin-sidebar {
    transform: translateX(-100%);
    z-index: 50;
    transition:
      transform var(--animate-duration-normal, 300ms) ease,
      width var(--animate-duration-normal, 300ms) ease;
  }

  .app-sidebar.open,
  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 6px -1px color-mix(in oklab, var(--foreground) 15%, transparent);
  }

  .app-topbar,
  .admin-topbar {
    left: 0;
  }

  .app-main,
  .admin-main {
    margin-left: 0;
  }

  .topbar-search {
    display: none;
  }

  /* Make mobile menu button more visible */
  .topbar-button.menu-toggle {
    width: 2.5rem;
    height: 2.5rem;
    background-color: var(--color-surface-100);
    border: 1px solid var(--border);
  }

  .topbar-button.menu-toggle:hover {
    background-color: var(--color-surface-200);
  }
}

@media (max-width: 767px) {
  .public-main {
    align-items: flex-start;
    justify-content: center;
    padding:
      max(0.75rem, env(safe-area-inset-top))
      0.75rem
      max(0.75rem, env(safe-area-inset-bottom));
  }

  .topbar-content {
    padding: 0 0.625rem;
    overflow-x: clip;
  }

  .app-content,
  .admin-content {
    padding: 0.625rem;
  }

  .app-page-header,
  .admin-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-page-actions,
  .admin-page-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .app-page-actions > *,
  .admin-page-actions > * {
    flex: 1 1 auto;
  }

  .topbar-profile-info {
    display: none;
  }

  .topbar-right {
    gap: 0.25rem;
    min-width: 0;
  }

  .app-search-modal__shell {
    padding: 4.75rem 0.625rem 0.75rem;
  }

  .app-search-modal__panel {
    max-height: calc(100vh - 5.5rem);
  }

  .topbar-profile-button {
    min-height: 2.25rem;
    padding: 0.25rem;
  }

  .topbar-right .divider {
    display: none;
  }

  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .overflow-x-auto table {
    width: 100%;
    min-width: 100%;
  }

  .overflow-x-auto.table-min-640 table {
    width: max-content;
    min-width: 640px;
  }
}

@media (max-width: 399px) {
  .public-main {
    padding:
      max(0.5rem, env(safe-area-inset-top))
      0.5rem
      max(0.5rem, env(safe-area-inset-bottom));
  }

  .topbar-content {
    padding: 0 0.5rem;
  }

  .app-content,
  .admin-content {
    padding: 0.5rem;
  }
}

/* =============================================================================
 * Utility Classes
 * ============================================================================= */

.admin-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;
}

.admin-divider {
  width: 1px;
  height: 1.5rem;
  background-color: var(--border-line-2);
  margin: 0 0.5rem;
}

/* Animation for sidebar toggle */
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-fade-in {
  animation: fade-in var(--animate-duration-normal) ease;
}

/* =============================================================================
 * Impersonation Banner
 * ============================================================================= */

body.impersonating .app-sidebar,
body.impersonating .admin-sidebar {
  top: 2.5rem;
}

body.impersonating .app-topbar,
body.impersonating .admin-topbar {
  top: 2.5rem;
}

body.impersonating .app-main,
body.impersonating .admin-main {
  margin-top: 2.5rem;
}

/* Native date/time pickers in dark mode */
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="month"],
[data-theme="dark"] input[type="week"] {
  color-scheme: dark !important;
}

/* =============================================================================
 * Dark Mode Logo Styles
 * ============================================================================= */

/* Light mode logo - visible in light mode, hidden in dark mode */
.logo-light {
  display: block !important;
}

.logo-dark {
  display: none !important;
}

.logo-dark-fallback {
  display: none !important;
}

/* Dark mode - hide light logo, show dark logo */
[data-theme="dark"] .logo-light {
  display: none !important;
}

[data-theme="dark"] .logo-dark {
  display: block !important;
}

[data-theme="dark"] .logo-dark-fallback {
  display: block !important;
}

/* =============================================================================
 * SVG Logo Support
 * ============================================================================= */

/* Base logo styles - apply to all logo images */
.logo-light,
.logo-dark,
.logo-dark-fallback {
  display: block;
  height: 2rem;
  width: auto;
  max-width: 8rem;
  object-fit: contain;
}

/* SVG-specific logo handling */
.logo-light[src$=".svg"],
.logo-dark[src$=".svg"],
.logo-dark-fallback[src$=".svg"] {
  /* SVGs scale naturally - use CSS for sizing */
  width: auto;
  height: 2rem;
  max-width: 8rem;
}

/* PNG/JPG logo handling with explicit dimensions */
.logo-light:not([src$=".svg"]),
.logo-dark:not([src$=".svg"]),
.logo-dark-fallback:not([src$=".svg"]) {
  /* Raster images use explicit width/height from helper */
  object-fit: contain;
}

/* Ensure all logo images scale properly */
img[src$=".svg"] {
  max-width: 100%;
  height: auto;
}

/* Logo preview in settings - larger display */
.logo-preview {
  height: 3rem;
  width: auto;
  max-width: 12rem;
  object-fit: contain;
}

/* =============================================================================
 * Checklist Template Form Animations
 * ============================================================================= */

@keyframes highlight-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in oklab, var(--primary) 40%, transparent);
  }
  50% {
    box-shadow: 0 0 0 8px color-mix(in oklab, var(--primary) 0%, transparent);
  }
  100% {
    box-shadow: 0 0 0 0 color-mix(in oklab, var(--primary) 0%, transparent);
  }
}

.highlight-animation {
  animation: highlight-pulse 0.6s ease-out 2;
}

/* =============================================================================
 * Drag and Drop Styles
 * ============================================================================= */

.form-item.dragging,
.form-item-group.dragging {
  opacity: 0.5;
  transform: scale(1.02);
  box-shadow: 0 10px 25px -5px color-mix(in oklab, var(--foreground) 12%, transparent);
}

.form-item.drag-over,
.form-item-group.drag-over {
  border-color: var(--primary);
  background-color: color-mix(in oklab, var(--primary) 10%, var(--background));
  transform: translateY(2px);
}

.drag-handle {
  cursor: grab;
}

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

.form-item,
.form-item-group {
  transition: all 0.2s ease;
}

.form-item:hover .drag-handle,
.form-item-group:hover .drag-handle {
  color: var(--color-primary-500);
}

/* =============================================================================
 * Dashboard Widgets
 * ============================================================================= */

.dashboard-widgets-container {
  min-width: 0;
  max-width: 100%;
}

.dashboard-widget {
  position: relative;
  background: var(--background);
  border-radius: 0.5rem;
  border: 1px solid var(--color-surface-200);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 0.5rem;
  min-width: 0;
  max-width: 100%;
}

.dashboard-widget:hover {
  border-color: color-mix(in oklab, var(--primary) 45%, var(--border-line-2));
  box-shadow: 0 4px 12px -2px color-mix(in oklab, var(--foreground) 12%, transparent);
}

/* Sortable.js classes */
.sortable-ghost {
  opacity: 0.4 !important;
  background: var(--color-primary-100) !important;
}

.sortable-chosen {
  box-shadow: 0 10px 25px -5px color-mix(in oklab, var(--foreground) 20%, transparent) !important;
  transform: scale(1.02);
}

.sortable-drag {
  opacity: 1 !important;
}

.dashboard-widget.is-resizing {
  user-select: none;
  opacity: 0.9;
}

.widget-content {
  height: 100%;
  min-height: 100%;
  min-width: 0;
  padding: 1rem;
  overflow: auto;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--background-1);
  border-radius: 0.375rem 0.375rem 0 0;
  margin: -1px -1px 0 -1px;
  cursor: default;
}

.widget-header:active {
  cursor: default;
}

.widget-title {
  font-weight: 600;
  color: var(--foreground);
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.widget-title svg {
  width: 1rem;
  height: 1rem;
  color: var(--primary);
}

/* Dashboard quick-link icon style stays visible across themes */
.dashboard-quick-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.dashboard-quick-link-icon {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.625rem;
  background: color-mix(in oklab, var(--primary) 16%, var(--background));
  color: var(--primary);
}

.dashboard-quick-link-icon svg {
  width: 1.125rem;
  height: 1.125rem;
  stroke-width: 2;
}

.dashboard-quick-link > div:last-child {
  min-width: 0;
}

.dashboard-quick-link-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--foreground);
}

.dashboard-quick-link-subtitle {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.75rem;
  line-height: 1.3;
  color: color-mix(in oklab, var(--foreground) 60%, transparent);
}

.dashboard-widget-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
}

.dashboard-widget-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dashboard-widget-link--inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.dashboard-widget-link--inline svg {
  width: 0.875rem;
  height: 0.875rem;
}

/* Compact shared presentation on small screens */
@media (max-width: 767px) {
  .widget-header {
    padding: 0.75rem 0.875rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .dashboard-quick-link {
    padding: 0.6875rem;
    gap: 0.75rem;
  }

  .dashboard-quick-link-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .widget-title {
    font-size: 0.875rem;
  }

  .dashboard-widget-link {
    font-size: 0.8125rem;
  }
}

.calendar-modern__toolbar {
  display: grid;
  gap: 1rem;
}

.calendar-modern__toolbar-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.875rem;
}

.calendar-modern__period-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.calendar-modern__period-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.calendar-modern__period-title {
  width: 11.5rem;
  flex: 0 0 11.5rem;
  min-width: 0;
  border: 1px solid color-mix(in oklab, var(--border-line-2) 82%, transparent);
  border-radius: 0.625rem;
  background: color-mix(in oklab, var(--background-1) 58%, var(--background));
  padding: 0.625rem 0.875rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--foreground);
  text-align: center;
}

.calendar-modern__toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.calendar-modern__toolbar-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.calendar-modern__toolbar-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.calendar-modern__filter-field {
  --calendar-filter-label-offset: calc(0.75rem * 1.2 + 0.375rem);
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.375rem;
}

.calendar-modern__filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: color-mix(in oklab, var(--foreground) 68%, transparent);
}

@media (min-width: 768px) {
  .calendar-modern__filter-field {
    transform: translateY(calc(var(--calendar-filter-label-offset) * -0.5));
  }
}

@media (max-width: 767px) {
  .calendar-modern__toolbar-header,
  .calendar-modern__toolbar-actions,
  .calendar-modern__toolbar-primary,
  .calendar-modern__toolbar-secondary,
  .calendar-modern__period-controls {
    width: 100%;
  }

  .calendar-modern__period-nav {
    width: 100%;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.625rem;
  }

  .calendar-modern__period-controls {
    min-width: 0;
    flex: 1 1 auto;
  }

  .calendar-modern__period-title {
    width: min(11.5rem, 100%);
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.9375rem;
    padding-inline: 0.75rem;
  }

  .calendar-modern__period-nav > .app-button {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .calendar-modern__toolbar-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .calendar-modern__toolbar-primary,
  .calendar-modern__toolbar-secondary {
    justify-content: stretch;
  }

  .calendar-modern__toolbar-primary > *,
  .calendar-modern__toolbar-secondary > * {
    flex: 1 1 100%;
  }
}

/* =============================================================================
 * Admin Dashboard Widgets - Sortable Layout
 * ============================================================================= */

.dashboard-widgets-container--sortable .widget-header {
  cursor: grab;
}

.dashboard-widgets-container--sortable .widget-header:active {
  cursor: grabbing;
}

[data-controller~="dashboard-widgets"].dashboard-widgets--static.dashboard-widgets-container--sortable .widget-header,
[data-controller~="dashboard-widgets"].dashboard-widgets--static.dashboard-widgets-container--sortable .widget-header:active {
  cursor: default;
}

/* Resize Handles */
.resize-handle {
  position: absolute;
  z-index: 10;
}

.resize-handle-right {
  top: 0;
  right: 0;
  width: 10px;
  height: 100%;
  cursor: ew-resize;
  background: transparent;
}

.resize-handle-right::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 50px;
  background: var(--color-surface-300);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.dashboard-widget:hover .resize-handle-right::before {
  opacity: 1;
}

.resize-handle-right:hover::before {
  background: var(--color-primary-500);
  opacity: 1;
}

.resize-handle-bottom {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 10px;
  cursor: ns-resize;
}

.resize-handle-bottom::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 4px;
  background: var(--color-surface-300);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.dashboard-widget:hover .resize-handle-bottom::before {
  opacity: 1;
}

.resize-handle-bottom:hover::before {
  background: var(--color-primary-500);
  opacity: 1;
}

/* Widget visibility toggle */
.widget-hidden {
  display: none;
}

/* Grid layout for widgets - responsive with auto height as default */
.dashboard-widgets-container--sortable [data-dashboard-widgets-target="container"] {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(90px, auto);
  gap: 1rem;
  min-width: 0;
  max-width: 100%;
}

/* Widget spans columns based on data-col-span, height is auto unless row-span is set */
.dashboard-widgets-container--sortable [data-dashboard-widgets-target="container"] > .dashboard-widget {
  grid-column: span var(--widget-col-span, 12);
  min-width: 0;
}

/* When row-span is explicitly set, use fixed height */
.dashboard-widgets-container--sortable [data-dashboard-widgets-target="container"] > .dashboard-widget[data-row-span]:not([data-row-span=""]) {
  grid-row: span var(--widget-row-span, 1);
}

/* Responsive adjustments */
@media (max-width: 1280px) {
  .dashboard-widgets-container--sortable [data-dashboard-widgets-target="container"] {
    grid-template-columns: repeat(6, 1fr);
  }

  .dashboard-widgets-container--sortable [data-dashboard-widgets-target="container"] > .dashboard-widget {
    grid-column: span 6 !important;
  }
}

@media (max-width: 1023px) {
  .dashboard-widgets-container--sortable [data-dashboard-widgets-target="container"] {
    display: flex !important;
    flex-direction: column;
    gap: 1rem;
  }

  .dashboard-widgets-container--sortable [data-dashboard-widgets-target="container"] > .dashboard-widget {
    width: 100%;
    grid-column: auto !important;
    grid-row: auto !important;
    overflow: visible;
  }

  .dashboard-widgets-container--sortable .resize-handle {
    display: none;
  }

  .dashboard-widgets-container--sortable .widget-content {
    overflow: visible;
  }

  .dashboard-widgets-container--sortable .widget-header {
    margin: 0;
  }
}

@media (max-width: 767px) {
  .dashboard-widgets-container--sortable [data-dashboard-widgets-target="container"] > .dashboard-widget {
    width: 100%;
  }

  .dashboard-widgets-container--sortable .resize-handle {
    display: none;
  }
}
