/* ================================================================
   SIMPLICITY — Global Component Class Library
   Import this file once at the app level.
   Do NOT duplicate these classes in component-scoped CSS.

   Usage:  <link rel="stylesheet" href="_content/Simplicity.UI/css/simplicity.css" />
   ================================================================ */

/* ── ICON ───────────────────────────────────────────────────────── */
.sp-icon {
  display: inline-flex;
  flex-shrink: 0;
  vertical-align: middle;
  pointer-events: none;
}

/* ── RESET ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--fg-1);
  background: var(--bg-app);
  margin: 0;
}

h1, h2, h3, h4, h5, h6 { margin: 0; line-height: var(--leading-snug); }

a { color: var(--fg-link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

button { font-family: inherit; cursor: pointer; }

::selection { background: var(--primary-100); color: var(--primary-900); }

/* ── TYPOGRAPHY ─────────────────────────────────────────────────── */
.h1 { font-size: var(--text-4xl); font-weight: var(--weight-bold);   letter-spacing: var(--tracking-tight); color: var(--fg-1); }
.h2 { font-size: var(--text-2xl); font-weight: var(--weight-semi);   letter-spacing: var(--tracking-tight); color: var(--fg-1); }
.h3 { font-size: var(--text-lg);  font-weight: var(--weight-semi);   color: var(--fg-1); }
.h4 { font-size: var(--text-md);  font-weight: var(--weight-semi);   color: var(--fg-1); }

.text-meta    { font-size: var(--text-xs);  color: var(--fg-3); }
.text-eyebrow { font-size: var(--text-xs);  font-weight: var(--weight-semi); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--fg-3); }
.text-mono    { font-family: var(--font-mono); font-size: 0.92em; }
.text-muted   { color: var(--fg-3); }
.text-strong  { font-weight: var(--weight-semi); color: var(--fg-1); }

