:root {
  --radius: 0.625rem;
  --background: oklch(0.985 0.002 247.858);
  --foreground: oklch(0.129 0.042 264.695);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.129 0.042 264.695);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.129 0.042 264.695);
  --primary: oklch(0.511 0.262 276.966);
  --primary-foreground: oklch(0.984 0.003 247.858);
  --secondary: oklch(0.967 0.003 264.542);
  --secondary-foreground: oklch(0.208 0.042 265.755);
  --muted: oklch(0.967 0.003 264.542);
  --muted-foreground: oklch(0.554 0.046 257.417);
  --accent: oklch(0.967 0.003 264.542);
  --accent-foreground: oklch(0.208 0.042 265.755);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(0.984 0.003 247.858);
  --border: oklch(0.929 0.013 255.508);
  --input: oklch(0.929 0.013 255.508);
  --ring: oklch(0.511 0.262 276.966);
  --success: oklch(0.627 0.194 149.214);
  --warn: oklch(0.666 0.179 58.318);

  /* Spacing scale (4px base) — use everywhere for professional rhythm */
  --space-1: 0.25rem;   /* 4 */
  --space-2: 0.5rem;    /* 8 */
  --space-3: 0.75rem;   /* 12 */
  --space-4: 1rem;      /* 16 */
  --space-5: 1.25rem;   /* 20 */
  --space-6: 1.5rem;    /* 24 */
  --space-7: 2rem;      /* 32 */
  --space-8: 2.5rem;    /* 40 */

  --page-pad-x: var(--space-6);
  --page-pad-y: var(--space-6);
  --page-gap: var(--space-6);
  --section-gap: var(--space-4);
  --stack-gap: var(--space-3);
  --inline-gap: var(--space-2);
  --card-pad: var(--space-5);
  --field-gap: var(--space-2);
  --header-gap: var(--space-2);

  /* Shell alignment: content breadcrumb lines up with first sidebar nav row */
  --shell-header-h: 3.5rem;
  --sidebar-nav-pad: var(--space-2);
  --nav-link-pad-y: var(--space-2);
  --content-pad-top: calc(var(--sidebar-nav-pad) + var(--nav-link-pad-y));
}
@media (max-width: 1023px) {
  :root {
    --page-pad-x: var(--space-5);
    --page-pad-y: var(--space-5);
    --page-gap: var(--space-5);
  }
}
@media (max-width: 767px) {
  :root {
    --page-pad-x: var(--space-4);
    --page-pad-y: var(--space-4);
    --page-gap: var(--space-4);
    --section-gap: var(--space-3);
    --card-pad: var(--space-4);
  }
}

html.dark {
  --background: oklch(0.129 0.042 264.695);
  --foreground: oklch(0.984 0.003 247.858);
  --card: oklch(0.208 0.042 265.755);
  --card-foreground: oklch(0.984 0.003 247.858);
  --popover: oklch(0.208 0.042 265.755);
  --popover-foreground: oklch(0.984 0.003 247.858);
  --primary: oklch(0.511 0.262 276.966);
  --primary-foreground: oklch(0.984 0.003 247.858);
  --secondary: oklch(0.279 0.041 260.031);
  --secondary-foreground: oklch(0.984 0.003 247.858);
  --muted: oklch(0.279 0.041 260.031);
  --muted-foreground: oklch(0.704 0.04 256.788);
  --accent: oklch(0.279 0.041 260.031);
  --accent-foreground: oklch(0.984 0.003 247.858);
  --destructive: oklch(0.577 0.245 27.325);
  --destructive-foreground: oklch(0.984 0.003 247.858);
  --border: oklch(0.372 0.044 257.287);
  --input: oklch(0.372 0.044 257.287);
  --ring: oklch(0.511 0.262 276.966);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
.h-full { height: 100%; }
body:has(.app-shell) {
  overflow: hidden;
  height: 100%;
  height: 100dvh;
}
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }

.scrollbar-thin {
  scrollbar-width: thin;
  scrollbar-color: oklch(0.55 0.02 264 / 0.35) transparent;
}
html.dark .scrollbar-thin {
  scrollbar-color: oklch(0.45 0.02 264 / 0.45) transparent;
}
.scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb {
  background-color: oklch(0.45 0.02 264 / 0.45);
  border-radius: 9999px;
}

.app-content--map {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.app-content--map > [data-ajax-page],
.app-content--map > .ops-map-page {
  flex: 1;
  min-height: 0;
}
.app-shell--map .app-main {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-shell {
  display: flex;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--background);
}
.app-sidebar {
  display: flex;
  flex-direction: column;
  width: 14rem;
  flex-shrink: 0;
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 55%, var(--card));
}
.app-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  height: var(--shell-header-h);
  flex-shrink: 0;
  padding: 0 0.75rem 0 1rem;
  border-bottom: 1px solid var(--border);
}
.app-sidebar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  font-weight: 700;
  font-size: 1rem;
}
.app-sidebar-brand .accent { color: var(--primary); }
.app-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgb(0 0 0 / 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
html.layout-mobile body.sidebar-open .app-sidebar-backdrop {
  display: block;
}
.app-sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: var(--sidebar-nav-pad);
  padding-bottom: max(var(--space-3), env(safe-area-inset-bottom, 0px));
}
.nav-group { margin-bottom: var(--section-gap); }
.nav-group:last-child { margin-bottom: 0; }
.nav-label {
  margin-bottom: var(--space-1);
  padding: 0 var(--space-3);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: var(--stack-gap);
  padding: var(--nav-link-pad-y) var(--space-3);
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover {
  background: var(--accent);
  color: var(--foreground);
}
.nav-link.active {
  background: color-mix(in oklch, var(--primary) 10%, transparent);
  color: var(--foreground);
  font-weight: 500;
}
.nav-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.app-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.app-topbar {
  z-index: 10;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: var(--inline-gap);
  border-bottom: 1px solid var(--border);
  background: var(--background);
  padding: 0 var(--page-pad-x);
  padding-top: env(safe-area-inset-top, 0px);
  height: calc(var(--shell-header-h) + env(safe-area-inset-top, 0px));
}
.app-topbar-start {
  display: flex;
  align-items: center;
  gap: var(--inline-gap);
  min-width: 0;
  flex: 1;
}
.app-topbar-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--inline-gap);
  flex-shrink: 0;
}
.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 0.625rem 0 0.375rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.user-menu-trigger:hover {
  background: var(--accent);
}
.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 9999px;
  background: color-mix(in oklch, var(--primary) 12%, transparent);
  color: var(--primary);
}
.user-avatar .nav-icon { width: 1rem; height: 1rem; }
.user-menu-label {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted-foreground);
}
.user-menu-chevron {
  display: inline-flex;
  color: var(--muted-foreground);
}
.user-menu-chevron .nav-icon { width: 0.875rem; height: 0.875rem; }
.app-topbar-user {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.app-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: var(--content-pad-top) var(--page-pad-x) var(--page-pad-y);
  padding-bottom: max(var(--page-pad-y), env(safe-area-inset-bottom, 0px));
}

/* Vertical rhythm: major blocks inside a page */
.app-content > [data-ajax-page] > .page-top,
.app-content > .page-top {
  margin-bottom: var(--section-gap);
}
.app-content > [data-ajax-page] > .page-header:not(.page-top .page-header),
.app-content > .page-header:not(.page-top .page-header) {
  margin-bottom: var(--page-gap);
}
.app-content > [data-ajax-page] > .page-body,
.app-content > .page-body {
  margin-bottom: var(--page-gap);
}
.app-content > [data-ajax-page] > .stat-grid:not(.page-body .stat-grid),
.app-content > .stat-grid:not(.page-body .stat-grid),
.app-content > [data-ajax-page] > .filter-bar,
.app-content > .filter-bar,
.app-content > [data-ajax-page] > .ui-card,
.app-content > .ui-card,
.app-content > [data-ajax-page] > .dashboard-card,
.app-content > .dashboard-card,
.app-content > [data-ajax-page] > .report-card,
.app-content > .report-card,
.app-content > [data-ajax-page] > .crm-grid-shell,
.app-content > .crm-grid-shell,
.app-content > [data-ajax-page] > .data-grid,
.app-content > .data-grid,
.app-content > [data-ajax-page] > .settings-form,
.app-content > .settings-form {
  margin-bottom: var(--page-gap);
}
.app-content > [data-ajax-page] > :last-child,
.app-content > :last-child {
  margin-bottom: 0;
}

/* Buttons */
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.ui-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ui-btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}
.ui-btn-primary:hover:not(:disabled) {
  filter: brightness(0.95);
}
.ui-btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--foreground);
}
.ui-btn-outline:hover:not(:disabled) {
  background: var(--accent);
}
.ui-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--foreground);
}
.ui-btn-ghost:hover:not(:disabled) {
  background: var(--accent);
}
.ui-btn-destructive:not(.ui-btn-outline):not(.ui-btn-ghost) {
  background: var(--destructive);
  color: var(--destructive-foreground);
}
.ui-btn-outline.ui-btn-destructive {
  background: transparent;
  border-color: var(--border);
  color: var(--destructive);
}
.ui-btn-outline.ui-btn-destructive:hover:not(:disabled) {
  background: color-mix(in oklch, var(--destructive) 10%, transparent);
  color: var(--destructive);
}
.ui-btn-icon {
  width: 2rem;
  height: 2rem;
  padding: 0;
}
.ui-btn-lg { height: 3rem; padding: 0 1.25rem; font-size: 0.875rem; }
.ui-btn-full { width: 100%; }

/* Form fields — align-content:start agar kolom 2 sejajar meski satu field punya hint */
.ui-field {
  display: grid;
  gap: var(--field-gap);
  align-content: start;
  align-items: stretch;
  min-width: 0;
}
.ui-label {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0.2rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25;
}
/* Dialog forms: tighter, sectioned layout */
.ui-dialog-body.form-stack {
  gap: 1rem;
}
.ui-dialog-body .ui-form-section + .ui-form-section {
  margin-top: 0.15rem;
  padding-top: 0.9rem;
}
.ui-dialog-body .ui-form-grid {
  gap: 0.75rem;
}
.ui-dialog-body .form-row-2 {
  gap: 0.75rem;
}
.ui-input,
.ui-textarea,
.ui-select {
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--input);
  background: transparent;
  color: var(--foreground);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.ui-input,
.ui-select {
  height: 2.25rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
}
.ui-input::placeholder,
.ui-textarea::placeholder { color: var(--muted-foreground); }
.ui-input:focus,
.ui-textarea:focus,
.ui-select:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring);
}
.ui-input:disabled,
.ui-textarea:disabled,
.ui-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.ui-input-lg { height: 3rem; font-size: 1rem; }
.ui-textarea {
  min-height: 3.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  resize: vertical;
}
.ui-input-wrap { position: relative; }
.ui-input-wrap.has-icon .ui-input { padding-left: 2.25rem; }
.ui-input-wrap.has-icon-right .ui-input { padding-right: 2.5rem; }
.ui-input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
  display: flex;
}
.ui-input-icon .nav-icon { width: 1rem; height: 1rem; }
.ui-input-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0;
  display: flex;
}
.ui-input-toggle:hover { color: var(--foreground); }

.ui-select-wrap { position: relative; }
.ui-select {
  appearance: none;
  padding-right: 2rem;
  cursor: pointer;
}
.ui-select-chevron {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--muted-foreground);
  opacity: 0.5;
}
.ui-select-chevron .nav-icon { width: 1rem; height: 1rem; }

