/* ==========================================================================
   MTM INDUS OS — Components: buttons, cards, inputs, badges, tables,
   modals, tooltips, progress, tabs, skeletons, empty states
   Global Premium White Theme — Single Source of Truth
   ========================================================================== */

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--color-text-primary);
  --btn-border: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-button);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--btn-font-size-md);
  font-weight: var(--font-weight-semibold);
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
  transition:
    transform var(--duration-fast) var(--ease-out),
    background var(--duration-normal) var(--ease-out),
    border-color var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    color var(--duration-normal) var(--ease-out),
    filter var(--duration-normal) var(--ease-out);
  will-change: transform;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--blue-400); outline-offset: 3px; }
.btn:disabled, .btn[aria-disabled='true'] {
  opacity: 0.45;
  pointer-events: none;
}
.btn svg { width: 17px; height: 17px; flex: none; }

/* Size + shape variants */
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--btn-font-size-sm);
  border-radius: var(--radius-button-sm);
}
.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--btn-font-size-lg);
  border-radius: var(--radius-button-lg);
}
.btn-xl {
  padding: var(--space-4) var(--space-8);
  font-size: var(--btn-font-size-xl);
  border-radius: var(--radius-button-lg);
}
.btn-block { display: flex; width: 100%; }
.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  flex: none;
  border-radius: var(--radius-button);
  color: var(--color-text-tertiary);
}
.btn-icon:hover { color: var(--color-text-primary); background: var(--color-surface-hover); }
.btn-icon.btn-sm { width: 32px; height: 32px; }
.btn-icon.btn-lg { width: 46px; height: 46px; border-radius: var(--radius-button-lg); }

/* Animated arrow */
.btn .btn-arrow { transition: transform var(--duration-normal) var(--ease-out); }
.btn:hover .btn-arrow { transform: translateX(3px); }

/* ==========================================================================
   PRIMARY BUTTON — MTM INDUS SIGNATURE
   ========================================================================== */

.btn-primary {
  --btn-fg: #ffffff;
  background: var(--grad-primary);
  box-shadow: var(--shadow-brand);
  border-color: transparent;
}

.btn-primary:hover {
  filter: brightness(1.05);
  box-shadow: var(--shadow-brand-lg);
}

.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-primary:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 3px;
}

.btn-primary:disabled {
  opacity: 0.45;
  box-shadow: none;
}

/* ==========================================================================
   SECONDARY BUTTON
   ========================================================================== */

.btn-secondary {
  --btn-bg: var(--color-surface);
  --btn-border: var(--color-surface-border);
  --btn-fg: var(--color-text-primary);
}

.btn-secondary:hover {
  --btn-border: var(--color-surface-border-strong);
  --btn-fg: var(--color-text-primary);
  background: var(--color-surface-hover);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--blue-400);
  outline-offset: 3px;
}

/* ==========================================================================
   GHOST BUTTON
   ========================================================================== */

.btn-ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-fg: var(--color-text-secondary);
}

.btn-ghost:hover { --btn-fg: var(--color-text-primary); background: var(--color-surface-hover); }

/* ==========================================================================
   OUTLINE BUTTON
   ========================================================================== */

.btn-outline {
  --btn-border: var(--color-surface-border-strong);
  --btn-fg: var(--color-text-primary);
  background: var(--color-surface);
}

