:root {
  /* Dark theme — primary sky + secondary teal */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bg: #0c1017;
  --surface: #141a22;
  --surface-2: #1a222d;
  --border: #2a3441;
  --accent: #4db6ff;
  --accent-soft: rgba(77, 182, 255, 0.14);
  --accent-strong: #4db6ff;
  --accent-hover: #7ec8ff;
  --accent-2: #2dd4bf;
  --accent-2-soft: rgba(45, 212, 191, 0.14);
  --accent-2-strong: #2dd4bf;
  --accent-2-hover: #5eead4;
  --on-accent: #0c1017;
  --on-accent-2: #0c1017;
  --text: #e8eef4;
  --text-muted: #8b98a5;
  --success: #3ecf7a;
  --warning: #e6b84d;
  --danger: #f07178;
  --info: #2dd4bf;
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 56px;
  --app-header-height: 61px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* One sans-serif across controls, tables, and sidebar — avoids system button/input fonts */
button, input, select, textarea, optgroup,
.btn, .form-control, .dropdown-item,
.table, .table th, .table td,
.sidebar, .topbar, .main-content,
.user-select-search, .user-option-name,
.smart-select-input, .cf-combobox-input,
.sidebar-favorites-manage, .nav-item {
  font-family: var(--font-sans);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: width 0.22s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--app-header-height);
  min-height: var(--app-header-height);
  max-height: var(--app-header-height);
  padding: 0 16px;
  box-sizing: border-box;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--accent);
}
.brand-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}
.brand-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
.brand-logo-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  overflow: visible;
}
.brand-logo-img {
  display: block;
  max-width: 100%;
  max-height: 36px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  border-radius: 4px;
}

.sidebar-nav {
  padding: 8px 8px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.nav-section {
  margin-bottom: 2px;
}

.nav-section:not([hidden]) ~ .nav-section:not([hidden]) {
  border-top: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  padding-top: 8px;
  margin-top: 8px;
}

/* Section toggle: keep the original compact label look, plus a quiet chevron */
button.nav-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  padding: 8px 10px 6px 12px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.2;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
  user-select: none;
}
button.nav-section-label:hover,
button.nav-section-label:focus,
button.nav-section-label:active {
  color: var(--text);
  background: none;
  box-shadow: none;
  text-decoration: none;
  outline: none;
}
button.nav-section-label:focus-visible {
  color: var(--text);
  outline: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  outline-offset: 1px;
  border-radius: 4px;
}
.nav-section-label-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-section-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.4;
  color: currentColor;
  transition: transform 0.18s ease, opacity 0.15s ease;
  transform: rotate(90deg);
}
button.nav-section-label:hover .nav-section-chevron {
  opacity: 0.75;
}
.nav-section.is-collapsed > .nav-section-label .nav-section-chevron {
  transform: rotate(0deg);
}
.nav-section.is-collapsed > .nav-section-items {
  display: none;
}

.sidebar-favorites {
  --fav-gold: #e3b341;
  --fav-gold-soft: rgba(227, 179, 65, 0.14);
  --fav-gold-line: rgba(227, 179, 65, 0.32);
  margin: 0 0 10px;
  padding: 2px 6px 6px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--fav-gold) 34%, var(--border));
  background:
    linear-gradient(
      160deg,
      rgba(227, 179, 65, 0.16) 0%,
      rgba(227, 179, 65, 0.05) 42%,
      color-mix(in srgb, var(--surface-2) 88%, transparent) 100%
    );
  box-shadow:
    inset 0 1px 0 rgba(227, 179, 65, 0.12),
    0 1px 0 color-mix(in srgb, var(--border) 70%, transparent);
}
.sidebar-favorites-label {
  color: var(--fav-gold) !important;
  font-weight: 700;
  letter-spacing: 0.02em;
  gap: 8px;
  justify-content: flex-start;
  align-items: center;
  padding-top: 2px;
  padding-bottom: 4px;
  line-height: 1;
}
.sidebar-favorites-label:hover,
.sidebar-favorites-label:focus,
.sidebar-favorites-label:active,
.sidebar-favorites-label:focus-visible {
  color: #f0c75a !important;
}
.sidebar-favorites-label .nav-section-label-text {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  min-height: 16px;
}
.sidebar-favorites-label .nav-section-chevron {
  margin-left: auto;
  opacity: 0.7;
  color: var(--fav-gold);
  align-self: center;
}
.sidebar-favorites-label-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  line-height: 0;
  color: var(--fav-gold);
}
.sidebar-favorites-label-icon .nav-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  opacity: 1;
}
.sidebar-favorites-label-icon .nav-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: rgba(227, 179, 65, 0.28);
  stroke: currentColor;
}
.sidebar-favorites-list:empty {
  display: none;
}
.sidebar-favorites-list .sidebar-favorite-link {
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.sidebar-favorites-list .sidebar-favorite-link:hover {
  border-color: var(--fav-gold-line);
  background: var(--fav-gold-soft);
  color: var(--text);
}
.sidebar-favorites-list .sidebar-favorite-link.active {
  border-color: var(--fav-gold-line);
  background: color-mix(in srgb, var(--fav-gold) 18%, var(--surface));
  color: var(--fav-gold);
}
.sidebar-favorites-empty {
  padding: 6px 10px 8px;
  color: color-mix(in srgb, var(--fav-gold) 45%, var(--text-muted));
  font-size: 12px;
  line-height: 1.4;
}
.sidebar-favorites-empty[hidden] {
  display: none;
}
.sidebar-favorites-manage {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px dashed color-mix(in srgb, var(--fav-gold) 40%, var(--border));
  border-radius: 8px;
  background: transparent;
  color: var(--fav-gold);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  margin-top: 2px;
}
.sidebar-favorites-manage:hover,
.sidebar-favorites-manage:focus-visible {
  background: var(--fav-gold-soft);
  border-style: solid;
  border-color: color-mix(in srgb, var(--fav-gold) 55%, var(--border));
  text-decoration: none;
  outline: none;
  color: #f0c75a;
}
.sidebar-favorites-manage:active {
  filter: brightness(0.92);
}
.sidebar-favorites-manage .nav-icon {
  width: 18px;
  height: 18px;
  color: inherit;
}

.nav-section-label-link {
  display: block;
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.15s;
  cursor: pointer;
}
.nav-section-label-link:hover { color: var(--accent); text-decoration: none; }
.nav-section-label-link.active { color: var(--accent); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.nav-item--locked {
  opacity: 0.48;
  cursor: not-allowed;
  position: relative;
  color: var(--text-muted);
  user-select: none;
}
.nav-item--locked:hover,
.nav-item--locked.is-tip-open {
  background: rgba(127, 127, 127, 0.08);
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.72;
}
.nav-item--locked .nav-icon { opacity: 0.55; }

.sidebar-favorites-overlay {
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(2px);
}
.sidebar-favorites-overlay[hidden],
.sidebar-favorites-dialog[hidden] {
  display: none !important;
}
.sidebar-favorites-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1091;
  display: flex;
  flex-direction: column;
  width: min(520px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 32px));
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.36);
  transform: translate(-50%, -50%);
}
.sidebar-favorites-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.sidebar-favorites-dialog-header h2 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 20px;
}
.sidebar-favorites-dialog-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}
.sidebar-favorites-dialog-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: -8px -8px 0 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.sidebar-favorites-dialog-close:hover,
.sidebar-favorites-dialog-close:focus-visible {
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}
.sidebar-favorites-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-favorites-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.sidebar-favorites-option:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.sidebar-favorites-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.sidebar-favorites-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}
.sidebar-favorites-option-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
}
.sidebar-favorites-option-main > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-favorites-option-main .nav-icon {
  width: 18px;
  height: 18px;
}
.sidebar-favorites-option input {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  accent-color: var(--accent);
}
.sidebar-favorites-status {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}
.sidebar-favorites-status.is-error {
  color: var(--danger);
}
.sidebar-favorites-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-favorites-dialog-actions .btn {
  min-height: 44px;
}

/* Floating plan-lock tip card */
.plan-lock-float {
  position: fixed;
  z-index: 1200;
  width: min(280px, calc(100vw - 24px));
  padding: 14px 14px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background:
    linear-gradient(165deg, color-mix(in srgb, var(--accent, #58a6ff) 10%, var(--surface)) 0%, var(--surface) 55%);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.28),
    0 0 0 1px color-mix(in srgb, var(--accent, #58a6ff) 12%, transparent);
  color: var(--text);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
  pointer-events: none;
}
.plan-lock-float.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.plan-lock-float__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent, #58a6ff);
  margin-bottom: 8px;
}
.plan-lock-float__eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #58a6ff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, #58a6ff) 22%, transparent);
}
.plan-lock-float__title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 6px;
  color: var(--text);
}
.plan-lock-float__text {
  display: block;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.plan-lock-float__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  background: color-mix(in srgb, var(--accent, #58a6ff) 14%, transparent);
  color: var(--accent, #58a6ff);
}
.plan-lock-float__cta::after {
  content: "→";
  font-weight: 700;
}
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.92;
}
.nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  opacity: 1;
}
.nav-badge {
  margin-left: auto;
  background: var(--accent-2-soft);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-badge[hidden] {
  display: none !important;
}

/* ── Main content ────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.22s ease;
}

.app-sticky-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--app-header-height);
  min-height: var(--app-header-height);
  max-height: var(--app-header-height);
  padding: 0 24px;
  box-sizing: border-box;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-primary {
  order: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
  min-height: 36px;
}
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-height: 36px;
}
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text-muted); }

.auto-filter-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 250;
  pointer-events: none;
  background: transparent;
  overflow: hidden;
}
.auto-filter-progress__bar {
  height: 100%;
  width: 36%;
  max-width: 280px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent-strong, var(--accent)),
    transparent
  );
  animation: auto-filter-progress-slide 0.95s ease-in-out infinite;
}
@keyframes auto-filter-progress-slide {
  0% { transform: translateX(-120%); opacity: 0.6; }
  50% { opacity: 1; }
  100% { transform: translateX(calc(100vw + 120%)); opacity: 0.6; }
}
main.content.is-auto-filter-loading {
  position: relative;
}
main.content.is-auto-filter-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 15;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  backdrop-filter: blur(1px);
  pointer-events: none;
}
main.content.is-auto-filter-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 120px;
  z-index: 16;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent-strong, var(--accent));
  animation: auto-filter-spin 0.65s linear infinite;
  pointer-events: none;
}
@keyframes auto-filter-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .auto-filter-progress__bar { animation: none; opacity: 0.85; transform: none; width: 100%; max-width: none; }
  main.content.is-auto-filter-loading::after { animation: none; opacity: 0.7; }
}
.linked-tickets-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.linked-tickets-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.linked-tickets-link {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.linked-tickets-link:hover { color: var(--accent); text-decoration: none; }
.linked-tickets-num { color: var(--accent); flex-shrink: 0; }
.linked-tickets-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.linked-tickets-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.linked-tickets-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.linked-tickets-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  height: 44px;
  padding: 0 16px;
  box-sizing: border-box;
  text-decoration: none;
}
.linked-tickets-actions .btn:hover,
.linked-tickets-actions .btn:active {
  text-decoration: none;
}
.linked-tickets-actions .btn:active {
  filter: brightness(0.94);
}
.linked-tickets-empty { margin: 0; }
.linked-tickets-empty .zero-state__lead {
  margin: 0 0 6px;
  color: var(--text, #e6edf3);
  font-weight: 600;
}
.linked-tickets-empty .zero-state__example {
  margin: 0 0 12px;
  color: var(--text-muted, #8b949e);
  font-size: 13px;
}

@media (max-width: 768px) {
  .app-sticky-header {
    height: auto;
  }
}


.service-switch {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  height: 36px;
  box-sizing: border-box;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1;
}
.service-switch .switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.service-switch .switch-label {
  display: block;
  margin: 0;
  padding: 0;
  /* Same content band as .switch-badge so both tabs share one baseline */
  height: 16px;
  line-height: 16px;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  transform: none;
}
.service-switch a.switch-btn:hover {
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
}
.service-switch .switch-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}
.service-switch .switch-btn.is-active:hover {
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
.service-switch .switch-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  background: var(--accent);
  color: var(--on-accent, #fff);
  transform: none;
}
.service-switch .switch-badge[hidden] {
  display: none !important;
}

/* ── Global search (topbar) ─────────────────── */
.global-search {
  position: relative;
  order: 1;
  flex: 1;
  min-width: 0;
  max-width: 520px;
}
.global-search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.global-search.open .global-search-field,
.global-search-field:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
  background: var(--surface-2);
}
.global-search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  opacity: 0.7;
}
.global-search-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.global-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  padding: 0;
}
.global-search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.55;
  font-weight: 400;
}
.global-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.global-search-kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--text-muted);
  font-size: 10px;
  font-family: inherit;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0.75;
  flex-shrink: 0;
}
.global-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 120;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.28),
    0 2px 8px rgba(0, 0, 0, 0.12);
  padding: 6px;
}
.global-search-group + .global-search-group {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
}
.global-search-group-label {
  padding: 6px 10px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.85;
}
.global-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s;
}
.global-search-item:hover,
.global-search-item.active {
  background: var(--accent-soft);
  text-decoration: none;
  color: var(--text);
}
.global-search-item-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--surface-2) 80%, var(--accent-soft));
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  font-size: 14px;
  flex-shrink: 0;
}
.global-search-item-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.global-search-item-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.global-search-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.global-search-footer {
  margin-top: 4px;
  padding: 8px 10px 4px;
  border-top: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}
.global-search-status,
.global-search-hint {
  padding: 14px 12px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}
.global-search-status-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.global-search-status-icon {
  font-size: 20px;
  opacity: 0.6;
}
.global-search-status-error {
  color: var(--danger, #f85149);
}
.global-search-hint-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.global-search-hint-text {
  font-size: 12px;
  line-height: 1.45;
  opacity: 0.8;
}
.global-search-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: global-search-spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes global-search-spin {
  to { transform: rotate(360deg); }
}

.user-name { color: var(--text); font-weight: 500; }

/* ── "Возникли вопросы?" help dropdown ────────── */
.help-dropdown { position: relative; display: inline-flex; }
.btn-help-docs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
  box-sizing: border-box;
}
.btn-help-docs:hover,
.help-dropdown.open .btn-help-docs {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(88,166,255,0.06);
  text-decoration: none;
}
.btn-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.92;
  color: inherit;
}
.btn-help-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.btn-help-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-left: 1px;
  opacity: 0.92;
  color: inherit;
  transition: transform 0.2s;
}
.btn-help-chevron svg {
  width: 12px;
  height: 12px;
  display: block;
}
.help-dropdown.open .btn-help-chevron { transform: rotate(180deg); }

/* dropdown menu */
.help-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
  overflow: hidden;
  z-index: 200;
  animation: helpDropIn 0.15s ease;
}
.help-dropdown.open .help-dropdown-menu { display: block; }
@keyframes helpDropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.help-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s;
  min-height: 44px;
}
.help-dropdown-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.help-dropdown-item:hover { background: rgba(88,166,255,0.07); text-decoration: none; }
.help-dropdown-item-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: inherit;
  background: none;
  border-radius: 0;
}
.help-dropdown-item-icon .nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.92;
  color: inherit;
}
.help-dropdown-item-icon .nav-icon svg,
.help-dropdown-item-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.help-dropdown-item:hover .help-dropdown-item-icon .nav-icon {
  opacity: 1;
}
.help-dropdown-item-text { display: flex; flex-direction: column; gap: 2px; }
.help-dropdown-item-title { font-size: 13px; font-weight: 600; color: var(--text); }
.help-dropdown-item-sub { font-size: 11px; color: var(--text-muted); }
.help-dropdown-item-danger {
  color: var(--danger, #f85149);
}
.help-dropdown-item-danger .help-dropdown-item-title { color: var(--danger, #f85149); }
.help-dropdown-item-danger .help-dropdown-item-icon {
  background: none;
  color: var(--danger, #f85149);
}
@media (max-width: 640px) { .btn-help-label, .btn-help-chevron { display: none; } }

/* ── Release notes widget ─────────────────────────────── */
.release-notes-widget { display: inline-flex; }
.release-notes-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.release-notes-btn:hover,
#releaseNotesDropdown.open .release-notes-btn {
  background: rgba(88,166,255,0.08);
  border-color: rgba(88,166,255,0.35);
  color: var(--accent);
}
.release-notes-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.92;
  color: inherit;
}
.release-notes-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.release-notes-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #f85149;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface, #0d1117);
}
.release-notes-badge--hidden { display: none; }
.release-notes-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(380px, calc(100vw - 24px));
  max-height: min(480px, calc(100vh - 120px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.28);
  overflow: hidden;
  z-index: 1200;
}
#releaseNotesDropdown.open .release-notes-panel { display: flex; flex-direction: column; }
.release-notes-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.release-notes-panel-title { font-size: 14px; font-weight: 700; color: var(--text); }
.release-notes-panel-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
}
.release-notes-action {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}
.release-notes-action:hover { text-decoration: underline; }
.release-notes-action--muted { color: var(--text-muted); }
.release-notes-action--muted:hover { color: var(--text); }
.release-notes-panel-body {
  overflow-y: auto;
  flex: 1;
}
.release-notes-loading,
.release-notes-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.release-notes-item { border-bottom: 1px solid var(--border); }
.release-notes-item:last-child { border-bottom: none; }
.release-notes-item--unread { background: rgba(88,166,255,0.05); }
.release-notes-item-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.release-notes-item-toggle[aria-expanded="true"] {
  padding-bottom: 4px;
}
.release-notes-item-toggle:hover { background: rgba(88,166,255,0.06); }
.release-notes-item-main { flex: 1; min-width: 0; }
.release-notes-item-chevron {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  opacity: 0.45;
  color: var(--text-muted);
  transition: transform 0.2s, opacity 0.15s;
}
.release-notes-item-toggle:hover .release-notes-item-chevron { opacity: 0.75; }
.release-notes-item-toggle[aria-expanded="true"] .release-notes-item-chevron {
  transform: rotate(180deg);
  opacity: 0.75;
}
.release-notes-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.release-notes-item-title { font-size: 13px; font-weight: 600; color: var(--text); }
.release-notes-item--unread .release-notes-item-title::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  vertical-align: middle;
}
.release-notes-item-version {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(88,166,255,0.12);
  padding: 2px 6px;
  border-radius: 4px;
}
.release-notes-item-date {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}
.release-notes-item-body { padding: 0 16px 10px; }
.release-notes-item-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
}
.release-notes-para {
  margin: 0 0 0.45em;
}
.release-notes-para:last-child {
  margin-bottom: 0;
}

