/* ============================================================
   Forge by Uncles&Co — Component Library
   components.css
   ============================================================ */

/* ============================================================
   1. BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration) var(--ease-default);
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-secondary:hover {
  background: var(--accent-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover { opacity: .9; }

.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-warning {
  background: var(--warning);
  color: white;
  border-color: var(--warning);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-outline:hover { border-color: var(--border-strong); background: var(--bg-surface-hover); }

/* Sizes */
.btn--sm { padding: var(--space-1) var(--space-3); font-size: var(--fs-xs); }
.btn--lg { padding: var(--space-3) var(--space-6); font-size: var(--fs-base); }
.btn--block { width: 100%; }
.btn--icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
}


/* ============================================================
   2. FORM CONTROLS
   ============================================================ */

.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}
.form-label .required {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--duration) var(--ease-default),
              box-shadow var(--duration) var(--ease-default);
}
.form-control:hover { border-color: var(--border-strong); }
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.form-control::placeholder { color: var(--text-tertiary); }
.form-control:disabled {
  opacity: .6;
  cursor: not-allowed;
  background: var(--bg-surface-alt);
}
.form-control.error { border-color: var(--danger); }

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239C8E82' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}

.form-hint {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  margin-top: var(--space-1);
}

/* Input group (prepend/append) */
.input-group {
  display: flex;
  align-items: stretch;
}
.input-group .form-control { border-radius: 0; }
.input-group .form-control:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.input-group .form-control:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.input-group__addon {
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-default);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Switch toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--duration) var(--ease-default);
}
.switch__slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: white;
  border-radius: var(--radius-full);
  transition: transform var(--duration) var(--ease-default);
}
.switch input:checked + .switch__slider { background: var(--accent); }
.switch input:checked + .switch__slider::before { transform: translateX(18px); }


/* ============================================================
   3. CARDS
   ============================================================ */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  transition: box-shadow var(--duration) var(--ease-default),
              border-color var(--duration) var(--ease-default);
}

.card--interactive:hover {
  box-shadow: var(--card-shadow-hover);
  border-color: var(--border-default);
}

.card--flat {
  box-shadow: none;
  border: 1px solid var(--border-default);
}

.card--brand {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-subtle);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.card__title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
}
.card__body { padding: var(--space-4) var(--space-5); }
.card__body--flush { padding: 0; }
.card__footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--border-subtle);
}


/* ============================================================
   4. STAT CARD (KPIs)
   ============================================================ */

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.stat-card__label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.stat-card__value {
  font-family: var(--font-mono);
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  line-height: 1;
}
.stat-card__trend {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
}
.stat-card__trend.up { color: var(--success); }
.stat-card__trend.down { color: var(--danger); }
.stat-card__sparkline {
  margin-top: var(--space-2);
  height: 32px;
}


/* ============================================================
   5. DATA TABLE
   ============================================================ */

.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.data-table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table th.sortable {
  cursor: pointer;
}
.data-table th.sortable:hover { color: var(--text-primary); }
.data-table th .sort-icon { margin-left: var(--space-1); opacity: .4; }
.data-table th.sorted .sort-icon { opacity: 1; color: var(--accent); }

.data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr { transition: background var(--duration) var(--ease-default); }
.data-table tbody tr:hover { background: var(--bg-surface-hover); }
.data-table tbody tr.selected { background: var(--accent-subtle); }

.data-table tbody tr:last-child td { border-bottom: none; }

/* Inline editing */
.data-table td.editable { cursor: pointer; }
.data-table td.editable:hover { background: var(--accent-surface); }
.data-table td.editing {
  padding: var(--space-1) var(--space-2);
}
.data-table td.editing .form-control {
  padding: var(--space-1) var(--space-2);
  font-size: var(--fs-sm);
}

/* Row actions */
.row-actions {
  display: flex;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--duration) var(--ease-default);
}
.data-table tbody tr:hover .row-actions { opacity: 1; }
.row-actions .btn--icon {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: var(--fs-sm);
}