.btn-outline:hover {
  --btn-border: var(--color-surface-border-focus);
  --btn-fg: var(--color-text-primary);
  background: var(--color-surface-hover);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   SOFT/ON-GLASS BUTTON
   ========================================================================== */

.btn-soft {
  --btn-bg: var(--color-surface);
  --btn-border: var(--color-surface-border);
  --btn-fg: var(--color-text-primary);
  backdrop-filter: blur(10px);
}

.btn-soft:hover { --btn-border: var(--color-surface-border-focus); --btn-fg: var(--color-text-primary); }

/* ==========================================================================
   SUCCESS BUTTON
   ========================================================================== */

.btn-success {
  --btn-bg: var(--grad-growth);
  --btn-fg: #ffffff;
  box-shadow: var(--shadow-emerald);
}

.btn-success:hover { filter: brightness(1.05); }

/* ==========================================================================
   WARNING/AMBER BUTTON
   ========================================================================== */

.btn-warning {
  --btn-bg: var(--grad-warning);
  --btn-fg: #ffffff;
}

.btn-warning:hover { filter: brightness(1.05); }

/* ==========================================================================
   DANGER/ROSE BUTTON
   ========================================================================== */

.btn-danger {
  --btn-bg: var(--grad-error);
  --btn-fg: #ffffff;
  box-shadow: var(--shadow-rose);
}

.btn-danger:hover { filter: brightness(1.05); }

/* ==========================================================================
   MAGNETIC BUTTON (desktop only)
   ========================================================================== */

.btn.magnetic { overflow: hidden; position: relative; }
.btn.magnetic::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}
.btn.magnetic:hover::after { opacity: 1; }
.btn.magnetic[data-hover='true'] { transform: translate(var(--tx, 0), var(--ty, 0)); }
.btn.magnetic[data-hover='true']::after { opacity: 0; }

/* ==========================================================================
   PANELS / CARDS
   ========================================================================== */

.panel {
  position: relative;
  border-radius: var(--radius-card);
  border: 1px solid var(--color-surface-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm), var(--shadow-inner);
}

.panel-sm { padding: var(--card-padding-sm); }
.panel-md { padding: var(--card-padding-md); }
.panel-lg { padding: var(--card-padding-lg); }
.panel-pad { padding: var(--card-padding-md); }

.panel-raised {
  border-color: var(--color-surface-border-strong);
  background: var(--color-surface);
  box-shadow: var(--shadow-md), var(--shadow-inner);
}

.panel-flat {
  background: var(--color-bg-secondary);
  box-shadow: none;
}

/* Interactive card behaviour — desktop hover only */
.card-interactive {
  transition:
    transform var(--duration-normal) var(--ease-out),
    border-color var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    background var(--duration-normal) var(--ease-out);
}
.card-interactive:hover {
  transform: translateY(-2px);
  border-color: var(--color-surface-border-focus);
  box-shadow: var(--shadow-lg), var(--shadow-inner);
}
.card-interactive:focus-within {
  border-color: var(--color-surface-border-focus);
  box-shadow: var(--shadow-focus);
}

@media (hover: none) {
  .card-interactive:hover { transform: none; }
}

/* Hairline highlight along the top edge of premium cards */
.edge-glow::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.3), rgba(6, 182, 212, 0.2), transparent);
  opacity: 0.6;
  pointer-events: none;
}

/* ==========================================================================
   FORM TITLE
   ========================================================================== */

.form-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ==========================================================================
   DASHBOARD VIEW LOADING SHELLS
   ========================================================================== */

.view-loading { width: 100%; max-width: 1280px; margin-inline: auto; }
.view-skel { width: 100%; }

/* ==========================================================================
   BADGES & PILLS
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-badge);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.01em;
  line-height: 1.6;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge-sm { padding: 1px 7px; font-size: var(--text-2xs); line-height: 1.5; }

.badge-blue { background: var(--color-bg-brand-subtle); color: var(--color-text-brand); border-color: var(--blue-200); }
.badge-cyan { background: var(--color-bg-info-subtle); color: var(--color-text-info); border-color: var(--cyan-200); }
.badge-emerald { background: var(--color-bg-success-subtle); color: var(--color-text-success); border-color: var(--emerald-200); }
.badge-amber { background: var(--color-bg-warning-subtle); color: var(--color-text-warning); border-color: var(--amber-200); }
.badge-rose { background: var(--color-bg-error-subtle); color: var(--color-text-error); border-color: var(--rose-200); }
.badge-neutral { background: var(--color-bg-tertiary); color: var(--color-text-tertiary); border-color: var(--slate-200); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge .dot.pulse { animation: pulse-dot 2.2s var(--ease-in-out) infinite; }

/* Status badge — for workflow states */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-badge);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.01em;
  line-height: 1.6;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Status badge variants — using semantic colors */