.ui-datepicker { position: relative; }
.ui-datepicker-input-wrap { position: relative; display: flex; align-items: center; }
.ui-datepicker-input-wrap .ui-input {
  padding-right: 4.25rem;
  cursor: pointer;
}
.ui-datepicker-clear {
  position: absolute;
  right: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ui-datepicker-clear:hover:not(:disabled) {
  background: color-mix(in oklch, var(--destructive) 12%, transparent);
  color: var(--destructive);
}
.ui-datepicker-clear:disabled { cursor: default; }
.ui-datepicker-icon {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-foreground);
  pointer-events: none;
}
.ui-datepicker-icon .nav-icon { width: 1rem; height: 1rem; }
.ui-field-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.35;
}

.flatpickr-calendar {
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border);
  font-family: inherit;
  background: var(--popover);
  color: var(--popover-foreground);
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}
.flatpickr-day.selected:hover { filter: brightness(0.95); }
.flatpickr-time input { font-family: inherit; }
.flatpickr-months .flatpickr-month { color: var(--primary); }
.dark .flatpickr-calendar {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
}
.dark .flatpickr-day { color: var(--foreground); }
.dark .flatpickr-day.flatpickr-disabled,
.dark .flatpickr-day.prevMonthDay,
.dark .flatpickr-day.nextMonthDay { color: var(--muted-foreground); }

/* legacy alias */
.ui-datepicker-wrap { position: relative; }

/* Checkbox — card-style, checkbox + label on one line */
.ui-checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--input);
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1.25;
  user-select: none;
}
.ui-checkbox:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in oklch, var(--primary) 5%, transparent);
}
.ui-checkbox:has(input:disabled) {
  opacity: 0.6;
  cursor: not-allowed;
}
.ui-checkbox input[type="checkbox"] {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
}
.ui-checkbox-label {
  flex: 1;
  min-width: 0;
}
.ui-checkbox.is-inline {
  padding: 0;
  border: none;
  background: transparent;
}
.ui-checkbox.is-inline:has(input:checked) {
  border-color: transparent;
  background: transparent;
}
input[type="checkbox"][data-grid-inline] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Dropdown menu */
.ui-dropdown { position: relative; display: inline-flex; }
.ui-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.25rem);
  right: 0;
  z-index: 50;
  min-width: 8rem;
  display: none;
  padding: 0.25rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--popover);
  color: var(--popover-foreground);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
.ui-dropdown.open .ui-dropdown-menu { display: block; }
.ui-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.375rem 0.5rem;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: inherit;
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.ui-dropdown-item:hover,
.ui-dropdown-item:focus {
  background: var(--accent);
  outline: none;
}
.ui-dropdown-item.destructive { color: var(--destructive); }
.ui-dropdown-item .nav-icon { width: 1rem; height: 1rem; }
.ui-dropdown-sep {
  height: 1px;
  margin: 0.25rem -0.25rem;
  background: var(--border);
}
.ui-dropdown-label {
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.ui-dropdown-hint {
  border-top: 1px solid var(--border);
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.ui-dropdown-item .check-slot {
  margin-left: auto;
  width: 1rem;
  height: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cards & panels */
.ui-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow:
    0 1px 2px 0 rgb(0 0 0 / 0.04),
    0 4px 12px -2px rgb(15 23 42 / 0.06);
}
.ui-card-body { padding: var(--card-pad); }
.ui-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--section-gap);
  margin-bottom: var(--section-gap);
}
.ui-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

/* Alerts */
.ui-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 40%, var(--card));
  font-size: 0.875rem;
  line-height: 1.5;
}
.ui-alert-icon {
  display: inline-flex;
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.1rem;
  opacity: 0.9;
}
.ui-alert-icon .nav-icon {
  width: 100%;
  height: 100%;
}
.ui-alert-title {
  margin: 0;
  font-weight: 600;
  color: var(--foreground);
}
.ui-alert-desc {
  margin: var(--space-1) 0 0;
  color: var(--muted-foreground);
}
.ui-alert.is-info {
  border-color: color-mix(in oklch, var(--primary) 28%, var(--border));
  background: color-mix(in oklch, var(--primary) 8%, var(--card));
}
.ui-alert.is-info .ui-alert-icon { color: var(--primary); }
.ui-alert.is-success {
  border-color: color-mix(in oklch, var(--success) 35%, var(--border));
  background: color-mix(in oklch, var(--success) 10%, var(--card));
}
.ui-alert.is-success .ui-alert-icon { color: var(--success); }
.ui-alert.is-warning {
  border-color: color-mix(in oklch, var(--warn) 35%, var(--border));
  background: color-mix(in oklch, var(--warn) 10%, var(--card));
}
.ui-alert.is-warning .ui-alert-icon { color: var(--warn); }
.ui-alert.is-danger,
.ui-alert.is-destructive {
  border-color: color-mix(in oklch, var(--destructive) 35%, var(--border));
  background: color-mix(in oklch, var(--destructive) 8%, var(--card));
}
.ui-alert.is-danger .ui-alert-icon,
.ui-alert.is-destructive .ui-alert-icon { color: var(--destructive); }

/* Page shell (Billiar UI Kit rhythm) */
.page-top {
  display: flex;
  flex-direction: column;
  gap: var(--header-gap);
}
.page-top .page-breadcrumb,
.page-top .ui-breadcrumb {
  margin-bottom: 0;
}
.page-top .page-header {
  margin-bottom: 0;
}
.page-breadcrumb {
  margin-bottom: 0;
}
.page-body {
  display: grid;
  gap: var(--page-gap);
  align-content: start;
  padding-top: 0;
}
.page-body > .stat-grid,
.page-body > .data-grid,
.page-body > .crm-grid-shell,
.page-body > .space-y-4,
.page-body > .settings-form,
.page-body > .page-two-col,
.page-body > .ui-card,
.page-body > .ld-page,
.page-body > section {
  margin-bottom: 0;
}
.page-body > .stat-grid {
  gap: var(--section-gap);
}
.ui-kit-page,
.page-body {
  min-width: 0;
}
.ui-kit-page {
  display: grid;
  gap: var(--page-gap);
}
.ui-kit-section {
  display: grid;
  gap: var(--section-gap);
}
.ui-kit-section-title {
  margin: 0 0 var(--space-3);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.ui-kit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.ui-kit-grid {
  display: grid;
  gap: var(--section-gap);
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

/* Page header */
.page-header {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap);
  margin-bottom: var(--page-gap);
}
@media (min-width: 768px) {
  .page-header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--section-gap);
  }
}
.page-header > div:first-child {
  min-width: 0;
  flex: 1;
  text-align: left;
}
.page-header h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
@media (min-width: 768px) {
  .page-header h2 {
    font-size: 1.5rem;
  }
}
.page-header p {
  margin: var(--space-1) 0 0;
  max-width: 40rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted-foreground);
}
.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  flex-shrink: 0;
  padding-top: 0.15rem;
}

/* Stats */
.stat-grid {
  display: grid;
  gap: var(--section-gap);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  margin-bottom: var(--page-gap);
}
.stat-card {
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border);
  background: var(--card);
  padding: var(--card-pad);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04);
}
.stat-label {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  letter-spacing: 0.01em;
}
.stat-value {
  margin-top: var(--space-2);
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.2;
}
.stat-split {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0.45rem 0 0;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  line-height: 1.3;
}
.stat-split-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  flex-shrink: 0;
}
.stat-dot--billiar { background: var(--primary); }
.stat-dot--cafe {
  background: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 88%, var(--foreground));
}
.hourly-chart-aside {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem 1rem;
}
.hourly-peak-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0.65rem;
  border: 1px solid color-mix(in oklch, var(--primary) 22%, var(--border));
  background: color-mix(in oklch, var(--primary) 8%, var(--card));
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.hourly-peak-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
}
.hourly-peak-chip strong {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--foreground);
}
.table-hourly-col.is-peak .table-hourly-label {
  color: var(--primary);
  font-weight: 700;
}
.table-hourly-col.is-peak .table-hourly-bar {
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--primary) 35%, transparent);
}

/* Denyut kas — owner cash pulse (not a ledger) */
.cash-pulse-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--section-gap);
}
.cash-pulse-panel {
  min-width: 0;
  padding: 0.85rem 0.95rem;
  border-radius: 0.85rem;
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 22%, var(--card));
}
.cash-pulse-label {
  margin: 0 0 0.65rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.cash-pulse-mix {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.cash-pulse-mix-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.cash-pulse-mix-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
}
.cash-pulse-mix-amt {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.cash-pulse-mix-track {
  margin-top: 0.3rem;
  height: 0.4rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--muted) 55%, transparent);
  overflow: hidden;
}
.cash-pulse-mix-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  min-width: 2px;
}
.cash-pulse-mix-meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.cash-pulse-tickets {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.cash-pulse-ticket {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  background: var(--card);
}
.cash-pulse-ticket-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.6875rem;
  font-weight: 650;
  color: var(--muted-foreground);
}
.cash-pulse-ticket strong {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cash-pulse-ticket .muted,
.cash-pulse-scale {
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}
.cash-pulse-scale {
  margin: 0.75rem 0 0;
}
.cash-pulse-feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.cash-pulse-feed li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 80%, transparent);
}
.cash-pulse-feed li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.cash-pulse-feed-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.cash-pulse-feed-type {
  font-size: 0.8125rem;
  font-weight: 650;
  color: var(--foreground);
}
.cash-pulse-feed-where {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}
.cash-pulse-feed-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  text-align: right;
  flex-shrink: 0;
}
.cash-pulse-feed-side strong {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.cash-pulse-feed-side time {
  font-size: 0.625rem;
  white-space: nowrap;
}
.cash-pulse-empty {
  margin: 0;
  font-size: 0.8125rem;
}
@media (max-width: 960px) {
  .cash-pulse-grid {
    grid-template-columns: 1fr;
  }
}

/* Table */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  margin-inline: -0.15rem;
  padding-inline: 0.15rem;
}
.ui-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.ui-table th,
.ui-table td {
  text-align: left;
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--border);
}
.ui-table th {
  color: var(--muted-foreground);
  font-weight: 600;
}
.ui-table .text-right { text-align: right; }
.row-actions {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.375rem;
  align-items: center;
  vertical-align: middle;
}
.row-actions > * {
  flex-shrink: 0;
}
.row-actions form,
.row-actions .inline-form {
  display: inline-flex;
  flex-wrap: nowrap;
  margin: 0;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--muted);
  color: var(--muted-foreground);
}
.badge-success {
  background: color-mix(in oklch, var(--success) 20%, transparent);
  color: var(--success);
}
.badge-warn {
  background: color-mix(in oklch, var(--warn) 20%, transparent);
  color: var(--warn);
}
.badge-muted {
  background: var(--muted);
  color: var(--muted-foreground);
}
.badge-destructive {
  background: color-mix(in oklch, var(--destructive) 20%, transparent);
  color: var(--destructive);
}

/* Alerts */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: calc(var(--radius) - 2px);
  margin-bottom: var(--section-gap);
  font-size: 0.875rem;
}
.alert-success {
  background: color-mix(in oklch, var(--success) 15%, transparent);
  color: var(--success);
}
.alert-error {
  background: color-mix(in oklch, var(--destructive) 15%, transparent);
  color: var(--destructive);
}