/* ── BUTTONS ────────────────────────────────────────────────────── */
.btn {
  font: var(--weight-medium) var(--text-base) var(--font-sans);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1;
  white-space: nowrap;
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
  text-decoration: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg, .btn [data-lucide] { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary   { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled)   { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: #fff; color: var(--fg-1); border-color: var(--border-default); }
.btn-secondary:hover:not(:disabled) { background: var(--neutral-50); border-color: var(--neutral-400); }
.btn-ghost     { background: transparent; color: var(--fg-2); border-color: transparent; }
.btn-ghost:hover:not(:disabled)     { background: var(--neutral-100); color: var(--fg-1); }
.btn-danger    { background: var(--danger-600); color: #fff; border-color: var(--danger-600); }
.btn-danger:hover:not(:disabled)    { background: var(--danger-700); }

.btn-sm { padding: 6px 10px; font-size: var(--text-sm); }
.btn-lg { padding: 10px 20px; font-size: var(--text-md); }
.btn-icon-only { padding: 8px; }

/* ── BADGES ─────────────────────────────────────────────────────── */
.badge {
  font-size: 11px;
  font-weight: var(--weight-semi);
  padding: 3px 9px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1.4;
}
.badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-success { background: var(--success-50);  color: var(--success-700); }
.badge-warning { background: var(--warning-50);  color: var(--warning-700); }
.badge-danger  { background: var(--danger-50);   color: var(--danger-700); }
.badge-info    { background: var(--info-50);     color: var(--info-700); }
.badge-gray    { background: var(--neutral-100); color: var(--neutral-700); }
.badge-brand   { background: var(--primary-50);  color: var(--primary-700); }
.badge-neutral { background: var(--neutral-100); color: var(--neutral-700); }

/* Status variant (with leading dot built-in) */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: var(--weight-semi);
  padding: 3px 9px;
  border-radius: var(--radius-full);
}
.status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-active   { background: var(--success-50);  color: var(--success-700); }
.status-inactive { background: var(--neutral-100); color: var(--neutral-500); }
.status-pending  { background: var(--warning-50);  color: var(--warning-700); }
.status-danger   { background: var(--danger-50);   color: var(--danger-700); }

/* Plan pills */
.plan-pill {
  font-size: 11px; font-weight: var(--weight-semi);
  padding: 2px 8px; border-radius: var(--radius-sm);
  background: var(--neutral-100); color: var(--neutral-700);
}
.plan-pill.enterprise { background: var(--primary-50);  color: var(--primary-700); }
.plan-pill.pro        { background: var(--info-50);     color: var(--info-700); }
.plan-pill.starter    { background: var(--neutral-100); color: var(--neutral-700); }

/* ── AVATAR ─────────────────────────────────────────────────────── */
.av {
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-weight: var(--weight-bold);
  font-size: 12px;
  flex-shrink: 0;
  user-select: none;
}
.av-blue    { background: var(--primary-100); color: var(--primary-700); }
.av-amber   { background: #fef0c7; color: #b54708; }
.av-rose    { background: #fee4e2; color: #b42318; }
.av-emerald { background: #d1fadf; color: #027a48; }
.av-sky     { background: #d1e9ff; color: #175cd3; }
.av-slate   { background: var(--neutral-200); color: var(--neutral-700); }
.av-sm  { width: 24px; height: 24px; font-size: 10px; }
.av-md  { width: 32px; height: 32px; font-size: 12px; }
.av-lg  { width: 40px; height: 40px; font-size: 14px; }

/* ── STAT CARDS ─────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}
.stat-card__label {
  font-size: var(--text-xs); font-weight: var(--weight-semi);
  color: var(--fg-3); text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center;
}
.stat-card__label svg,
.stat-card__label [data-lucide] { width: 16px; height: 16px; color: var(--fg-3); }
.stat-card__value {
  font-size: 28px; font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight); color: var(--fg-1); line-height: 1.1;
}
.stat-card__delta {
  font-size: var(--text-xs); font-weight: var(--weight-semi);
  margin-top: 6px; display: flex; align-items: center; gap: 4px;
}
.stat-card__delta--up   { color: var(--success-700); }
.stat-card__delta--down { color: var(--danger-700); }
.stat-card__delta--flat { color: var(--fg-3); }

/* ── PANEL / CARD ───────────────────────────────────────────────── */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.panel-head h2,
.panel-head h3 { font-size: var(--text-md); font-weight: var(--weight-semi); margin: 0; }
.panel-head .sub { font-size: var(--text-sm); color: var(--fg-3); margin-top: 2px; }
.panel-body { padding: 20px; }
.panel-foot {
  padding: 14px 20px;
  background: var(--neutral-25);
  border-top: 1px solid var(--border-subtle);
  display: flex; justify-content: flex-end; gap: var(--space-2);
}

/* ── TOOLBAR / FILTER BAR ───────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--neutral-25);
  flex-wrap: wrap;
}
.toolbar .spacer { flex: 1; }

.tab-group {
  display: inline-flex;
  background: var(--neutral-100);
  border-radius: var(--radius-md);
  padding: 3px;
}
.tab {
  padding: 5px 12px;
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--fg-2); border-radius: var(--radius-sm);
  cursor: pointer; user-select: none;
  transition: background var(--dur-fast);
}
.tab.active,
.tab[aria-selected="true"] {
  background: #fff; color: var(--fg-1);
  box-shadow: var(--shadow-xs);
}

/* Search inline (in toolbar) */
.search-inline { position: relative; }
.search-inline input {
  padding: 7px 10px 7px 30px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font: var(--text-sm) var(--font-sans);
  background: #fff; outline: none;
  min-width: 220px; color: var(--fg-1);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.search-inline input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
.search-inline input::placeholder { color: var(--fg-4); }
.search-inline [data-lucide],
.search-inline svg {
  position: absolute; left: 9px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--fg-3);
  pointer-events: none;
}

/* ── TABLES ─────────────────────────────────────────────────────── */
.sp-table-wrapper { overflow-x: auto; }

.sp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.sp-table th {
  text-align: left;
  font-size: 11px; font-weight: var(--weight-semi);
  text-transform: uppercase; letter-spacing: var(--tracking-caps);
  color: var(--fg-3);
  padding: 10px 16px;
  background: var(--neutral-25);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.sp-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--fg-1);
  vertical-align: middle;
}
.sp-table tr:last-child td { border-bottom: none; }
.sp-table__row--clickable:hover td {
  background: var(--neutral-25);
  cursor: pointer;
}

/* Tenant cell pattern */
.tenant-cell { display: flex; align-items: center; gap: 10px; }
.tenant-cell .name { font-weight: var(--weight-medium); line-height: 1.3; }
.tenant-cell .meta { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); }

/* ── SWITCH (toggle) ────────────────────────────────────────────── */
.switch {
  display: inline-flex;
  width: 36px; height: 20px;
  border-radius: var(--radius-full);
  background: var(--neutral-300);
  position: relative; cursor: pointer; flex-shrink: 0;
  transition: background var(--dur-fast);
}
.switch.on, .switch[aria-checked="true"] { background: var(--accent); }
.switch::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  transition: left var(--dur-fast);
  box-shadow: var(--shadow-xs);
}
.switch.on::after, .switch[aria-checked="true"]::after { left: 18px; }

/* ── FORM FIELDS ────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label {
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--fg-1);
}
.field .field-help { font-size: var(--text-xs); color: var(--fg-3); }
.field .field-error { font-size: var(--text-xs); color: var(--danger-600); font-weight: var(--weight-medium); }

.sp-input {
  font: var(--text-base) var(--font-sans);
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: #fff;
  color: var(--fg-1);
  outline: none;
  width: 100%;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.sp-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
.sp-input::placeholder { color: var(--fg-4); }
.sp-input:disabled { opacity: 0.5; cursor: not-allowed; background: var(--bg-sunken); }
textarea.sp-input { resize: vertical; min-height: 80px; font-family: var(--font-sans); }

.sp-select {
  font: var(--text-base) var(--font-sans);
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: #fff;
  color: var(--fg-1);
  outline: none;
  width: 100%;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  cursor: pointer;
  appearance: auto;
}
.sp-select:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
.sp-select:disabled { opacity: 0.5; cursor: not-allowed; background: var(--bg-sunken); }

/* ── MODAL ──────────────────────────────────────────────────────── */
.sp-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(22, 26, 33, 0.40);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: grid; place-items: center;
  animation: sp-fade var(--dur-base) var(--ease-out);
  padding: var(--space-4);
}
.sp-modal {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 680px; max-width: 100%;
  max-height: calc(100vh - var(--space-8));
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-xl);
  animation: sp-rise var(--dur-base) var(--ease-out);
  overflow: hidden;
}
.sp-modal__header {
  padding: 20px 24px 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-shrink: 0;
}
.sp-modal__title { font-size: var(--text-lg); font-weight: var(--weight-semi); margin: 0 0 4px; }
.sp-modal__close {
  background: none; border: none; cursor: pointer;
  color: var(--fg-3); font-size: 18px; line-height: 1;
  padding: 2px 6px; border-radius: var(--radius-sm);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.sp-modal__close:hover { background: var(--neutral-100); color: var(--fg-1); }
.sp-modal__body {
  padding: 20px 24px;
  display: flex; flex-direction: column; gap: 16px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.sp-modal__footer {
  padding: 14px 24px;
  background: var(--neutral-25);
  border-top: 1px solid var(--border-subtle);
  display: flex; justify-content: flex-end; gap: var(--space-2);
  flex-shrink: 0;
}

/* ── TOGGLE SWITCH ───────────────────────────────────────────────── */
.sp-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.sp-toggle__track {
  position: relative; width: 40px; height: 22px;
  background: var(--neutral-200); border-radius: 11px;
  transition: background var(--dur-base) var(--ease-out);
  flex-shrink: 0;
}
.sp-toggle__track::after {
  content: ""; position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: transform var(--dur-base) var(--ease-out);
}
.sp-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.sp-toggle input:checked ~ .sp-toggle__track { background: var(--primary-500); }
.sp-toggle input:checked ~ .sp-toggle__track::after { transform: translateX(18px); }
.sp-toggle input:focus-visible ~ .sp-toggle__track {
  outline: 2px solid var(--primary-400); outline-offset: 2px;
}
.sp-toggle__label { font-size: var(--text-sm); color: var(--fg-2); line-height: 1.4; }

/* ── TOAST ──────────────────────────────────────────────────────── */
.sp-toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--neutral-900); color: #fff;
  padding: 12px 16px; border-radius: var(--radius-lg);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: sp-rise var(--dur-base) var(--ease-out);
  z-index: 300;
}
.sp-toast svg,
.sp-toast [data-lucide] { width: 16px; height: 16px; color: var(--success-500); }

/* ── SKELETON ───────────────────────────────────────────────────── */
@keyframes sp-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.sp-skeleton {
  background: linear-gradient(90deg,
    var(--neutral-100) 25%,
    var(--neutral-50)  50%,
    var(--neutral-100) 75%);
  background-size: 800px 100%;
  animation: sp-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}
.sp-skeleton--circle { border-radius: var(--radius-full); }
.sp-skeleton--text   { height: 14px; border-radius: var(--radius-sm); }

/* ── EMPTY STATE ────────────────────────────────────────────────── */
.sp-empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  gap: var(--space-3);
}
.sp-empty-state__icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  background: var(--primary-50);
  display: grid; place-items: center;
  color: var(--primary-600);
  margin-bottom: var(--space-1);
}
.sp-empty-state__icon svg,
.sp-empty-state__icon [data-lucide] { width: 22px; height: 22px; }
.sp-empty-state__title { font-size: var(--text-md); font-weight: var(--weight-semi); color: var(--fg-1); }
.sp-empty-state__desc  { font-size: var(--text-sm); color: var(--fg-3); max-width: 320px; line-height: var(--leading-relaxed); }

