/* ============================================================================
   components.css — buttons, inputs, cards, badges, modals, toasts, etc.
   ============================================================================ */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-4);
  height: 36px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  letter-spacing: -0.01em;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; flex-shrink: 0; }

.btn-sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-lg { height: 44px; padding: 0 var(--sp-5); font-size: var(--fs-md); border-radius: var(--r-md); }
.btn-icon { padding: 0; width: 36px; }
.btn-icon.btn-sm { width: 30px; }
.btn-icon.btn-lg { width: 44px; }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .15);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn-primary:active { filter: brightness(.96); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-strong);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-secondary:active { background: var(--surface-pressed); }

.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-ghost:active { background: var(--surface-pressed); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-danger:hover { filter: brightness(1.06); }

/* ---------- Inputs ---------- */
.input,
.select,
.textarea {
  width: 100%;
  height: 36px;
  padding: 0 var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
}
.textarea { height: auto; min-height: 88px; padding: var(--sp-3); resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input::placeholder { color: var(--text-subtle); }

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.field-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.field-help {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.field-error {
  font-size: var(--fs-xs);
  color: var(--danger);
}

/* ---------- Search input (with leading icon) ---------- */
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search .icon {
  position: absolute;
  left: var(--sp-3);
  width: 16px;
  height: 16px;
  color: var(--text-subtle);
  pointer-events: none;
}
.search .input {
  padding-left: calc(var(--sp-3) + 16px + var(--sp-2));
  padding-right: var(--sp-12);
}
.search .kbd {
  position: absolute;
  right: var(--sp-2);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 22px;
  padding: 0 var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  pointer-events: none;
  letter-spacing: 0;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-std) var(--ease-out),
              transform var(--t-std) var(--ease-out),
              border-color var(--t-std) var(--ease-out);
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
}
.card-title {
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  margin: 0;
}
.card-subtitle {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin: 2px 0 0;
}
.card-body { padding: var(--sp-6); }
.card-body-flush { padding: 0; }
.card-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

/* ---------- Badge / Pill ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
}
.badge-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge-success { color: var(--success); background: var(--success-soft); border-color: transparent; }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge-danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge-info { color: var(--info); background: var(--info-soft); border-color: transparent; }
.badge-accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent-grad);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: .02em;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: var(--fs-sm); }

/* ---------- Dropdown / Popover ---------- */
.popover {
  position: absolute;
  z-index: 60;
  min-width: 220px;
  padding: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-4px) scale(.98);
  pointer-events: none;
  transition: opacity var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}
.popover.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-hover); }
.menu-item .icon { width: 16px; height: 16px; color: var(--text-muted); }
.menu-item-danger { color: var(--danger); }
.menu-item-danger .icon { color: var(--danger); }
.menu-divider {
  height: 1px;
  margin: var(--sp-1) 0;
  background: var(--border-subtle);
}
.menu-label {
  padding: var(--sp-2) var(--sp-3) var(--sp-1);
  font-size: 10px;
  letter-spacing: .08em;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  color: var(--text-subtle);
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  z-index: 70;
  transition: opacity var(--t-std) var(--ease-out);
}
.modal-backdrop.is-open { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed;
  z-index: 80;
  top: 50%;
  left: 50%;
  width: min(560px, calc(100vw - var(--sp-8)));
  max-height: calc(100vh - var(--sp-8));
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translate(-50%, calc(-50% + 8px)) scale(.98);
  pointer-events: none;
  transition: opacity var(--t-std) var(--ease-out),
              transform var(--t-std) var(--ease-out);
}
.modal.is-open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  z-index: 100;
  bottom: var(--sp-6);
  right: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  min-width: 280px;
  max-width: 420px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  animation: toast-in var(--t-std) var(--ease-out) both;
}
.toast .icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-success .icon { color: var(--success); }
.toast-warn .icon { color: var(--warn); }
.toast-error .icon { color: var(--danger); }
.toast-info .icon { color: var(--info); }
.toast.is-leaving { animation: toast-out var(--t-std) var(--ease-out) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px); }
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: absolute;
  z-index: 90;
  padding: var(--sp-1) var(--sp-2);
  background: var(--text-strong);
  color: var(--text-inverse);
  font-size: var(--fs-xs);
  border-radius: var(--r-sm);
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}
.tooltip.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Skeleton ---------- */
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  display: block;
  background: linear-gradient(90deg, var(--skeleton-from) 0%, var(--skeleton-to) 50%, var(--skeleton-from) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s linear infinite;
  border-radius: var(--r-sm);
}
.skel-line { height: 12px; border-radius: var(--r-pill); }
.skel-line-lg { height: 16px; }
.skel-line-xl { height: 20px; }
.skel-block { height: 80px; border-radius: var(--r-md); }
.skel-circle { width: 32px; height: 32px; border-radius: 999px; }