.muted { color: var(--muted-foreground); }
.text-right { text-align: right; }
.form-grid { display: grid; gap: var(--section-gap); max-width: 40rem; }
.form-grid-wide { max-width: none; }
.stack { display: grid; gap: var(--section-gap); }
.form-actions { margin-top: 0.5rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.link-danger {
  border: 0;
  background: none;
  color: var(--destructive);
  cursor: pointer;
  padding: 0;
  font-size: 0.875rem;
  text-decoration: underline;
}

/* Pagination */
.pagination {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
  font-size: 0.875rem;
}
.pagination a { color: var(--primary); text-decoration: none; }
.pagination a:hover { text-decoration: underline; }

/* Chart */
.chart-bars {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 2px;
  align-items: end;
  height: 140px;
  margin-top: 1rem;
  width: 100%;
}
.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}
.chart-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  min-height: 0;
}
.chart-hit {
  cursor: crosshair;
}
.chart-hit:focus {
  outline: 2px solid color-mix(in oklch, var(--primary) 45%, transparent);
  outline-offset: 2px;
}
.chart-bar {
  width: 100%;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
}
.chart-label {
  font-size: 0.55rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

/* Omzet per jam — Billiar vs Cafe grouped bars */
.hourly-chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}
.hourly-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
}
.hourly-chart-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 0.2rem;
}
.hourly-chart-swatch--billiar { background: var(--primary); }
.hourly-chart-swatch--cafe {
  background: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 88%, var(--foreground));
}
.hourly-chart-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0.85rem 0 1rem;
}
.hourly-chart-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  padding: 0.7rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 28%, var(--card));
}
.hourly-chart-stat-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.hourly-chart-stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
  line-height: 1.2;
}
.hourly-chart-stat-sub {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hourly-chart {
  --hourly-cols: 24;
  display: grid;
  grid-template-columns: repeat(var(--hourly-cols), minmax(0, 1fr));
  gap: 0.2rem;
  align-items: end;
  height: 11.5rem;
  width: 100%;
  padding-top: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.hourly-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  position: relative;
  border-radius: 0.35rem 0.35rem 0 0;
  transition: background 0.12s ease;
}
.hourly-col:hover,
.hourly-col:focus-visible {
  background: color-mix(in oklch, var(--muted) 35%, transparent);
}
.hourly-col.is-peak .hourly-label {
  color: var(--primary);
  font-weight: 700;
}
.hourly-bars {
  flex: 1;
  width: 100%;
  max-width: 1.85rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.12rem;
  min-height: 0;
  padding-bottom: 0.15rem;
}
.hourly-bar {
  flex: 1 1 0;
  min-width: 0;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  transition: height 0.2s ease, filter 0.12s ease;
}
.hourly-bar--billiar { background: var(--primary); }
.hourly-bar--cafe {
  background: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 88%, var(--foreground));
}
.hourly-col:hover .hourly-bar,
.hourly-col:focus-visible .hourly-bar { filter: brightness(1.06); }
.hourly-label {
  font-size: 0.625rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
  line-height: 1;
  padding: 0.3rem 0 0.1rem;
}
@media (max-width: 1100px) {
  .hourly-chart-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .hourly-chart-summary { grid-template-columns: 1fr; }
  .hourly-chart { height: 10rem; gap: 0.12rem; }
  .hourly-bars { max-width: 1.35rem; gap: 0.08rem; }
  .hourly-label { font-size: 0.55rem; }
}

/* Floating chart tooltip portal */
.chart-tip-portal {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10050;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.chart-tip-portal.is-visible {
  opacity: 1;
}
.chart-tip-portal[hidden] {
  display: none !important;
}
.chart-tip-card {
  border-radius: calc(var(--radius) - 1px);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  padding: 0.55rem 0.7rem;
  box-shadow:
    0 4px 6px -1px rgb(0 0 0 / 0.08),
    0 12px 28px -6px rgb(0 0 0 / 0.16);
  min-width: 9.5rem;
  max-width: 15rem;
}
html.dark .chart-tip-card {
  box-shadow:
    0 4px 6px -1px rgb(0 0 0 / 0.35),
    0 12px 28px -6px rgb(0 0 0 / 0.5);
}
.chart-tip-card--active {
  border-color: color-mix(in oklch, var(--success) 45%, var(--border));
}
.chart-tip-title {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}
.chart-tip-card--active .chart-tip-title {
  color: color-mix(in oklch, var(--success) 75%, var(--foreground));
}
.chart-tip-meta {
  margin: 0;
  display: grid;
  gap: 0.2rem;
}
.chart-tip-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.35;
}
.chart-tip-row dt {
  margin: 0;
  color: var(--muted-foreground);
  font-weight: 500;
  white-space: nowrap;
}
.chart-tip-row dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.dashboard-chart-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--stack-gap) var(--space-6);
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

/* Dashboard day navigator — full-width, centered date, status right */
.dashboard-page-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--section-gap);
  margin-bottom: var(--page-gap);
}
.dashboard-page-intro {
  min-width: 0;
  width: 100%;
}
.dashboard-kicker {
  margin: 0 0 var(--space-1);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.dashboard-page-intro h2 {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.dashboard-ops-window {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin: var(--space-2) 0 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--muted-foreground);
}
.dashboard-ops-range {
  font-variant-numeric: tabular-nums;
  color: color-mix(in oklch, var(--foreground) 72%, var(--muted-foreground));
  font-weight: 500;
}
.dashboard-ops-sep {
  display: inline-block;
  width: 0.25rem;
  height: 0.25rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--muted-foreground) 55%, transparent);
}
.dashboard-ops-data {
  font-variant-numeric: tabular-nums;
}

.dash-day-nav {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto 2.5rem;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  width: 100%;
  padding: var(--space-2);
  border-radius: 1rem;
  border: 1px solid color-mix(in oklch, var(--border) 90%, transparent);
  background:
    linear-gradient(
      180deg,
      color-mix(in oklch, var(--card) 92%, transparent),
      color-mix(in oklch, var(--muted) 28%, var(--card))
    );
  box-shadow:
    0 1px 0 color-mix(in oklch, var(--foreground) 4%, transparent),
    inset 0 1px 0 color-mix(in oklch, var(--foreground) 3%, transparent);
}
.dash-day-nav.is-live {
  border-color: color-mix(in oklch, var(--success) 22%, var(--border));
}
.dash-day-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 0.8rem;
  background: transparent;
  color: var(--muted-foreground);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.dash-day-nav-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  stroke-width: 2.25;
}
.dash-day-nav-btn:hover:not([disabled]) {
  background: color-mix(in oklch, var(--muted) 70%, transparent);
  color: var(--foreground);
}
.dash-day-nav-btn:focus-visible {
  outline: 2px solid color-mix(in oklch, var(--primary) 55%, transparent);
  outline-offset: 1px;
}
.dash-day-nav-btn[disabled] {
  opacity: 0.28;
  cursor: not-allowed;
}
.dash-day-nav-body {
  min-width: 0;
  padding: 0.35rem 0.85rem;
  text-align: center;
}
.dash-day-nav-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.55rem 0.75rem;
  margin: 0;
  max-width: 100%;
}
.dash-day-nav-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--foreground);
}
.dash-day-nav-divider {
  display: inline-block;
  width: 1px;
  height: 0.95em;
  align-self: center;
  background: color-mix(in oklch, var(--border) 88%, var(--muted-foreground));
  opacity: 0.9;
}
.dash-day-nav-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.35rem;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--muted-foreground);
}
.dash-day-nav-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: color-mix(in oklch, var(--foreground) 78%, var(--muted-foreground));
}
.dash-day-nav-sep {
  margin: 0 0.05rem;
  opacity: 0.65;
}
.dash-day-nav-aside {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.15rem;
}
.dash-day-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.25;
  white-space: nowrap;
}
.dash-day-pill--live {
  color: color-mix(in oklch, var(--success) 88%, var(--foreground));
  background: color-mix(in oklch, var(--success) 14%, transparent);
  border: 1px solid color-mix(in oklch, var(--success) 26%, transparent);
}
.dash-day-pill-dot {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0 color-mix(in oklch, currentColor 35%, transparent);
  animation: dash-live-pulse 2s ease-out infinite;
}
@keyframes dash-live-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in oklch, currentColor 35%, transparent); }
  70% { box-shadow: 0 0 0 0.35rem transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.dash-day-pill--archive {
  color: var(--muted-foreground);
  background: color-mix(in oklch, var(--muted) 55%, transparent);
  border: 1px solid color-mix(in oklch, var(--border) 90%, transparent);
}
.dash-day-today-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--primary);
  text-decoration: none;
}
.dash-day-today-link .nav-icon {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
  opacity: 0.9;
}
.dash-day-today-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.dash-day-today-link:hover .nav-icon {
  opacity: 1;
}
.dash-day-today-link:focus-visible {
  outline: 2px solid color-mix(in oklch, var(--primary) 55%, transparent);
  outline-offset: 2px;
  border-radius: 0.25rem;
}
@media (max-width: 639px) {
  .dashboard-page-intro h2 {
    font-size: 1.375rem;
  }
  .dash-day-nav {
    grid-template-columns: 2.25rem minmax(0, 1fr) 2.25rem;
    grid-template-areas:
      "prev body next"
      "aside aside aside";
    row-gap: 0.35rem;
  }
  .dash-day-nav-btn:first-child { grid-area: prev; }
  .dash-day-nav-body { grid-area: body; padding-inline: 0.25rem; }
  .dash-day-nav-aside {
    grid-area: aside;
    justify-content: center;
    padding: 0 0 0.15rem;
  }
  .dash-day-nav-btn:last-child,
  .dash-day-nav > button.dash-day-nav-btn { grid-area: next; }
  .dash-day-nav-line {
    gap: 0.35rem 0.55rem;
  }
  .dash-day-nav-title {
    font-size: 0.9375rem;
  }
  .dash-day-nav-meta {
    font-size: 0.75rem;
  }
  .dash-day-nav-divider {
    display: none;
  }
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chart-legend-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 2px;
}

.chart-legend-swatch--revenue {
  background: var(--primary);
}