/* Table toolbar */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-3);
}
.table-toolbar__search {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.table-toolbar__search i {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: var(--fs-sm);
}
.table-toolbar__search .form-control {
  padding-left: var(--space-8);
}
.table-toolbar__filters {
  display: flex;
  gap: var(--space-2);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}
.pagination__pages {
  display: flex;
  gap: var(--space-1);
}
.pagination__btn {
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: var(--fs-xs);
  min-width: 28px;
  text-align: center;
}
.pagination__btn:hover { background: var(--bg-surface-hover); }
.pagination__btn.active {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}


/* ============================================================
   6. MODAL
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--duration) var(--ease-default);
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: scaleIn var(--duration) var(--ease-default);
}
.modal--sm { max-width: 400px; }
.modal--lg { max-width: 720px; }
.modal--xl { max-width: 960px; }
.modal--full { max-width: 95vw; max-height: 95vh; }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.modal__title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); }
.modal__close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: var(--fs-xl);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
}
.modal__close:hover { color: var(--text-primary); background: var(--bg-surface-hover); }

.modal__body {
  padding: var(--space-5);
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
}


/* ============================================================
   7. DRAWER (Side panel)
   ============================================================ */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 900;
  animation: fadeIn var(--duration) var(--ease-default);
}
.drawer-overlay.hidden { display: none; }

.drawer {
  position: fixed;
  top: 0;
  right: -480px;
  width: 480px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-default);
  box-shadow: var(--shadow-xl);
  z-index: 950;
  display: flex;
  flex-direction: column;
  transition: right var(--duration) var(--ease-default);
}
.drawer.open { right: 0; }

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  min-height: var(--topnav-h);
}
.drawer__body { flex: 1; overflow-y: auto; padding: var(--space-5); }
.drawer__footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
}


/* ============================================================
   8. TOAST NOTIFICATIONS
   ============================================================ */

.toast-container {
  position: fixed;
  top: calc(var(--topnav-h) + var(--space-4));
  right: var(--space-4);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 320px;
  max-width: 420px;
  pointer-events: all;
  animation: slideRight var(--duration) var(--ease-default);
}
.toast__icon { font-size: var(--fs-lg); flex-shrink: 0; margin-top: 1px; }
.toast__content { flex: 1; }
.toast__title { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.toast__message { font-size: var(--fs-xs); color: var(--text-secondary); margin-top: 2px; }
.toast__close {
  background: none; border: none; color: var(--text-tertiary);
  cursor: pointer; font-size: var(--fs-sm); padding: 2px;
}
.toast__undo {
  font-size: var(--fs-xs);
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: var(--fw-semibold);
  margin-top: var(--space-1);
}

.toast--success { border-left: 3px solid var(--success); }
.toast--success .toast__icon { color: var(--success); }
.toast--warning { border-left: 3px solid var(--warning); }
.toast--warning .toast__icon { color: var(--warning); }
.toast--danger { border-left: 3px solid var(--danger); }
.toast--danger .toast__icon { color: var(--danger); }
.toast--info { border-left: 3px solid var(--info); }
.toast--info .toast__icon { color: var(--info); }


/* ============================================================
   9. BADGES & TAGS
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.badge--brand { background: var(--accent-subtle); color: var(--accent); }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--muted { background: var(--bg-surface-alt); color: var(--text-secondary); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  font-size: var(--fs-xs);
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}
.tag__remove {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: var(--fs-xs);
  padding: 0;
  line-height: 1;
}
.tag__remove:hover { color: var(--danger); }


/* ============================================================
   10. BREADCRUMB & TABS
   ============================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb__sep { color: var(--text-tertiary); }
.breadcrumb__current { color: var(--text-primary); font-weight: var(--fw-medium); }

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-default);
  gap: 0;
}
.tab {
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--duration) var(--ease-default);
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}


/* ============================================================
   11. COMMAND PALETTE (Cmd+K)
   ============================================================ */

.cmd-palette-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(8px);
  z-index: 3000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
}
.cmd-palette-overlay.hidden { display: none; }

.cmd-palette {
  width: 580px;
  max-width: 90vw;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.15s var(--ease-default);
  overflow: hidden;
}
.cmd-palette__input-wrap {
  display: flex;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-3);
}
.cmd-palette__input-wrap i { color: var(--text-tertiary); font-size: var(--fs-lg); }
.cmd-palette__input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  color: var(--text-primary);
}
.cmd-palette__input::placeholder { color: var(--text-tertiary); }
.cmd-palette__kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  background: var(--bg-surface-alt);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
}

.cmd-palette__results {
  max-height: 360px;
  overflow-y: auto;
  padding: var(--space-2);
}
.cmd-palette__group-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);
}
.cmd-palette__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-primary);
  font-size: var(--fs-sm);
}
.cmd-palette__item:hover,
.cmd-palette__item.highlighted {
  background: var(--accent-subtle);
  color: var(--accent);
}
.cmd-palette__item i { color: var(--text-tertiary); width: 20px; text-align: center; }


/* ============================================================
   12. FILE UPLOAD (Drag & Drop)
   ============================================================ */