.status-badge--success { background: var(--color-status-success-bg); color: var(--color-status-success); border-color: var(--color-status-success-border); }
.status-badge--warning { background: var(--color-status-warning-bg); color: var(--color-status-warning); border-color: var(--color-status-warning-border); }
.status-badge--error { background: var(--color-status-error-bg); color: var(--color-status-error); border-color: var(--color-status-error-border); }
.status-badge--info { background: var(--color-status-info-bg); color: var(--color-status-info); border-color: var(--color-status-info-border); }
.status-badge--neutral { background: var(--slate-100); color: var(--slate-600); border-color: var(--slate-200); }
.status-badge--pending { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-200); }
.status-badge--active { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--emerald-200); }
.status-badge--completed { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--emerald-200); }
.status-badge--approved { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--emerald-200); }
.status-badge--paid { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--emerald-200); }
.status-badge--pending-approval { background: var(--cyan-50); color: var(--cyan-700); border-color: var(--cyan-200); }
.status-badge--pending-client-approval { background: var(--cyan-50); color: var(--cyan-700); border-color: var(--cyan-200); }
.status-badge--in-progress { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-200); }
.status-badge--proposed { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-200); }
.status-badge--draft { background: var(--slate-100); color: var(--slate-600); border-color: var(--slate-200); }
.status-badge--paused { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-200); }
.status-badge--cancelled { background: var(--rose-50); color: var(--rose-700); border-color: var(--rose-200); }
.status-badge--rejected { background: var(--rose-50); color: var(--rose-700); border-color: var(--rose-200); }
.status-badge--expired { background: var(--slate-100); color: var(--slate-600); border-color: var(--slate-200); }
.status-badge--partially-paid { background: var(--cyan-50); color: var(--cyan-700); border-color: var(--cyan-200); }
.status-badge--open { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-200); }
.status-badge--waiting-for-client { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-200); }
.status-badge--resolved { background: var(--emerald-50); color: var(--emerald-700); border-color: var(--emerald-200); }
.status-badge--closed { background: var(--slate-100); color: var(--slate-600); border-color: var(--slate-200); }

/* ==========================================================================
   FIELDS & INPUTS
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: var(--text-sm); font-weight: var(--font-weight-semibold); color: var(--color-text-secondary); }
.field > label .req { color: var(--color-text-error); }

.input, .select, .textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-input);
  border: 1px solid var(--color-surface-border);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: var(--input-font-size);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}
.input::placeholder, .textarea::placeholder { color: var(--color-text-tertiary); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--color-surface-border-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-surface-border-focus);
  box-shadow: 0 0 0 3px var(--blue-100);
  background: var(--color-surface);
}
.textarea { resize: vertical; min-height: 96px; line-height: var(--line-height-relaxed); }

.select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.select option { background: var(--color-surface); color: var(--color-text-primary); }

.input.invalid, .textarea.invalid, .select.invalid {
  border-color: var(--color-surface-border-error);
  box-shadow: 0 0 0 3px var(--rose-100);
}

.form-msg { font-size: var(--text-sm); min-height: 20px; color: var(--color-text-tertiary); }
.form-msg.error { color: var(--color-text-error); }
.form-msg.ok { color: var(--color-text-success); }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: var(--text-sm); color: var(--color-text-secondary); }
.check input[type=checkbox] {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  flex: none; width: 18px; height: 18px; margin-top: 2px;
  border: 1.5px solid var(--color-surface-border-strong); border-radius: 5px;
  background: var(--color-surface); display: grid; place-items: center;
  transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.check input[type=checkbox]:after {
  content: ""; width: 10px; height: 10px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F172A' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 0; transform: scale(.6);
  transition: opacity var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-spring);
}
.check input[type=checkbox]:checked { background: var(--grad-primary); border-color: transparent; }
.check input[type=checkbox]:checked:after { opacity: 1; transform: scale(1); }

.search-field { position: relative; }
.search-field svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--color-text-tertiary); pointer-events: none; }
.search-field .input { padding-left: 38px; }

/* ==========================================================================
   TABLES
   ========================================================================== */