.chart-legend-swatch--count,
.chart-legend-swatch--sessions {
  background: color-mix(in oklch, var(--warning, #d97706) 85%, var(--foreground));
}

.chart-legend-swatch--hours {
  background: color-mix(in oklch, var(--success) 85%, var(--foreground));
}

.table-chart-bars {
  display: grid;
  grid-template-columns: repeat(var(--table-cols, 12), minmax(0, 1fr));
  gap: clamp(1px, calc(24px / var(--table-cols, 12)), 4px);
  align-items: end;
  height: 160px;
  margin-top: 1rem;
  width: 100%;
}

.table-chart-col {
  min-width: 0;
}

.table-chart-trio,
.table-chart-duo {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
  height: 120px;
}

.table-chart-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-height: 2px;
}

.table-chart-bar--revenue {
  background: var(--primary);
}

.table-chart-bar--hours {
  background: color-mix(in oklch, var(--success) 85%, var(--foreground));
}

.table-chart-bar--count,
.table-chart-bar--sessions {
  background: color-mix(in oklch, var(--warning, #d97706) 85%, var(--foreground));
}

.table-chart-bars .chart-label {
  font-size: clamp(0.45rem, calc(9rem / var(--table-cols, 12)), 0.55rem);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-empty-chart {
  margin: 1.5rem 0 0.5rem;
  text-align: center;
  font-size: 0.875rem;
}

/* Table session analytics panel */
.table-analytics-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--stack-gap);
  margin-bottom: var(--page-gap);
}

.table-analytics-kpi {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 22%, transparent);
  min-width: 0;
}

.table-analytics-kpi-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.table-analytics-kpi-value {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}

.table-analytics-kpi-value .muted {
  font-size: 0.85em;
  font-weight: 500;
}

.table-analytics-kpi-sub {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.table-analytics-panels {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: var(--section-gap);
  margin-bottom: var(--page-gap);
}

.table-analytics-panel {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: var(--card-pad);
  background: color-mix(in oklch, var(--card) 92%, var(--muted));
  min-width: 0;
}

.table-analytics-panel-head h4 {
  margin: 0 0 0.15rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.table-analytics-panel-head p {
  margin: 0;
  font-size: 0.75rem;
}

.table-analytics-panel-head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.table-analytics-panel-head:not(.table-analytics-panel-head--split) p {
  margin-bottom: 0.75rem;
}

/* Chart pan — professional horizontal navigator (no native scrollbar) */
.chart-pan {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.chart-pan-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.2rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--card) 88%, var(--muted));
  box-shadow: 0 1px 0 color-mix(in oklch, var(--foreground) 4%, transparent);
}
.chart-pan-controls[hidden] {
  display: none !important;
}
.chart-pan-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}
.chart-pan-btn .nav-icon {
  width: 1rem;
  height: 1rem;
}
.chart-pan-btn:hover:not(:disabled) {
  background: color-mix(in oklch, var(--muted) 70%, transparent);
  color: var(--foreground);
}
.chart-pan-btn:focus-visible {
  outline: 2px solid color-mix(in oklch, var(--ring) 45%, transparent);
  outline-offset: 1px;
}
.chart-pan-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.chart-pan-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 7.5rem;
  max-width: 11rem;
  padding: 0 0.35rem;
  text-align: center;
  line-height: 1.2;
}
.chart-pan-range {
  font-size: 0.75rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
  white-space: nowrap;
}
.chart-pan-count {
  margin-top: 0.1rem;
  font-size: 0.625rem;
  white-space: nowrap;
}
.chart-pan-viewport {
  position: relative;
  min-width: 0;
}
.chart-pan-fade {
  position: absolute;
  top: 0;
  bottom: 0.15rem;
  width: 1.75rem;
  z-index: 2;
  pointer-events: none;
}
.chart-pan-fade[hidden] {
  display: none !important;
}
.chart-pan-fade--start {
  left: 0;
  background: linear-gradient(
    90deg,
    color-mix(in oklch, var(--card) 92%, var(--muted)),
    transparent
  );
}
.chart-pan-fade--end {
  right: 0;
  background: linear-gradient(
    270deg,
    color-mix(in oklch, var(--card) 92%, var(--muted)),
    transparent
  );
}
.chart-pan-track,
.table-hourly-chart.chart-pan-track {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  height: 10rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.15rem 0.1rem 0.35rem;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.chart-pan-track::-webkit-scrollbar,
.table-hourly-chart.chart-pan-track::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.chart-pan-track:focus-visible {
  outline: 2px solid color-mix(in oklch, var(--ring) 40%, transparent);
  outline-offset: 2px;
  border-radius: 0.35rem;
}
.table-hourly-col {
  flex: 0 0 auto;
  width: 3.35rem;
  min-width: 3.35rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  height: 100%;
  position: relative;
  scroll-snap-align: start;
}
.table-hourly-value {
  font-size: 0.6875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
  min-height: 0.95rem;
  line-height: 1;
}
.table-hourly-bar-wrap {
  flex: 1;
  width: 100%;
  max-width: 1.65rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}
.table-hourly-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: color-mix(in oklch, var(--primary) 75%, var(--foreground));
  transition: height 0.2s ease;
}
.table-hourly-col:hover .table-hourly-bar,
.table-hourly-col:focus-visible .table-hourly-bar {
  filter: brightness(1.08);
}
.table-hourly-label {
  font-size: 0.625rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
  white-space: nowrap;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-align: center;
}
.chart-pan-rail {
  position: relative;
  height: 0.35rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--muted) 70%, transparent);
  cursor: pointer;
}
.chart-pan-rail[hidden] {
  display: none !important;
}
.chart-pan-thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  min-width: 2rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in oklch, var(--primary) 55%, var(--muted-foreground));
  cursor: grab;
  transition: background 0.12s ease;
}
.chart-pan-thumb:hover,
.chart-pan-thumb:active {
  background: var(--primary);
}
.chart-pan-thumb:active {
  cursor: grabbing;
}
.chart-pan-thumb:focus-visible {
  outline: 2px solid color-mix(in oklch, var(--ring) 45%, transparent);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .table-analytics-panel-head--split {
    flex-direction: column;
    align-items: stretch;
  }
  .chart-pan-controls {
    width: 100%;
    justify-content: space-between;
  }
  .chart-pan-info {
    min-width: 0;
    flex: 1;
    max-width: none;
  }
  .table-hourly-col {
    width: 3rem;
    min-width: 3rem;
  }
}

.table-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.table-timeline-axis {
  display: flex;
  justify-content: space-between;
  margin-left: 2.75rem;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  padding-bottom: 0.25rem;
  border-bottom: 1px dashed var(--border);
}

.table-timeline-row {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
}

.table-timeline-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-align: right;
}

.table-timeline-track {
  position: relative;
  height: 1.125rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--muted) 35%, transparent);
  overflow: hidden;
}

.table-timeline-block {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 999px;
  min-width: 3px;
  cursor: crosshair;
}

.table-timeline-block--completed {
  background: color-mix(in oklch, var(--primary) 88%, white);
}

.table-timeline-block--active {
  background: color-mix(in oklch, var(--success) 80%, white);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--success) 40%, transparent);
  animation: table-timeline-pulse 2s ease-in-out infinite;
}

@keyframes table-timeline-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.72; }
}

.table-hourly-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  height: 10rem;
  min-width: 0;
}

.table-analytics-table-wrap {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 1rem;
  overflow-x: auto;
}
.table-analytics-table-wrap.perf-board {
  overflow: hidden;
}
.perf-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.perf-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1.2fr) minmax(6.5rem, 0.7fr) minmax(10rem, 1.2fr);
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-radius: 0.85rem;
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--card) 94%, var(--muted));
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.perf-row:hover,
.perf-row:focus-visible {
  background: color-mix(in oklch, var(--primary) 6%, var(--card));
  border-color: color-mix(in oklch, var(--primary) 22%, var(--border));
}
.perf-row.is-top {
  background:
    linear-gradient(
      90deg,
      color-mix(in oklch, var(--primary) 8%, transparent),
      color-mix(in oklch, var(--card) 94%, var(--muted))
    );
}
.perf-row.is-live {
  box-shadow: inset 3px 0 0 color-mix(in oklch, var(--success) 75%, transparent);
}
.perf-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
  background: color-mix(in oklch, var(--muted) 55%, transparent);
}
.perf-row.is-top .perf-rank {
  color: var(--primary-foreground);
  background: var(--primary);
}
.perf-identity { min-width: 0; }
.perf-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.perf-name {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--foreground);
}
.perf-meta {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.perf-omzet {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  text-align: right;
}
.perf-omzet strong {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}
.perf-omzet span {
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
}
.perf-bars {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.perf-bar-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) 2.75rem;
  gap: 0.4rem;
  align-items: center;
}
.perf-bar-label {
  font-size: 0.625rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.perf-bar-track {
  height: 0.4rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--muted) 55%, transparent);
  overflow: hidden;
}
.perf-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  min-width: 2px;
}
.perf-bar-fill--share { background: var(--primary); }
.perf-bar-fill--util {
  background: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 85%, var(--foreground));
}
.perf-bar-pct {
  font-size: 0.6875rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
  text-align: right;
}
@media (max-width: 900px) {
  .perf-row {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    grid-template-areas:
      "rank identity omzet"
      "bars bars bars";
  }
  .perf-rank { grid-area: rank; }
  .perf-identity { grid-area: identity; }
  .perf-omzet { grid-area: omzet; }
  .perf-bars { grid-area: bars; }
}

.table-analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.table-analytics-table th,
.table-analytics-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table-analytics-table th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-align: left;
  white-space: nowrap;
}

.table-analytics-table tbody tr:last-child td {
  border-bottom: 0;
}

.table-analytics-row.chart-hit {
  cursor: default;
  transition: background 0.12s ease;
}

.table-analytics-row.chart-hit:hover,
.table-analytics-row.chart-hit:focus-within {
  background: color-mix(in oklch, var(--primary) 7%, transparent);
}

.table-analytics-table-name {
  font-weight: 600;
  margin-right: 0.35rem;
}

.table-analytics-live {
  font-size: 0.625rem;
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
}

.table-analytics-share {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 7.5rem;
}

.table-analytics-share-bar {
  flex: 1;
  height: 0.4rem;
  border-radius: 999px;
  background: color-mix(in oklch, var(--muted) 40%, transparent);
  overflow: hidden;
}

.table-analytics-share-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  min-width: 2px;
  pointer-events: none;
}

.table-analytics-share--util .table-analytics-share-bar span {
  background: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 85%, var(--foreground));
}

.table-analytics-share-pct {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  min-width: 2.5rem;
  text-align: right;
}

.table-analytics-row.is-top {
  background: color-mix(in oklch, var(--primary) 5%, transparent);
}

.table-analytics-row.is-live td:first-child {
  box-shadow: inset 3px 0 0 color-mix(in oklch, var(--success) 75%, transparent);
}

@media (max-width: 960px) {
  .table-analytics-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .table-analytics-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .table-analytics-kpis {
    grid-template-columns: 1fr;
  }
}

/* Login page */
.login-page {
  position: relative;
  display: flex;
  min-height: 100vh;
  background: var(--background);
}
.login-brand {
  position: relative;
  display: none;
  width: 42%;
  flex-shrink: 0;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 3rem 2.5rem;
}
@media (min-width: 1024px) {
  .login-brand { display: flex; }
}
.login-brand-glow {
  pointer-events: none;
  position: absolute;
  right: -5rem;
  top: 33%;
  width: 16rem;
  height: 16rem;
  border-radius: 9999px;
  background: rgb(255 255 255 / 0.08);
  filter: blur(48px);
}
.login-brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}
.login-brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  background: rgb(255 255 255 / 0.15);
}
.login-brand-icon .nav-icon { width: 1.25rem; height: 1.25rem; }
.login-brand-title { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.025em; }
.login-brand-sub { font-size: 0.75rem; opacity: 0.7; margin-top: 0.125rem; }
.login-brand-content { position: relative; max-width: 24rem; }
.login-brand-content h1 {
  font-size: 1.875rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.025em;
  margin: 0;
}
.login-brand-content p {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  line-height: 1.6;
  opacity: 0.75;
}
.login-features {
  list-style: none;
  padding: 0;
  margin: 2.5rem 0 0;
  display: grid;
  gap: 0.75rem;
}
.login-features li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.login-features .nav-icon { opacity: 0.8; }
.login-brand-footer {
  position: relative;
  font-size: 0.75rem;
  opacity: 0.5;
}
.login-main {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
}
.login-main-glow {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top right, oklch(0.511 0.262 276.966 / 0.06), transparent 55%);
}
html.dark .login-main-glow {
  background: radial-gradient(ellipse at top right, oklch(0.511 0.262 276.966 / 0.12), transparent 55%);
}
.login-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1.5rem 1.5rem 0;
}
@media (min-width: 640px) {
  .login-header { padding: 1.5rem 2.5rem 0; }
}
.login-body {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
}
@media (min-width: 640px) {
  .login-body { padding: 2.5rem; }
}
.login-form-wrap { width: 100%; max-width: 26.25rem; }
.login-mobile-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}
@media (min-width: 1024px) {
  .login-mobile-brand { display: none; }
}
.login-mobile-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: color-mix(in oklch, var(--primary) 10%, transparent);
  color: var(--primary);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--primary) 20%, transparent);
}
.login-intro { margin-bottom: 2rem; }
.login-intro h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.login-intro p {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted-foreground);
}
.login-card {
  display: grid;
  gap: 1.25rem;
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
@media (min-width: 640px) {
  .login-card { padding: 2rem; }
}
.login-footer-note {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

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

/* Drawer sidebar: tablet and below only (≤1023) */
@media (max-width: 1023px) {
  body.sidebar-open { overflow: hidden; }

  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    width: min(18rem, 88vw);
    max-height: 100dvh;
    padding-left: env(safe-area-inset-left, 0px);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: none;
  }
  .app-sidebar-header {
    padding-top: max(0px, env(safe-area-inset-top, 0px));
  }
  .app-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgb(0 0 0 / 0.18);
  }

  .app-content {
    padding: var(--content-pad-top) var(--page-pad-x) var(--page-pad-y);
    padding-bottom: max(var(--page-pad-y), env(safe-area-inset-bottom, 0px));
  }
}