.profile-topbar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  min-height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 12px 3px 3px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  box-sizing: border-box;
}
.profile-topbar-btn:hover {
  background: var(--surface-2);
  border-color: var(--accent);
}
.profile-topbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(88,166,255,0.2);
  border: 1px solid rgba(88,166,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  pointer-events: none;
  overflow: hidden;
  box-sizing: border-box;
}
.profile-topbar-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.profile-topbar-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}
.profile-topbar-role {
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Profile modal ──────────────────────────────────────── */
.profile-modal-header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile-modal-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(88,166,255,0.2);
  border: 2px solid rgba(88,166,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}
.profile-modal-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.profile-modal-login {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.profile-modal-role-badge { margin-top: 5px; }

.profile-modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}
.profile-modal-tab {
  flex: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}
.profile-modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.profile-modal-tab:hover { color: var(--text); }

.profile-perms {
  margin-top: 4px;
}

/* Profile msg (inline feedback) */
.profile-msg {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
}
.profile-msg-success { background: rgba(63,185,80,0.13); color: var(--success); }
.profile-msg-error   { background: rgba(248,81,73,0.13);  color: var(--danger); }
.profile-telegram-field {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  max-width: 320px;
}
.profile-telegram-field:focus-within {
  border-color: var(--accent, #58a6ff);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.18);
}
.profile-telegram-prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 0 8px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  border-right: 1px solid var(--border);
}
.profile-telegram-field .form-control {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  min-height: 44px;
}

.profile-theme-block {
  margin-top: 18px;
  margin-bottom: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.profile-theme-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.profile-theme-status {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  min-height: 1.2em;
}
.profile-theme-status.is-ok { color: var(--success); }
.profile-theme-status.is-err { color: var(--danger); }
.profile-theme-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.profile-theme-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  text-decoration: none;
}
.profile-theme-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
}
.profile-theme-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(88, 166, 255, 0.18));
}
.profile-theme-card.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.profile-theme-preview {
  display: flex;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
}
.profile-theme-preview--light {
  background: #f4f7fb;
}
.profile-theme-preview--light .ptp-sidebar { background: #ffffff; border-right: 1px solid #d0d8e2; }
.profile-theme-preview--light .ptp-bar { background: #1570c9; }
.profile-theme-preview--light .ptp-bar-2 { background: #0d9488; }
.profile-theme-preview--light .ptp-line { background: #d0d8e2; }
.profile-theme-preview--dark {
  background: #0c1017;
}
.profile-theme-preview--dark .ptp-sidebar { background: #141a22; border-right: 1px solid #2a3441; }
.profile-theme-preview--dark .ptp-bar { background: #4db6ff; }
.profile-theme-preview--dark .ptp-bar-2 { background: #2dd4bf; }
.profile-theme-preview--dark .ptp-line { background: #2a3441; }
.ptp-sidebar { width: 22%; }
.ptp-main {
  flex: 1;
  padding: 10px 9px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ptp-bar {
  height: 8px;
  width: 42%;
  border-radius: 999px;
}
.ptp-bar-2 {
  height: 6px;
  width: 28%;
  border-radius: 999px;
  opacity: 0.9;
}
.ptp-line {
  height: 6px;
  width: 88%;
  border-radius: 999px;
}
.ptp-line.short { width: 58%; }
.profile-theme-card-meta { display: flex; flex-direction: column; gap: 2px; }
.profile-theme-card-title { font-size: 13px; font-weight: 600; }
.profile-theme-card-hint { font-size: 12px; color: var(--text-muted); }
.profile-theme-auto {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  cursor: pointer;
  text-decoration: none;
}
.profile-theme-auto:hover { text-decoration: none; }
.profile-theme-auto input {
  margin-top: 2px;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  accent-color: var(--accent, #58a6ff);
  cursor: pointer;
}
.profile-theme-auto-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  line-height: 1.35;
}
.profile-theme-auto-text strong { font-weight: 600; color: var(--text); }
.profile-theme-auto-text small { color: var(--text-muted); font-size: 12px; }
.profile-info-actions {
  margin-top: 0;
}
@media (max-width: 560px) {
  .profile-theme-cards { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .profile-topbar-name, .profile-topbar-role { display: none; }
}

.content { padding: 24px; flex: 1; }

/* ── Section banner (page header with docs link) ─── */
.section-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.section-banner:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.3); }

.section-banner-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  user-select: none;
  -webkit-user-select: none;
}

.section-banner-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.section-banner-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.92;
  line-height: 0;
}
.section-banner-nav-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}
.section-banner-titles {
  flex: 1;
  min-width: 0;
}
.section-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.section-banner-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}
.section-banner-abbr {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--text-muted);
  font-weight: 400;
}
.section-banner-abbr > div + div {
  margin-top: 1px;
}
.section-banner-docs-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--text-muted, #8b949e);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.section-banner-docs-link:hover,
.section-banner-docs-link:focus {
  color: var(--accent, #58a6ff);
  background: rgba(88, 166, 255, 0.1);
  outline: none;
}
.section-banner-docs-icon {
  display: block;
  width: 35px;
  height: 35px;
}

@media (max-width: 600px) {
  .section-banner-header { padding: 12px 14px; }
  .section-banner-title { font-size: 14px; }
}

/* ── Flash messages ──────────────────────── */
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  margin: 0;
  font-size: 14px;
  border-left: 4px solid;
}
.flash-success { background: rgba(63,185,80,0.1); border-color: var(--success); color: var(--success); }
.flash-error   { background: rgba(248,81,73,0.1);  border-color: var(--danger);  color: var(--danger);  }
.flash-warning { background: rgba(210,153,34,0.1); border-color: var(--warning); color: var(--warning); }
.flash-info    { background: var(--accent-soft); border-color: var(--info);    color: var(--info);    }
.flash-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 16px; padding: 0 4px; }

/* ── Admin broadcast banners (top toast) ─── */
.admin-broadcast-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.admin-broadcast-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 20px;
  background: var(--accent-2-soft);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  animation: adminBroadcastSlideIn 0.35s ease-out;
}
body.light-theme .admin-broadcast-banner {
  background: var(--accent-2-soft);
  border-bottom-color: var(--border);
}
.admin-broadcast-banner.is-dismissing {
  animation: adminBroadcastSlideOut 0.25s ease-in forwards;
}
@keyframes adminBroadcastSlideIn {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes adminBroadcastSlideOut {
  from { opacity: 1; transform: translateY(0); max-height: 120px; }
  to { opacity: 0; transform: translateY(-12px); max-height: 0; padding-top: 0; padding-bottom: 0; }
}
.admin-broadcast-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(88,166,255,0.18);
  color: var(--info, #58a6ff);
  font-size: 18px;
  line-height: 1;
}
.admin-broadcast-body { flex: 1; min-width: 0; }
.admin-broadcast-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--info, #58a6ff);
  margin-bottom: 4px;
}
.admin-broadcast-message {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.admin-broadcast-message a.text-link {
  color: var(--info, #58a6ff);
  font-weight: 600;
  text-decoration: none;
}
.admin-broadcast-message a.text-link:hover,
.admin-broadcast-message a.text-link:active {
  color: var(--info, #58a6ff);
  text-decoration: none;
  opacity: 0.88;
}
.admin-broadcast-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.admin-broadcast-close:hover {
  background: rgba(248,81,73,0.15);
  color: var(--danger, #f85149);
}
@media (max-width: 640px) {
  .admin-broadcast-banner { padding: 12px 14px; gap: 10px; }
  .admin-broadcast-icon { width: 30px; height: 30px; }
  .admin-broadcast-message { font-size: 13px; }
}

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 15px; font-weight: 600; color: var(--text); flex: 1; text-align: left; }
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }

.form-card {
  max-width: 800px;
  /* Allow searchable-select dropdowns to extend past the card edge */
  overflow: visible;
}

/* ── Settings layout ─────────────────────── */
.settings-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  max-width: 960px;
}
.settings-layout--wide {
  max-width: 1280px;
}
.settings-sidebar {
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 80px;
}
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.settings-nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none !important;
}
.settings-nav-item:focus,
.settings-nav-item:active { text-decoration: none !important; }
.settings-nav-item.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  font-weight: 600;
}
.settings-nav-item--locked {
  opacity: 0.45;
  cursor: not-allowed;
  position: relative;
  color: var(--text-muted);
  user-select: none;
}
.settings-nav-item--locked:hover,
.settings-nav-item--locked.is-tip-open {
  background: rgba(127, 127, 127, 0.08);
  color: var(--text-muted);
  text-decoration: none !important;
  opacity: 0.72;
}
.dropdown-item--locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn--locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.settings-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
  line-height: 1;
}
.settings-nav-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.settings-main { flex: 1; min-width: 0; }
.settings-main .form-card { max-width: none; }
.sidebar-settings-card { overflow: hidden; }
.sidebar-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.sidebar-settings-subtitle {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
}
.sidebar-core-note {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 13px 15px;
  border: 1px solid rgba(88, 166, 255, 0.24);
  border-radius: 10px;
  background: rgba(88, 166, 255, 0.07);
}
.sidebar-core-note-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--accent);
}
.sidebar-core-note-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.sidebar-core-note div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}
.sidebar-core-note span:last-child { color: var(--text-muted); }
.sidebar-settings-grid {
  column-count: 2;
  column-gap: 14px;
}
.sidebar-settings-group {
  display: inline-block;
  width: 100%;
  overflow: hidden;
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  break-inside: avoid;
}
.sidebar-settings-group h4 {
  margin: 0;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.sidebar-settings-items {
  display: flex;
  flex-direction: column;
}
.sidebar-settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.sidebar-settings-item:last-child { border-bottom: 0; }
.sidebar-settings-item:hover { background: rgba(88, 166, 255, 0.06); }
.sidebar-settings-item.is-locked { cursor: help; }
.sidebar-settings-item.is-locked:hover { background: rgba(139, 148, 158, 0.06); }
.sidebar-settings-item-main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.sidebar-settings-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: var(--text-muted);
}
.sidebar-settings-item-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.sidebar-settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.sidebar-settings-footer p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}
.sidebar-save-status.success { color: var(--success); }
.sidebar-save-status.error { color: var(--danger); }
.sidebar-nav .nav-item[hidden],
.sidebar-nav .nav-section[hidden] { display: none !important; }
.backup-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.backup-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 100px;
}
.backup-stat-value { font-size: 22px; font-weight: 700; color: var(--text); }
.backup-stat-label { font-size: 12px; color: var(--text-muted); }
.backup-warning {
  padding: 14px 16px;
  margin-bottom: 20px;
  border-radius: 8px;
  border: 1px solid rgba(248, 81, 73, 0.35);
  background: rgba(248, 81, 73, 0.08);
  color: var(--text);
}
.backup-warning p { margin: 8px 0 0; font-size: 14px; line-height: 1.5; }
.backup-preview-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
.backup-preview-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 10px;
}
.backup-preview-group { margin-bottom: 8px; }
.backup-preview-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border);
}
.backup-preview-group-total {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.backup-preview-table { margin-bottom: 0; }
.backup-preview-table td,
.backup-preview-table th { padding: 8px 12px; font-size: 13px; }
.backup-preview-table tfoot td {
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.backup-preview-count,
.backup-preview-value {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.text-right { text-align: right; }
.backup-preview-note { font-size: 13px; margin: 8px 0 0; }
.backup-preview-excluded {
  margin: 0;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}
@media (max-width: 768px) {
  .settings-layout { flex-direction: column; }
  .settings-sidebar {
    flex: none;
    width: 100%;
    flex-direction: row;
    position: static;
    overflow-x: auto;
  }
  .settings-nav-item { white-space: nowrap; }
  .sidebar-settings-grid { column-count: 1; }
  .sidebar-settings-footer {
    align-items: stretch;
    flex-direction: column;
  }
  .sidebar-settings-footer .btn { width: 100%; }
}

/* ── Tables ──────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.table th[data-col^="cf_"],
.table th.cf-col {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}
.detail-custom-fields .detail-section-title,
.detail-custom-fields .detail-list dt {
  font-weight: 400;
}
.item-mobile-meta__row[data-col^="cf_"] dt {
  font-weight: 400;
}
.table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.table td code {
  display: inline-block;
  max-width: 100%;
  box-sizing: border-box;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: var(--surface-2); }

.table-sortable-header {
  position: relative;
  padding-right: 28px !important;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, background 0.15s;
}
.table-sortable-header::after {
  content: '↕';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 11px;
  opacity: 0.45;
}
.table-sortable-header:hover,
.table-sortable-header:focus-visible {
  color: var(--accent);
  background: rgba(88, 166, 255, 0.08);
  outline: none;
}
.table-sortable-header:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(88, 166, 255, 0.35);
}
.table-sortable-header.table-sort--asc::after {
  content: '↑';
  color: var(--accent);
  opacity: 1;
}
.table-sortable-header.table-sort--desc::after {
  content: '↓';
  color: var(--accent);
  opacity: 1;
}

.table td.cell-copyable {
  cursor: copy;
  transition: background 0.15s;
}
.table td.cell-copyable:hover {
  background: rgba(88,166,255,0.08);
}
.table td.cell-copyable--flash {
  background: rgba(63,185,80,0.14);
}

.copy-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  z-index: 10000;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--success);
  color: var(--success);
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.copy-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.text-center { text-align: center; }

/* ── Forms ───────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.form-control {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  box-sizing: border-box;
  background: var(--surface-2, var(--bg));
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.35;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.form-control:hover:not(:disabled):not(:focus) {
  border-color: color-mix(in srgb, var(--border) 45%, var(--text-muted));
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
  background: var(--surface);
}
.form-control::placeholder {
  color: var(--text-muted);
  opacity: 0.82;
}
.form-control:disabled,
.form-control[readonly] {
  cursor: not-allowed;
  opacity: 0.68;
  background: color-mix(in srgb, var(--surface-2, var(--bg)) 76%, var(--border));
}
select.form-control {
  cursor: pointer;
  color-scheme: dark;
}
select.form-control option,
select.form-control optgroup {
  background: var(--surface);
  color: var(--text);
}
html.light-theme select.form-control,
body.light-theme select.form-control { color-scheme: light; }
textarea.form-control {
  resize: vertical;
  min-height: 96px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
textarea.form-control::-webkit-scrollbar { width: 6px; }
textarea.form-control::-webkit-scrollbar-track { background: transparent; }
textarea.form-control::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
textarea.form-control::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

.form-row[hidden],
.form-group[hidden] {
  display: none !important;
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 180px; }
.col-4 { flex: 0 0 calc(33.33% - 11px); }
.col-6 { flex: 0 0 calc(50% - 8px); }
.col-8 { flex: 0 0 calc(66.67% - 11px); }

.form-actions { display: flex; gap: 10px; margin-top: 24px; }
.required { color: var(--danger); }

.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
}
.checkbox-wrap input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-secondary:hover { background: var(--border); opacity: 1; }
.btn-primary {
  background: var(--accent-strong, var(--accent));
  color: var(--on-accent, #0d1117);
  border-color: var(--accent-strong, var(--accent));
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent, #0d1117);
  opacity: 1;
}
.btn-danger    { background: var(--danger);   color: #fff;    border-color: var(--danger); }
.btn-danger:hover { opacity: 0.9; }
.btn-secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-warning   { background: var(--warning);  color: #0d1117; border-color: var(--warning); }
.btn-warning:hover { opacity: 0.9; }
.btn-info      { background: var(--accent-2); color: var(--on-accent-2, #0d1117); border-color: var(--accent-2); }
.btn-info:hover {
  background: var(--accent-2-hover);
  border-color: var(--accent-2-hover);
  color: var(--on-accent-2, #0d1117);
  opacity: 1;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }

/* Compact action buttons in table rows (reference: /stock/replacements) */
.table-row-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
}
.table-row-actions .btn,
.table-row-actions .btn-sm,
.table td.actions .btn,
.table td.actions .btn-sm {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1;
  font-weight: 400;
  white-space: nowrap;
  text-align: center;
  vertical-align: middle;
}
.table-row-actions .dropdown,
.table td.actions .dropdown,
.table-row-actions .status-dropdown,
.table td.actions .status-dropdown {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.table-row-actions .inline-form,
.table td.actions .inline-form {
  display: inline-flex;
  align-items: center;
  margin: 0;
  vertical-align: middle;
}
.table td.actions {
  width: 1%;
  white-space: nowrap;
  vertical-align: middle;
}

/* Icons inside buttons — Lucide outline, inherits button color */
.btn-icon,
.btn-icon-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: inherit;
  opacity: 1;
}
.btn-icon svg,
.btn-icon-plus svg {
  width: 14px;
  height: 14px;
  display: block;
  stroke: currentColor;
}
.btn-sm .btn-icon,
.btn-sm .btn-icon-plus,
.btn-sm .btn-icon svg,
.btn-sm .btn-icon-plus svg {
  width: 12px;
  height: 12px;
}

/* ── Star / Favourite button ─────────────── */
.btn-icon-star {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-icon-star:hover {
  color: #e3b341;
  border-color: #e3b341;
  background: rgba(227,179,65,0.08);
  opacity: 1;
}
.btn-icon-star.is-favorite {
  color: #e3b341;
  border-color: #e3b341;
  background: rgba(227,179,65,0.12);
}

/* ── Badges ──────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-success { background: rgba(63,185,80,0.15); color: var(--success); }
.badge-danger  { background: rgba(248,81,73,0.15); color: var(--danger); }
.badge-warning { background: rgba(210,153,34,0.15); color: var(--warning); }
.badge-info    { background: var(--accent-2-soft); color: var(--accent-2); }
.badge-perm    { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); margin: 2px 2px; }

/* Status badges */
.badge-status-active      { background: rgba(63,185,80,0.15); color: var(--success); }
.badge-status-in_repair   { background: rgba(210,153,34,0.15); color: var(--warning); }
.badge-status-written_off { background: rgba(248,81,73,0.15); color: var(--danger); }
.badge-status-transferred { background: var(--accent-2-soft); color: var(--accent-2); }

/* Condition badges */
.badge-condition-excellent { background: rgba(63,185,80,0.15); color: var(--success); }
.badge-condition-good      { background: var(--accent-2-soft); color: var(--accent-2); }
.badge-condition-fair      { background: rgba(210,153,34,0.15); color: var(--warning); }
.badge-condition-poor      { background: rgba(248,81,73,0.15); color: var(--danger); }

/* ── Audit (stocktaking) badges ──────────── */
.badge-audit-draft       { background: rgba(139,148,158,0.15); color: var(--text-muted); }
.badge-audit-in_progress { background: var(--accent-2-soft);  color: var(--accent-2); }
.badge-audit-completed   { background: rgba(63,185,80,0.15);   color: var(--success); }
.badge-audit-cancelled   { background: rgba(248,81,73,0.15);   color: var(--danger); }

.badge-audit-item-pending     { background: rgba(139,148,158,0.15); color: var(--text-muted); }
.badge-audit-item-found       { background: rgba(63,185,80,0.15);   color: var(--success); }
.badge-audit-item-not_found   { background: rgba(248,81,73,0.15);   color: var(--danger); }
.badge-audit-item-discrepancy { background: rgba(210,153,34,0.15);  color: var(--warning); }

/* ── Item request badges ─────────────────── */
.badge-req-pending   { background: rgba(210,153,34,0.15);  color: var(--warning); }
.badge-req-approved  { background: rgba(63,185,80,0.15);   color: var(--success); }
.badge-req-rejected  { background: rgba(248,81,73,0.15);   color: var(--danger); }
.badge-req-cancelled { background: rgba(139,148,158,0.15); color: var(--text-muted); }
.badge-req-completed { background: var(--accent-2-soft);  color: var(--accent-2); }

/* ── Purchase / procurement badges ───────── */
.badge-purchase-draft              { background: rgba(139,148,158,0.15); color: var(--text-muted); }
.badge-purchase-pending            { background: rgba(210,153,34,0.15);  color: var(--warning); }
.badge-purchase-approved           { background: var(--accent-2-soft);  color: var(--accent-2); }
.badge-purchase-ordered            { background: rgba(59,130,246,0.15);  color: #3b82f6; }
.badge-purchase-partially_received { background: rgba(210,153,34,0.15);  color: var(--warning); }
.badge-purchase-received           { background: rgba(63,185,80,0.15);   color: var(--success); }
.badge-purchase-rejected           { background: rgba(248,81,73,0.15);   color: var(--danger); }
.badge-purchase-cancelled          { background: rgba(139,148,158,0.15); color: var(--text-muted); }

.badge-mol-active   { background: rgba(63,185,80,0.15); color: var(--success); }
.badge-mol-inactive { background: rgba(139,148,158,0.15); color: var(--text-muted); }
.badge-mol-transfer-draft              { background: rgba(139,148,158,0.15); color: var(--text-muted); }
.badge-mol-transfer-pending_acceptance { background: rgba(210,153,34,0.15);  color: var(--warning); }
.badge-mol-transfer-accepted           { background: rgba(63,185,80,0.15);   color: var(--success); }
.badge-mol-transfer-cancelled          { background: rgba(248,81,73,0.15);   color: var(--danger); }

.badge-pubrep-new         { background: rgba(210,153,34,0.15);  color: var(--warning); }
.badge-pubrep-in_progress { background: var(--accent-2-soft);  color: var(--accent-2); }
.badge-pubrep-resolved    { background: rgba(63,185,80,0.15);   color: var(--success); }
.badge-pubrep-rejected    { background: rgba(248,81,73,0.15);   color: var(--danger); }
.badge-pubrep-spam        { background: rgba(139,148,158,0.15); color: var(--text-muted); }

/* ── Audit table row highlights ──────────── */
.row-success td { background: rgba(63,185,80,0.04); }
.row-warning td { background: rgba(210,153,34,0.06); }
.row-danger  td { background: rgba(248,81,73,0.06); }

/* ── Page header ─────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-title-text { font-size: 20px; font-weight: 700; color: var(--text); }

/* ── Toolbar / search ────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.search-input { max-width: 220px; }
.filter-select { width: auto; min-width: 120px; max-width: 180px; flex: 0 1 auto; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; }
.toolbar-row-2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  flex-wrap: nowrap;
}
.toolbar-row-2 > .toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

/* ── Form field hints ────────────────────── */
.form-hint {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  line-height: 1.35;
  color: color-mix(in srgb, var(--text-muted) 78%, transparent);
}

/* ── MOL create/edit form ────────────────── */
.mol-form-card {
  max-width: 720px;
}
.mol-form-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mol-form-body > .form-group {
  margin-bottom: 0;
}
.mol-form-body .form-label {
  margin-bottom: 4px;
}
.mol-form-body .form-control {
  min-height: 40px;
}
.mol-form-body textarea.form-control {
  min-height: 0;
}
.mol-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mol-form-grid > .form-group {
  margin-bottom: 0;
}
.mol-form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}
.mol-form-submit {
  align-self: flex-start;
  margin-top: 4px;
}
.mol-form-body .ms-trigger {
  min-height: 40px;
  padding: 8px 12px;
}

/* ── Styled scrollbar ────────────────────── */
.card-body.p-0 {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.card-body.p-0::-webkit-scrollbar { height: 6px; }
.card-body.p-0::-webkit-scrollbar-track { background: transparent; }
.card-body.p-0::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.card-body.p-0::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Sidebar scrollbar ───────────────────── */
.sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Bulk action bar ────────────────────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.bulk-count { font-weight: 600; font-size: 14px; color: var(--accent); white-space: nowrap; }
.bulk-bar .bulk-bar-select,
.bulk-bar .btn {
  min-height: 38px;
  box-sizing: border-box;
}
.bulk-bar .btn {
  padding: 8px 16px;
  font-size: 14px;
  line-height: 1.2;
  align-items: center;
}
.bulk-bar .btn.btn-sm,
.bulk-bar .btn-archive-inline {
  padding: 8px 16px;
  font-size: 14px;
  min-height: 38px;
}

.modal--bulk-edit {
  width: min(480px, 96vw);
}
.bulk-edit-warning {
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, #dc2626 35%, var(--border));
  background: color-mix(in srgb, #dc2626 10%, var(--surface));
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}
.bulk-edit-warning strong {
  color: #dc2626;
}
.bulk-edit-count {
  margin: 0 0 12px;
  font-size: 13px;
}

/* ── Sidebar footer ─────────────────────── */
.sidebar-footer {
  padding: 8px 8px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(88,166,255,0.06) 0%, transparent 100%);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}
.sidebar-collapse-btn:hover {
  background: rgba(88,166,255,0.1);
  border-color: rgba(88,166,255,0.35);
  color: var(--accent);
  box-shadow: 0 0 0 1px rgba(88,166,255,0.08);
}
.sidebar-collapse-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.92;
  color: inherit;
  transition: transform 0.22s ease;
}
.sidebar-collapse-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.sidebar-collapse-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Collapsed sidebar (desktop only) ───── */
@media (min-width: 769px) {
  html.sidebar-collapsed {
    --sidebar-width: var(--sidebar-collapsed-width);
  }
  html.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 0 8px;
  }
  html.sidebar-collapsed .brand-text,
  html.sidebar-collapsed .nav-section-label,
  html.sidebar-collapsed .nav-badge,
  html.sidebar-collapsed .sidebar-favorites-empty,
  html.sidebar-collapsed .sidebar-favorites-manage-label,
  html.sidebar-collapsed .sidebar-collapse-label {
    display: none;
  }
  /* Icons-only mode: always show section items regardless of accordion state */
  html.sidebar-collapsed .nav-section.is-collapsed > .nav-section-items {
    display: block;
  }
  html.sidebar-collapsed .brand-logo-wrap {
    flex: none;
    width: 36px;
    height: 36px;
    justify-content: center;
    align-items: center;
    overflow: visible;
  }
  html.sidebar-collapsed .brand-logo-img {
    max-height: 32px;
    max-width: 32px;
    width: auto;
    height: auto;
    object-fit: contain;
    object-position: center;
  }
  html.sidebar-collapsed .nav-section:not([hidden]) ~ .nav-section:not([hidden]) {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
  }
  html.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 10px 8px;
    font-size: 0;
    gap: 0;
  }
  html.sidebar-collapsed .nav-icon {
    width: 20px;
    height: 20px;
  }
  html.sidebar-collapsed .nav-icon svg {
    width: 20px;
    height: 20px;
  }
  html.sidebar-collapsed .sidebar-collapse-btn {
    justify-content: center;
    padding: 10px 8px;
    margin-top: 4px;
  }
  html.sidebar-collapsed .sidebar-favorites {
    margin: 2px 2px 6px;
    padding: 4px 0 4px;
    border-radius: 8px;
    box-shadow: none;
    background: color-mix(in srgb, var(--fav-gold) 8%, var(--surface-2));
    border-color: color-mix(in srgb, var(--fav-gold) 22%, var(--border));
  }
  html.sidebar-collapsed .sidebar-favorites .nav-section-items-inner {
    padding: 0;
  }
  html.sidebar-collapsed .sidebar-favorites .sidebar-favorites-label {
    display: flex !important;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 4px 0 2px;
    margin: 0;
    min-height: 0;
    pointer-events: none;
  }
  html.sidebar-collapsed .sidebar-favorites-label .nav-section-label-text,
  html.sidebar-collapsed .sidebar-favorites-label .nav-section-chevron {
    display: none;
  }
  html.sidebar-collapsed .sidebar-favorites-label-icon {
    width: 18px;
    height: 18px;
  }
  html.sidebar-collapsed .sidebar-favorites-label-icon .nav-icon,
  html.sidebar-collapsed .sidebar-favorites-label-icon .nav-icon svg {
    width: 16px;
    height: 16px;
  }
  html.sidebar-collapsed .sidebar-favorites-list .sidebar-favorite-link {
    justify-content: center;
    align-items: center;
    width: calc(100% - 4px);
    margin: 0 2px 2px;
    padding: 10px 0;
    border: none;
    background: transparent;
    border-radius: 8px;
  }
  html.sidebar-collapsed .sidebar-favorites-list .sidebar-favorite-link:hover {
    border: none;
    background: var(--fav-gold-soft);
    color: var(--text);
  }
  html.sidebar-collapsed .sidebar-favorites-list .sidebar-favorite-link.active {
    border: none;
    background: color-mix(in srgb, var(--fav-gold) 18%, transparent);
    color: var(--fav-gold);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fav-gold) 35%, transparent);
  }
  html.sidebar-collapsed .sidebar-favorites-manage {
    display: flex;
    justify-content: center;
    align-items: center;
    width: calc(100% - 4px);
    margin: 1px 2px 0;
    min-height: 40px;
    padding: 10px 0;
    border-style: solid;
    border-radius: 8px;
  }
  html.sidebar-collapsed .sidebar-favorites-manage .nav-icon {
    width: 20px;
    height: 20px;
  }
  html.sidebar-collapsed .sidebar-favorites-manage .nav-icon svg {
    width: 18px;
    height: 18px;
  }
  html.sidebar-collapsed .sidebar-collapse-icon {
    transform: rotate(180deg);
  }
}