/* ---------- Empty state ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  gap: var(--sp-3);
  color: var(--text-muted);
}
.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--bg-soft);
  color: var(--text-subtle);
  margin-bottom: var(--sp-2);
}
.empty-icon .icon { width: 22px; height: 22px; }
.empty-title { font-size: var(--fs-md); font-weight: var(--fw-semibold); color: var(--text-strong); margin: 0; }
.empty-text { font-size: var(--fs-sm); color: var(--text-muted); max-width: 38ch; margin: 0; }

/* ---------- KPI card / stat ---------- */
.kpi {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--t-std) var(--ease-out),
              border-color var(--t-std) var(--ease-out),
              transform var(--t-std) var(--ease-out);
}
.kpi:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-grad);
  opacity: 0;
  transition: opacity var(--t-std) var(--ease-out);
}
.kpi:hover::before { opacity: 1; }
.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
}
.kpi-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
}
.kpi-icon .icon { width: 16px; height: 16px; }
.kpi-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-3xl);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.kpi-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px var(--sp-2);
  border-radius: var(--r-pill);
  font-weight: var(--fw-medium);
}
.kpi-trend-up { color: var(--success); background: var(--success-soft); }
.kpi-trend-down { color: var(--danger); background: var(--danger-soft); }
.kpi-trend-flat { color: var(--text-muted); background: var(--bg-soft); }
.kpi-trend .icon { width: 12px; height: 12px; }
.kpi-spark { height: 36px; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs .sep { color: var(--text-subtle); display: inline-flex; }
.breadcrumbs .sep .icon { width: 14px; height: 14px; }
.breadcrumbs .current { color: var(--text-strong); font-weight: var(--fw-medium); }

/* ---------- Tabs (subnav-style underline) ---------- */
.tabs {
  display: flex;
  gap: var(--sp-1);
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: var(--subnav-h);
  padding: 0 var(--sp-3);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: color var(--t-fast) var(--ease-out);
  text-decoration: none;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text-strong); }
.tab.is-active::after {
  content: '';
  position: absolute;
  left: var(--sp-3);
  right: var(--sp-3);
  bottom: -1px;
  height: 2px;
  background: var(--accent-grad);
  border-radius: var(--r-pill);
}
.tab .icon { width: 14px; height: 14px; }

/* ---------- Page header ---------- */
.page-header {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.page-header-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.page-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  letter-spacing: -0.02em;
  margin: 0;
}
.page-subtitle {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: var(--sp-1) 0 0;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
}
.toolbar + .card { border-top-left-radius: 0; border-top-right-radius: 0; }
.toolbar-group { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px var(--sp-2);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.chip:hover { background: var(--surface-hover); color: var(--text); }
.chip.is-active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip .icon { width: 12px; height: 12px; }

/* ---------- Stat list (used by Downtime by Category) ---------- */
.stat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.stat-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
}
.stat-row-name { color: var(--text); font-weight: var(--fw-medium); }
.stat-row-val { font-family: var(--font-mono); color: var(--text-muted); font-size: var(--fs-xs); }
.stat-row-bar {
  grid-column: 1 / -1;
  height: 6px;
  background: var(--bg-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.stat-row-bar-fill {
  display: block;
  height: 100%;
  background: var(--accent-grad);
  border-radius: var(--r-pill);
  width: 0;
  transition: width var(--t-slow) var(--ease-out);
}

/* ---------- Tree (used by Equipment hierarchy preview) ---------- */
.tree { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tree-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  color: var(--text);
  transition: background var(--t-fast) var(--ease-out);
}
.tree-item:hover { background: var(--surface-hover); }
.tree-item .icon { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.tree-children { list-style: none; margin: 0; padding: 0 0 0 var(--sp-5); border-left: 1px dashed var(--border); margin-left: var(--sp-3); }
.tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-meta { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-subtle); }

/* ---------- Status pill ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  border-radius: var(--r-pill);
}
.status-active { color: var(--success); background: var(--success-soft); }
.status-completed { color: var(--info); background: var(--info-soft); }
.status-pending { color: var(--warn); background: var(--warn-soft); }
.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent);
}

/* ---------- Shift schedule (dashboard card) ---------- */
.schedule-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.schedule-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}
.schedule-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}
.schedule-icon-day { background: rgba(245, 158, 11, .14); color: var(--warn); }
.schedule-icon-night { background: var(--info-soft); color: var(--info); }
.schedule-icon .icon { width: 16px; height: 16px; }
.schedule-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-time {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.schedule-arrow {
  color: var(--text-subtle);
  font-weight: var(--fw-regular);
}
.schedule-target {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
}
.schedule-target-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  letter-spacing: -0.01em;
}
.schedule-target-unit {
  color: var(--text-muted);
  font-weight: var(--fw-regular);
  font-size: var(--fs-sm);
}

/* When the card gets really narrow, drop the row label so the time stays readable. */
@media (max-width: 480px) {
  .schedule-row { grid-template-columns: 32px 1fr; }
  .schedule-row .schedule-label { display: none; }
  .schedule-row .schedule-time { justify-self: end; }
}

/* ---------- Form helpers (CRUD modals) ---------- */
.crud-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}
.crud-form .field { gap: var(--sp-1); }
.check-row {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
  cursor: pointer;
}
.check-row:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.check {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
  flex-shrink: 0;
  position: relative;
}
.check:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.check:checked::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 9px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(45deg) translate(-1px, -1px);
}
.check:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.check-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.check-label { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-strong); }

/* ---------- Tabulator row-action buttons ---------- */
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}
.icon-btn-xs {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
}
.icon-btn-xs .icon { width: 14px; height: 14px; }
.icon-btn-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- Hero greeting ---------- */
.greeting {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-6);
}
.greeting-eyebrow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.greeting-title {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  letter-spacing: -0.02em;
  margin: 0;
}
.greeting-title .accent {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.greeting-subtitle {
  font-size: var(--fs-md);
  color: var(--text-muted);
  margin: 0;
  max-width: 60ch;
}