/* Phone / small tablet content densify (≤767) */
@media (max-width: 767px) {
  .app-topbar {
    padding-left: var(--page-pad-x);
    padding-right: var(--page-pad-x);
  }
  .app-topbar-user { display: none; }
  .user-menu-label { display: none; }
  .user-menu-chevron { display: none; }
  .user-menu-trigger {
    padding: 0;
    width: 2.5rem;
    height: 2.5rem;
    justify-content: center;
    border-radius: 9999px;
  }
  .app-content {
    padding: var(--content-pad-top) var(--page-pad-x) var(--page-pad-y);
    padding-bottom: max(var(--page-pad-y), env(safe-area-inset-bottom, 0px));
  }

  .page-header h2 { font-size: 1.25rem; }
  .page-header-actions {
    width: 100%;
  }
  .page-header-actions > .ui-btn,
  .page-header > .ui-btn {
    flex: 1 1 auto;
    min-height: 2.75rem;
    justify-content: center;
  }

  .ui-card-header {
    flex-direction: column;
    align-items: stretch;
  }
  .ui-card-header .ui-btn {
    width: 100%;
    justify-content: center;
    min-height: 2.75rem;
  }

  .data-grid-table {
    font-size: 0.8125rem;
  }

  .row-actions {
    gap: var(--space-1);
  }

  .filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    align-content: start;
    gap: var(--stack-gap);
    padding: var(--card-pad);
  }
  .filter-bar .ui-field,
  .filter-bar .filter-select {
    min-width: 0;
    width: 100%;
    flex: none;
  }
  .filter-bar > .ui-btn,
  .filter-bar > a.ui-btn {
    width: 100%;
    min-height: 2.75rem;
    justify-content: center;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--stack-gap);
  }
  .stat-value { font-size: 1.25rem; }

  .chart-bars {
    gap: var(--space-1);
    overflow-x: auto;
    padding-bottom: var(--space-1);
  }
  .chart-label { font-size: 0.625rem; }

  .ui-dialog-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .ui-dialog {
    max-height: min(94dvh, 100%);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
  .ui-dialog-footer {
    padding-bottom: max(var(--space-4), env(safe-area-inset-bottom, 0px));
  }
  .ui-dialog-footer-actions {
    width: 100%;
  }
  .ui-dialog-footer-actions .ui-btn {
    flex: 1 1 0;
    min-height: 2.75rem;
    justify-content: center;
  }
  .ui-dialog-footer .ui-btn-primary {
    min-width: 0;
  }

  .settings-actions .ui-btn {
    width: 100%;
    justify-content: center;
    min-height: 2.75rem;
  }

  .settings-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .ui-dropdown-menu {
    right: 0;
    left: auto;
  }

  /* Touch targets for chrome only — not dense table row actions */
  .app-topbar .ui-btn-icon,
  .app-sidebar-toggle {
    min-width: 2.75rem;
    min-height: 2.75rem;
  }
}

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

/* —— DataGrid (chrome in ui-kit-grid.css; keep loading + embedded hooks) —— */
.data-grid-shell.is-loading,
.data-grid.is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}
.data-grid.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    110deg,
    transparent 30%,
    color-mix(in srgb, var(--card) 55%, transparent) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: grid-loading-shimmer 1.1s linear infinite;
  pointer-events: none;
}
[data-ajax-page].is-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.55;
  transition: opacity 0.15s ease;
  min-height: 8rem;
}
@keyframes grid-loading-shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* —— Alpine CRM data-grid (partials/data-grid.html) —— */
.crm-grid-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 28rem;
  width: 100%;
  min-width: 0;
}
.crm-grid-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
  pointer-events: none;
  z-index: 1;
}
.crm-grid-search-icon svg {
  width: 1rem;
  height: 1rem;
}
.crm-grid-search-input {
  box-sizing: border-box;
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem 0 2.5rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--input);
  background: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  line-height: 1.25;
  box-shadow: none;
}
.crm-grid-search-input::placeholder {
  color: var(--muted-foreground);
}
.crm-grid-search-input:focus {
  outline: none;
  border-color: color-mix(in oklab, var(--ring) 50%, var(--input));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 22%, transparent);
}
.crm-grid-search-input.is-filtered {
  padding-right: 2.25rem;
}
.crm-grid-search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.crm-grid-search-clear:hover {
  background: var(--muted);
  color: var(--foreground);
}
.crm-grid-search-clear svg {
  width: 0.875rem;
  height: 0.875rem;
}
.crm-grid-search-input::-webkit-search-cancel-button,
.crm-grid-search-input::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.crm-grid-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  min-width: 0;
  max-width: 100%;
}
.crm-grid-card {
  min-width: 0;
}
.crm-grid-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
}
.crm-grid-table--sticky {
  border-collapse: separate;
  border-spacing: 0;
}
.crm-grid-sticky {
  position: sticky;
  z-index: 2;
}
.crm-grid-thead .crm-grid-sticky {
  z-index: 5;
  background: color-mix(in oklab, var(--muted) 50%, var(--card));
}
.crm-grid-sticky-left-0 {
  left: 0;
  width: 8rem;
  min-width: 8rem;
  max-width: 8rem;
}
.crm-grid-sticky-left-1 {
  left: 8rem;
  width: 12rem;
  min-width: 12rem;
  max-width: 12rem;
}
.crm-grid-sticky-left-2 {
  left: 20rem;
  width: 10rem;
  min-width: 10rem;
  max-width: 10rem;
}
.crm-grid-sticky-right {
  right: 0;
  min-width: 9rem;
  z-index: 3;
}
.crm-grid-thead .crm-grid-sticky-right {
  z-index: 6;
}
.crm-grid-table--sticky tbody tr .crm-grid-sticky {
  background: var(--card);
}
.crm-grid-table--sticky tbody tr:nth-child(even) .crm-grid-sticky {
  background: color-mix(in oklab, var(--muted) 15%, var(--card));
}
.crm-grid-table--sticky tbody tr:hover .crm-grid-sticky {
  background: color-mix(in oklab, var(--muted) 35%, var(--card));
}
.crm-grid-sticky-left-edge::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 6px;
  transform: translateX(100%);
  background: linear-gradient(90deg, rgb(15 23 42 / 0.08), transparent);
  pointer-events: none;
}
.crm-grid-sticky-right-edge::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 6px;
  transform: translateX(-100%);
  background: linear-gradient(270deg, rgb(15 23 42 / 0.08), transparent);
  pointer-events: none;
}
.crm-grid-sticky-left-edge,
.crm-grid-sticky-right-edge {
  position: sticky;
}
.crm-grid-thead {
  display: table-header-group;
}
.crm-grid-thead tr {
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--muted) 50%, transparent);
}
.crm-grid-th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  vertical-align: middle;
  white-space: nowrap;
}
.crm-grid-th-index {
  width: 3rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  text-align: center;
}
.crm-grid-th-actions {
  text-align: right;
}
.crm-grid-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  min-height: 1.25rem;
  padding: 0.15rem 0.25rem;
  margin: -0.15rem -0.25rem;
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  line-height: 1.2;
  cursor: pointer;
  border-radius: 0.35rem;
  transition: color 0.12s ease, background 0.12s ease;
}
.crm-grid-sort-label {
  color: inherit;
}
.crm-grid-sort-btn:hover,
.crm-grid-sort-btn.is-active {
  color: var(--foreground);
}
.crm-grid-sort-btn:hover {
  background: color-mix(in oklab, var(--muted) 55%, transparent);
}
.crm-grid-sort-btn--center {
  justify-content: center;
  margin-inline: auto;
}
.crm-grid-sort-icon {
  display: inline-flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 0.75rem;
  line-height: 0;
  gap: 0;
  opacity: 0.45;
  transition: opacity 0.12s ease;
}
.crm-grid-sort-btn:hover .crm-grid-sort-icon,
.crm-grid-sort-btn.is-active .crm-grid-sort-icon {
  opacity: 0.9;
}
.crm-grid-sort-up,
.crm-grid-sort-down {
  width: 0.75rem;
  height: 0.45rem;
  stroke-width: 2.25;
}
.crm-grid-sort-up.is-on,
.crm-grid-sort-down.is-on {
  color: var(--primary);
  opacity: 1;
}
.crm-grid-th .crm-grid-sort-btn {
  pointer-events: auto;
  position: relative;
  z-index: 1;
}
.crm-grid-mobile-count {
  font-size: 0.6875rem;
  line-height: 1.35;
}
.crm-grid-page-size select {
  appearance: auto;
}
.data-grid-embedded,
.data-grid.data-grid-embedded {
  border: none;
  box-shadow: none;
  background: transparent;
  border-radius: 0;
}
.data-grid-embedded .data-grid-body { padding: 0; }
/* legacy header/search rules removed — toolbar lives in ui-kit-grid.css */
.ui-table tbody tr[hidden] { display: none; }
/* Hover for non-grid tables only; grid zebra/hover is in ui-kit-grid.css */
.app-content table:not(.data-grid-table) tbody tr:hover td {
  background: color-mix(in oklch, var(--accent) 50%, transparent);
}
.text-right, .ui-table .text-right { text-align: right; }

/* —— Dialog (professional create/edit sheet) —— */
body.dialog-open { overflow: hidden; }
.ui-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgb(15 23 42 / 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: ui-dialog-fade 0.18s ease-out;
}
@media (min-width: 640px) {
  .ui-dialog-backdrop {
    align-items: center;
    padding: 1.25rem;
  }
}
.ui-dialog-backdrop[hidden] { display: none !important; }
@keyframes ui-dialog-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes ui-dialog-rise {
  from { opacity: 0; transform: translateY(1rem) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.ui-dialog {
  width: 100%;
  max-width: 32rem;
  max-height: min(92dvh, 40rem);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* never scroll the whole dialog */
  border-radius: 1.1rem 1.1rem 0 0;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow:
    0 0 0 1px color-mix(in oklch, var(--primary) 12%, transparent),
    0 28px 60px -20px rgb(0 0 0 / 0.45);
  animation: ui-dialog-rise 0.22s ease-out;
}
@media (min-width: 640px) {
  .ui-dialog { border-radius: 1.1rem; }
}
.ui-dialog-wide { max-width: 42rem; }
.ui-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--stack-gap);
  flex-shrink: 0;
  padding: var(--space-5) var(--card-pad) var(--space-4);
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(180deg, color-mix(in oklch, var(--primary) 7%, transparent), transparent 70%);
}
.ui-dialog-heading { min-width: 0; flex: 1; }
.ui-dialog-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.ui-dialog-desc {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--muted-foreground);
}
.ui-dialog-desc[hidden] { display: none !important; }
.ui-dialog-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0; /* allow child body to scroll */
  overflow: hidden;
  padding: 0;
}
.ui-dialog-form[hidden] {
  display: none !important;
}
.ui-dialog-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-5) var(--card-pad) var(--space-4);
  display: grid;
  gap: var(--section-gap);
  align-content: start;
}
.ui-dialog-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--stack-gap);
  flex-shrink: 0;
  margin-top: 0;
  padding: var(--space-4) var(--card-pad) var(--space-5);
  border-top: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 35%, transparent);
}
.ui-dialog-footer-actions {
  display: flex;
  gap: var(--inline-gap);
}
.ui-dialog-footer .ui-btn-primary {
  min-width: 7.5rem;
}
.ui-readonly {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in oklch, var(--muted) 50%, transparent);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