/* ── ACTIVITY FEED ──────────────────────────────────────────────── */
.act-item {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.act-item:last-child { border-bottom: none; }
.act-item .act-text { font-size: var(--text-sm); line-height: var(--leading-normal); color: var(--fg-2); }
.act-item .act-text b { color: var(--fg-1); font-weight: var(--weight-semi); }
.act-item .act-time { font-size: 11px; color: var(--fg-3); margin-top: 2px; }

/* ── ANNOUNCEMENT CARD ──────────────────────────────────────────── */
.ann-card {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 16px; padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.ann-card:last-child { border-bottom: none; }
.ann-card__icon {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  display: grid; place-items: center;
  background: var(--primary-50); color: var(--primary-600);
  flex-shrink: 0;
}
.ann-card__icon svg,
.ann-card__icon [data-lucide] { width: 18px; height: 18px; }
.ann-card__title { font-weight: var(--weight-semi); font-size: var(--text-base); margin-bottom: 2px; }
.ann-card__body  { font-size: var(--text-sm); color: var(--fg-2); margin-bottom: 6px; line-height: var(--leading-normal); }
.ann-card__meta  { font-size: var(--text-xs); color: var(--fg-3); display: flex; gap: 12px; }

/* ── FEATURE FLAG ROW ───────────────────────────────────────────── */
.flag-row {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 16px; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
}
.flag-row:last-child { border-bottom: none; }
.flag-row__name { font-weight: var(--weight-medium); font-size: var(--text-base); }
.flag-row__key  { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); margin-top: 2px; }
.flag-row__desc { font-size: var(--text-xs); color: var(--fg-3); margin-top: 2px; }

/* ── STACK (flex helper) ────────────────────────────────────────── */
.stack { display: flex; flex-direction: column; }
.stack-row { display: flex; flex-direction: row; }
.stack-center { align-items: center; }
.stack-between { justify-content: space-between; }
.stack-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ── DIVIDER ────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-subtle); }
.divider-v { width: 1px; background: var(--border-subtle); align-self: stretch; }