.file-upload {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration) var(--ease-default);
}
.file-upload:hover,
.file-upload.dragover {
  border-color: var(--accent);
  background: var(--accent-surface);
}
.file-upload__icon {
  font-size: var(--fs-4xl);
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}
.file-upload__text { color: var(--text-secondary); font-size: var(--fs-sm); }
.file-upload__text strong { color: var(--accent); }
.file-upload__hint { color: var(--text-tertiary); font-size: var(--fs-xs); margin-top: var(--space-1); }


/* ============================================================
   13. EMPTY STATE
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
}
.empty-state__icon {
  font-size: 4rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
  opacity: .5;
}
.empty-state__title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.empty-state__desc {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  max-width: 400px;
  margin-bottom: var(--space-6);
}


/* ============================================================
   14. AI CHAT BUTTON & PANEL
   ============================================================ */

.ai-fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--brand-gradient);
  color: white;
  border: none;
  font-size: var(--fs-xl);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 800;
  box-shadow: var(--ai-glow);
  animation: pulse-glow 3s ease-in-out infinite;
  transition: transform var(--duration) var(--ease-default);
}
.ai-fab:hover { transform: scale(1.08); }
.ai-fab:active { transform: scale(.95); }

.ai-panel {
  position: fixed;
  top: 0;
  right: -420px;
  width: 420px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-default);
  box-shadow: var(--shadow-xl);
  z-index: 850;
  display: flex;
  flex-direction: column;
  transition: right var(--duration) var(--ease-default);
}
.ai-panel.open { right: 0; }

.ai-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.ai-panel__title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.ai-panel__title .dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: var(--radius-full);
  animation: pulse-glow 2s ease-in-out infinite;
}

.ai-panel__messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.ai-msg {
  max-width: 90%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
}
.ai-msg--user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--text-on-accent);
  border-bottom-right-radius: var(--radius-sm);
}
.ai-msg--bot {
  align-self: flex-start;
  background: var(--bg-surface-alt);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-sm);
}

.ai-panel__input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-subtle);
}
.ai-panel__input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  color: var(--text-primary);
  outline: none;
}
.ai-panel__input:focus { border-color: var(--accent); }
.ai-panel__send {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-panel__send:hover { background: var(--accent-hover); }


/* ============================================================
   15. ACCORDION
   ============================================================ */

.accordion { border: 1px solid var(--border-default); border-radius: var(--radius-lg); }
.accordion__item { border-bottom: 1px solid var(--border-subtle); }
.accordion__item:last-child { border-bottom: none; }
.accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-4) var(--space-5);
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  text-align: left;
}
.accordion__trigger:hover { background: var(--bg-surface-hover); }
.accordion__trigger .icon {
  transition: transform var(--duration) var(--ease-default);
}
.accordion__item.open .accordion__trigger .icon { transform: rotate(180deg); }
.accordion__content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-default);
}
.accordion__item.open .accordion__content { max-height: 1000px; }
.accordion__content-inner { padding: 0 var(--space-5) var(--space-4); }


/* ============================================================
   16. SKELETON LOADER
   ============================================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface-alt) 25%,
    var(--bg-surface-hover) 50%,
    var(--bg-surface-alt) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton--text { height: 14px; width: 60%; margin-bottom: var(--space-2); }
.skeleton--title { height: 20px; width: 40%; margin-bottom: var(--space-3); }
.skeleton--avatar { width: 40px; height: 40px; border-radius: var(--radius-full); }
.skeleton--card { height: 120px; }
.skeleton--row { height: 44px; margin-bottom: var(--space-1); }


/* ============================================================
   17. SLIDER (Range Input)
   ============================================================ */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border-default);
  border-radius: var(--radius-full);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--accent);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  background: var(--accent);
  cursor: pointer;
  border: 2px solid white;
}


/* ============================================================
   18. DATE PICKER (basic styling)
   ============================================================ */

input[type="date"].form-control,
input[type="datetime-local"].form-control {
  color-scheme: dark;
}
[data-theme="light"] input[type="date"].form-control,
[data-theme="light"] input[type="datetime-local"].form-control {
  color-scheme: light;
}


/* ============================================================
   19. TOOLTIP
   ============================================================ */

[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-1) var(--space-2);
  background: var(--bg-app);
  color: var(--text-primary);
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration) var(--ease-default);
  z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; }


/* ============================================================
   20. PRINT
   ============================================================ */

@media print {
  .sidebar, .topnav, .ai-fab, .ai-panel,
  .toast-container, .cmd-palette-overlay { display: none !important; }
  .app-layout { grid-template-columns: 1fr !important; }
  .content { padding: 0 !important; }
  body { background: white !important; color: black !important; }
}