/* —— Form stack —— */
.form-stack { display: grid; gap: var(--space-5); }
.form-card { margin-bottom: var(--page-gap); }
.form-section-title {
  margin: 0 0 var(--space-4);
  font-size: 1rem;
  font-weight: 600;
}
.form-section-desc {
  margin: calc(var(--space-2) * -1) 0 var(--space-4);
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.form-row-2 {
  display: grid;
  gap: var(--section-gap);
  grid-template-columns: 1fr 1fr;
  align-items: start;
}
@media (max-width: 639px) { .form-row-2 { grid-template-columns: 1fr; } }
.ui-choice-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.booking-deposit-section {
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--border);
}
.booking-deposit-section [data-booking-payment-field] {
  transition: opacity 0.15s;
}
.booking-deposit-section.is-collapsed [data-booking-payment-field] {
  display: none;
}
.ui-radio-group { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.ui-radio-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--input);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  color: var(--muted-foreground);
}
.ui-radio-item.is-checked,
.ui-radio-item:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in oklch, var(--primary) 5%, transparent);
  color: var(--foreground);
  font-weight: 500;
}
.ui-radio-item input { accent-color: var(--primary); }
/* —— Upload —— */
.ui-upload { margin: 0.5rem 0; }
.ui-upload-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.ui-upload-step {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}
.ui-upload-label { font-size: 0.875rem; font-weight: 600; }
.ui-upload-hint { font-size: 0.8rem; color: var(--muted-foreground); margin: 0 0 0.75rem; }
.ui-upload-status {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
}
.ui-upload-status[data-tone="ok"] {
  background: color-mix(in oklch, var(--success) 15%, transparent);
  color: var(--success);
}
.ui-upload-dropzone {
  border: 1.5px dashed var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 1rem;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.ui-upload-dropzone.dragover {
  border-color: var(--primary);
  background: color-mix(in oklch, var(--primary) 8%, transparent);
}
.ui-upload-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  color: var(--muted-foreground);
}
.ui-upload-pick strong { color: var(--foreground); font-size: 0.875rem; }
.ui-upload-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: color-mix(in oklch, var(--primary) 10%, transparent);
  margin-bottom: 0.25rem;
}
.ui-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}
.ui-upload-preview {
  margin-bottom: 0.75rem;
  text-align: center;
}
.ui-upload-preview img {
  max-height: 12rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.5rem;
}
.ui-upload-preview.hidden, .hidden { display: none !important; }

/* —— Sweeter sidebar —— */
html.dark .app-sidebar {
  background: color-mix(in oklch, var(--card) 88%, var(--background));
}
.app-sidebar-brand {
  background: color-mix(in oklch, var(--primary) 6%, transparent);
  letter-spacing: -0.02em;
}
.nav-link.active {
  box-shadow: inset 3px 0 0 var(--primary);
  border-radius: 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0;
}

/* Legacy aliases (templates migrating to ui-* classes) */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--primary);
  color: var(--primary-foreground);
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  color: var(--foreground);
}
.btn-ghost:hover { background: var(--accent); }
.panel {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.panel h3 { margin-top: 0; margin-bottom: 1rem; font-size: 1rem; font-weight: 600; }
.app-content table.crm-grid-table th,
.app-content table.crm-grid-table td {
  border-bottom: 1px solid var(--border);
}
.app-content table.crm-grid-table th {
  color: var(--muted-foreground);
  font-weight: 650;
}
.app-content table:not(.ui-table):not(.crm-grid-table) {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.app-content table:not(.ui-table):not(.crm-grid-table) th,
.app-content table:not(.ui-table):not(.crm-grid-table) td {
  text-align: left;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.app-content table:not(.ui-table):not(.crm-grid-table) th {
  color: var(--muted-foreground);
  font-weight: 600;
}
.app-content label:not(.ui-checkbox):not(.ui-radio-item):not(.ui-radio):not(.ui-label):not(.ui-field-label) {
  display: grid;
  gap: 0.35rem;
  font-size: 0.875rem;
}
.app-content input:not(.ui-input):not(.crm-grid-search-input):not(.data-grid-search):not([type="checkbox"]):not([type="radio"]),
.app-content select:not(.ui-select),
.app-content textarea:not(.ui-textarea) {
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--input);
  background: transparent;
  color: var(--foreground);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}
.app-content input:focus,
.app-content select:focus,
.app-content textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring);
}

.ui-readonly { margin: 0; font-size: 0.9375rem; font-weight: 500; }
.ui-link { color: var(--primary); font-size: 0.875rem; text-decoration: none; }
.ui-link:hover { text-decoration: underline; }
.ui-btn-sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; min-height: 2rem; }
.page-note { margin: -0.5rem 0 1rem; font-size: 0.875rem; }
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  align-content: flex-start;
  gap: var(--stack-gap);
  margin-bottom: var(--page-gap);
  padding: var(--card-pad);
  border-radius: calc(var(--radius) + 2px);
  border: 1px solid var(--border);
  background: var(--card);
}
.filter-bar > * {
  flex: 0 0 auto; /* never stretch vertically in column layouts */
}
.filter-bar .ui-field {
  margin: 0;
  min-width: min(10rem, 100%);
  flex: 1 1 10rem;
}
.filter-bar .filter-select { min-width: min(12rem, 100%); }
@media (max-width: 767px) {
  .filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    align-content: start;
  }
  .filter-bar > *,
  .filter-bar .ui-field {
    flex: none;
    width: 100%;
    min-width: 0;
  }
  .filter-bar > .ui-btn,
  .filter-bar > a.ui-btn {
    width: 100%;
    min-height: 2.75rem;
    justify-content: center;
  }
}

/* Flatpickr: never reserve layout space when closed */
.flatpickr-calendar:not(.open) {
  display: none !important;
}
.flatpickr-calendar.open {
  display: inline-block !important;
  z-index: 80;
}
.ui-datepicker,
.ui-datepicker-input-wrap,
.flatpickr-wrapper {
  min-height: 0;
}

.settings-form {
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  padding-bottom: var(--space-7);
}

.settings-layout {
  display: grid;
  gap: var(--section-gap);
}
@media (min-width: 960px) {
  .settings-layout {
    grid-template-columns: minmax(11rem, 14rem) minmax(0, 1fr);
    align-items: start;
    gap: var(--space-5);
  }
  .settings-tabs {
    flex-direction: column;
    flex-wrap: nowrap;
    position: sticky;
    top: var(--space-3);
  }
  .settings-tab {
    width: 100%;
    justify-content: flex-start;
  }
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: var(--space-1);
  border-radius: calc(var(--radius));
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 35%, transparent);
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.settings-tab:hover {
  color: var(--foreground);
  background: color-mix(in oklch, var(--background) 70%, transparent);
}

.settings-tab.is-active {
  color: var(--foreground);
  background: var(--card);
  box-shadow: 0 1px 3px color-mix(in oklch, var(--foreground) 8%, transparent);
}

.settings-tab-icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  opacity: 0.85;
}

.settings-tab-icon svg {
  width: 100%;
  height: 100%;
}

.settings-panels {
  display: grid;
  gap: 1rem;
}

.settings-panel {
  display: none;
  gap: 1rem;
}

.settings-panel.is-active {
  display: grid;
}

.settings-panel-intro {
  margin: 0;
  padding: 0.875rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--primary) 6%, var(--card));
  font-size: 0.875rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}

.settings-panel-intro strong {
  color: var(--foreground);
}

.settings-card { margin: 0; }
.settings-card .ui-card-desc,
.ui-card-desc {
  margin: var(--space-2) 0 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted-foreground);
}
.settings-subheading { margin: 0.5rem 0 0; font-size: 0.875rem; font-weight: 600; color: var(--muted-foreground); }
.field-hint { margin: -0.25rem 0 0; font-size: 0.8rem; color: var(--muted-foreground); }
.field-hint code { font-size: 0.85em; color: var(--foreground); }
.duration-preview {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: color-mix(in oklch, var(--muted) 30%, transparent);
}
.duration-preview-title { margin: 0 0 0.75rem; font-size: 0.875rem; font-weight: 600; }
.duration-preview-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.duration-chip {
  display: inline-flex;
  padding: 0.375rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--background);
  font-size: 0.875rem;
  font-weight: 500;
}
.checkbox-stack { gap: 0.75rem; }
.settings-actions { display: flex; justify-content: flex-start; padding-top: 0.5rem; }
.settings-readonly-note { text-align: center; font-size: 0.875rem; }
.ui-weekday-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
}
.ui-weekday-row .ui-checkbox.is-inline {
  margin: 0;
}
.qris-preview-wrap { margin-bottom: 1rem; }
.qris-preview-img {
  max-height: 12rem;
  width: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.5rem;
}
.dashboard-card, .report-card { margin-bottom: var(--page-gap); }
.opname-diff.has-diff { color: #d97706; font-weight: 600; }
.refund-form { display: inline-flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.ui-input-sm { height: 2rem; padding: 0.25rem 0.5rem; font-size: 0.8125rem; }

/* —— Shift detail page —— */
.shift-detail-page {
  display: flex;
  flex-direction: column;
  gap: calc(var(--page-gap) * 0.85);
}
.shift-block-desc {
  margin-top: -0.35rem;
  margin-bottom: 1rem;
}

/* KPI */
.shift-kpi-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 1024px) {
  .shift-kpi-grid {
    grid-template-columns: 1.25fr repeat(3, 1fr);
    gap: var(--section-gap);
  }
}
.shift-detail-header {
  align-items: flex-start;
}
.shift-detail-intro {
  min-width: 0;
  flex: 1;
}
.shift-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 0.15s;
}
.shift-detail-back:hover {
  color: var(--foreground);
}
.shift-detail-back .nav-icon {
  width: 1rem;
  height: 1rem;
}
.shift-detail-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem 0.875rem;
}
.shift-detail-title-row h2 {
  margin: 0;
}
.shift-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
}
.shift-status-pill.is-open {
  border-color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 35%, var(--border));
  background: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 12%, var(--card));
  color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 70%, var(--foreground));
}
.shift-status-pill.is-closed {
  background: var(--muted);
  color: var(--muted-foreground);
}
.shift-status-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: currentColor;
  animation: shift-pulse 2s ease-in-out infinite;
}
@keyframes shift-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.shift-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.45;
}
.shift-detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.shift-detail-meta-item .nav-icon {
  width: 0.9rem;
  height: 0.9rem;
  opacity: 0.65;
}
.shift-detail-meta-item strong {
  color: var(--foreground);
  font-weight: 600;
}
.shift-detail-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: var(--border);
  flex-shrink: 0;
}
.shift-detail-notes {
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px dashed var(--border);
  background: color-mix(in oklch, var(--muted) 50%, transparent);
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  line-height: 1.45;
}
.shift-detail-actions {
  flex-shrink: 0;
}
.shift-export-group {
  display: inline-flex;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.shift-export-group .ui-btn {
  border-radius: 0;
  border: 0;
  box-shadow: none;
}
.shift-export-group .ui-btn + .ui-btn {
  border-left: 1px solid var(--border);
}
.shift-export-group .ui-btn .nav-icon {
  width: 0.95rem;
  height: 0.95rem;
}

.shift-kpi-card {
  padding: var(--card-pad);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
}
.shift-kpi-hero {
  border-color: color-mix(in oklch, var(--primary) 22%, var(--border));
  background: linear-gradient(
    145deg,
    color-mix(in oklch, var(--primary) 7%, var(--card)) 0%,
    var(--card) 55%
  );
}
.shift-kpi-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.shift-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  color: var(--muted-foreground);
}
.shift-kpi-icon .nav-icon {
  width: 1rem;
  height: 1rem;
}
.shift-kpi-icon--sales {
  background: color-mix(in oklch, var(--primary) 14%, var(--muted));
  color: var(--primary);
}
.shift-kpi-label {
  font-size: 0.8rem;
  color: var(--muted-foreground);
}
.shift-kpi-value {
  margin-top: 0.35rem;
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.shift-kpi-value--sm {
  font-size: 1.35rem;
}
.shift-kpi-split {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0.5rem 0 0;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}
.shift-kpi-split-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-variant-numeric: tabular-nums;
}
.shift-kpi-hint {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
}

.shift-detail-columns {
  display: grid;
  gap: var(--section-gap);
}
@media (min-width: 960px) {
  .shift-detail-columns {
    grid-template-columns: 1fr 1fr;
  }
}
.shift-section {
  margin-bottom: 0;
}
.shift-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.shift-inline-badge {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 14%, var(--muted));
  color: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 75%, var(--foreground));
  white-space: nowrap;
}