.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--color-surface-border); background: var(--color-surface); -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-sm); min-width: 640px; }
table.data thead th {
  text-align: left; padding: 11px 16px;
  font-size: var(--text-xs); font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--color-text-tertiary); border-bottom: 1px solid var(--color-surface-border);
  background: var(--color-bg-secondary); white-space: nowrap;
}
table.data tbody td { padding: 12px 16px; border-bottom: 1px solid var(--color-surface-border); color: var(--color-text-primary); vertical-align: middle; }
table.data tbody tr { transition: background var(--duration-fast) var(--ease-out); }
table.data tbody tr:hover { background: var(--color-surface-hover); }
table.data tbody tr:last-child td { border-bottom: none; }
td.cell-strong { color: var(--color-text-primary); font-weight: var(--font-weight-semibold); }
td .cell-sub { display: block; font-size: var(--text-xs); color: var(--color-text-tertiary); margin-top: 2px; }

/* Mobile table card view */
@media (max-width: 700px) {
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table.data { min-width: 700px; }
  .table-wrap::-webkit-scrollbar { height: 6px; }
  .table-wrap::-webkit-scrollbar-track { background: transparent; }
  .table-wrap::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 3px; }
}

/* ==========================================================================
   PROGRESS
   ========================================================================== */

.progress {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-bg-tertiary);
  overflow: hidden;
  border: 1px solid var(--color-surface-border);
}
.progress > span {
  display: block; height: 100%; border-radius: inherit;
  background: var(--grad-primary);
  transition: width 900ms var(--ease-out);
}
.progress--success > span { background: var(--grad-growth); }
.progress--warning > span { background: var(--grad-warning); }
.progress--error > span { background: var(--grad-error); }

/* ==========================================================================
   TABS
   ========================================================================== */

.tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-surface-border);
  border-radius: var(--radius-md);
  width: -moz-fit-content; width: fit-content;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: var(--font-weight-semibold);
  color: var(--color-text-tertiary); white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
}
.tab:hover { color: var(--color-text-primary); }
.tab[aria-selected='true'] {
  color: var(--color-text-primary);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ==========================================================================
   SEGMENTED CONTROL
   ========================================================================== */

.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 7px 14px; border-radius: var(--radius-full);
  border: 1px solid var(--color-surface-border);
  background: var(--color-bg-secondary);
  font-size: var(--text-sm); font-weight: var(--font-weight-medium);
  color: var(--color-text-tertiary);
  transition: all var(--duration-fast) var(--ease-out);
}
.chip:hover { color: var(--color-text-primary); border-color: var(--color-surface-border-strong); }
.chip.active {
  color: var(--color-text-primary);
  background: var(--blue-50); border-color: var(--blue-200);
  box-shadow: 0 0 16px -4px rgba(37, 99, 235, 0.4);
}

/* ==========================================================================
   MODALS
   ========================================================================== */

.modal-overlay {
  position: fixed; inset: 0; z-index: var(--z-index-modal-backdrop);
  display: grid; place-items: center; padding: var(--space-5);
  background: var(--color-overlay);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transition: opacity var(--duration-normal) var(--ease-out);
}
.modal-overlay.open { opacity: 1; }
.modal {
  width: 100%; max-width: var(--modal-max-width-md);
  max-height: min(86dvh, 780px);
  display: flex; flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border-strong);
  border-radius: var(--radius-modal);
  box-shadow: var(--shadow-xl);
  transform: translateY(14px) scale(0.97); opacity: 0;
  transition: transform var(--duration-normal) var(--ease-spring), opacity var(--duration-normal) var(--ease-out);
  overflow: hidden;
}
.modal-overlay.open .modal { transform: none; opacity: 1; }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--color-surface-border);
}
.modal-head h3 { font-size: var(--text-lg); color: var(--color-text-primary); }
.modal-body { padding: var(--space-6); overflow-y: auto; }
.confirm-danger-icon {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  color: var(--color-text-error); background: var(--color-status-error-bg);
  border: 1px solid var(--color-status-error-border);
}
.modal-foot {
  display: flex; justify-content: flex-end; gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-surface-border); background: var(--color-bg-secondary);
}