/* ── Pagination ──────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
}
.page-info { color: var(--text-muted); font-size: 13px; }

/* Page size: 50 / 100 / 150 / 200 — segmented control with clear hit targets */
.per-page-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.per-page-control-label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.per-page-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2, var(--bg));
}
.per-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 34px;
  padding: 6px 12px;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none !important;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.per-page-btn + .per-page-btn {
  border-left: 1px solid var(--border);
}
.per-page-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  text-decoration: none !important;
}
html.light-theme .per-page-btn:hover,
body.light-theme .per-page-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}
.per-page-btn.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}
.pagination .per-page-control {
  margin-left: 4px;
}
@media (max-width: 640px) {
  .pagination .per-page-control {
    width: 100%;
    justify-content: center;
    margin-left: 0;
    padding-top: 4px;
  }
  .per-page-toggle {
    flex: 1;
  }
  .per-page-btn {
    flex: 1;
  }
}

/* ── Stats grid ──────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  border-top: 3px solid var(--border);
}
.stat-active  { border-top-color: var(--success); }
.stat-warning { border-top-color: var(--warning); }
.stat-danger  { border-top-color: var(--danger); }
.stat-info    { border-top-color: var(--info); }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Dashboard charts grid (legacy kept for reference) ───────────────── */
.dashboard-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.dashboard-charts-grid .card,
.dashboard-half-row .card {
  margin-bottom: 0;
}

.dashboard-half-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* ── Activation onboarding checklist ─────── */
.onboarding-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px 14px;
  margin-bottom: 16px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.14);
  border-left: 3px solid var(--accent);
  transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}
.onboarding-card.onboarding-card-highlight {
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.35), 0 8px 32px rgba(88, 166, 255, 0.15);
  border-left-color: var(--accent-hover);
}
.onboarding-card.is-dismissing {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.onboarding-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.onboarding-card.is-collapsed .onboarding-header {
  margin-bottom: 0;
}
.onboarding-card.is-collapsed .onboarding-card-body {
  display: none;
}
.onboarding-header-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.onboarding-action-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 5px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.onboarding-action-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface-2);
}
.onboarding-action-btn-danger:hover {
  color: var(--danger);
  border-color: rgba(248, 81, 73, 0.45);
  background: rgba(248, 81, 73, 0.08);
}
.onboarding-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 2px;
}
.onboarding-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}
.onboarding-dismiss-btn {
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.onboarding-dismiss-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface-2);
}
.onboarding-optional {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.onboarding-optional-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.onboarding-step-optional.is-active {
  border-color: var(--border);
  background: var(--surface);
  opacity: 1;
}
.onboarding-step-optional .onboarding-step-marker {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 14px;
}
.onboarding-step-optional.is-done .onboarding-step-marker {
  background: rgba(63, 185, 80, 0.12);
  border-color: rgba(63, 185, 80, 0.35);
  color: var(--success);
}
.onboarding-progress {
  height: 4px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 4px;
}
.onboarding-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.35s ease;
}
.onboarding-progress-label {
  font-size: 10px;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.onboarding-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.onboarding-step {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
}
.onboarding-step.is-done {
  padding: 6px 10px;
}
.onboarding-step.is-done {
  border-color: rgba(63, 185, 80, 0.35);
  background: rgba(63, 185, 80, 0.06);
}
.onboarding-step.is-active {
  border-color: rgba(88, 166, 255, 0.45);
  background: rgba(88, 166, 255, 0.06);
}
.onboarding-step.is-locked {
  opacity: 0.55;
}
.onboarding-step-marker {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.onboarding-step.is-done .onboarding-step-marker {
  background: rgba(63, 185, 80, 0.15);
  border-color: var(--success);
  color: var(--success);
}
.onboarding-step.is-active .onboarding-step-marker {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.onboarding-step-body {
  flex: 1;
  min-width: 0;
}
.onboarding-step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}
.onboarding-step.is-done .onboarding-step-title {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: rgba(139, 148, 158, 0.5);
}
.onboarding-step-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin: 3px 0 0;
  line-height: 1.4;
}
.onboarding-step-cta {
  flex-shrink: 0;
  text-decoration: none;
  padding: 3px 10px !important;
  font-size: 11px !important;
  line-height: 1.4;
  white-space: nowrap;
}
.onboarding-step-cta-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  align-items: stretch;
}
.onboarding-step-cta-group .onboarding-step-cta {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
@media (min-width: 720px) {
  .onboarding-step-cta-group {
    flex-direction: row;
    align-items: center;
  }
}
.onboarding-step-hint {
  flex-shrink: 0;
  font-size: 10px;
  white-space: nowrap;
}
.onboarding-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}
.onboarding-preset-chip {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2, var(--surface));
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.onboarding-preset-chip:hover {
  border-color: var(--accent, #3b82f6);
  background: var(--surface);
  text-decoration: none;
}
.onboarding-preset-chip:active {
  filter: brightness(0.92);
}
.onboarding-preset-chip:disabled,
.onboarding-preset-chip.is-loading {
  opacity: 0.55;
  cursor: wait;
}
.onboarding-preset-hint {
  margin: 4px 0 0;
  font-size: 0.8rem;
}
@media (max-width: 600px) {
  .onboarding-card { padding: 12px; }
  .onboarding-header { flex-direction: column; gap: 10px; }
  .onboarding-header-actions { align-self: stretch; justify-content: flex-end; }
}

/* ── First-run company preset chooser ───── */
.preset-onboarding-lock {
  overflow: hidden;
}
.preset-onboarding-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10070;
  background: rgba(5, 10, 18, 0.76);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}