.shift-cash-card .ui-card-body {
  padding-bottom: 1rem;
}

/* Cash flow — horizontal, tidak menumpuk */
.shift-cash-flow {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  padding: 0.85rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 24%, var(--card));
  overflow-x: auto;
}
.shift-cash-flow-step {
  flex: 1 1 0;
  min-width: 7.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-radius: calc(var(--radius) - 4px);
  background: var(--card);
  border: 1px solid color-mix(in oklch, var(--border) 85%, transparent);
}
.shift-cash-flow-step--variance.shift-variance--surplus {
  border-color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 35%, var(--border));
  background: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 8%, var(--card));
}
.shift-cash-flow-step--variance.shift-variance--short {
  border-color: color-mix(in oklch, var(--destructive) 35%, var(--border));
  background: color-mix(in oklch, var(--destructive) 6%, var(--card));
}
.shift-cash-flow-step--variance.shift-variance--short .shift-cash-flow-value {
  color: var(--destructive);
}
.shift-cash-flow-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}
.shift-cash-flow-value {
  font-size: clamp(0.8125rem, 1.8vw, 1rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  word-break: break-word;
}
.shift-cash-flow-hint {
  font-size: 0.625rem;
  color: var(--muted-foreground);
  line-height: 1.25;
}
.shift-cash-flow-arrow {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--muted-foreground);
  opacity: 0.4;
}
.shift-cash-flow-arrow .nav-icon {
  width: 0.9rem;
  height: 0.9rem;
}

.shift-cash-pay-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.shift-cash-pay-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  background: var(--card);
  white-space: nowrap;
}
.shift-cash-pay-chip strong {
  font-variant-numeric: tabular-nums;
}
.shift-cash-pay-chip--cash {
  border-color: color-mix(in oklch, var(--primary) 20%, var(--border));
}
.shift-cash-pay-chip--qris {
  border-color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 20%, var(--border));
}
.shift-cash-pay-note {
  font-size: 0.6875rem;
  margin-left: auto;
}

/* Analytics — 3 kolom seimbang */
.shift-analytics-grid {
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 960px) {
  .shift-analytics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--section-gap);
    align-items: stretch;
  }
}
.shift-analytics-card {
  height: 100%;
}
.shift-analytics-card .ui-card-body {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.shift-analytics-card .ui-card-title {
  margin-bottom: 0.75rem;
}

.shift-mix-list--compact {
  gap: 0.65rem;
  flex: 1;
}

/* Breakdown satu baris — label | bar | nominal */
.shift-breakdown-list--compact {
  gap: 0.55rem;
}
.shift-breakdown-list--compact .shift-breakdown-row {
  display: grid;
  grid-template-columns: minmax(5.5rem, 1fr) minmax(3rem, 2fr) auto;
  align-items: center;
  gap: 0.5rem 0.65rem;
}
.shift-breakdown-list--compact .shift-breakdown-label {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
}
.shift-breakdown-list--compact .shift-breakdown-meta {
  font-size: 0.6875rem;
  font-weight: 400;
}
.shift-breakdown-list--compact .shift-breakdown-bar {
  height: 0.35rem;
}
.shift-breakdown-list--compact .shift-breakdown-amount {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

/* Panel header — judul + chip sebaris */
.shift-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-bottom: 0;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.shift-panel-header-main {
  min-width: 0;
}
.shift-panel-header-main .ui-card-desc {
  margin-top: 0.15rem;
  margin-bottom: 0;
}
.shift-panel-title-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.shift-panel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: calc(var(--radius) - 2px);
  flex-shrink: 0;
}
.shift-panel-icon .nav-icon {
  width: 1.1rem;
  height: 1.1rem;
}
.shift-panel-icon--ops {
  background: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 14%, var(--muted));
  color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 80%, var(--foreground));
}
.shift-panel-icon--fin {
  background: color-mix(in oklch, var(--primary) 12%, var(--muted));
  color: var(--primary);
}
.shift-panel-title-row .ui-card-title {
  margin: 0;
  line-height: 1.25;
}
.shift-panel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.shift-panel-chip {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
  white-space: nowrap;
}
.shift-panel-chip--money {
  color: var(--foreground);
  background: color-mix(in oklch, var(--primary) 8%, var(--card));
  border-color: color-mix(in oklch, var(--primary) 22%, var(--border));
}
.shift-panel-chip--muted {
  opacity: 0.8;
}
.shift-panel-toolbar {
  padding: 0.75rem 0;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
  margin-bottom: 0.75rem;
}
.shift-ledger--ops .shift-pro-table-wrap,
.shift-ledger--fin .data-grid-shell.is-embedded {
  margin-top: 0;
}

.shift-cash-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
}
@media (min-width: 900px) {
  .shift-cash-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

.shift-cash-metric {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 5rem;
  padding: 0.8rem 0.85rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 30%, var(--card));
}
.shift-cash-metric-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  line-height: 1.2;
}
.shift-cash-metric-value {
  font-size: clamp(0.875rem, 2.2vw, 1.0625rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  word-break: break-word;
}
.shift-cash-metric-hint {
  margin-top: auto;
  font-size: 0.6875rem;
  line-height: 1.3;
  min-height: 0.9rem;
}

.shift-cash-metric--variance.shift-variance--surplus {
  border-color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 40%, var(--border));
  background: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 10%, var(--card));
}
.shift-cash-metric--variance.shift-variance--surplus .shift-cash-metric-label,
.shift-cash-metric--variance.shift-variance--surplus .shift-cash-metric-hint {
  color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 70%, var(--foreground));
}
.shift-cash-metric--variance.shift-variance--short {
  border-color: color-mix(in oklch, var(--destructive) 40%, var(--border));
  background: color-mix(in oklch, var(--destructive) 7%, var(--card));
}
.shift-cash-metric--variance.shift-variance--short .shift-cash-metric-label,
.shift-cash-metric--variance.shift-variance--short .shift-cash-metric-hint {
  color: color-mix(in oklch, var(--destructive) 75%, var(--foreground));
}
.shift-cash-metric--variance.shift-variance--short .shift-cash-metric-value {
  color: var(--destructive);
}

.shift-cash-inflow {
  padding: 0.85rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 22%, var(--card));
}
.shift-cash-inflow-title {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}
.shift-cash-inflow-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
}
.shift-cash-inflow-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: calc(var(--radius) - 4px);
  border: 1px solid var(--border);
  background: var(--card);
}
.shift-cash-inflow-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.shift-cash-inflow-item-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
}
.shift-cash-inflow-item-count {
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.shift-cash-inflow-item-value {
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.shift-cash-inflow-item--cash {
  border-color: color-mix(in oklch, var(--primary) 18%, var(--border));
}
.shift-cash-inflow-item--qris {
  border-color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 18%, var(--border));
}
.shift-cash-inflow-note {
  margin: 0.65rem 0 0;
  font-size: 0.6875rem;
  line-height: 1.4;
}

.shift-mix-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.shift-mix-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.shift-mix-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.shift-mix-name {
  font-size: 0.875rem;
  font-weight: 500;
}
.shift-mix-count {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.shift-mix-bar {
  height: 0.45rem;
  border-radius: 999px;
  background: var(--muted);
  overflow: hidden;
}
.shift-mix-fill {
  height: 100%;
  border-radius: inherit;
  min-width: 2px;
  transition: width 0.35s ease;
}
.shift-mix-fill--session { background: var(--primary); }
.shift-mix-fill--extend { background: color-mix(in oklch, var(--primary) 55%, var(--accent-emerald, oklch(0.65 0.15 160))); }
.shift-mix-fill--order { background: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 88%, var(--foreground)); }

.shift-breakdown-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.shift-breakdown-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.shift-breakdown-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.shift-breakdown-label {
  font-size: 0.875rem;
  font-weight: 500;
}
.shift-breakdown-amount {
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
}
.shift-breakdown-bar {
  height: 0.4rem;
  border-radius: 999px;
  background: var(--muted);
  overflow: hidden;
}
.shift-breakdown-fill {
  height: 100%;
  border-radius: inherit;
  min-width: 2px;
}
.shift-breakdown-fill--cash { background: var(--primary); }
.shift-breakdown-fill--qris { background: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 88%, var(--foreground)); }
.shift-breakdown-fill--cafe { background: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 85%, var(--foreground)); }
.shift-breakdown-fill--vip { background: color-mix(in oklch, var(--primary) 70%, #a855f7); }
.shift-breakdown-fill--standard { background: color-mix(in oklch, var(--primary) 45%, var(--muted-foreground)); }
.shift-breakdown-fill--payment { background: var(--primary); }
.shift-breakdown-meta {
  font-size: 0.6875rem;
}
.shift-empty-hint {
  margin: 0;
  padding: 1.25rem 0;
  text-align: center;
  font-size: 0.875rem;
}

.shift-cafe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.shift-cafe-chip {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.shift-cafe-chip strong {
  font-weight: 700;
  color: var(--foreground);
}
.shift-cafe-chip--ok {
  border-color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 30%, var(--border));
  color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 70%, var(--foreground));
}
.shift-cafe-chip--warn {
  border-color: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 35%, var(--border));
  color: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 75%, var(--foreground));
}
.shift-cafe-chip--muted {
  opacity: 0.75;
}
.shift-cafe-chip--total {
  font-weight: 700;
  color: var(--foreground);
  background: color-mix(in oklch, var(--primary) 10%, var(--card));
  border-color: color-mix(in oklch, var(--primary) 25%, var(--border));
}

.shift-order-id {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--muted-foreground);
}
.shift-order-source {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--muted);
}
.shift-order-items {
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shift-txn-type {
  font-size: 0.8125rem;
  font-weight: 500;
}

/* Ledger compare + professional tables */
.shift-ledger-compare {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: color-mix(in oklch, var(--muted) 22%, var(--card));
}
@media (max-width: 767px) {
  .shift-ledger-compare {
    grid-template-columns: 1fr;
  }
  .shift-ledger-compare-divider {
    transform: rotate(90deg);
    justify-self: center;
  }
}
.shift-ledger-compare-card {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  min-width: 0;
}
.shift-ledger-compare-card strong {
  display: block;
  font-size: 0.8125rem;
}
.shift-ledger-compare-card p {
  margin: 0.1rem 0 0;
  font-size: 0.6875rem;
  line-height: 1.35;
  color: var(--muted-foreground);
}
.shift-ledger-compare-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: calc(var(--radius) - 2px);
  flex-shrink: 0;
}
.shift-ledger-compare-icon .nav-icon {
  width: 1rem;
  height: 1rem;
}
.shift-ledger-compare-card--ops .shift-ledger-compare-icon {
  background: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 14%, var(--muted));
  color: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 80%, var(--foreground));
}
.shift-ledger-compare-card--fin .shift-ledger-compare-icon {
  background: color-mix(in oklch, var(--primary) 12%, var(--muted));
  color: var(--primary);
}
.shift-ledger-compare-divider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  opacity: 0.45;
}
.shift-ledger-compare-divider .nav-icon {
  width: 1rem;
  height: 1rem;
}

.shift-ledger {
  overflow: hidden;
}
.shift-ledger--ops {
  border-color: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 22%, var(--border));
}
.shift-ledger--fin {
  border-color: color-mix(in oklch, var(--primary) 22%, var(--border));
}
.shift-ledger-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.shift-ledger-head-main {
  min-width: min(100%, 14rem);
  flex: 1;
}
.shift-ledger-badge {
  display: inline-block;
  margin-bottom: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.shift-ledger-badge--ops {
  background: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 14%, var(--muted));
  color: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 75%, var(--foreground));
}
.shift-ledger-badge--fin {
  background: color-mix(in oklch, var(--primary) 12%, var(--muted));
  color: var(--primary);
}
.shift-ledger-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  margin: 0;
}
.shift-ledger-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.65rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--card);
  min-width: 4.25rem;
}
.shift-ledger-stat dt {
  margin: 0;
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}
.shift-ledger-stat dd {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.shift-ledger-stat--ok dd { color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 75%, var(--foreground)); }
.shift-ledger-stat--warn dd { color: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 80%, var(--foreground)); }
.shift-ledger-stat--muted dd { color: var(--muted-foreground); }
.shift-ledger-stat--money dd { font-size: 0.8125rem; }