/* ==========================================================================
   TOASTS
   ========================================================================== */

.toast-region {
  position: fixed; bottom: var(--space-6); right: var(--space-6);
  z-index: var(--z-index-toast);
  display: flex; flex-direction: column; gap: 10px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  opacity: 0; transform: translateX(24px);
  transition: opacity var(--duration-normal) var(--ease-out), transform var(--duration-normal) var(--ease-spring);
}
.toast.show { opacity: 1; transform: none; }
.toast.leaving { opacity: 0; transform: translateY(8px) scale(0.98); }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok svg { color: var(--emerald-500); }
.toast.error svg { color: var(--rose-500); }
.toast.info svg { color: var(--cyan-500); }

/* ==========================================================================
   DROPDOWNS
   ========================================================================== */

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: var(--z-index-dropdown);
  min-width: 220px; padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-surface-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px) scale(0.98);
  transform-origin: top right; pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
.dropdown.open .dropdown-menu { opacity: 1; transform: none; pointer-events: auto; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border-radius: var(--radius-xs);
  font-size: var(--text-sm); color: var(--color-text-primary);
  text-align: left; background: none; border: none; cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.dropdown-item:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }
.dropdown-item svg { width: 15px; height: 15px; color: var(--color-text-tertiary); }
.dropdown-item.danger { color: var(--color-text-error); }
.dropdown-sep { height: 1px; margin: 6px 8px; background: var(--color-surface-border); }

/* ==========================================================================
   SKELETONS
   ========================================================================== */

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-bg-tertiary) 25%, var(--blue-100) 50%, var(--color-bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton-text { height: 12px; margin-bottom: 9px; }
.skeleton-text.w-2 { width: 40%; }
.skeleton-text.w-3 { width: 65%; }
.skeleton-card { height: 120px; border-radius: var(--radius-card); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ==========================================================================
   EMPTY STATES
   ========================================================================== */

.empty {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-3); padding: var(--space-9) var(--space-6); text-align: center;
}
.empty-icon {
  display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: var(--radius-card);
  background: var(--blue-50); border: 1px solid var(--blue-200); color: var(--blue-500);
}
.empty-icon svg { width: 28px; height: 28px; }
.empty h4 { margin: 0; font-size: var(--text-md); color: var(--color-text-primary); }
.empty p { margin: 0; color: var(--color-text-tertiary); max-width: 380px; font-size: var(--text-sm); }

/* ==========================================================================
   TOOLTIPS
   ========================================================================== */

[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%; translate: -50% 4px;
  padding: 6px 10px; background: var(--color-text-primary); border: 1px solid var(--color-surface-border-strong);
  border-radius: var(--radius-xs); font-size: var(--text-xs); font-weight: var(--font-weight-medium); color: var(--color-surface); white-space: nowrap; pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-out), translate var(--duration-fast) var(--ease-out); z-index: 90; opacity: 0;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; translate: -50% 0; }
[data-tip-right]::after { bottom: auto; left: calc(100% + 10px); top: 50%; translate: -4px -50%; }
[data-tip-right]:hover::after, [data-tip-right]:focus-visible::after { translate: 0 -50%; }

/* ==========================================================================
   AVATARS
   ========================================================================== */

.avatar {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--radius-avatar);
  background: var(--grad-primary-soft);
  border: 1px solid var(--color-surface-border-focus);
  color: var(--blue-600); font-weight: var(--font-weight-bold); font-size: var(--text-sm);
  flex: none; user-select: none;
}
.avatar-lg { width: 52px; height: 52px; font-size: var(--text-lg); }
.avatar-sm { width: 30px; height: 30px; font-size: var(--text-xs); }

/* ==========================================================================
   KBD
   ========================================================================== */

kbd { font-family: var(--font-family-mono); font-size: var(--text-xs); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--color-surface-border-strong); border-bottom-width: 2px; background: var(--color-bg-tertiary); color: var(--color-text-tertiary); }