.preset-onboarding-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.preset-onboarding-modal {
  position: fixed;
  z-index: 10071;
  inset: auto 0 0;
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 900px);
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.48);
  opacity: 0;
  pointer-events: none;
  transform: translateY(32px);
  transition: opacity 0.24s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.preset-onboarding-modal.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.preset-onboarding-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 22px 18px 16px;
  border-bottom: 1px solid var(--border, #30363d);
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.13), rgba(63, 185, 80, 0.05));
}
.preset-onboarding-mark {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--accent, #58a6ff);
  color: #fff;
  font-size: 20px;
  box-shadow: 0 8px 24px rgba(88, 166, 255, 0.28);
}
.preset-onboarding-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--accent, #58a6ff);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.preset-onboarding-header h2 {
  margin: 0;
  color: var(--text, #e6edf3);
  font-size: 20px;
  line-height: 1.25;
}
.preset-onboarding-header p {
  margin: 7px 0 0;
  color: var(--text-muted, #8b949e);
  font-size: 13px;
  line-height: 1.5;
}
.preset-onboarding-content {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--border, #30363d) transparent;
}
.preset-onboarding-content::-webkit-scrollbar {
  width: 7px;
}
.preset-onboarding-content::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--border, #30363d);
}
.preset-onboarding-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.preset-onboarding-search > span {
  position: absolute;
  left: 15px;
  color: var(--text-muted, #8b949e);
  font-size: 22px;
  pointer-events: none;
}
.preset-onboarding-search input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px 11px 44px;
  border: 1px solid var(--border, #30363d);
  border-radius: 12px;
  outline: 0;
  background: var(--surface-2, #21262d);
  color: var(--text, #e6edf3);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.preset-onboarding-search input:focus {
  border-color: var(--accent, #58a6ff);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}
.preset-onboarding-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}
.preset-onboarding-option[hidden] {
  display: none !important;
}
.preset-onboarding-option {
  display: block;
  min-width: 0;
  cursor: pointer;
}
.preset-onboarding-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.preset-onboarding-option-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 82px;
  padding: 12px 42px 12px 12px;
  border: 1px solid var(--border, #30363d);
  border-radius: 13px;
  background: var(--surface-2, #21262d);
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}
.preset-onboarding-option:hover .preset-onboarding-option-card {
  border-color: rgba(88, 166, 255, 0.58);
  background: color-mix(in srgb, var(--surface-2, #21262d) 88%, var(--accent, #58a6ff));
}
.preset-onboarding-option:active .preset-onboarding-option-card {
  transform: scale(0.99);
}
.preset-onboarding-option input:focus-visible + .preset-onboarding-option-card {
  outline: 3px solid rgba(88, 166, 255, 0.32);
  outline-offset: 2px;
}
.preset-onboarding-option input:checked + .preset-onboarding-option-card {
  border-color: var(--accent, #58a6ff);
  background: rgba(88, 166, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(88, 166, 255, 0.2);
}
.preset-onboarding-option-icon {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(88, 166, 255, 0.12);
  font-size: 24px;
}
.preset-onboarding-option-icon.preset-accent-green { background: rgba(63, 185, 80, 0.13); }
.preset-onboarding-option-icon.preset-accent-orange,
.preset-onboarding-option-icon.preset-accent-coral,
.preset-onboarding-option-icon.preset-accent-yellow { background: rgba(210, 153, 34, 0.14); }
.preset-onboarding-option-icon.preset-accent-red,
.preset-onboarding-option-icon.preset-accent-pink { background: rgba(248, 81, 73, 0.13); }
.preset-onboarding-option-icon.preset-accent-purple,
.preset-onboarding-option-icon.preset-accent-indigo { background: rgba(188, 140, 255, 0.13); }
.preset-onboarding-option-icon.preset-accent-teal,
.preset-onboarding-option-icon.preset-accent-cyan { background: rgba(45, 212, 191, 0.13); }
.preset-onboarding-option-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}
.preset-onboarding-option-copy strong {
  color: var(--text, #e6edf3);
  font-size: 14px;
  line-height: 1.3;
}
.preset-onboarding-option-copy > span {
  color: var(--text-muted, #8b949e);
  font-size: 12px;
  line-height: 1.35;
}
.preset-onboarding-option-copy small {
  color: var(--accent, #58a6ff);
  font-size: 10px;
  line-height: 1.3;
}
.preset-onboarding-check {
  position: absolute;
  top: 50%;
  right: 14px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border, #30363d);
  border-radius: 50%;
  color: transparent;
  transform: translateY(-50%);
}
.preset-onboarding-option input:checked + .preset-onboarding-option-card .preset-onboarding-check {
  border-color: var(--accent, #58a6ff);
  background: var(--accent, #58a6ff);
  color: #fff;
}
.preset-onboarding-empty {
  margin: 18px 0 4px;
  color: var(--text-muted, #8b949e);
  font-size: 13px;
  text-align: center;
}
.preset-onboarding-footer {
  display: flex;
  flex-direction: column-reverse;
  gap: 12px;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border, #30363d);
  background: var(--surface, #161b22);
}
.preset-onboarding-skip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(88, 166, 255, 0.34);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.09), rgba(188, 140, 255, 0.06));
  color: var(--text, #e6edf3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}
.preset-onboarding-skip::before {
  content: "✎";
  color: var(--accent, #58a6ff);
  font-size: 16px;
}
.preset-onboarding-skip:hover {
  color: var(--text, #e6edf3);
  border-color: var(--accent, #58a6ff);
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.16), rgba(188, 140, 255, 0.1));
  text-decoration: none;
}
.preset-onboarding-skip:active {
  transform: scale(0.98);
}
.preset-onboarding-skip:disabled {
  opacity: 0.58;
  cursor: wait;
}
.preset-onboarding-primary-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.preset-onboarding-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 210px;
  text-align: center;
}
.preset-onboarding-status {
  color: var(--text-muted, #8b949e);
  font-size: 11px;
  text-align: center;
}

@media (min-width: 760px) {
  .preset-onboarding-modal {
    inset: 50% auto auto 50%;
    width: min(920px, calc(100vw - 40px));
    max-height: min(86vh, 780px);
    border-bottom: 1px solid var(--border, #30363d);
    border-radius: 20px;
    transform: translate(-50%, calc(-50% + 24px)) scale(0.98);
  }
  .preset-onboarding-modal.is-open {
    transform: translate(-50%, -50%) scale(1);
  }
  .preset-onboarding-header {
    padding: 24px 26px 18px;
  }
  .preset-onboarding-header h2 {
    font-size: 23px;
  }
  .preset-onboarding-content {
    padding: 18px 26px 22px;
  }
  .preset-onboarding-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .preset-onboarding-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 14px 26px 18px;
  }
  .preset-onboarding-primary-wrap {
    align-items: flex-end;
  }
  .preset-onboarding-status {
    text-align: right;
  }
}

.dest-onboarding-mark {
  background: var(--success, #3ecf7a);
  box-shadow: 0 8px 24px rgba(62, 207, 122, 0.28);
}
.dest-onboarding-content {
  padding-top: 14px;
}
.dest-onboarding-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.dest-onboarding-card {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 14px 12px 14px 14px;
  border: 1px solid var(--border, #30363d);
  border-radius: 16px;
  background: var(--surface-2, #21262d);
  color: var(--text, #e6edf3);
  text-decoration: none;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
}
.dest-onboarding-card:hover,
.dest-onboarding-card:focus-visible {
  color: var(--text, #e6edf3);
  text-decoration: none;
  border-color: var(--accent, #58a6ff);
  background: color-mix(in srgb, var(--surface-2, #21262d) 86%, var(--accent, #58a6ff));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
.dest-onboarding-card:active,
.dest-onboarding-card.is-opening {
  transform: scale(0.985);
  filter: brightness(0.92);
}
.dest-onboarding-card:focus-visible {
  outline: 3px solid rgba(88, 166, 255, 0.32);
  outline-offset: 2px;
}
.dest-onboarding-icon {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: var(--accent, #58a6ff);
  background: rgba(88, 166, 255, 0.12);
}
.dest-onboarding-nav-icon,
.dest-onboarding-icon .nav-icon,
.dest-onboarding-icon .dest-onboarding-nav-icon {
  width: 24px;
  height: 24px;
  opacity: 1;
}
.dest-onboarding-icon svg,
.dest-onboarding-nav-icon svg {
  width: 24px;
  height: 24px;
}
.dest-accent-items .dest-onboarding-icon {
  color: var(--accent, #4db6ff);
  background: var(--accent-soft, rgba(77, 182, 255, 0.14));
}
.dest-accent-stock .dest-onboarding-icon {
  color: var(--accent-2, #2dd4bf);
  background: var(--accent-2-soft, rgba(45, 212, 191, 0.14));
}
.dest-accent-stocktaking .dest-onboarding-icon {
  color: var(--warning, #e6b84d);
  background: rgba(230, 184, 77, 0.16);
}
.dest-accent-tickets .dest-onboarding-icon {
  color: #bc8cff;
  background: rgba(188, 140, 255, 0.14);
}
html.light-theme .dest-accent-tickets .dest-onboarding-icon,
body.light-theme .dest-accent-tickets .dest-onboarding-icon {
  color: #6d28d9;
  background: rgba(109, 40, 217, 0.12);
}
.dest-onboarding-copy {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}
.dest-onboarding-copy strong {
  color: var(--text, #e6edf3);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}
.dest-onboarding-copy span {
  color: var(--text-muted, #8b949e);
  font-size: 13px;
  line-height: 1.4;
}
.dest-onboarding-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 11px;
  background: var(--accent, #58a6ff);
  color: var(--on-accent, #0c1017);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.dest-onboarding-go::after {
  content: "→";
  margin-left: 6px;
}
.dest-onboarding-card:hover .dest-onboarding-go,
.dest-onboarding-card:focus-visible .dest-onboarding-go {
  background: var(--accent-hover, #7ec8ff);
}
.dest-onboarding-stay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border, #30363d);
  border-radius: 12px;
  background: transparent;
  color: var(--text, #e6edf3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}
.dest-onboarding-stay:hover {
  color: var(--text, #e6edf3);
  border-color: var(--accent, #58a6ff);
  background: var(--accent-soft, rgba(77, 182, 255, 0.14));
  text-decoration: none;
}
.dest-onboarding-stay:active {
  transform: scale(0.98);
}
.dest-onboarding-footer {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.dest-onboarding-hint {
  margin: 0;
  color: var(--text-muted, #8b949e);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}

@media (min-width: 760px) {
  .dest-onboarding-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .dest-onboarding-card {
    min-height: 112px;
    padding: 16px;
  }
  .dest-onboarding-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .dest-onboarding-hint {
    max-width: 360px;
    text-align: right;
  }
}

/* ── Dashboard widget grid ───────────────── */
.dashboard-boards-bar {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
  width: 100%;
}

.dashboard-boards-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-board-tabs-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
}

.dashboard-board-tabs-row .dashboard-board-tabs {
  flex: 1 1 auto;
  min-width: 0;
}

.dashboard-board-tab-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-right: 6px;
  border-radius: 6px;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
}

.dashboard-board-tab.is-active .dashboard-board-tab-lock {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.dashboard-board-tab-lock .nav-icon,
.dashboard-board-tab-lock .dashboard-board-tab-lock-icon {
  width: 14px;
  height: 14px;
}

.dashboard-board-tab-lock .nav-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.dashboard-board-tab-label-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-dash-list-view { margin-bottom: 24px; }
.admin-dash-list-view > .toolbar {
  align-items: center;
  gap: 16px;
}
.admin-dash-list-lead {
  font-size: 13px;
  line-height: 1.35;
  text-align: right;
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-dash-preset-table { margin-bottom: 0; }
.admin-dash-preset-name-link {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.admin-dash-preset-name-link:hover {
  color: var(--accent);
  text-decoration: none;
}
.admin-dash-editor-toolbar {
  margin-bottom: 16px;
}
.admin-dash-editor-toolbar .toolbar-row-2 {
  gap: 12px;
}
.admin-dash-editor-toolbar .toolbar-actions .admin-dash-save-status {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  line-height: 1.35;
  font-size: 13px;
  margin-right: 4px;
}
.admin-dash-editor-toolbar .toolbar-actions .btn {
  flex-shrink: 0;
  min-height: 44px;
}
.admin-dash-editor-toolbar .admin-dash-editor-back {
  flex-shrink: 0;
}
.admin-dash-preset-name-row {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px 14px;
  width: auto;
  max-width: min(420px, 100%);
  margin-bottom: 12px;
  padding: 6px 14px 6px 16px;
  border: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--border) 35%, transparent);
}
.admin-dash-preset-name-label {
  flex: 0 0 auto;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.admin-dash-preset-name-input {
  flex: 0 1 220px;
  width: min(220px, 100%);
  max-width: 220px;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  padding-left: 12px;
  padding-right: 12px;
  font-size: 14px;
  font-weight: 600;
  border-color: transparent;
  background: color-mix(in srgb, var(--surface-2) 45%, var(--surface));
}
.admin-dash-preset-name-input:hover:not(:disabled):not(:focus) {
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
  background: var(--surface-2);
}
.admin-dash-preset-name-input:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.admin-dash-settings-list {
  max-height: 60vh;
  overflow-y: auto;
}
.admin-dash-editor-hint {
  font-size: 13px;
  margin: 0 0 14px;
  max-width: 720px;
  line-height: 1.45;
}
.admin-dash-preview-bar {
  margin-bottom: 12px;
}
.admin-dash-preview-widgets {
  margin-bottom: 32px;
}
.admin-dash-save-status { font-size: 13px; min-height: 20px; }
.admin-dash-save-status.is-ok { color: var(--success, #3fb950); }
.admin-dash-save-status.is-warn { color: var(--warning, #d29922); }
.admin-dash-save-status.is-err { color: var(--danger, #f85149); }
#adminDashSaveBtn.admin-dash-save-btn-dirty {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}
.admin-dash-widget-preview {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 4px 0;
}
.admin-dash-widget-preview-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.admin-dash-widget-preview-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
.admin-dash-editor-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  min-height: 44px;
  text-decoration: none;
}
.admin-dash-editor-back:hover { text-decoration: none; }

/* ── Dashboard board tabs ────────────────── */
.dashboard-board-tabs {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-muted) 65%, var(--border))
    color-mix(in srgb, var(--border) 55%, transparent);
  -webkit-overflow-scrolling: touch;
}

.dashboard-board-tabs::-webkit-scrollbar {
  height: 6px;
}
.dashboard-board-tabs::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--border) 45%, transparent);
  border-radius: 999px;
}
.dashboard-board-tabs::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-muted) 70%, var(--border));
  border-radius: 999px;
  min-width: 40px;
}
.dashboard-board-tabs::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.dashboard-board-tab {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 340px;
  padding: 0 4px 0 2px;
  border: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}

.dashboard-board-tab.is-active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.dashboard-board-tab.dashboard-board-tab-workspace-switch {
  flex-shrink: 0;
  background: var(--accent-2-soft);
  border: 1px solid color-mix(in srgb, var(--accent-2) 38%, var(--border) 62%);
  color: color-mix(in srgb, var(--accent-2-strong, var(--accent-2)) 72%, var(--text));
}

.dashboard-board-tab.dashboard-board-tab-workspace-switch:hover {
  background: color-mix(in srgb, var(--accent-2-soft) 55%, var(--accent-2) 45%);
  border-color: color-mix(in srgb, var(--accent-2) 65%, var(--border));
  color: var(--text);
}

.dashboard-board-tab.dashboard-board-tab-workspace-switch .dashboard-board-tab-name {
  font-weight: 600;
}

.dashboard-board-tab:not(.is-active):not(.dashboard-board-tab-workspace-switch):hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-2);
}

.dashboard-board-tab-name {
  appearance: none;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 8px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  max-width: 30ch;
  text-decoration: none;
  line-height: 1.2;
}

.dashboard-board-tab-name:hover,
.dashboard-board-tab-name:focus-visible {
  text-decoration: none;
  color: inherit;
  outline: none;
}

.dashboard-board-tab-rename,
.dashboard-board-tab-close {
  appearance: none;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  text-decoration: none;
  opacity: 0;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.dashboard-board-tab:hover .dashboard-board-tab-rename,
.dashboard-board-tab:hover .dashboard-board-tab-close,
.dashboard-board-tab.is-active .dashboard-board-tab-rename,
.dashboard-board-tab.is-active .dashboard-board-tab-close,
.dashboard-board-tab-rename:focus-visible,
.dashboard-board-tab-close:focus-visible {
  opacity: 0.85;
}

.dashboard-board-tab-rename:hover,
.dashboard-board-tab-rename:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
  opacity: 1;
  text-decoration: none;
  outline: none;
}

.dashboard-board-tab-close {
  font-size: 16px;
}

.dashboard-board-tab-close:hover,
.dashboard-board-tab-close:focus-visible {
  background: color-mix(in srgb, var(--danger, #f85149) 16%, transparent);
  color: var(--danger, #f85149);
  opacity: 1;
  text-decoration: none;
  outline: none;
}

.dashboard-board-tab-add {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 44px;
  max-width: 120px;
  padding: 8px 14px 10px;
  border: 1px dashed var(--border);
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  flex-shrink: 0;
  text-decoration: none;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.dashboard-board-tab-add:hover:not(:disabled),
.dashboard-board-tab-add:focus-visible:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  text-decoration: none;
  outline: none;
}

.dashboard-board-tab-add:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.dashboard-board-tab-input {
  width: 30ch;
  max-width: 280px;
  margin: 4px 6px 8px;
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 6px;
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.dashboard-board-tab-input:focus {
  border-color: var(--accent);
}

.dashboard-board-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 280px;
  padding: 32px 20px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.dashboard-board-empty[hidden] {
  display: none !important;
}

.dashboard-board-empty-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.dashboard-board-empty-text {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--text-muted);
  max-width: 320px;
}

.dashboard-widgets.is-empty {
  display: none;
}

/* Masonry board: JS packs widgets into columns with a constant gap.
   On narrow screens we fall back to a simple vertical stack. */
.dashboard-widgets {
  position: relative;
  display: block;
  width: 100%;
}

.dashboard-widgets.is-masonry-ready .dashboard-widget:not(.widget-hidden) {
  position: absolute;
  margin: 0;
  will-change: transform;
}

.dashboard-widget {
  min-width: 0;
  box-sizing: border-box;
}

.dashboard-widget .card {
  margin-bottom: 0;
}

.dashboard-widget.widget-hidden {
  display: none !important;
}

.dashboard-widget.widget-dragging {
  opacity: 0.35;
  z-index: 5;
}

.dashboard-widget.widget-drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: 3px;
  border-radius: 10px;
}

/* ── Drag handle ─────────────────────────── */
.drag-handle {
  cursor: grab;
  font-size: 16px;
  line-height: 1;
  color: var(--text-muted);
  opacity: 0.45;
  user-select: none;
  flex-shrink: 0;
  margin-right: 6px;
  transition: opacity 0.15s;
  padding: 2px;
}

.drag-handle:hover {
  opacity: 1;
  color: var(--text);
}

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

/* ── Widget settings modal items ─────────── */
.modal.modal--widget-settings {
  width: min(560px, 96vw);
}

.widget-settings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.widget-settings-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  padding: 4px 14px 2px;
}

.widget-settings-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 0 4px;
}

.widget-settings-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.widget-settings-item:last-child {
  border-bottom: none;
}

.widget-settings-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.widget-settings-label {
  font-size: 14px;
  color: var(--text);
}

.widget-inline-kpi {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 16px 6px;
}

.widget-inline-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.widget-inline-kpi-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Summary KPI widget ──────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px;
}

.kpi-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}

.kpi-card.kpi-info  { border-left-color: var(--info); }
.kpi-card.kpi-success { border-left-color: var(--success); }
.kpi-card.kpi-warning { border-left-color: var(--warning); }
.kpi-card.kpi-danger  { border-left-color: var(--danger); }

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Category breakdown widget ───────────── */
.cat-breakdown-list {
  list-style: none;
  padding: 12px 0;
}

.cat-breakdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
}

.cat-breakdown-name {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-breakdown-bar-wrap {
  width: 80px;
  background: var(--border);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.cat-breakdown-bar-fill {
  height: 100%;
  background: var(--accent-2);
  border-radius: 4px;
}

.cat-breakdown-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 24px;
  text-align: right;
  flex-shrink: 0;
}

/* ── Activity feed widget ────────────────── */
.activity-list {
  list-style: none;
  padding: 4px 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-top: 1px;
}

.activity-icon.act-created { background: color-mix(in srgb, var(--success) 15%, transparent); }
.activity-icon.act-updated { background: color-mix(in srgb, var(--info) 15%, transparent); }

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

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

/* Audit progress block (in-progress audits on dashboard) */
.audit-progress-block {
  padding: 12px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.audit-progress-block:last-of-type {
  border-bottom: none;
}
.audit-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.audit-progress-title {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
}
.audit-progress-title:hover { text-decoration: underline; }
.audit-progress-pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  margin-left: 8px;
}
.audit-progress-bar-wrap {
  width: 100%;
  background: var(--border);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 6px;
}
.audit-progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  transition: width 0.3s ease;
}
.audit-progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

/* Donut chart */
.donut-card-body {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.donut-wrap {
  position: relative;
  flex-shrink: 0;
}
.donut-svg {
  width: 120px;
  height: 120px;
  display: block;
}
.donut-center-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.donut-total {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.donut-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}
.donut-legend {
  list-style: none;
  flex: 1;
  min-width: 0;
}
.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 13px;
}
.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.donut-legend-label {
  flex: 1;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.donut-legend-val {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  flex-shrink: 0;
}

/* Horizontal bar chart */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 36px;
  align-items: center;
  gap: 10px;
}
.bar-label {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  background: var(--surface-2);
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.bar-fill-accent { background: var(--accent); }
.bar-fill-accent-2 { background: var(--accent-2); }
.bar-fill-info   { background: var(--accent-2); opacity: 0.9; }
.bar-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
}

/* ── Detail page ─────────────────────────── */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.detail-header h2 { font-size: 22px; font-weight: 700; }
.inv-number { font-size: 13px; color: var(--text-muted); background: var(--surface-2); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--border); }
.detail-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.item-detail-page .detail-actions .btn,
.item-detail-page .detail-actions .btn-icon-star,
.item-detail-page .detail-actions .detail-status-dropdown .btn {
  height: 36px;
  min-height: 36px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 400;
}
.item-detail-page .detail-actions .inline-form {
  display: inline-flex;
  align-items: center;
}
.item-detail-page .detail-actions .btn-icon-star {
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  align-items: start;
}
.detail-grid-left { display: flex; flex-direction: column; gap: 12px; }
.detail-grid-right { display: flex; flex-direction: column; gap: 12px; align-self: start; }
.detail-grid-left > .card,
.detail-grid-right > .card {
  margin-bottom: 0;
}

/* ── Form field info tooltip ───────────────────────────────────── */
.field-info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-left: 5px;
  vertical-align: middle;
  cursor: help;
  outline: none;
}
.field-info-tip-icon {
  display: block;
  width: 15px;
  height: 15px;
  color: var(--text-muted, #8b949e);
  transition: color 0.15s;
}
.field-info-tip:hover .field-info-tip-icon,
.field-info-tip:focus .field-info-tip-icon,
.field-info-tip:focus-within .field-info-tip-icon {
  color: var(--accent, #58a6ff);
}
.field-info-tip-popup {
  position: absolute;
  z-index: 600;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 220px;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text, #e6edf3);
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #2d3344);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
  text-align: left;
  white-space: normal;
}
.field-info-tip-popup::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: var(--border, #2d3344);
}
.field-info-tip:hover .field-info-tip-popup,
.field-info-tip:focus .field-info-tip-popup,
.field-info-tip:focus-within .field-info-tip-popup {
  opacity: 1;
  visibility: visible;
}
.field-info-tip--end .field-info-tip-popup {
  left: auto;
  right: 0;
  transform: none;
}
.field-info-tip--end .field-info-tip-popup::before {
  left: auto;
  right: 7px;
  transform: none;
}
.field-info-tip--start .field-info-tip-popup {
  left: 0;
  transform: none;
}
.field-info-tip--start .field-info-tip-popup::before {
  left: 7px;
  transform: none;
}
.form-label-with-tip {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0;
  line-height: 1.4;
  margin-bottom: 6px;
}
.form-card > .card-body {
  overflow: visible;
}
.item-cost-section {
  overflow: visible;
}
.collapsible-form-section.is-collapsed .collapsible-form-section-body-inner {
  overflow: hidden;
}
.collapsible-form-section:not(.is-collapsed) .collapsible-form-section-body-inner {
  overflow: visible;
}

/* ── Collapsible form section ──────────────────────────────────── */
.collapsible-form-section .collapsible-form-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}
.collapsible-form-section.is-collapsed .collapsible-form-section-header {
  margin-bottom: 0;
}
.collapsible-form-section:not(.is-collapsed) .collapsible-form-section-header {
  margin-bottom: 1rem;
}
.collapsible-form-section-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.28s ease;
}
.collapsible-form-section.is-collapsed .collapsible-form-section-body {
  grid-template-rows: 0fr;
}
.collapsible-form-section-body-inner {
  overflow: hidden;
}
.collapsible-form-toggle {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border, #2d3344);
  background: transparent;
  font-size: 12px;
  color: var(--text-muted, #8b949e);
  cursor: pointer;
}
.collapsible-form-section-header:hover .collapsible-form-toggle {
  color: var(--accent, #58a6ff);
  border-color: rgba(88, 166, 255, 0.3);
}

/* ── Item detail: section icons & drag reorder ─────────────────── */
.item-detail-section-header,
.item-detail-page .collapsible-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.item-detail-section-header .card-title,
.item-detail-page .collapsible-card-header .card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.card-title-icon {
  flex-shrink: 0;
  font-size: 1em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--text-muted, #8b949e);
}
.card-title-icon .nav-icon,
.card-title-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: inherit;
  opacity: 1;
  line-height: 0;
}
.card-title-icon svg,
.card-title-icon .nav-icon svg,
.card-title-nav-icon svg {
  width: 18px !important;
  height: 18px !important;
  display: block;
  stroke: currentColor;
}
.card-title-text {
  min-width: 0;
}
/* Item detail: ensure Lucide SVGs never collapse without emoji fallbacks */
.attachment-icon {
  color: var(--text-muted, #8b949e);
}
.attachment-icon .nav-icon,
.attachment-icon svg {
  width: 18px !important;
  height: 18px !important;
  display: block;
  stroke: currentColor;
}
.upload-source-icon {
  color: var(--text-muted, #8b949e);
}
.upload-source-icon .nav-icon,
.upload-source-icon svg {
  width: 18px !important;
  height: 18px !important;
  display: block;
  stroke: currentColor;
}
.item-links-list-icon {
  color: var(--text-muted, #8b949e);
}
.item-links-list-icon .nav-icon,
.item-links-list-icon svg,
.item-link-search-icon .nav-icon,
.item-link-search-icon svg {
  width: 16px !important;
  height: 16px !important;
  display: block;
  stroke: currentColor;
}
.contact-info-list-item .nav-icon,
.contact-info-list-item svg {
  width: 14px !important;
  height: 14px !important;
  display: block;
  stroke: currentColor;
  flex-shrink: 0;
}

.section-drag-handle {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 28px;
  margin: -4px 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted, #8b949e);
  font-size: 14px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  opacity: 0.55;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.section-drag-handle:hover,
.section-drag-handle:focus {
  opacity: 1;
  color: var(--accent, #58a6ff);
  background: rgba(88, 166, 255, 0.1);
  outline: none;
}
.section-drag-handle:active {
  cursor: grabbing;
}
.item-detail-section.is-dragging {
  opacity: 0.5;
}
.item-detail-section.is-drag-over {
  box-shadow: 0 0 0 2px var(--accent, #58a6ff);
}
.detail-sections-sortable {
  min-height: 40px;
}

.item-links-header.item-detail-section-header .card-title {
  flex: 1;
  min-width: 0;
}
.item-links-header.item-detail-section-header .item-links-header-actions {
  flex-shrink: 0;
}

.card-qr {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.card-related-items {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.card-nfc-tags {
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.nfc-tags-hint {
  font-size: 13px;
  margin: 0 0 12px;
  line-height: 1.45;
}
.nfc-tag-row {
  cursor: default;
}
.scanner-mode-switch {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}
.scanner-mode-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.scanner-mode-btn:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.scanner-mode-btn.is-active {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.12);
  color: var(--accent);
}
.nfc-scan-visual {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  background: var(--surface-2);
  border: 2px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.nfc-scan-visual.is-listening {
  border-color: var(--accent);
  box-shadow: 0 0 0 6px rgba(88, 166, 255, 0.12);
  animation: nfc-pulse 1.6s ease-in-out infinite;
}
@keyframes nfc-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.nfc-scan-status {
  min-height: 1.2em;
  font-size: 13px;
  text-align: center;
  color: var(--text);
  margin: 0;
}
.nfc-scan-status--error {
  color: var(--danger, #f85149);
}
.item-detail-page .card-qr .barcode-section,
.item-detail-page .card-qr .qr-actions {
  width: 100%;
  max-width: 100%;
  align-self: stretch;
}

/* ── Item links (related positions) ───────────────── */
.item-links-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.item-links-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.item-links-graph-wrap {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  overflow: auto;
  max-height: min(60vh, 520px);
}
.item-links-graph-modal-body { padding-top: 8px; }
.item-links-graph-hint {
  font-size: 12px;
  margin-top: 10px;
  margin-bottom: 0;
  text-align: center;
}
.modal--item-links-graph { width: min(560px, 96vw); }
.modal--item-link-add { width: min(440px, 96vw); }
.item-links-graph {
  display: block;
  width: 100%;
  height: auto;
  min-height: 280px;
}
.item-links-graph-edge {
  stroke-width: 2.5;
  stroke-linecap: round;
}
.item-links-graph-node rect {
  fill: var(--surface);
  stroke: var(--border);
  stroke-width: 2;
  transition: stroke 0.2s, filter 0.2s;
}
.item-links-graph-node--current rect {
  fill: rgba(88,166,255,0.12);
  stroke: var(--accent);
  stroke-width: 2.5;
}
.item-links-graph-node:not(.item-links-graph-node--current):hover rect {
  stroke: var(--accent);
  filter: drop-shadow(0 4px 12px rgba(88,166,255,0.2));
}
.item-links-graph-title {
  fill: var(--text);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  pointer-events: none;
}
.item-links-graph-sub {
  fill: var(--text-muted);
  font-size: 9px;
  font-family: inherit;
  pointer-events: none;
}
.item-links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.item-links-list-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  transition: border-color 0.15s;
}
.item-links-list-row:hover { border-color: rgba(88,166,255,0.35); }
.item-links-list-link {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.item-links-list-icon {
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.item-links-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.92;
  line-height: 0;
}
.item-links-nav-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.contact-info-list-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.contact-info-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.85;
  line-height: 0;
}
.contact-info-nav-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}
.item-links-list-name {
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.item-links-list-meta {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-danger-soft {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
}
.btn-danger-soft:hover { background: rgba(239,68,68,0.12); color: #ef4444; }

.item-links-empty { text-align: center; padding: 8px 0 4px; }
.item-links-empty-lead {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.item-links-empty-example {
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.item-links-empty-example strong { color: var(--text); font-weight: 600; }

.item-link-search-row { position: relative; }
.item-link-search-results {
  margin-top: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 240px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  padding-bottom: 6px;
}
.item-link-search-results[hidden] { display: none !important; }
.item-link-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font-family: inherit;
  border-bottom: 1px solid var(--border);
}
.item-link-search-item:last-child { border-bottom: none; }
.item-link-search-item:hover,
.item-link-search-item.is-active {
  background: rgba(88,166,255,0.1);
}
.item-link-search-mark {
  background: rgba(88,166,255,0.25);
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}
.item-link-search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 18px;
}
.item-link-search-text { min-width: 0; }
.item-link-search-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-link-search-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}
.item-link-search-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; }
.detail-list dt { color: var(--text-muted); font-weight: 500; }
.detail-list dd { color: var(--text); }

/* Item card details: paired zebra rows improve scanning without a heavy table. */
#detail-section-details .detail-list {
  gap: 1px 0;
}
#detail-section-details .detail-list dt,
#detail-section-details .detail-list dd {
  min-width: 0;
  margin: 0;
  padding: 7px 10px;
  line-height: 1.45;
  transition: background-color 0.16s ease;
}
#detail-section-details .detail-list dt {
  border-radius: 8px 0 0 8px;
}
#detail-section-details .detail-list dd {
  border-radius: 0 8px 8px 0;
  overflow-wrap: anywhere;
}
#detail-section-details .detail-list dt:nth-of-type(odd),
#detail-section-details .detail-list dd:nth-of-type(odd) {
  background: transparent;
}
#detail-section-details .detail-list dt:nth-of-type(even),
#detail-section-details .detail-list dd:nth-of-type(even) {
  background: var(--surface-2);
}

.contact-info-list { list-style: none; margin-top: 4px; font-size: 13px; color: var(--text-muted); }
.contact-info-list li { margin: 2px 0; }

.contact-fields-block { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; }

.notes-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.notes-section h4 { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.detail-custom-fields { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-section-title { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; font-weight: 500; }

/* ── Public link box ─────────────────────────────── */
.public-link-box {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.public-link-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--info);
  margin-bottom: 8px;
}
.public-link-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.public-link-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: text;
}

.barcode-section { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.barcode-img { max-width: 100%; background: #fff; padding: 12px; border-radius: 6px; }
.barcode-number { font-family: var(--font-sans); color: var(--text-muted); font-size: 13px; }

/* ── History ─────────────────────────────── */
.change-list { list-style: none; font-size: 12px; }
.change-list li { margin: 2px 0; }
.old-val { color: var(--danger); text-decoration: line-through; }
.new-val { color: var(--success); }

/* ── Permissions ─────────────────────────── */
.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}
.permission-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.permission-item input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.perm-label { font-size: 13px; color: var(--text); }

/* ── Permissions table ───────────────────── */
.perm-table-wrap {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.perm-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-2);
}
.perm-table thead th {
  background: var(--surface-3, var(--surface-2));
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.perm-table thead th.perm-col-section { text-align: left; }
.perm-table tbody tr { border-bottom: 1px solid var(--border); }
.perm-table tbody tr:last-child { border-bottom: none; }
.perm-table tbody tr:hover { background: var(--surface-hover, rgba(255,255,255,0.03)); }
.perm-section-name { padding: 10px 14px; font-size: 13px; color: var(--text); font-weight: 500; }
.perm-col-action { width: 130px; }
.perm-cell { text-align: center; padding: 10px 14px; }
.perm-check { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.perm-check input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.perm-table--readonly .perm-cell { color: var(--text-muted); }
.perm-granted { color: var(--accent); font-weight: 700; font-size: 14px; line-height: 1; }
.perm-table-wrap--compact { font-size: 12px; }
.perm-table-wrap--compact .perm-table thead th { padding: 6px 8px; font-size: 11px; }
.perm-table-wrap--compact .perm-section-name { padding: 5px 8px; font-size: 12px; }
.perm-table-wrap--compact .perm-cell { padding: 5px 8px; }
.perm-table-wrap--compact .perm-col-action { width: 72px; }
.profile-perms .perm-table-wrap { margin-top: 0; }

.perm-extra-block { margin-top: 16px; }
.perm-extra-heading { margin-bottom: 10px; }
.perm-extra-grid { display: flex; flex-direction: column; gap: 10px; }
.perm-extra-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: start;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
  margin: 0;
}
.perm-extra-check {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-top: 2px;
}
.perm-extra-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}
.perm-extra-title {
  display: block;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
}
.perm-extra-section {
  display: block;
  font-size: 13px;
  margin-top: 2px;
}
.perm-extra-hint {
  display: block;
  font-size: 13px;
  line-height: 1.45;
  margin-top: 4px;
}

.settings-strict-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-strict-option {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: start;
  min-height: 44px;
  cursor: pointer;
  margin: 0;
}
.settings-strict-option > input[type="checkbox"] {
  margin: 4px 0 0;
  width: 18px;
  height: 18px;
}
.settings-strict-option-body strong {
  display: block;
  margin-bottom: 4px;
}
.settings-strict-option-body small {
  display: block;
  line-height: 1.45;
}

.select-with-lock {
  display: flex;
  align-items: stretch;
  width: 100%;
}
.select-with-lock-field {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.select-with-lock-field .vendor-select-wrapper,
.select-with-lock-field .user-select-wrapper {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.select-with-lock--locked {
  position: relative;
  min-height: 44px;
  cursor: help;
  outline: none;
}
.select-with-lock--locked .select-with-lock-field .user-select-control {
  flex: 1;
  min-height: 44px;
  height: 100%;
  box-sizing: border-box;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
  margin: 0;
}
.select-with-lock--locked .select-lock-badge {
  flex: 0 0 44px;
  width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border, #2d3344);
  border-left-width: 0;
  border-radius: 0 6px 6px 0;
  background: var(--input-bg, var(--surface-2, #1e2330));
  box-sizing: border-box;
  color: var(--text-muted, #8b949e);
  pointer-events: none;
}
.select-with-lock--locked:hover .select-lock-badge,
.select-with-lock--locked:focus-within .select-lock-badge {
  color: var(--accent, #58a6ff);
  border-color: var(--border, #2d3344);
}
.select-with-lock--locked .select-lock-icon {
  width: 18px;
  height: 18px;
  display: block;
}
.select-with-lock--locked .select-lock-tooltip {
  position: absolute;
  z-index: 650;
  left: 0;
  right: 0;
  bottom: calc(100% + 10px);
  top: auto;
  transform: none;
  min-width: 0;
  max-width: none;
  width: auto;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text, #e6edf3);
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #2d3344);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s, visibility 0.15s;
  text-align: left;
  white-space: normal;
}
.select-with-lock--locked .select-lock-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 18px;
  border: 7px solid transparent;
  border-top-color: var(--border, #2d3344);
}
.select-with-lock--locked:hover .select-lock-tooltip,
.select-with-lock--locked:focus-within .select-lock-tooltip {
  opacity: 1;
  visibility: visible;
}
.is-field-locked .user-select-control,
.is-field-locked .user-select-search {
  cursor: help;
  opacity: 1;
  background: var(--input-bg, var(--surface-2, #1e2330));
}
.is-field-locked .user-select-arrow { opacity: 0.5; }
.is-field-locked .user-select-footer,
.is-field-locked .user-select-clear { display: none !important; }

.item-form-card .user-select-clear { display: none !important; }

.settings-section-divider {
  border: none;
  border-top: 1px solid var(--border, #2d3344);
  margin: 28px 0 24px;
}

/* ── Inline form ─────────────────────────── */
.inline-form { display: inline; }

/* ── Dropdown ────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 140px;
  padding: 4px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 14px;
  font-size: 13px;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  min-height: 36px;
  line-height: 1.2;
  white-space: nowrap;
}
.dropdown-item .btn-icon,
.dropdown-item .btn-icon-plus,
.dropdown-item .nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.92;
  color: inherit;
}
.dropdown-item .btn-icon svg,
.dropdown-item .btn-icon-plus svg,
.dropdown-item .nav-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.dropdown-item:hover { background: var(--surface-2); color: var(--accent); }

.dropdown-toggle--menu {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.dropdown-toggle-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.dropdown-toggle-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-left: 2px;
  opacity: 0.72;
  color: inherit;
  transition: transform 0.2s ease;
}
.dropdown-toggle-chevron svg {
  width: 12px;
  height: 12px;
  display: block;
}
.dropdown.open > .dropdown-toggle--menu .dropdown-toggle-chevron {
  transform: rotate(180deg);
}
.dropdown-menu--sections {
  min-width: 240px;
  padding: 0;
  overflow: hidden;
}
.dropdown-section-header {
  padding: 10px 14px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  user-select: none;
}
.dropdown-section-header:not(:first-child) {
  border-top: 1px solid var(--border);
  margin-top: 2px;
  padding-top: 12px;
}
.dropdown-menu--sections .dropdown-item {
  padding-left: 16px;
  padding-right: 16px;
}

/* ── Column picker ───────────────────────── */
.col-picker-wrap { position: relative; }
.col-picker-menu {
  min-width: 220px;
  padding: 0;
  overflow: hidden;
}
.col-picker-header {
  padding: 10px 14px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.col-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: background 0.12s;
}
.col-picker-item:hover { background: var(--surface-2); }
.col-picker-label { flex: 1; }

/* Toggle switch */
.col-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 12px;
}
.col-toggle input[type=checkbox] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.col-toggle-track {
  display: block;
  width: 32px;
  height: 18px;
  border-radius: 9px;
  background: var(--border);
  position: relative;
  transition: background 0.2s;
  cursor: pointer;
}
.col-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s, background 0.2s;
}
.col-toggle input[type=checkbox]:checked + .col-toggle-track {
  background: rgba(88,166,255,0.35);
}
.col-toggle input[type=checkbox]:disabled + .col-toggle-track,
.col-toggle input[type=checkbox]:disabled:checked + .col-toggle-track {
  background: rgba(139, 148, 158, 0.22);
  cursor: help;
}
.col-toggle input[type=checkbox]:disabled + .col-toggle-track::after,
.col-toggle input[type=checkbox]:disabled:checked + .col-toggle-track::after {
  background: var(--text-muted);
}
.col-toggle input[type=checkbox]:focus-visible + .col-toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.col-toggle input[type=checkbox]:checked + .col-toggle-track::after {
  transform: translateX(14px);
  background: var(--accent);
}

/* ── Utility ─────────────────────────────── */
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 20px; }
.p-4 { padding: 16px; }

/* ── Login page ──────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.login-title { font-size: 22px; font-weight: 700; color: var(--text); }
.login-subtitle { color: var(--text-muted); margin-top: 4px; font-size: 14px; }
.login-form .form-group { margin-bottom: 20px; }

code { font-family: var(--font-sans); font-size: 12px; background: var(--surface-2); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border); color: var(--text-muted); display: inline-block; max-width: 100%; box-sizing: border-box; white-space: normal; overflow-wrap: anywhere; word-break: break-word; line-height: 1.35; vertical-align: middle; }

/* ── Item photo ──────────────────────────── */
.item-photo-wrap {
  text-align: center;
  margin-bottom: 16px;
}
.item-photo {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
}
.item-photo-thumb {
  max-width: 120px;
  max-height: 120px;
  border-radius: 6px;
  border: 1px solid var(--border);
  object-fit: cover;
  display: block;
}
.field-with-scan {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.field-with-scan .form-control {
  flex: 1;
  min-width: 0;
}
.field-scan-btn {
  flex-shrink: 0;
  align-self: stretch;
  padding-left: 12px;
  padding-right: 12px;
  display: none;
}
@media (max-width: 768px) {
  .field-scan-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
.field-scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 10060;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.field-scanner-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.field-scanner-modal {
  position: fixed;
  z-index: 10061;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(110%);
  width: min(420px, 100%);
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.42s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.field-scanner-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.field-scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.field-scanner-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.field-scanner-close {
  border: none;
  background: transparent;
  color: var(--text-muted, #8b949e);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.field-scanner-close:hover {
  color: var(--text, #e6edf3);
  background: var(--surface-2, #1c2128);
}
.field-scanner-reader {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  min-height: 260px;
}
.field-scanner-hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-muted, #8b949e);
  text-align: center;
  line-height: 1.45;
}
.field-scanner-preview-label {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted, #8b949e);
}
.field-scanner-preview {
  background: var(--surface-2, #1c2128);
  border: 1px solid var(--border, #30363d);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  word-break: break-all;
}
.field-scanner-preview code {
  font-size: 15px;
  color: var(--text, #e6edf3);
}
.field-scanner-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.photo-upload-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.file-upload-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.upload-source-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.upload-source-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.upload-source-label-inline {
  align-items: center;
  margin-bottom: 0;
}
.upload-source-text {
  flex: 1;
  min-width: 0;
}
.upload-source-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface, #0d1117);
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.upload-source-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.92;
  line-height: 0;
}
.upload-source-nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.upload-source-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.upload-source-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}
.upload-panel-note {
  display: block;
  margin-top: 8px;
}
.upload-camera-block {
  display: none;
}
@media (max-width: 768px), (pointer: coarse) {
  .upload-camera-block {
    display: block;
  }
}
.photo-upload-row .form-control {
  width: 100%;
}
.file-upload-panel.js-photo-ready .photo-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.photo-file-input {
  margin-top: 10px;
}
.photo-add-btn {
  display: none;
}
.file-upload-panel.js-photo-ready .photo-add-btn {
  display: inline-flex;
}
.photo-camera-btn,
.photo-add-btn {
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 16px;
}
.photo-add-btn:hover,
.photo-camera-btn:hover {
  text-decoration: none;
}
.photo-add-btn:active,
.photo-camera-btn:active {
  filter: brightness(0.88);
}
.qr-settings-save-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
  margin-bottom: 0 !important;
}
.qr-save-status {
  font-size: 12px;
}
.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.photo-edit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.photo-pending-row {
  margin-bottom: 4px;
}
.photo-edit-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 132px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.photo-edit-card.is-primary {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.photo-edit-card--pending {
  border-style: dashed;
}
.photo-edit-card .item-photo-thumb {
  width: 100%;
  height: 132px;
  max-width: none;
  max-height: none;
  border: 0;
  border-radius: 0;
  object-fit: cover;
}
.photo-file-fallback {
  width: 100%;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
  background: var(--surface-2);
}
.photo-primary-badge,
.photo-pending-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 1;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 999px;
}
.photo-pending-badge {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.photo-edit-actions {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--surface-2);
}
.photo-delete-form {
  margin: 0;
  padding: 0;
}
.photo-delete-btn,
.photo-primary-btn {
  flex: 1;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, filter 0.15s, color 0.15s;
  text-decoration: none;
}
.photo-delete-btn {
  background: rgba(240, 113, 120, 0.16);
  color: #ffb4b8;
}
.photo-delete-btn:hover {
  background: var(--danger);
  color: #fff;
  text-decoration: none;
}
.photo-delete-btn:active,
.photo-primary-btn:active {
  filter: brightness(0.88);
}
.photo-primary-btn {
  background: var(--accent-soft);
  color: var(--accent);
}
.photo-primary-btn:hover {
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
}
.photo-empty-hint {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text);
}
.photo-empty-hint strong {
  font-size: 14px;
}
.photo-empty-hint span {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}
.photo-make-primary-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
}
.photo-make-primary-btn:hover {
  text-decoration: none;
}
.photo-make-primary-btn:active {
  filter: brightness(0.88);
}
@media (max-width: 600px) {
  .attachment-item {
    flex-wrap: wrap;
  }
  .attachment-item .inline-form {
    margin-left: 0;
  }
  .upload-source-label-inline {
    flex-wrap: wrap;
  }
  .upload-source-label-inline .photo-add-btn,
  .upload-source-label-inline .photo-camera-btn {
    width: 100%;
  }
}

/* ── Barcode settings ────────────────────── */
.qr-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}
.qr-actions > .btn {
  width: 100%;
  justify-content: center;
}
.barcode-settings {
  width: 100%;
}
.barcode-settings summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  list-style: none;
  width: 100%;
}
.barcode-settings summary::-webkit-details-marker { display: none; }
.barcode-settings-body {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 10px;
}
.form-control-sm {
  font-size: 13px;
  padding: 4px 8px;
  height: auto;
  min-height: 32px;
}
.barcode-settings-body .form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.barcode-settings-body .form-row label {
  font-size: 12px;
  color: var(--text-muted);
}
.form-range {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ── QR image ────────────────────────────── */
.qr-img {
  width: 100%;
  max-width: 320px;
  height: auto;
  image-rendering: pixelated;
}

/* ── Mobile nav ──────────────────────────── */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px 8px;
  margin-right: 0;
  line-height: 1;
  flex-shrink: 0;
}
.hamburger-btn .nav-icon,
.sidebar-close-btn .nav-icon {
  width: 20px;
  height: 20px;
  opacity: 1;
  color: inherit;
}
.hamburger-btn .nav-icon svg,
.sidebar-close-btn .nav-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}
.topbar-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 8px;
}
.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
  padding: 0 4px;
  line-height: 1;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ── Responsive breakpoints ──────────────── */
@media (max-width: 1100px) {
  .dashboard-half-row { grid-template-columns: 1fr; }
  .dashboard-widgets {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: auto !important;
  }
  .dashboard-widgets.is-masonry-ready .dashboard-widget:not(.widget-hidden) {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    transform: none !important;
  }
}

@media (max-width: 768px) {
  .hamburger-btn { display: inline-flex; }
  .sidebar-close-btn { display: inline-flex; }
  .sidebar-collapse-btn { display: none; }

  .dashboard-boards-bar-top {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-board-tabs-row {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .dashboard-board-tabs {
    width: 100%;
    padding-bottom: 8px;
  }

  .dashboard-board-tab,
  .dashboard-board-tab-add {
    flex-shrink: 0;
  }

  .dashboard-board-tabs::-webkit-scrollbar {
    height: 8px;
  }

  .admin-dash-list-view > .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-dash-list-lead {
    white-space: normal;
    text-align: left;
    margin-left: 0;
  }

  .admin-dash-editor-toolbar .toolbar-row-2 {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .admin-dash-editor-toolbar .toolbar-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }

  .admin-dash-preset-name-row {
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .admin-dash-preset-name-input {
    flex: 1 1 160px;
    width: auto;
    max-width: none;
  }

  .dashboard-boards-bar-top > .btn {
    align-self: flex-end;
  }

  .dashboard-board-tab-rename,
  .dashboard-board-tab-close {
    opacity: 0.75;
  }

  .topbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 8px 12px;
    gap: 8px;
    height: auto;
    min-height: 0;
    max-height: none;
  }
  .topbar-primary {
    order: 1;
    display: flex;
    width: 100%;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    margin-left: 0;
    gap: 0;
    align-items: center;
    justify-content: space-between;
  }
  .topbar-tools {
    display: contents;
  }
  .hamburger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    padding: 0;
    margin: 0;
    font-size: 18px;
    line-height: 1;
    box-sizing: border-box;
    flex: 0 0 36px;
  }
  .topbar-primary > .service-switch,
  .topbar-primary .help-dropdown,
  .topbar-primary .release-notes-widget {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    margin: 0;
    flex: 0 0 auto;
    align-self: center;
  }
  .topbar-primary .service-switch {
    height: 36px;
    padding: 3px;
    box-sizing: border-box;
    align-items: stretch;
  }
  .topbar-primary .service-switch .switch-btn {
    height: 100%;
    min-height: 0;
    padding: 0 10px;
    font-size: 12px;
    line-height: 1;
    align-items: center;
    justify-content: center;
  }
  .topbar-primary .service-switch .switch-label {
    display: block;
    height: 16px;
    line-height: 16px;
    transform: none;
  }
  .topbar-primary .btn-help-docs,
  .topbar-primary .release-notes-btn,
  .topbar-primary .profile-topbar-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    line-height: 1;
    flex: 0 0 36px;
  }
  .topbar-primary .btn-help-docs {
    border-radius: 8px;
  }
  .topbar-primary .btn-help-label,
  .topbar-primary .btn-help-chevron,
  .topbar-primary .profile-topbar-name,
  .topbar-primary .profile-topbar-role {
    display: none !important;
  }
  .topbar-primary .profile-topbar-avatar {
    width: 28px;
    height: 28px;
    margin: 0;
  }
  .topbar-primary .release-notes-widget,
  .topbar-primary .release-notes-btn {
    width: 36px;
    height: 36px;
  }
  .global-search {
    order: 2;
    flex: 0 0 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .global-search-field {
    width: 100%;
    height: 36px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-favorites-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 16px;
  }
  .sidebar-favorites-options {
    grid-template-columns: 1fr;
  }

  .main-content { margin-left: 0; }

  .content { padding: 16px; }

  /* Detail page stacks to single column */
  .detail-grid { grid-template-columns: 1fr; }
  .dashboard-charts-grid { grid-template-columns: 1fr; }
  .dashboard-half-row { grid-template-columns: 1fr; }
  .dashboard-widgets {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: auto !important;
  }
  .dashboard-widgets.is-masonry-ready .dashboard-widget:not(.widget-hidden) {
    position: static !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    transform: none !important;
  }

  /* Detail header wraps nicely */
  .detail-header { flex-direction: column; align-items: flex-start; }
  .detail-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Tables: horizontal scroll */
  .card-body.p-0 { overflow-x: auto; }
  .table { min-width: 600px; }

  /* Toolbar stacks vertically */
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-form { flex-direction: column; }
  .search-form .form-control,
  .search-form .filter-select,
  .search-form select.form-control { max-width: 100%; width: 100%; }
  .toolbar-actions { flex-wrap: wrap; }
  .mol-form-grid { grid-template-columns: 1fr; }

  /* Topbar user info: hide role badge on very small screens */
  .topbar-user .badge { display: none; }
  .user-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .global-search-kbd { display: none; }
  .global-search-input::placeholder { font-size: 12px; }

  /* Form rows stack */
  .form-row { flex-direction: column; gap: 0; }
  .col-4, .col-6, .col-8 { flex: 1 1 100%; }
}

@media (max-width: 480px) {
  .detail-list { grid-template-columns: 1fr; }
  .detail-list dt { color: var(--text-muted); margin-top: 10px; margin-bottom: 2px; }
  .detail-list dd { margin-bottom: 4px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  #detail-section-details .detail-list {
    grid-template-columns: 1fr;
    gap: 0 0;
  }
  #detail-section-details .detail-list dt {
    margin: 1px 0 0;
    padding: 7px 10px 1px;
    border-radius: 8px 8px 0 0;
  }
  #detail-section-details .detail-list dd {
    margin: 0;
    padding: 1px 10px 7px;
    border-radius: 0 0 8px 8px;
  }
}

/* ── Theme accent pair (settings) ─────────── */
.theme-accent-pair {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 20px;
}
.theme-accent-swatch {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}
.theme-accent-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.theme-accent-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-accent-picker {
  width: 48px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
}
.theme-accent-hex {
  max-width: 120px;
}
.theme-accent-preview {
  display: flex;
  flex: 1;
  min-width: 120px;
  max-width: 220px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface-2);
}
.theme-accent-preview--light {
  background: #f4f7fb;
  border-color: #d0d8e2;
}
.theme-accent-preview--dark {
  background: #0c1017;
  border-color: #2a3441;
}
.theme-accent-preview-bar {
  display: block;
  width: 50%;
  height: 100%;
  background: var(--accent);
}
.theme-accent-preview-bar-2 {
  display: block;
  width: 50%;
  height: 100%;
  background: var(--accent-2);
}
html.light-theme,
body.light-theme {
  /* Light theme — primary blue + secondary teal */
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --border: #d0d8e2;
  --accent: #1570c9;
  --accent-soft: rgba(21, 112, 201, 0.12);
  --accent-strong: #1570c9;
  --accent-hover: #0f5a9e;
  --accent-2: #0d9488;
  --accent-2-soft: rgba(13, 148, 136, 0.12);
  --accent-2-strong: #0d9488;
  --accent-2-hover: #0b7362;
  --on-accent: #ffffff;
  --on-accent-2: #ffffff;
  --text: #1a2332;
  --text-muted: #5a6577;
  --success: #1a7f37;
  --warning: #9a6700;
  --danger: #cf222e;
  --info: #0d9488;
}

html.light-theme .nav-item.active,
body.light-theme .nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-strong, var(--accent));
}

body.light-theme .sidebar-overlay {
  background: rgba(0,0,0,0.4);
}

/* ── Item Comments ──────────────────────────────────────────────────────── */
.comment-thread { display: flex; flex-direction: column; gap: 12px; }

.comment-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(88,166,255,0.15);
  border: 1px solid rgba(88,166,255,0.3);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.comment-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.comment-avatar-letter { line-height: 1; }

.comment-author {
  font-weight: 600;
  color: var(--text);
}

.comment-date {
  font-size: 12px;
}

.comment-delete-form { margin-left: auto; }

.btn-comment-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.btn-comment-delete:hover { color: var(--danger); background: rgba(248,81,73,0.1); }

.comment-text {
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-form { display: flex; flex-direction: column; align-items: flex-start; width: 100%; }

.comment-input { width: 100%; resize: vertical; min-height: 60px; }

/* ── Attachments ─────────────────────────── */
.attachment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.attachment-icon {
  font-size: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.attachment-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.92;
  line-height: 0;
}
.attachment-nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.attachment-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.attachment-name {
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-name:hover { text-decoration: underline; }

.attachment-meta { font-size: 12px; }

.attachment-form .form-row { flex-wrap: wrap; }

/* ── Empty-value dash ─────────────────────── */
.empty-val { font-size: 0.75em; color: var(--text-muted); opacity: 0.55; }

/* ── Calendar ────────────────────────────── */
.cal-target-toggle {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cal-target-toggle__option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  user-select: none;
  font-size: 14px;
  font-weight: 500;
}

.cal-target-toggle__option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.cal-target-toggle__option input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-nav-btn {
  font-size: 18px;
  line-height: 1;
  padding: 4px 12px;
}

.cal-month-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  min-width: 180px;
  text-align: center;
}

.cal-grid-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-header-cell {
  padding: 10px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.cal-header-cell.cal-weekend { color: var(--danger); }

.cal-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 110px;
  padding: 6px 8px;
  vertical-align: top;
  background: var(--surface);
  transition: background 0.1s;
  position: relative;
}

.cal-cell:nth-child(7n) { border-right: none; }

.cal-cell--empty { background: var(--bg); }

.cal-cell--weekend { background: rgba(248,81,73,0.03); }

.cal-cell--today { background: rgba(88,166,255,0.06); }

.cal-day-number {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1.4;
}

.cal-day-today {
  color: var(--accent);
  font-weight: 700;
}

.cal-booking {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(88,166,255,0.13);
  border: 1px solid rgba(88,166,255,0.3);
  border-radius: 4px;
  padding: 3px 6px;
  margin-bottom: 3px;
  cursor: pointer;
  font-size: 11px;
  color: var(--accent);
  transition: background 0.15s, border-color 0.15s;
  overflow: hidden;
}

.cal-booking:hover {
  background: rgba(88,166,255,0.22);
  border-color: rgba(88,166,255,0.55);
}

.cal-booking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.cal-booking-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-booking-kind {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  font-size: 12px;
  line-height: 1;
}

.cal-booking-kind--item { opacity: 0.95; }
.cal-booking-kind--location { opacity: 0.95; }

.cal-location-notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(88, 166, 255, 0.35);
  background: rgba(88, 166, 255, 0.08);
}

.cal-location-notice__icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.cal-location-notice__title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.cal-location-notice__text,
.cal-location-notice__empty {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}

.cal-location-notice__empty {
  margin-top: 8px;
  color: var(--text);
}

.cal-location-notice__cta {
  margin-top: 12px;
  min-height: 44px;
}

.cal-kind-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: -8px 0 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.cal-kind-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cal-agenda__item-name .cal-booking-kind {
  margin-right: 4px;
  vertical-align: middle;
}

/* ── Calendar day tooltip ────────────────── */
.cal-day-tooltip {
  display: none;
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.18);
  padding: 10px 14px;
  min-width: 220px;
  max-width: 320px;
  pointer-events: none;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  text-align: left;
}

.cal-day-tooltip-title {
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
  white-space: nowrap;
}

.cal-day-tooltip-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}

.cal-day-tooltip-row:last-child {
  border-bottom: none;
}

.cal-day-tooltip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 4px;
}

.cal-day-tooltip-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.cal-day-tooltip-name {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-day-tooltip-meta {
  color: var(--text-muted);
  font-size: 11px;
}

/* ── Modal ───────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
}

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 201;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: min(540px, 96vw);
  max-height: 90vh;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
}

/* Form wrapping body+footer must participate in modal flex layout,
   otherwise tall content pushes the footer below the visible area. */
.modal > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.modal-close:hover { color: var(--text); background: var(--surface-2); }

.modal--profile { width: min(700px, 96vw); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.modal-body::-webkit-scrollbar { width: 5px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.modal-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
  flex-shrink: 0;
}


/* ── Calendar filters / zero / agenda / more ─ */
.cal-toolbar {
  gap: 12px;
}
.cal-nav-btn,
.cal-today-btn,
.cal-primary-cta {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.cal-nav-btn:hover,
.cal-today-btn:hover,
.cal-primary-cta:hover {
  text-decoration: none;
}
.cal-filters {
  margin: 0 0 16px;
}
.cal-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}
.cal-filters-row .ss-wrap {
  flex: 1 1 180px;
  min-width: 160px;
}
.cal-filters-row .btn {
  min-height: 44px;
}
.cal-cell[data-date] {
  cursor: pointer;
}
.cal-cell[data-date]:hover {
  background: rgba(88,166,255,0.08);
}
.cal-cell[data-date]:active {
  background: rgba(88,166,255,0.14);
}
.cal-zero {
  margin-bottom: 16px;
}
.cal-zero .zero-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}
.cal-zero .zero-state__icon {
  font-size: 2rem;
  margin-bottom: 10px;
}
.cal-zero .zero-state__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 8px;
}
.cal-zero .zero-state__lead {
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}
.cal-zero .zero-state__steps {
  display: grid;
  gap: 10px;
  text-align: left;
  margin: 0 0 18px;
}
.cal-zero .zero-state__step {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, var(--bg));
  display: grid;
  gap: 2px;
}
.cal-zero .zero-state__step span {
  color: var(--text-muted);
  font-size: 0.92rem;
}
.cal-zero .zero-state__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.cal-zero .zero-state__actions .btn {
  min-height: 44px;
}
.cal-more {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2, var(--bg));
}
.cal-more__summary {
  cursor: pointer;
  list-style: none;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
.cal-more__summary::-webkit-details-marker { display: none; }
.cal-more__summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.15s;
}
.cal-more[open] > .cal-more__summary::before {
  transform: rotate(90deg);
}
.cal-more__body {
  padding: 0 14px 14px;
}
.cal-delete-text {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}
.modal--sm {
  width: min(420px, 96vw);
}
.cal-form-delete-row {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.cal-agenda {
  display: none;
  margin-top: 16px;
}
.cal-agenda__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px;
}
.cal-agenda__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.cal-agenda__item {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px 14px;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.15s;
}
.cal-agenda__item:hover,
.cal-agenda__item:active {
  background: var(--surface-2, rgba(88,166,255,0.08));
  text-decoration: none;
}
.cal-agenda__item-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-agenda__item-name {
  font-weight: 600;
  color: var(--text);
}
.cal-agenda__item-dates,
.cal-agenda__item-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .cal-grid-wrapper {
    display: none;
  }
  .cal-agenda {
    display: block;
  }
  .cal-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .cal-nav {
    justify-content: space-between;
  }
  .cal-month-label {
    min-width: 0;
    flex: 1;
  }
  .cal-primary-cta,
  .cal-today-btn {
    width: 100%;
  }
  .cal-filters-row .btn {
    flex: 1 1 auto;
  }
}


.cal-booking-status {
  font-weight: 600;
}
.cal-grid-wrapper--empty {
  opacity: 0.92;
}

/* ── Booking detail view ─────────────────── */
.booking-detail { display: flex; flex-direction: column; gap: 12px; }

.booking-detail-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.booking-detail-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  min-width: 120px;
  flex-shrink: 0;
  padding-top: 1px;
}

.booking-detail-value {
  color: var(--text);
  font-size: 14px;
}

.mb-4 { margin-bottom: 16px; }
.page-header { display: flex; align-items: center; gap: 12px; }



/* ── Booking bar chart widget ────────────── */
.booking-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  padding: 0 4px;
}

.booking-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.booking-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  background: var(--border);
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  min-height: 8px;
}

.booking-bar-fill {
  width: 100%;
  background: var(--accent-2);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
  min-height: 4px;
}

.booking-bar-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}

.booking-bar-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1;
}

/* ── Mini-calendar widget ─────────────────── */
.mini-cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.mini-cal-nav .card-title {
  flex: 0 0 auto;
  margin: 0;
}

.mini-cal-nav--body {
  justify-content: center;
  margin-bottom: 10px;
  flex: none;
}

.mini-cal-month {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 120px;
  text-align: center;
}

.mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.mini-cal-head {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0;
}

.mini-cal-head.mini-cal-weekend {
  color: var(--accent);
}

.mini-cal-cell {
  position: relative;
  text-align: center;
  padding: 4px 2px;
  border-radius: 4px;
  font-size: 12px;
  min-height: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
}

.mini-cal-cell.mini-cal-empty {
  background: none;
}

.mini-cal-cell.mini-cal-today .mini-cal-day {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
}

.mini-cal-cell.mini-cal-weekend {
  color: var(--accent);
}

.mini-cal-cell.mini-cal-has-bookings {
  background: var(--accent-bg, rgba(99,102,241,0.08));
  cursor: default;
}

.mini-cal-day {
  font-size: 12px;
  line-height: 20px;
}

.mini-cal-dot-count {
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  line-height: 14px;
  min-width: 14px;
  text-align: center;
}

.mini-cal-legend {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mini-cal-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  overflow: hidden;
}

.mini-cal-legend-date {
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.mini-cal-legend-name {
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.mini-cal-legend-name:hover {
  text-decoration: underline;
  color: var(--accent);
}

.mini-cal-legend-resp {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
  flex-shrink: 0;
  font-size: 11px;
}

/* ── Reports ─────────────────────────────── */
.report-hub-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.report-stat-card {
  flex: 1 1 160px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}

.report-stat-icon {
  font-size: 28px;
  line-height: 1;
}

.report-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.report-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.report-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.report-hub-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  cursor: pointer;
}

.report-hub-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text);
  transform: translateY(-2px);
}

.report-hub-card-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.report-hub-card-body {
  flex: 1;
}

.report-hub-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.report-hub-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.report-hub-card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.report-tag {
  font-size: 11px;
  background: rgba(88,166,255,0.1);
  color: var(--accent);
  border: 1px solid rgba(88,166,255,0.25);
  border-radius: 4px;
  padding: 2px 8px;
}

.report-hub-card-arrow {
  font-size: 18px;
  color: var(--text-muted);
  align-self: center;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.15s;
}

.report-hub-card:hover .report-hub-card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* Filters card */
.report-filters-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.report-filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.report-filters-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.report-filters-form .report-filters-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.report-filters-form .form-group {
  flex: 1 1 160px;
  margin-bottom: 0;
}

.report-filters-form .form-group--actions {
  flex: 0 0 auto;
}

/* Summary strip */
.report-summary-row {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.report-summary-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-summary-block--tags {
  flex-direction: column;
}

.report-summary-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.report-summary-lbl {
  font-size: 12px;
  color: var(--text-muted);
}

.report-summary-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
  flex-shrink: 0;
}

.report-summary-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mb-1 { margin-bottom: 4px; }

/* Toolbar */
.report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.report-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-toolbar-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.report-toolbar-count {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
}

.report-toolbar-right {
  display: flex;
  gap: 8px;
}

/* Print-only header — hidden on screen */
.print-header {
  display: none;
}

/* ── Multi-select dropdown (ms-*) ────────── */
.ms-root {
  position: relative;
  width: 100%;
}

.ms-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  padding: 7px 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  min-height: 36px;
}

.ms-trigger:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.ms-trigger--open,
.ms-trigger--active {
  border-color: var(--accent);
}

.ms-trigger--active .ms-trigger-text {
  color: var(--accent);
  font-weight: 500;
}

.ms-trigger-text {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ms-chevron {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.ms-trigger--open .ms-chevron {
  transform: rotate(180deg);
}

.ms-panel {
  position: fixed;
  min-width: 220px;
  max-height: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  z-index: 500;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ms-search-row {
  padding: 10px 10px 6px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ms-search {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 13px;
  padding: 5px 10px;
  outline: none;
  transition: border-color 0.15s;
}

.ms-search:focus {
  border-color: var(--accent);
}

.ms-selall-row {
  display: flex;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ms-selall-btn {
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.12s;
}

.ms-selall-btn:hover {
  background: rgba(88, 166, 255, 0.1);
}

.ms-selall-btn--clear {
  color: var(--text-muted);
}

.ms-selall-btn--clear:hover {
  background: var(--surface-2);
  color: var(--text);
}

.ms-list {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  max-height: 230px;
  padding: 6px 0 10px;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.ms-list::-webkit-scrollbar { width: 5px; }
.ms-list::-webkit-scrollbar-track { background: transparent; }
.ms-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.ms-list::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.ms-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
  user-select: none;
}

.ms-option:hover {
  background: var(--surface-2);
}

.ms-option input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

/* ── Single-select searchable dropdown (ss-*) ── */
.ss-root {
  position: relative;
  width: 100%;
}

.ss-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  padding: 7px 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  min-height: 36px;
}

.ss-trigger:hover {
  border-color: var(--accent);
  background: var(--surface);
}

.ss-trigger--open,
.ss-trigger--active {
  border-color: var(--accent);
}

.ss-trigger-text {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ss-chevron {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.ss-trigger--open .ss-chevron {
  transform: rotate(180deg);
}

.ss-panel {
  position: fixed;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  z-index: 500;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ss-search-row {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ss-search {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 13px;
  padding: 5px 10px;
  outline: none;
  transition: border-color 0.15s;
}

.ss-search:focus {
  border-color: var(--accent);
}

.ss-list {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  max-height: 240px;
  padding: 4px 0 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.ss-list::-webkit-scrollbar { width: 5px; }
.ss-list::-webkit-scrollbar-track { background: transparent; }
.ss-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.ss-list::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.ss-option {
  padding: 4px 12px;
  min-height: 30px;
  max-height: 34px;
  box-sizing: border-box;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.3;
  color: var(--text);
  transition: background 0.1s;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-option:hover { background: var(--surface-2); }

.ss-option--clear {
  color: var(--text-muted);
  font-style: italic;
  border-bottom: 1px solid var(--border);
}

.ss-option--active {
  color: var(--accent);
  font-weight: 500;
}

/* ── Unified searchable fields and dropdowns ─────────────────── */
.ss-trigger,
.ms-trigger {
  min-height: 40px;
  background: var(--surface-2, var(--bg));
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.ss-trigger:focus-visible,
.ms-trigger:focus-visible,
.ss-trigger--open,
.ms-trigger--open {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}

.ss-panel,
.ms-panel {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.38);
}

.ss-search,
.ms-search {
  min-height: 36px;
  box-sizing: border-box;
  background: var(--surface-2, var(--bg));
  border-radius: 7px;
}

.ss-option,
.ms-option {
  min-height: 30px;
  max-height: 34px;
  box-sizing: border-box;
  margin: 1px 4px;
  padding-top: 4px;
  padding-bottom: 4px;
  border-radius: 6px;
}

.ss-option:hover,
.ss-option.is-keyboard-active,
.ms-option:hover {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface-2));
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-control,
.smart-select-control {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  box-sizing: border-box;
  overflow: hidden;
  background: var(--surface-2, var(--bg));
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-control:hover,
.smart-select-control:hover {
  border-color: color-mix(in srgb, var(--border) 45%, var(--text-muted));
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-control:focus-within,
.smart-select.is-open .smart-select-control,
.smart-select-control:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-search,
.smart-select-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  box-sizing: border-box;
  padding: 9px 10px 9px 12px;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-search::placeholder,
.smart-select-input::placeholder {
  color: var(--text-muted);
  opacity: 0.82;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-clear,
.smart-select-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-clear:hover,
.smart-select-clear:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.smart-select-clear[hidden] {
  display: none;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-arrow,
.smart-select-arrow {
  flex: 0 0 auto;
  padding: 0 11px 0 4px;
  color: var(--text-muted);
  font-size: 11px;
  pointer-events: none;
  transition: transform 0.15s;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper).is-open .user-select-arrow,
.smart-select.is-open .smart-select-arrow {
  transform: rotate(180deg);
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-dropdown,
.smart-select-dropdown {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.38);
  /* Clip to radius; scrolling lives on the list so the last option is fully visible */
  overflow: hidden;
  max-height: none;
  z-index: 10000;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-list {
  max-height: min(240px, 40vh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  /* Extra bottom pad so the last row is not clipped by radius / border */
  padding: 4px 0 8px;
  margin: 0;
  list-style: none;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-option {
  display: flex;
  align-items: center;
  min-height: 30px;
  max-height: 34px;
  margin: 1px 4px;
  padding: 3px 10px;
  border-radius: 6px;
  box-sizing: border-box;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: background 0.1s, color 0.1s;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-option:hover,
body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-option.keyboard-focus {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface-2));
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-option.selected {
  background: color-mix(in srgb, var(--accent) 17%, transparent);
  color: var(--accent);
  font-weight: 600;
}

/* Filter bars: change value via list only; show long labels in dropdown */
body :is(
  [data-auto-filter],
  .search-form--filters,
  .movements-filter-form,
  .items-filters-card,
  .stock-filters-card,
  .report-filters-form,
  [data-st-list-form]
) :is(.filter-select-wrapper, .user-select-wrapper) .user-select-clear,
body :is(
  [data-auto-filter],
  .search-form--filters,
  .movements-filter-form,
  .items-filters-card,
  .stock-filters-card,
  .report-filters-form,
  [data-st-list-form]
) .smart-select-clear {
  display: none !important;
}

body :is(
  [data-auto-filter],
  .search-form--filters,
  .movements-filter-form,
  .items-filters-card,
  .stock-filters-card,
  .report-filters-form,
  [data-st-list-form]
) :is(.filter-select-wrapper, .user-select-wrapper) .user-select-option {
  align-items: flex-start;
  min-height: 30px;
  max-height: none;
  overflow: visible;
  white-space: normal;
  word-break: break-word;
  text-overflow: unset;
  line-height: 1.4;
  padding: 8px 12px;
}

body :is(
  [data-auto-filter],
  .search-form--filters,
  .movements-filter-form,
  .items-filters-card,
  .stock-filters-card,
  .report-filters-form,
  [data-st-list-form]
) .filter-select-wrapper .user-select-dropdown {
  left: 0;
  right: auto;
  min-width: 100%;
  width: max(100%, 280px);
  max-width: min(440px, calc(100vw - 32px));
}

/* Toolbar / sidebar list filters — shared layout */
form.search-form--filters,
form[data-auto-filter].search-form--filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
form.search-form--filters > .search-input,
form.search-form--filters > .form-control.search-input,
form.search-form--filters > input[type="search"] {
  flex: 1 1 160px;
  min-width: 120px;
  max-width: 360px;
  min-height: 38px;
}
form.search-form--filters .filter-select,
form.search-form--filters .smart-select,
form.search-form--filters .smart-select--filter-bar {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 440px;
}
form.search-form--filters .filter-actions,
form.search-form--filters > .btn.btn-secondary {
  flex: 0 0 auto;
  min-height: 38px;
}

.smart-select-dropdown--filter-bar {
  max-width: min(440px, calc(100vw - 32px));
}
.smart-select-dropdown--filter-bar .smart-select-option {
  align-items: flex-start;
  min-height: 32px;
  max-height: none;
  overflow: visible;
  white-space: normal;
  word-break: break-word;
  text-overflow: unset;
  line-height: 1.4;
  padding: 8px 12px;
}

.ss-panel--filter-bar,
.ms-panel--filter-bar {
  max-width: min(440px, calc(100vw - 32px));
}
.ss-panel--filter-bar .ss-option,
.ms-panel--filter-bar .ms-option {
  align-items: flex-start;
  min-height: 30px;
  max-height: none;
  height: auto;
  overflow: visible;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
  padding-top: 8px;
  padding-bottom: 8px;
}
.ss-panel--filter-bar .ss-option {
  display: flex;
}
.ms-panel--filter-bar .ms-option {
  display: flex;
  gap: 8px;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-list,
.smart-select-options,
.scroll-styled,
.ms-list,
.ss-list {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-list::-webkit-scrollbar,
.smart-select-options::-webkit-scrollbar,
.scroll-styled::-webkit-scrollbar,
.ms-list::-webkit-scrollbar,
.ss-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-list::-webkit-scrollbar-track,
.smart-select-options::-webkit-scrollbar-track,
.scroll-styled::-webkit-scrollbar-track,
.ms-list::-webkit-scrollbar-track,
.ss-list::-webkit-scrollbar-track {
  background: transparent;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-list::-webkit-scrollbar-thumb,
.smart-select-options::-webkit-scrollbar-thumb,
.scroll-styled::-webkit-scrollbar-thumb,
.ms-list::-webkit-scrollbar-thumb,
.ss-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-list::-webkit-scrollbar-thumb:hover,
.smart-select-options::-webkit-scrollbar-thumb:hover,
.scroll-styled::-webkit-scrollbar-thumb:hover,
.ms-list::-webkit-scrollbar-thumb:hover,
.ss-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
  background-clip: padding-box;
}

.smart-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.smart-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.smart-select-input:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.smart-select--sm .smart-select-control {
  min-height: 32px;
}
.smart-select--sm .smart-select-input {
  min-height: 30px;
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 13px;
}
.smart-select--sm .smart-select-clear {
  width: 26px;
  height: 26px;
  flex-basis: 26px;
}
.smart-select--bulk {
  width: auto;
  min-width: 140px;
  flex: 0 1 220px;
}

.smart-select-dropdown {
  position: fixed;
  display: none;
  min-width: 220px;
}

.smart-select.is-open .smart-select-dropdown {
  display: block;
}

.smart-select-options {
  max-height: min(260px, 40vh);
  margin: 0;
  padding: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  list-style: none;
}

.smart-select-option {
  display: flex;
  align-items: center;
  min-height: 32px;
  max-height: 36px;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.1s, background 0.1s;
}

.smart-select-option:hover,
.smart-select-option.is-active {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface-2));
  color: var(--text);
}

.smart-select-option.is-selected {
  background: color-mix(in srgb, var(--accent) 17%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.smart-select-option.is-disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.smart-select-option-group {
  padding: 8px 10px 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.smart-select-empty {
  padding: 18px 12px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.cf-combobox-dropdown,
.item-link-search-results {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.cf-combobox-dropdown::-webkit-scrollbar,
.item-link-search-results::-webkit-scrollbar { width: 6px; }
.cf-combobox-dropdown::-webkit-scrollbar-track,
.item-link-search-results::-webkit-scrollbar-track { background: transparent; }
.cf-combobox-dropdown::-webkit-scrollbar-thumb,
.item-link-search-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}
.cf-combobox-dropdown::-webkit-scrollbar-thumb:hover,
.item-link-search-results::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 768px) {
  .form-control,
  body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-search,
  .smart-select-input,
  .ss-search,
  .ms-search,
  .cf-combobox-input {
    min-height: 44px;
    font-size: 16px;
  }

  body :is(.filter-select-wrapper, .user-select-wrapper, .vendor-select-wrapper) .user-select-control,
  .smart-select-control,
  .ss-trigger,
  .ms-trigger {
    min-height: 44px;
  }

  .smart-select-dropdown {
    max-width: calc(100vw - 24px);
    border-radius: 12px;
  }

  .smart-select-options {
    max-height: min(320px, 48vh);
    padding: 6px;
  }

  .smart-select-option {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 15px;
  }

  .smart-select--bulk {
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
  }

  .form-row .form-group {
    min-width: 100%;
  }
}

/* ── Report Column Picker (rcp-*) ──────────── */
.rcp-wrap {
  position: relative;
  display: inline-block;
}

.rcp-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 400;
  padding: 4px 0;
}

.rcp-header {
  padding: 8px 14px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.rcp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
  user-select: none;
  gap: 12px;
}

.rcp-item:hover {
  background: var(--surface-2);
}

.rcp-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
  order: 2;
}

.rcp-label {
  flex: 1;
}

/* ── Print styles ────────────────────────── */
@media print {
  /* Hide UI chrome */
  .sidebar,
  .topbar,
  .section-banner,
  .report-filters-card,
  .report-toolbar,
  .flash,
  .modal,
  .modal-backdrop {
    display: none !important;
  }

  /* Reset layout */
  body {
    background: #fff !important;
    color: #111 !important;
    font-size: 11pt;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  .content {
    padding: 0 !important;
  }

  /* Show print header */
  .print-header {
    display: block !important;
    margin-bottom: 18pt;
    padding-bottom: 10pt;
    border-bottom: 2pt solid #111;
  }

  .print-header-logo {
    font-size: 16pt;
    font-weight: 700;
    margin-bottom: 6pt;
  }

  .print-header-meta {
    font-size: 9pt;
    color: #555;
    display: flex;
    flex-wrap: wrap;
    gap: 12pt;
  }

  /* Summary */
  .report-summary-row {
    display: flex !important;
    background: none !important;
    border: 1pt solid #ccc !important;
    border-radius: 4pt !important;
    padding: 8pt 12pt !important;
    margin-bottom: 14pt !important;
    color: #111 !important;
  }

  .report-summary-num { color: #111 !important; }
  .report-summary-lbl { color: #555 !important; }
  .report-summary-divider { background: #ccc !important; }

  /* Table */
  .card {
    border: 1pt solid #ccc !important;
    border-radius: 4pt !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  .table {
    border-collapse: collapse !important;
    width: 100% !important;
    font-size: 9pt !important;
  }

  .table th {
    background: #f0f0f0 !important;
    color: #111 !important;
    border: 1pt solid #ccc !important;
    padding: 5pt 8pt !important;
    text-align: left !important;
  }

  .table-sortable-header {
    padding-right: 8pt !important;
    cursor: default !important;
  }

  .table-sortable-header::after {
    content: none !important;
  }

  .table td {
    border: 1pt solid #ddd !important;
    padding: 4pt 8pt !important;
    color: #111 !important;
  }

  .table tbody tr:nth-child(even) td {
    background: #fafafa !important;
  }

  .badge {
    border: 1pt solid #ccc !important;
    background: none !important;
    color: #111 !important;
    padding: 1pt 4pt !important;
    border-radius: 3pt !important;
    font-size: 8pt !important;
  }

  code {
    background: none !important;
    color: #111 !important;
    font-size: 9pt !important;
  }

  .text-muted { color: #555 !important; }

  a { color: #111 !important; text-decoration: none !important; }

  /* Page setup */
  @page {
    margin: 18mm 15mm;
    size: A4 landscape;
  }
}

/* ── Photo carousel ─────────────────────────────────────────────────────────── */
.item-carousel {
  position: relative;
  width: 100%;
  margin-bottom: 16px;
  user-select: none;
}

.carousel-track-wrap {
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-secondary, #f6f8fa);
}

.carousel-track {
  display: flex;
  transition: transform 0.35s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}

.carousel-slide {
  min-width: 100%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 320px;
  overflow: hidden;
}

.carousel-img {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  cursor: zoom-in;
  display: block;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,.45);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
  padding: 0;
}
.carousel-btn:hover { background: rgba(0,0,0,.7); }
.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: var(--border, #ccc);
  cursor: pointer;
  padding: 0;
  transition: background .2s, transform .2s;
}
.carousel-dot.active {
  background: var(--accent, #0969da);
  transform: scale(1.25);
}

/* ── Lightbox ────────────────────────────────────────────────────────────────── */
.photo-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0,0,0,.88);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.photo-lightbox.open {
  display: flex;
}
.lightbox-img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  cursor: default;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  opacity: .8;
  transition: opacity .15s;
}
.lightbox-close:hover { opacity: 1; }

/* ─── Vendor Management ──────────────────────────────────────────────────── */
.vendors-page { }
.vendors-table-wrap {
  margin-bottom: 24px;
}
.vendor-avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 14px;
  border-radius: 8px;
}
.vendor-list-name .vendor-avatar-sm {
  flex-shrink: 0;
}
.vendor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.vendor-card {
  display: block;
  background: var(--card-bg, #1e2a3a);
  border: 1px solid var(--border, #2d3748);
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.vendor-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  border-color: var(--accent, #58a6ff);
}
.vendor-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.vendor-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.vendor-avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 22px;
  border-radius: 12px;
}
.vendor-card-name {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}
.vendor-card-contact {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}
.vendor-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.vendor-meta-item {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}
.vendor-card-stats {
  display: flex;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #2d3748);
}
.vendor-stat {
  font-size: 12px;
  color: var(--text-muted, #94a3b8);
}
.vendor-stat strong {
  color: var(--text, #e2e8f0);
}
/* Rating */
.vendor-rating { display: inline-flex; align-items: center; gap: 2px; }
.vendor-rating .star { color: var(--border, #2d3748); font-size: 14px; }
.vendor-rating .star.filled { color: #f59e0b; }
.vendor-rating .star.half { color: #f59e0b; opacity: .6; }
.vendor-rating .rating-value { font-size: 12px; margin-left: 4px; color: var(--text-muted, #94a3b8); }
.vendor-rating-lg .star { font-size: 18px; }
/* Rating input */
.rating-input { display: flex; align-items: center; gap: 4px; padding: 8px 0; }
.rating-input .rating-star { font-size: 24px; cursor: pointer; color: var(--border, #2d3748); transition: color .15s, transform .15s; }
.rating-input .rating-star.active,
.rating-input .rating-star.hover { color: #f59e0b; transform: scale(1.1); }
.rating-clear-btn { background: none; border: none; color: var(--text-muted, #94a3b8); cursor: pointer; font-size: 14px; margin-left: 8px; }
/* Vendor detail */
.vendor-detail-header { display: flex; align-items: center; gap: 16px; }
.vendor-detail-name { margin: 0; font-size: 20px; }
.vendor-detail-actions { display: flex; gap: 8px; }
.vendor-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 12px;
}
.vendor-detail-item-wide { grid-column: 1 / -1; }
.vendor-detail-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted, #94a3b8); margin-bottom: 4px; }
.vendor-detail-value { font-size: 14px; }
.vendor-detail-value a { color: var(--accent, #58a6ff); text-decoration: none; }
.vendor-detail-value a:hover { text-decoration: underline; }
/* Responsive tables */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Contract status badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.badge-success { background: rgba(16,185,129,.15); color: #10b981; }
.badge-warning { background: rgba(245,158,11,.15); color: #f59e0b; }
.badge-danger { background: rgba(239,68,68,.15); color: #ef4444; }
.badge-secondary { background: rgba(148,163,184,.15); color: #94a3b8; }
.contract-expired td { opacity: .6; }
.contract-expiring td { background: rgba(245,158,11,.05); }
.btn-xs { padding: 2px 8px; font-size: 11px; }
.empty-state { padding: 48px 24px; text-align: center; }
.empty-state h3 { font-size: 1.15rem; font-weight: 600; }
.empty-state p { color: var(--text-muted, #94a3b8); margin: 0 0 16px; }
.empty-state-sm { padding: 24px; text-align: center; }
.empty-state-sm p { color: var(--text-muted, #94a3b8); margin: 0 0 12px; }
.zero-state {
  padding: 36px 24px;
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
}
.zero-state__icon {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.zero-state-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.92;
  line-height: 0;
}
.zero-state-nav-icon svg {
  width: 32px;
  height: 32px;
  display: block;
}
.zero-state__title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text);
}
.zero-state__lead {
  margin: 0 0 16px;
  color: var(--text-muted, #94a3b8);
  font-size: 0.95rem;
  line-height: 1.5;
}
.zero-state__example {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--surface-2, var(--surface));
  color: var(--text-muted, #94a3b8);
  font-size: 0.85rem;
  line-height: 1.45;
  text-align: left;
}
.zero-state__steps {
  display: grid;
  gap: 10px;
  text-align: left;
  margin: 0 0 20px;
}
.zero-state__step {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.zero-state__step strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
  font-size: 0.9rem;
}
.zero-state__step span {
  color: var(--text-muted, #94a3b8);
  font-size: 0.85rem;
  line-height: 1.4;
}
.zero-state__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.zero-state__actions .btn {
  min-height: 44px;
}
/* Vendor detail card header fix */
.vendor-detail-card .card-header {
  flex-wrap: wrap;
  gap: 12px;
}
.vendor-detail-card .card-header .vendor-detail-header {
  flex: 1;
  min-width: 0;
}
.vendor-detail-card .card-header .vendor-detail-actions {
  flex-shrink: 0;
}

/* ── Label designer ─────────────────────────────────────────────────────── */
.card-label-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.label-designer-root {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.label-designer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.label-designer-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  align-items: end;
}
.label-designer .label-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
}
.label-designer .label-control label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.label-designer .form-control {
  min-height: 36px;
  border-radius: 10px;
  background: var(--surface);
  border-color: var(--border);
}
.label-designer .form-control-sm {
  padding: 7px 10px;
}
.label-select-wrap {
  position: relative;
  display: block;
}
.label-select-wrap::after {
  content: '▾';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
}
.label-select-wrap select.form-control {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
}
.cf-like-select-wrap {
  min-width: 0;
}
.cf-like-select-wrap .form-control {
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.label-designer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.label-designer-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
.label-designer-footer .label-designer-footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 1 0;
  min-width: min(100%, 168px);
  max-width: 220px;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  box-sizing: border-box;
  line-height: 1.25;
  text-decoration: none;
}
.label-designer-footer .label-designer-footer-btn--primary {
  font-weight: 600;
}
.label-designer-actions .form-control {
  max-width: 240px;
}
.label-add-field-dropdown {
  position: relative;
}
.label-add-field-menu {
  min-width: 220px;
  max-height: 260px;
  overflow-y: auto;
  right: auto;
  left: 0;
}
.label-designer-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 10px;
  align-items: start;
}
.label-preview-wrap {
  overflow: hidden;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
}
.label-preview-viewport {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
}
.label-preview-stage {
  transform-origin: top center;
  flex-shrink: 0;
}
.label-preview-paper {
  position: relative;
  background: #fff;
  border: 1px solid #c8c8c8;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
}
.label-preview-paper.is-thermal {
  border-color: #d6d6d6;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}
.label-preview-paper:not(.is-thermal)::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    135deg,
    transparent,
    transparent 8px,
    rgba(0, 0, 0, 0.02) 8px,
    rgba(0, 0, 0, 0.02) 9px
  );
}
.label-preview-format-hint {
  font-size: 11px;
  margin: 6px 0 0;
  text-align: center;
}
.label-preview-canvas {
  position: absolute;
  background: #fff;
  color: #111;
  border: 1px dashed rgba(37, 99, 235, 0.45);
  overflow: hidden;
  touch-action: none;
  box-sizing: border-box;
  box-shadow: none;
}
.label-preview-paper.is-thermal .label-preview-canvas {
  position: relative;
  left: 0 !important;
  top: 0 !important;
  border-style: solid;
  border-color: #d6d6d6;
}
.label-preview-element {
  position: absolute;
  border: 1px dashed rgba(37, 99, 235, .35);
  background: transparent;
  color: #111;
  padding: 0;
  box-sizing: border-box;
  cursor: move;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}
.label-preview-element.is-selected {
  border-style: solid;
  border-color: #2563eb;
  box-shadow: none;
  background: rgba(37, 99, 235, 0.04);
  overflow: visible;
  z-index: 2;
}
.label-preview-element[data-type="qr"],
.label-preview-element[data-type="image"] {
  display: block;
  padding: 0;
  background: transparent;
  overflow: hidden;
}
.label-preview-element[data-type="qr"].is-selected,
.label-preview-element[data-type="image"].is-selected {
  background: rgba(37, 99, 235, 0.04);
  overflow: visible;
}
.label-preview-qr-img,
.label-preview-image-img,
.label-preview-barcode-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}
.label-preview-element[data-type="barcode"] {
  background: #fff;
}
.label-preview-element[data-type="barcode"].is-selected {
  background: rgba(37, 99, 235, 0.04);
  overflow: visible;
}
.label-barcode-controls {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}
.label-preview-image-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #6b7280;
  font-size: 10px;
  text-align: center;
  padding: 2px;
  box-sizing: border-box;
  background: transparent;
}
.label-preview-content {
  width: 100%;
  height: 100%;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
  cursor: text;
  padding: 0.5mm;
  box-sizing: border-box;
}
.label-preview-content:focus {
  background: rgba(88, 166, 255, .08);
}
.label-preview-content.is-variable {
  cursor: move;
  user-select: none;
  background: transparent;
  color: #1e3a5f;
}
.label-preview-content.is-variable:focus {
  background: rgba(37, 99, 235, 0.06);
  outline: none;
}
.label-preview-resize {
  position: absolute;
  background: transparent;
  z-index: 2;
  pointer-events: auto;
}
.label-preview-resize[data-dir="n"],
.label-preview-resize[data-dir="s"] {
  left: 10px;
  right: 10px;
  height: 5px;
  cursor: ns-resize;
}
.label-preview-resize[data-dir="n"] { top: -2px; }
.label-preview-resize[data-dir="s"] { bottom: -2px; }
.label-preview-resize[data-dir="e"],
.label-preview-resize[data-dir="w"] {
  top: 10px;
  bottom: 10px;
  width: 5px;
  cursor: ew-resize;
}
.label-preview-resize[data-dir="e"] { right: -2px; }
.label-preview-resize[data-dir="w"] { left: -2px; }
.label-preview-resize[data-dir="ne"],
.label-preview-resize[data-dir="nw"],
.label-preview-resize[data-dir="se"],
.label-preview-resize[data-dir="sw"] {
  width: 7px;
  height: 7px;
  background: #fff;
  border: 1.5px solid #2563eb;
  border-radius: 1px;
  box-sizing: border-box;
}
.label-preview-resize[data-dir="ne"] { top: -3px; right: -3px; cursor: nwse-resize; }
.label-preview-resize[data-dir="nw"] { top: -3px; left: -3px; cursor: nesw-resize; }
.label-preview-resize[data-dir="se"] { bottom: -3px; right: -3px; cursor: nesw-resize; }
.label-preview-resize[data-dir="sw"] { bottom: -3px; left: -3px; cursor: nwse-resize; }
.label-preview-element:not(.is-selected) .label-preview-resize {
  display: none;
  pointer-events: none;
}
.label-element-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
  font-size: 12px;
}
.label-element-panel-empty {
  font-size: 11px;
  line-height: 1.35;
  margin: 0;
}
.label-element-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.label-element-controls .label-control label {
  font-size: 11px;
}
.label-element-controls .form-control-sm {
  padding: 4px 8px;
  min-height: 30px;
}
.label-element-help {
  font-size: 12px;
  margin: 0 0 4px;
}
.label-tpl-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.label-tpl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.label-tpl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.item-label-template-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.item-label-template-info .label-template-name {
  font-size: 15px;
  font-weight: 600;
}
.item-label-template-info .btn {
  width: 100%;
  justify-content: center;
}
.barcode-settings-body .item-label-template-info .form-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.label-print-hint {
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}
.label-cat-picker-modal {
  width: min(480px, 96vw);
}
.label-cat-picker-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 16px;
  padding-bottom: 16px;
}
.label-cat-picker-desc {
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}
.label-cat-picker-toolbar {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.label-cat-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.label-cat-picker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: min(52vh, 360px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.label-cat-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-left: calc(var(--cat-depth, 0) * 16px);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}
.label-cat-picker-item:hover {
  background: var(--surface);
}
.label-cat-picker-item:has(input:checked) {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
.label-cat-picker-item.is-hidden {
  display: none;
}
.label-cat-picker-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}
.label-cat-picker-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
}
.label-cat-picker-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
}
.label-cat-picker-footer {
  justify-content: space-between;
}
.label-cat-picker-count {
  font-size: 12px;
}
.label-cat-picker-footer-actions {
  display: flex;
  gap: 8px;
}
@media (max-width: 768px) {
  .label-designer-main {
    grid-template-columns: 1fr;
  }
  .label-designer-actions .form-control,
  .label-designer-footer .label-designer-footer-btn {
    width: 100%;
    max-width: none;
    flex: 1 1 100%;
  }
}

/* ── In-app user poll modal ───────────────────────────────── */
.user-poll-backdrop {
  opacity: 0;
  transition: opacity 0.22s ease;
  background: rgba(8, 12, 18, 0.62);
  backdrop-filter: blur(4px);
}
.user-poll-backdrop.is-visible { opacity: 1; }

.modal--user-poll {
  width: min(480px, 94vw);
  opacity: 0;
  transform: translate(-50%, -46%) scale(0.96);
  transition: opacity 0.28s ease, transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  border: 1px solid color-mix(in srgb, var(--accent, #58a6ff) 28%, var(--border));
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.35),
    0 0 0 1px color-mix(in srgb, var(--accent, #58a6ff) 10%, transparent);
  overflow: hidden;
}
.modal--user-poll.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.user-poll-modal-accent {
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--accent, #58a6ff),
    color-mix(in srgb, var(--accent, #58a6ff) 40%, var(--accent-2, #3fb950)),
    var(--accent-2, #3fb950)
  );
}

.user-poll-modal-header {
  align-items: flex-start;
  gap: 12px;
  padding-top: 18px;
}
.user-poll-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent, #58a6ff);
  margin-bottom: 6px;
}
.user-poll-modal-header .modal-title {
  font-size: 18px;
  line-height: 1.35;
  max-width: 36ch;
}

.user-poll-modal-body {
  padding-top: 12px;
}
.user-poll-desc {
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.user-poll-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  max-height: min(42vh, 320px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.user-poll-options::-webkit-scrollbar { width: 5px; }
.user-poll-options::-webkit-scrollbar-track { background: transparent; }
.user-poll-options::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.user-poll-option { display: block; cursor: pointer; }
.user-poll-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.user-poll-option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2, var(--surface));
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.user-poll-option:hover .user-poll-option-card {
  border-color: color-mix(in srgb, var(--accent, #58a6ff) 45%, var(--border));
  text-decoration: none;
}
.user-poll-option input:checked + .user-poll-option-card {
  border-color: var(--accent, #58a6ff);
  background: color-mix(in srgb, var(--accent, #58a6ff) 12%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #58a6ff) 35%, transparent);
}
.user-poll-option-radio {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  position: relative;
  transition: border-color 0.15s ease;
}
.user-poll-option input:checked + .user-poll-option-card .user-poll-option-radio {
  border-color: var(--accent, #58a6ff);
}
.user-poll-option input:checked + .user-poll-option-card .user-poll-option-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent, #58a6ff);
}
.user-poll-option-text {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}

.user-poll-custom-wrap {
  margin-bottom: 14px;
  opacity: 0.72;
  transition: opacity 0.15s ease;
}
.user-poll-custom-wrap.is-active { opacity: 1; }
.user-poll-custom-wrap .form-label {
  margin-bottom: 6px;
  font-size: 13px;
}
.user-poll-custom-wrap .form-control {
  resize: vertical;
  min-height: 64px;
}

.user-poll-error {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(248, 81, 73, 0.12);
  color: var(--danger, #f85149);
  font-size: 13px;
}
.user-poll-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.user-poll-actions .btn { text-decoration: none; }

@media (max-width: 520px) {
  .modal--user-poll {
    width: 100vw;
    max-height: 92vh;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(110%);
    border-radius: 16px 16px 0 0;
  }
  .modal--user-poll.is-visible {
    transform: translateY(0);
  }
}

/* ── Business-process apply modals ───────── */
.modal.modal--bp-apply {
  width: min(560px, 96vw);
}
.modal.modal--bp-apply .modal-body {
  max-height: min(50vh, 420px);
  overflow-y: auto;
}
.bp-apply-result-section {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2, var(--surface));
}
.bp-apply-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.bp-apply-result-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}
.bp-apply-result-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(63, 185, 80, 0.18);
  color: #3fb950;
  font-size: 0.75rem;
  font-weight: 700;
}
.bp-apply-result-count.skipped {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted, #94a3b8);
}
.bp-apply-result-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
}
.bp-apply-result-list li {
  position: relative;
  padding-left: 14px;
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
  line-height: 1.35;
}
.bp-apply-result-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent, #3b82f6);
}
.bp-apply-result-summary {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted, #94a3b8);
}
.bp-apply-result-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px 20px 18px;
}
.bp-apply-next-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(88, 166, 255, 0.24);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(88, 166, 255, 0.1), rgba(63, 185, 80, 0.05));
}
.bp-apply-next-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.bp-apply-next-copy strong {
  color: var(--text);
  font-size: 0.9rem;
}
.bp-apply-next-copy span {
  color: var(--text-muted, #94a3b8);
  font-size: 0.78rem;
  line-height: 1.4;
}
.bp-apply-next-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}
.bp-apply-next-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 9px 14px;
  text-align: center;
  text-decoration: none;
}
.bp-apply-next-btn:hover {
  text-decoration: none;
}
.bp-apply-next-btn-manual {
  border: 1px solid rgba(88, 166, 255, 0.38);
  background: var(--surface-2, #21262d);
  color: var(--text, #e6edf3);
}
.bp-apply-next-btn-manual:hover {
  border-color: var(--accent, #58a6ff);
  background: rgba(88, 166, 255, 0.1);
  color: var(--text, #e6edf3);
}
.bp-apply-result-close {
  align-self: center;
  min-height: 44px;
  padding: 8px 18px;
  border: 0;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  font-size: 0.8rem;
  cursor: pointer;
}
.bp-apply-result-close:hover {
  color: var(--text);
  text-decoration: none;
}
@media (min-width: 520px) {
  .bp-apply-next-buttons {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 600px) {
  .bp-apply-result-list { grid-template-columns: 1fr; }
}


/* Booking lifecycle accents */
.cal-booking[data-status="cancelled"],
.cal-agenda__item[data-status="cancelled"] {
  opacity: 0.55;
  text-decoration: line-through;
}
.cal-form-lifecycle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.cal-form-lifecycle-row .btn {
  min-height: 44px;
}


/* Calendar: filter apply matches ss-wrap height; settings; modal footer wrap */
.cal-filters-row {
  align-items: stretch;
}
.cal-filters-row .ss-wrap .ss-trigger {
  min-height: 44px;
  height: 100%;
  box-sizing: border-box;
}
.cal-filters-row .cal-filter-apply,
.cal-filters-row .btn {
  min-height: 44px;
  height: 44px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
}
.cal-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cal-settings-btn {
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  text-decoration: none;
}
.cal-settings-btn:hover {
  text-decoration: none;
}
.cal-settings-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
  opacity: 0.92;
  line-height: 0;
}
.cal-settings-nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.cal-empty-filters {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.modal--booking-view {
  width: min(640px, 96vw);
}
.modal--booking-view .modal-footer,
#view-modal .modal-footer {
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-content: flex-start;
}
.modal--booking-view .modal-footer .btn,
#view-modal .modal-footer .btn,
#view-modal .modal-footer form {
  flex: 0 1 auto;
  max-width: 100%;
}
.cal-status-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cal-status-color-input {
  width: 56px;
  height: 44px;
  padding: 4px;
  cursor: pointer;
}
.cal-status-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  min-height: 44px;
}
.cal-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.cal-statuses-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}