/* ── UTILITY ────────────────────────────────────────────────────── */
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only   { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.w-full    { width: 100%; }
.m-0       { margin: 0; }
.p-0       { padding: 0; }

/* ── MODULE TABS (underline style) ──────────────────────────────── */
.sp-tabs { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; }
.sp-tabs::-webkit-scrollbar { display: none; }
.sp-tab {
  padding: 10px 16px;
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--fg-3); background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  cursor: pointer; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.sp-tab:hover { color: var(--fg-1); }
.sp-tab--active { color: var(--primary-600); border-bottom-color: var(--primary-500); }
.sp-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--neutral-100); border-radius: 9px;
  font-size: var(--text-xs); font-weight: var(--weight-medium);
  color: var(--fg-3);
}
.sp-tab--active .sp-tab-count { background: var(--primary-100); color: var(--primary-700); }

/* ── FIELD — auto-style raw inputs inside .field wrappers ────────── */
/* Eliminates the need to add class="sp-input" to every input manually. */
.field > input,
.field > input[type="text"],
.field > input[type="email"],
.field > input[type="date"],
.field > input[type="time"],
.field > input[type="number"],
.field > input[type="tel"],
.field > input[type="password"],
.field > input[type="url"],
.field > textarea {
  font: var(--text-base) var(--font-sans);
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: #fff;
  color: var(--fg-1);
  outline: none;
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow   var(--dur-fast) var(--ease-out);
}
.field > input:focus,
.field > textarea:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
.field > input::placeholder,
.field > textarea::placeholder { color: var(--fg-4); }
.field > input:disabled,
.field > textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-sunken);
}
.field > textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-sans);
  line-height: var(--leading-normal);
}
.field > select {
  font: var(--text-base) var(--font-sans);
  padding: 9px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: #fff;
  color: var(--fg-1);
  outline: none;
  width: 100%;
  cursor: pointer;
  appearance: auto;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow   var(--dur-fast) var(--ease-out);
}
.field > select:focus {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-focus);
}
.field > select:disabled { opacity: 0.5; cursor: not-allowed; background: var(--bg-sunken); }

/* ── MODAL HEAD / FOOT class aliases ───────────────────────────── */
/* Used throughout modal components (Clinic, Cafe, Payroll etc.)   */
.sp-modal__head {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.sp-modal__head h2,
.sp-modal__head h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  color: var(--fg-1);
  margin: 0;
}
.sp-modal__foot {
  padding: 14px 24px;
  background: var(--neutral-25);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ── MODAL TABS (inside modals) ─────────────────────────────────── */
.sp-modal-tabs {
  display: flex;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.sp-modal-tab {
  padding: 10px 14px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--fg-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}
.sp-modal-tab:hover { color: var(--fg-1); }
.sp-modal-tab--active {
  color: var(--primary-600);
  border-bottom-color: var(--primary-500);
  font-weight: var(--weight-semi);
}

/* ── ANIMATIONS ─────────────────────────────────────────────────── */
@keyframes sp-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes sp-rise { from { opacity: 0; transform: translateY(8px) scale(0.99) } to { opacity: 1; transform: none } }
@keyframes sp-slide-in { from { transform: translateX(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