.shift-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin-bottom: 0.85rem;
}
.shift-table-search {
  position: relative;
  flex: 1;
  min-width: min(100%, 14rem);
}
.shift-table-search .data-grid-search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.55;
}
.shift-table-search .ui-input {
  width: 100%;
  padding-left: 2.1rem;
}
.shift-table-toolbar-meta {
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}
.shift-table-toolbar-meta strong {
  color: var(--foreground);
}

.shift-pro-table-wrap {
  overflow-x: auto;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
}
.shift-pro-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.shift-pro-table thead th {
  padding: 0.55rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  background: color-mix(in oklch, var(--muted) 45%, transparent);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.shift-pro-table tbody td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
  vertical-align: top;
}
.shift-pro-table tbody tr:last-child td {
  border-bottom: 0;
}
.shift-pro-table tbody tr:hover td {
  background: color-mix(in oklch, var(--muted) 25%, transparent);
}
.shift-pro-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.shift-row-id {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}
.shift-row-note {
  display: inline-flex;
  margin-left: 0.25rem;
  vertical-align: middle;
  color: var(--muted-foreground);
  opacity: 0.7;
}
.shift-row-note .nav-icon {
  width: 0.85rem;
  height: 0.85rem;
}

.shift-src-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.shift-src-badge--counter {
  background: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 12%, var(--muted));
  color: color-mix(in oklch, var(--accent-amber, oklch(0.75 0.12 85)) 78%, var(--foreground));
}
.shift-src-badge--table {
  background: color-mix(in oklch, var(--primary) 10%, var(--muted));
  color: var(--primary);
}

.shift-item-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  max-width: 18rem;
}
.shift-item-chip {
  display: inline-block;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  line-height: 1.3;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
}
.shift-item-chip--more {
  color: var(--muted-foreground);
  font-style: italic;
  border-style: dashed;
}

.shift-qty-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--muted);
}

.shift-money-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
}
.shift-money-sub {
  font-size: 0.6875rem;
}

.shift-created-cell {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 7rem;
}
.shift-created-by {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

.shift-table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 2rem 1rem;
  text-align: center;
}
.shift-table-empty .nav-icon {
  width: 1.75rem;
  height: 1.75rem;
  opacity: 0.35;
}
.shift-table-empty p {
  margin: 0;
}

.shift-table-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.shift-ledger--fin .data-grid-shell.is-embedded {
  margin-top: 0;
}
.shift-ledger--fin .data-grid-toolbar {
  margin-bottom: 0.65rem;
}

.shift-txn-badge {
  display: inline-flex;
  padding: 0.15rem 0.45rem;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.shift-txn-badge--session {
  background: color-mix(in oklch, var(--primary) 12%, var(--muted));
  color: var(--primary);
}
.shift-txn-badge--extend {
  background: color-mix(in oklch, var(--primary) 8%, var(--muted));
  color: color-mix(in oklch, var(--primary) 65%, var(--foreground));
}
.shift-txn-badge--order {
  background: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 12%, var(--muted));
  color: color-mix(in oklch, var(--accent-emerald, oklch(0.65 0.15 160)) 72%, var(--foreground));
}
.shift-txn-badge--member {
  background: var(--muted);
  color: var(--muted-foreground);
}

.shift-txn-relation {
  display: block;
  font-size: 0.6875rem;
  margin-top: 0.1rem;
}
.shift-context-cell {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: flex-start;
}
.shift-txn-customer {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}
.shift-pay-method {
  font-size: 0.8125rem;
  font-weight: 500;
}
.shift-amount--refund {
  color: var(--destructive);
}
.shift-txn-by {
  display: block;
  font-size: 0.6875rem;
  margin-top: 0.15rem;
}
.shift-txn-row--refund td {
  background: color-mix(in oklch, var(--destructive) 4%, transparent);
}

@media (max-width: 639px) {
  .shift-cash-flow {
    flex-direction: column;
    gap: 0.35rem;
  }
  .shift-cash-flow-arrow {
    justify-content: center;
    transform: rotate(90deg);
  }
  .shift-breakdown-list--compact .shift-breakdown-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }
  .shift-breakdown-list--compact .shift-breakdown-bar {
    grid-column: 1 / -1;
  }
  .shift-detail-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .shift-cafe-chips {
    width: 100%;
  }
  .shift-kpi-value {
    font-size: 1.375rem;
  }
}

/* —— Page layout utilities —— */
.page-two-col {
  display: grid;
  gap: var(--page-gap);
  align-items: start;
}
@media (min-width: 1024px) {
  .page-two-col {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .page-two-col--ticket {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }
}
.page-two-col-main,
.page-two-col-side {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  min-width: 0;
}
.stack-gap {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}
.form-grid--2 {
  grid-template-columns: 1fr;
  max-width: none;
}
@media (min-width: 640px) {
  .form-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Definition list */
.ui-dl {
  margin: 0;
  display: grid;
  gap: 0;
}
.ui-dl-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
}
.ui-dl-row:first-child {
  border-top: 0;
  padding-top: 0;
}
.ui-dl-row dt {
  margin: 0;
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.ui-dl-row dd {
  margin: 0;
  text-align: right;
  font-weight: 500;
  word-break: break-word;
}

/* Card footer */
.ui-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--inline-gap);
  padding: var(--space-4) var(--card-pad);
  border-top: 1px solid var(--border);
}
.ui-card > .ui-card-header {
  padding: var(--card-pad) var(--card-pad) var(--space-4);
  margin-bottom: 0;
}
.ui-card > .ui-card-header + .ui-card-body {
  padding-top: 0;
}
.ui-card > .ui-card-body:only-child,
.ui-card > .ui-card-body:last-child {
  padding-bottom: var(--card-pad);
}

/* Breadcrumb */
.ui-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 var(--space-2);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--muted-foreground);
}
.ui-breadcrumb a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--muted-foreground);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}
.ui-breadcrumb a:hover {
  color: var(--foreground);
}
.ui-breadcrumb-sep {
  display: inline-flex;
  color: var(--muted-foreground);
  opacity: 0.55;
}
.ui-breadcrumb-sep .nav-icon {
  width: 0.875rem;
  height: 0.875rem;
}
.ui-breadcrumb-current {
  color: var(--foreground);
  font-weight: 550;
}

/* Stat variants */
.stat-value--sm {
  font-size: 1.125rem;
  font-weight: 650;
  line-height: 1.35;
}
.stat-value--badge {
  font-size: inherit;
  font-weight: inherit;
  margin-top: var(--space-2);
}
.stat-grid--client {
  margin-bottom: var(--page-gap);
}

/* Settings layout */
.settings-form {
  width: 100%;
  max-width: none;
}
.settings-theme-card .ui-card-body {
  padding-top: var(--space-3);
}
.bank-import-card .ui-card-body {
  max-width: 36rem;
}

/* Client portal */
.client-portal {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--background);
}
.client-portal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--section-gap);
  padding: var(--space-4) var(--page-pad-x);
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--card) 92%, var(--background));
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.client-portal-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.client-portal-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  background: color-mix(in oklch, var(--primary) 12%, var(--muted));
  color: var(--primary);
}
.client-portal-logo .nav-icon {
  width: 1.25rem;
  height: 1.25rem;
}
.client-portal-title {
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.client-portal-sub {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.client-portal-actions {
  display: flex;
  align-items: center;
  gap: var(--inline-gap);
  flex-shrink: 0;
}
.client-portal-main {
  flex: 1;
  padding: var(--page-pad-y) var(--page-pad-x);
  max-width: 56rem;
  margin: 0 auto;
  width: 100%;
}

/* Client login variant */
.login-page--client {
  min-height: 100%;
  min-height: 100dvh;
}
.login-main--centered {
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Data grid — looser rhythm inside page body */
.page-body .space-y-4 > :not([hidden]) ~ :not([hidden]) {
  margin-top: var(--section-gap) !important;
}
.page-body .crm-grid-shell,
.page-body .space-y-4 {
  min-width: 0;
}
.page-body .crm-grid-card,
.page-body .space-y-4 > div.overflow-hidden {
  border-radius: calc(var(--radius) + 2px);
  box-shadow:
    0 1px 2px 0 rgb(0 0 0 / 0.04),
    0 4px 12px -2px rgb(15 23 42 / 0.06);
}

.ld-page > .page-top {
  margin-bottom: var(--space-5);
  border-bottom: 0;
  padding-bottom: 0;
}

/* Ticket detail */
.ticket-detail-header .ui-breadcrumb {
  margin-bottom: 0;
}
.ticket-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--inline-gap);
}
.ticket-desc {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--foreground);
}
.ticket-outcome {
  margin: var(--space-4) 0 0;
  font-size: 0.875rem;
}
.ticket-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: var(--space-3);
}
.ticket-photo-item {
  display: block;
  overflow: hidden;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: var(--muted);
  aspect-ratio: 4 / 3;
}
.ticket-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ticket-upload-form {
  margin-top: var(--section-gap);
  padding-top: var(--section-gap);
  border-top: 1px solid var(--border);
}
.ticket-empty-note {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.ticket-empty-note--center {
  padding: var(--space-6) var(--card-pad);
  text-align: center;
}
.ticket-comments .ui-card-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-4);
}
.ticket-comment-list {
  display: flex;
  flex-direction: column;
}
.ticket-comment-item {
  padding: var(--space-4) var(--card-pad);
  border-top: 1px solid var(--border);
}
.ticket-comment-item:first-child {
  border-top: 0;
}
.ticket-comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}
.ticket-comment-author {
  font-size: 0.875rem;
  font-weight: 600;
}
.ticket-comment-time {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.ticket-comment-body {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.ticket-comment-internal {
  margin-top: var(--space-2);
  font-size: 0.6875rem;
}
.ticket-comment-form {
  padding: var(--space-4) var(--card-pad);
  border-top: 1px solid var(--border);
  display: grid;
  gap: var(--space-3);
}
.ticket-comment-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.ticket-comment-locked {
  margin: 0;
  padding: var(--space-4) var(--card-pad);
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted-foreground);
}
.assignee-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  display: grid;
  gap: var(--space-1);
}
.assignee-picker {
  display: grid;
  gap: var(--space-2);
  max-height: 10rem;
  overflow-y: auto;
  padding: var(--space-1);
}
.assignee-picker-item {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
}
.ui-checkbox--inline {
  align-self: end;
  padding: var(--space-2) 0;
}

/* Onboarding breadcrumb in header */
.wz-back-link {
  margin-bottom: var(--space-1);
}

/* Operations map panel toggle */
.ops-panel-toggle {
  pointer-events: auto;
  position: absolute;
  left: var(--space-3);
  top: var(--space-3);
  z-index: 20;
  backdrop-filter: blur(8px);
  background: color-mix(in oklch, var(--card) 95%, transparent);
}

/* —— Layout: desktop vs mobile nav (must be last; beats .ui-btn) —— */
html.layout-desktop .app-sidebar-toggle {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
html.layout-desktop .app-sidebar-backdrop {
  display: none !important;
}
html.layout-desktop .app-sidebar {
  position: relative !important;
  transform: none !important;
  box-shadow: none !important;
}
html.layout-desktop .app-topbar-start {
  gap: 0;
}
html.layout-mobile .app-sidebar-toggle {
  display: inline-flex !important;
}
html.layout-mobile body.sidebar-open {
  overflow: hidden;
}
