/* ==========================================================
   GeroTheme UI components — builds on the tokens in style.css.
   Every component here is showcased in components.html.
   ========================================================== */

/* ================= BUTTONS =================
   .btn + variant: .primary | .secondary | .ghost | .danger | .link-btn
   size: .sm | .lg      state: [disabled] | .loading      .btn-icon (square) */
.btn.lg { height: 40px; padding: 0 16px; font-size: 13.5px; border-radius: 10px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.primary .lucide { color: currentColor; }
.btn.secondary { background: var(--surface-3); border-color: transparent; box-shadow: none; }
.btn.secondary:hover { background: var(--secondary-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { background: #d63b40; }
.btn.danger .lucide { color: currentColor; }
.btn.danger-soft { background: var(--red-soft); border-color: transparent; color: var(--red); box-shadow: none; }
.btn.danger-soft .lucide { color: currentColor; }
.btn.link-btn { height: auto; padding: 0; border: 0; background: none; box-shadow: none; color: var(--blue); }
.btn.link-btn:hover { text-decoration: underline; background: none; }
.btn.btn-icon { width: 34px; padding: 0; justify-content: center; }
.btn.btn-icon.sm { width: 30px; }
.btn.block { width: 100%; justify-content: center; }
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, .acc-trigger:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading > * { visibility: hidden; }
.btn.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-3) var(--text-3) var(--text-3) transparent;
  animation: spin .7s linear infinite;
}
.btn.primary.loading::after, .btn.danger.loading::after { border-color: #fff #fff #fff transparent; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; box-shadow: none; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn.active { background: var(--surface-3); }

/* ================= BADGES & TAGS ================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.badge .lucide { width: 12px; height: 12px; }
.badge.pill { border-radius: 999px; }
.badge.outline { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.badge.solid { background: var(--primary); color: var(--primary-fg); }
.badge.green  { background: var(--green-soft);  color: var(--green); }
.badge.red    { background: var(--red-soft);    color: var(--red); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.blue   { background: var(--blue-soft);   color: var(--blue); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.outline.dot::before { background: var(--green); }
.count {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 600;
}

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 4px 0 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 12px; font-weight: 500;
  transition: opacity .2s, transform .2s var(--ease);
}
.tag.removing { opacity: 0; transform: scale(.7); }
.tag button { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: var(--text-3); }
.tag button:hover { background: var(--surface-3); color: var(--text); }
.tag button .lucide { width: 12px; height: 12px; }

/* ================= ALERTS ================= */
.alert {
  display: flex; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  transition: height .25s var(--ease), opacity .2s, margin .25s var(--ease), padding .25s var(--ease);
}
.alert + .alert { margin-top: 10px; }
.alert.removing { opacity: 0; }
.alert > .lucide { width: 18px; height: 18px; margin-top: 1px; }
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 600; }
.alert-text { margin-top: 2px; color: var(--text-2); font-size: 12.5px; }
.alert-actions { display: flex; gap: 8px; margin-top: 10px; }
.alert .close { align-self: flex-start; margin: -4px -6px 0 0; }
.alert.info    { background: var(--blue-soft);   border-color: color-mix(in srgb, var(--blue) 22%, transparent); }
.alert.info > .lucide { color: var(--blue); }
.alert.success { background: var(--green-soft);  border-color: color-mix(in srgb, var(--green) 22%, transparent); }
.alert.success > .lucide { color: var(--green); }
.alert.warning { background: var(--orange-soft); border-color: color-mix(in srgb, var(--orange) 24%, transparent); }
.alert.warning > .lucide { color: var(--orange); }
.alert.danger  { background: var(--red-soft);    border-color: color-mix(in srgb, var(--red) 22%, transparent); }
.alert.danger > .lucide { color: var(--red); }
.alert.banner { align-items: center; background: var(--ink); border-color: var(--ink); color: var(--ink-fg); }
.alert.banner .alert-text { color: rgba(255, 255, 255, .7); }
.alert.banner .icon-btn { color: rgba(255, 255, 255, .7); background: transparent; }
.alert.banner .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* ================= FORMS ================= */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 12.5px; font-weight: 500; }
.field .req { color: var(--red); }
.hint { font-size: 11.5px; color: var(--text-3); }
.field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 13px;
  outline: 0; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-hover); }
.input:focus, .select:focus, .textarea:focus, .input-group:focus-within {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring);
}
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.5; font: inherit; }
.select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239a9da5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}

.input-group {
  display: flex; align-items: center; height: 36px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.input-group > .lucide { margin-left: 11px; color: var(--text-3); }
.input-group input { flex: 1; min-width: 0; height: 100%; padding: 0 10px; border: 0; outline: 0; background: transparent; font-size: 13px; }
.input-group .addon { height: 100%; display: grid; place-items: center; padding: 0 10px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; border-right: 1px solid var(--border); }
.input-group .addon.end { border-right: 0; border-left: 1px solid var(--border); }
.input-group .icon-btn { width: 28px; height: 28px; margin-right: 4px; border: 0; }

.field.error .input, .field.error .input-group { border-color: var(--red); }
.field.error .input:focus, .field.error .input-group:focus-within { box-shadow: 0 0 0 3px rgba(229, 72, 77, .12); }
.field .error-text { display: none; align-items: center; gap: 5px; font-size: 11.5px; color: var(--red); }
.field .error-text .lucide { width: 13px; height: 13px; }
.field.error .error-text { display: flex; animation: fadeUp .2s var(--ease-out); }
.field.error .hint { display: none; }
.field.success .input { border-color: var(--green); }

/* Checkbox & radio */
.choice { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13px; }
.choice small { display: block; color: var(--text-3); font-size: 12px; }
.choice input { flex-shrink: 0; margin: 1px 0 0; }
.checkbox, .radio {
  appearance: none; width: 16px; height: 16px; margin: 0;
  border: 1.5px solid var(--control-border); background: var(--surface) center / 12px no-repeat;
  cursor: pointer; transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.checkbox { border-radius: 4px; }
.radio { border-radius: 50%; }
.checkbox:hover, .radio:hover { border-color: var(--text-3); }
.checkbox:focus-visible, .radio:focus-visible { box-shadow: 0 0 0 3px var(--ring); outline: 0; }
.checkbox:checked, .checkbox:indeterminate, .radio:checked { background-color: var(--primary); border-color: var(--primary); }
.checkbox:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5 8.5 3 3 6-7'/%3E%3C/svg%3E"); }
.checkbox:indeterminate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='white' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 8h8'/%3E%3C/svg%3E"); }
/* dark theme: the fill is light, so the tick turns dark */
[data-theme="dark"] .checkbox:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23141519' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3.5 8.5 3 3 6-7'/%3E%3C/svg%3E"); }
[data-theme="dark"] .checkbox:indeterminate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' stroke='%23141519' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M4 8h8'/%3E%3C/svg%3E"); }
.radio:checked { box-shadow: inset 0 0 0 3px var(--surface); }
.checkbox:disabled, .radio:disabled { opacity: .45; cursor: not-allowed; }

/* Switch: <label class="switch"><input type="checkbox"><span class="track"></span> Label</label> */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; flex-shrink: 0; width: 34px; height: 20px; border-radius: 999px;
  background: var(--track); transition: background .2s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .22s var(--ease);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(14px); background: var(--primary-fg); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--ring); }
.switch input:disabled + .track { opacity: .45; }
.switch.sm .track { width: 28px; height: 16px; }
.switch.sm .track::after { width: 12px; height: 12px; }
.switch.sm input:checked + .track::after { transform: translateX(12px); }

/* Range */
.range { width: 100%; accent-color: var(--primary); cursor: pointer; }

/* Dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 22px 16px; border: 1.5px dashed var(--border-strong); border-radius: 10px;
  background: var(--surface-2); text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--surface-3); }
.dropzone.dragover { transform: scale(1.01); }
.dropzone .dz-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.dropzone strong { font-size: 13px; }
.file-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; animation: fadeUp .25s var(--ease-out); }
.file-item .progress { flex: 1; }
.file-item small { color: var(--text-3); white-space: nowrap; }

/* Tags input */
.tags-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  min-height: 36px; padding: 4px 6px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow);
  cursor: text; transition: border-color .15s, box-shadow .15s;
}
.tags-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.tags-input .tag { height: 24px; animation: pop .2s var(--ease-out); }
.tags-input input { flex: 1; min-width: 80px; height: 24px; border: 0; outline: 0; background: transparent; font-size: 13px; }

/* ================= TABS ================= */
.tab-list { position: relative; display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 10px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap;
  transition: color .15s;
}
.tab .lucide { width: 14px; height: 14px; }
.tab:hover, .tab.active { color: var(--text); }
.tab-ink { position: absolute; left: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); transition: transform .3s var(--ease), width .3s var(--ease); }
.tab-panel { display: none; padding-top: 14px; color: var(--text-2); }
.tab-panel.active { display: block; animation: fadeUp .3s var(--ease-out); }

.tabs.pills .tab-list { border: 0; padding: 3px; background: var(--surface-3); border-radius: var(--radius-sm); width: fit-content; max-width: 100%; gap: 0; }
.tabs.pills .tab { height: 28px; border-radius: 6px; }
.tabs.pills .tab-ink { top: 3px; bottom: 3px; height: auto; border-radius: 6px; background: var(--surface); box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }

/* ================= ACCORDION ================= */
.accordion { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.acc-item + .acc-item { border-top: 1px solid var(--border); }
.acc-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 14px; font-weight: 500; text-align: left;
  transition: background .15s;
}
.acc-trigger:hover { background: var(--surface-2); }
.acc-trigger .lucide { color: var(--text-3); transition: transform .25s var(--ease); }
.acc-item.open .acc-trigger .lucide { transform: rotate(180deg); }
.acc-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s var(--ease); }
.acc-item.open .acc-panel { grid-template-rows: 1fr; }
.acc-inner { min-height: 0; overflow: hidden; }
.acc-inner > div { padding: 0 14px 14px; color: var(--text-2); }

/* ================= MODAL & DRAWER ================= */
.modal {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: var(--overlay);
  opacity: 0; visibility: hidden;
  transition: opacity .2s, visibility .2s;
}
.modal.open { opacity: 1; visibility: visible; }
.modal-dialog {
  width: 100%; max-width: 460px; max-height: calc(100vh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 14px; box-shadow: 0 24px 60px -12px rgba(16, 24, 40, .3);
  transform: translateY(12px) scale(.97);
  transition: transform .25s var(--ease-out);
}
.modal.open .modal-dialog { transform: none; }
.modal-dialog.sm { max-width: 380px; }
.modal-dialog.lg { max-width: 640px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.modal-head h3 { font-size: 15px; font-weight: 600; }
.modal-head p { margin-top: 3px; color: var(--text-2); font-size: 12.5px; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.modal-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; margin-bottom: 12px; }
.modal-icon .lucide { width: 20px; height: 20px; }
.modal.confirm .modal-body { text-align: center; align-items: center; gap: 0; padding-top: 24px; }
.modal.confirm .modal-body p { margin-top: 6px; color: var(--text-2); }
.modal.confirm .modal-foot { border: 0; background: none; padding-top: 0; }
.modal.confirm .modal-foot .btn { flex: 1; justify-content: center; }

/* Drawer = modal that slides in from the right */
.modal.drawer { justify-content: flex-end; padding: 0; }
.modal.drawer .modal-dialog {
  max-width: 400px; height: 100%; max-height: none; border-radius: 0;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.32, .72, 0, 1);
}
.modal.drawer.open .modal-dialog { transform: none; }
.modal.drawer .modal-body { flex: 1; }
.modal.drawer .modal-foot { border-radius: 0; }

/* ================= TOOLTIP ================= */
.tooltip {
  position: fixed; top: 0; left: 0; z-index: 140;
  max-width: 240px; padding: 5px 9px; border-radius: 6px;
  background: var(--ink); color: var(--ink-fg);
  font-size: 12px; font-weight: 500; line-height: 1.4; pointer-events: none;
  opacity: 0; transform: translateY(3px);
  transition: opacity .12s, transform .12s;
}
.tooltip[data-pos="bottom"] { transform: translateY(-3px); }
.tooltip[data-pos="left"] { transform: translateX(3px); }
.tooltip[data-pos="right"] { transform: translateX(-3px); }
.tooltip.show { opacity: 1; transform: none; }

/* Menu extras */
.menu-item kbd { margin-left: auto; font-family: inherit; font-size: 11px; color: var(--text-3); }

/* ================= PROGRESS & LOADING ================= */
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: var(--primary); transition: width .6s var(--ease-out); }
.progress.lg { height: 10px; }
.progress-bar.green { background: var(--green); }
.progress-bar.orange { background: var(--orange); }
.progress-bar.red { background: var(--red); }
.progress-bar.blue { background: var(--blue); }
.progress-bar.striped {
  background-image: linear-gradient(45deg, rgba(255, 255, 255, .18) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .18) 50%, rgba(255, 255, 255, .18) 75%, transparent 75%);
  background-size: 14px 14px; animation: stripes .8s linear infinite;
}
.progress.indeterminate .progress-bar { width: 35%; animation: indeterminate 1.3s var(--ease) infinite; }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12px; color: var(--text-2); }
.progress-meta strong { color: var(--text); font-weight: 600; }

.ring { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .ring-bg { stroke: var(--surface-3); }
.ring .ring-fg { stroke: var(--primary); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 1s var(--ease-out); }
.ring .ring-fg.green { stroke: var(--green); }
.ring .ring-fg.orange { stroke: var(--orange); }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 600; }

.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--primary); animation: spin .7s linear infinite; }
.spinner.sm { width: 14px; height: 14px; }
.spinner.lg { width: 28px; height: 28px; border-width: 3px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: bounce 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }

.skeleton {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--skeleton-hi) 50%, var(--surface-3) 75%) 0 0 / 200% 100%;
  animation: skeleton 1.2s ease-in-out infinite;
}
.skeleton.circle { border-radius: 50%; }

/* ================= AVATARS ================= */
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 13px; }
.avatar.xl { width: 52px; height: 52px; font-size: 16px; }
.avatar.square { border-radius: 8px; }
.avatar.tone-blue, .avatar.tone-green, .avatar.tone-violet, .avatar.tone-orange, .avatar.tone-red { font-weight: 600; }
.avatar.dark { background: var(--primary); color: var(--primary-fg); }
.avatar-wrap { position: relative; display: inline-flex; }
.presence { position: absolute; right: 0; bottom: 0; width: 25%; height: 25%; min-width: 8px; min-height: 8px; border-radius: 50%; border: 2px solid var(--surface); background: var(--text-3); }
.presence.online { background: var(--green); }
.presence.busy { background: var(--red); }
.presence.away { background: var(--orange); }
.avatar-group { display: inline-flex; }
.avatar-group .avatar { box-shadow: 0 0 0 2px var(--surface); transition: transform .15s var(--ease); }
.avatar-group .avatar + .avatar { margin-left: -8px; }
.avatar-group .avatar:hover { transform: translateY(-2px); z-index: 1; }

/* ================= PAGINATION ================= */
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--radius-sm);
  display: inline-grid; place-items: center;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  transition: background .15s, color .15s;
}
.page-btn:hover { background: var(--surface-2); color: var(--text); }
.page-btn.active { background: var(--primary); color: var(--primary-fg); }
.page-btn[disabled] { opacity: .4; pointer-events: none; }
.page-btn .lucide { width: 14px; height: 14px; }
.page-gap { width: 24px; text-align: center; color: var(--text-3); }
.pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pagination-bar .hint { font-size: 12.5px; }

/* ================= STEPPER ================= */
.stepper { display: flex; align-items: flex-start; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; text-align: center; }
.step::before { content: ""; position: absolute; top: 14px; right: 50%; width: 100%; height: 2px; background: var(--border); }
.step:first-child::before { display: none; }
.step::after { content: ""; position: absolute; top: 14px; right: 50%; width: 0; height: 2px; background: var(--primary); transition: width .35s var(--ease); }
.step:first-child::after { display: none; }
.step.done::after, .step.active::after { width: 100%; }
.step-dot {
  position: relative; z-index: 1;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--border); background: var(--surface);
  font-size: 12px; font-weight: 600; color: var(--text-3);
  transition: background .25s, border-color .25s, color .25s;
}
.step-dot .lucide { width: 14px; height: 14px; display: none; }
.step.active .step-dot { border-color: var(--primary); color: var(--text); box-shadow: 0 0 0 4px var(--surface-3); }
.step.done .step-dot { border-color: var(--primary); background: var(--primary); color: var(--primary-fg); }
.step.done .step-dot span { display: none; }
.step.done .step-dot .lucide { display: block; animation: pop .25s var(--ease-out); }
.step-label { font-size: 12px; font-weight: 500; color: var(--text-3); transition: color .2s; }
.step.active .step-label, .step.done .step-label { color: var(--text); }

/* ================= TIMELINE & LIST ================= */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 1px; background: var(--border-strong); }
.timeline li:last-child::before { display: none; }
.timeline .act-icon { border-radius: 50%; }
.timeline p { font-size: 12.5px; }
.timeline small { color: var(--text-3); font-size: 11.5px; }
.timeline .quote { margin-top: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 12px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item p { font-weight: 500; }
.list-item small { color: var(--text-3); font-size: 12px; }

/* ================= EMPTY STATE ================= */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px 16px; }
.empty-icon {
  position: relative; width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 14px;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow);
}
.empty-icon::before, .empty-icon::after { content: ""; position: absolute; inset: -9px; border: 1px dashed var(--border-strong); border-radius: 18px; }
.empty-icon::after { inset: -18px; border-radius: 24px; opacity: .5; }
.empty-icon .lucide { width: 22px; height: 22px; color: var(--text-2); }
.empty-state h4 { margin: 8px 0 4px; font-size: 14px; }
.empty-state p { max-width: 280px; color: var(--text-2); font-size: 12.5px; }
.empty-state .actions { display: flex; gap: 8px; margin-top: 16px; }

/* ================= CARD VARIANTS ================= */
.card.plain { padding: 0; background: var(--surface); }
.card.plain > .card-head { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card.plain > .card-body { border: 0; box-shadow: none; border-radius: 0 0 var(--radius) var(--radius); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 8px 6px 10px; font-size: 12px; color: var(--text-2); }
.profile-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.profile-card p { color: var(--text-2); font-size: 12.5px; }
.profile-stats { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.profile-stats strong { display: block; font-size: 15px; }
.profile-stats span { font-size: 11.5px; color: var(--text-3); }
.stat-mini { display: flex; align-items: center; gap: 12px; }
.stat-mini .act-icon { width: 38px; height: 38px; border-radius: 10px; }
.stat-mini .act-icon .lucide { width: 18px; height: 18px; }
.stat-mini p { font-size: 12px; color: var(--text-2); }
.stat-mini strong { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }

/* ================= TYPOGRAPHY ================= */
.type-scale { display: flex; flex-direction: column; gap: 10px; }
.type-scale .row { display: flex; align-items: baseline; gap: 16px; }
.type-scale .row > span:first-child { width: 64px; flex-shrink: 0; font-size: 11px; color: var(--text-3); }
.t-display { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.t-h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.t-h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.t-h3 { font-size: 14px; font-weight: 600; }
.t-body { font-size: 13px; color: var(--text); }
.t-small { font-size: 12px; color: var(--text-2); }
.t-caption { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
kbd.key {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface);
  font-family: inherit; font-size: 11px; font-weight: 500; color: var(--text-2);
}
code.inline { padding: 2px 6px; border-radius: 5px; background: var(--surface-3); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }

/* ================= KEYFRAMES ================= */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes stripes { to { background-position: 14px 0; } }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
@keyframes skeleton { to { background-position: -200% 0; } }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }

/* ================= TABLES =================
   Base .table lives in style.css. Modifiers:
   .striped · .bordered · .no-hover · .compact · .comfortable · .stack (cards on narrow containers) */
.table.striped tbody tr:nth-child(even) td { background: var(--row-striped); }
.table.bordered :is(th, td) + :is(th, td) { border-left: 1px solid var(--border); }
.table.no-hover tbody tr:hover td { background: transparent; }
.table.no-hover.striped tbody tr:nth-child(even):hover td { background: var(--row-striped); }
.table td { transition: background .15s, height .2s var(--ease); }
.table.compact th { height: 32px; }
.table.compact td { height: 36px; }
.table.comfortable td { height: 60px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }
.table .muted-cell { color: var(--text-3); }
.table tfoot td {
  height: 44px; padding: 0 14px; font-weight: 600;
  background: var(--surface-2); border-top: 1px solid var(--border);
}
.table-caption { padding: 10px 14px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--border); }

/* Toolbar + footer around a table */
.table-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table-toolbar .spacer { flex: 1; }
.table-toolbar .search { height: 32px; width: 220px; }
.table-toolbar .segmented { width: auto; }
.table-toolbar .segmented button { width: 32px; height: 24px; display: grid; place-items: center; }
.table-toolbar .segmented .lucide { width: 14px; height: 14px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: 999px;
  border: 1px dashed var(--border-strong);
  font-size: 12px; font-weight: 500; color: var(--text-2);
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip.active { border-style: solid; border-color: var(--primary); background: var(--primary); color: var(--primary-fg); }
.chip small { font-size: 11px; opacity: .65; }
.table-footer {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 14px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-2);
}
.table-footer .range-info { margin-left: auto; }
.rows-per-page { display: flex; align-items: center; gap: 8px; }
.select.sm, .input.sm { width: auto; height: 30px; font-size: 12px; }
.select.sm { padding: 0 28px 0 9px; background-position: right 7px center; }
.input.sm { padding: 0 9px; }

/* Rich cells */
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user p { font-weight: 500; }
.cell-user small { display: block; color: var(--text-3); font-size: 11.5px; }
.cell-progress { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.cell-progress .progress { flex: 1; }
.cell-progress span { width: 34px; text-align: right; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
@media (hover: hover) {
  .row-actions.reveal { opacity: 0; transition: opacity .15s; }
  tr:hover .row-actions.reveal, tr:focus-within .row-actions.reveal { opacity: 1; }
}

/* Selection bulk bar (place inside a positioned container) */
.bulk-bar {
  position: absolute; left: 50%; bottom: 62px; z-index: 4;
  display: flex; align-items: center; gap: 2px;
  padding: 5px 5px 5px 14px; border-radius: 12px;
  background: var(--ink); color: var(--ink-fg); box-shadow: var(--shadow-lg);
  white-space: nowrap;
  opacity: 0; visibility: hidden; transform: translate(-50%, 14px);
  transition: opacity .2s, transform .25s var(--ease-out), visibility .2s;
}
.bulk-bar.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.bulk-bar strong { margin-right: 8px; font-size: 12.5px; }
.bulk-bar .sep { width: 1px; height: 18px; margin: 0 4px; background: rgba(255, 255, 255, .2); }
.bulk-bar .btn { background: transparent; border-color: transparent; box-shadow: none; color: var(--primary-fg); }
.bulk-bar .btn:hover { background: rgba(255, 255, 255, .1); }
.bulk-bar .btn .lucide { color: currentColor; }
.bulk-bar .btn.danger-text { color: #ff9a9d; }
.bulk-bar .icon-btn { background: transparent; color: rgba(255, 255, 255, .7); }
.bulk-bar .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* Empty row */
.table .empty-row td { height: auto; white-space: normal; }
.table .empty-row:hover td { background: transparent; }

/* Expandable rows */
.expand-btn {
  width: 24px; height: 24px; border-radius: 6px;
  display: grid; place-items: center; color: var(--text-3);
  transition: transform .2s var(--ease), background .15s, color .15s;
}
.expand-btn:hover { background: var(--surface-3); color: var(--text); }
.expand-btn .lucide { width: 14px; height: 14px; }
tr.expanded .expand-btn { transform: rotate(90deg); color: var(--text); }
.table tbody tr.expanded > td { background: var(--surface-2); }
.table .detail-row > td { height: auto; padding: 0; border-bottom: 0; white-space: normal; background: var(--surface-2) !important; }
.table .detail-row.open > td { border-bottom: 1px solid var(--border); }
.detail-anim { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.detail-row.open .detail-anim { grid-template-rows: 1fr; }
.detail-anim > div { min-height: 0; overflow: hidden; }
.detail-content { padding: 4px 16px 16px 50px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.detail-box { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.detail-box h5 { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
/* nested inside a .table, so reset the outer .table td styles */
.detail-content .mini-table td { height: auto; padding: 6px 0; border-bottom: 1px dashed var(--border); background: transparent !important; }
.detail-content .mini-table tr:last-child td { border-bottom: 0; }
.mini-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Inline editing */
.editable {
  display: inline-block; min-width: 40px;
  margin: -4px -6px; padding: 4px 6px; border-radius: 6px;
  cursor: text; transition: background .15s, box-shadow .15s;
}
.editable:hover { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
.editable:focus-visible { outline: 2px solid var(--blue); }
.cell-input {
  width: 100%; min-width: 110px; height: 30px; padding: 0 8px;
  border: 1px solid var(--primary); border-radius: 6px; outline: 0;
  box-shadow: 0 0 0 3px var(--ring); font: inherit; font-size: 12.5px;
}
.cell-input.num { text-align: right; }
.table td.flash { animation: flash 1.2s var(--ease); }

/* Reorderable rows */
.drag-handle {
  width: 24px; height: 24px; border-radius: 6px;
  display: grid; place-items: center; color: var(--text-3); cursor: grab;
  transition: background .15s, color .15s;
}
.drag-handle:hover, .drag-handle:focus-visible { background: var(--surface-3); color: var(--text); outline: 0; }
.drag-handle .lucide { width: 14px; height: 14px; }
.table tr.dragging td { opacity: .35; }
.table tr.drop-before td { box-shadow: inset 0 2px 0 var(--primary); }
.table tr.drop-after td { box-shadow: inset 0 -2px 0 var(--primary); }
.rank { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--surface-3); font-size: 11px; font-weight: 600; }

/* Sticky header / first column */
.table-scroll { max-height: 340px; overflow: auto; }
.table-scroll .table thead th { position: sticky; top: 0; z-index: 2; border-bottom: 0; box-shadow: inset 0 -1px 0 var(--border); }
.table .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.table thead .sticky-col { z-index: 3; background: var(--surface-2); }
.table-scroll.scrolled-x .sticky-col { box-shadow: inset -1px 0 0 var(--border), 8px 0 12px -8px rgba(16, 24, 40, .15); }
.table-scroll.scrolled-x thead .sticky-col { box-shadow: inset -1px 0 0 var(--border), inset 0 -1px 0 var(--border), 8px 0 12px -8px rgba(16, 24, 40, .15); }
.table-scroll.scrolled-y thead th { box-shadow: inset 0 -1px 0 var(--border), 0 6px 10px -8px rgba(16, 24, 40, .2); }
.table td.heat, .table tbody tr:hover td.heat { background: rgba(34, 160, 107, var(--a, 0)); text-align: center; font-variant-numeric: tabular-nums; }
.table th.center { text-align: center; }

/* Grouped rows */
.table .group-row td { height: 36px; background: var(--surface-2); }
.table .group-row:hover td { background: var(--surface-3); }
.group-toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12.5px; }
.group-toggle .lucide { width: 14px; height: 14px; color: var(--text-3); transition: transform .2s var(--ease); }
.group-row.collapsed .group-toggle .lucide { transform: rotate(-90deg); }
.table .group-row .num { font-weight: 600; color: var(--text-2); }
.table tbody tr.group-item td:first-child { padding-left: 36px; }

/* Responsive "stack" table: rows become cards when its container is narrow */
.stack-wrap { container-type: inline-size; transition: max-width .35s var(--ease); margin: 0 auto; max-width: 100%; }
.stack-wrap.preview-mobile { max-width: 380px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
@container (max-width: 560px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table.stack tbody tr:last-child { border-bottom: 0; }
  .table.stack td { height: auto; padding: 3px 0; border: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; white-space: normal; }
  .table.stack td::before { content: attr(data-label); font-size: 11.5px; color: var(--text-3); }
  .table.stack td.stack-title { padding-bottom: 8px; }
  .table.stack td.stack-title::before { display: none; }
  .table.stack tbody tr:hover td { background: transparent; }
}

@media (max-width: 760px) {
  .table-toolbar .search { width: 100%; }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-content { padding-left: 16px; }
  .table-footer .range-info { margin-left: 0; }
}

/* ================= SELECT (assets/js/select.js) ================= */
.ks-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; clip-path: inset(50%); }
.kselect { position: relative; min-width: 0; }
.ks-control {
  display: flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 3px 8px 3px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.ks-control:hover { border-color: var(--border-hover); }
.ks-control:focus-visible, .kselect.open .ks-control { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.kselect.disabled .ks-control { background: var(--surface-2); color: var(--text-3); cursor: not-allowed; }
.ks-values { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ks-placeholder { color: var(--text-3); font-size: 13px; }
.ks-single { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ks-chip {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  height: 24px; padding: 0 3px 0 8px; border-radius: 6px;
  background: var(--surface-3); font-size: 12px; font-weight: 500; animation: pop .15s var(--ease-out);
}
.ks-chip button { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 4px; color: var(--text-3); }
.ks-chip button:hover { background: var(--border-strong); color: var(--text); }
.ks-chip .lucide, .ks-clear .lucide { width: 12px; height: 12px; }
.ks-clear { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; color: var(--text-3); }
.ks-clear:hover { background: var(--surface-2); color: var(--text); }
.ks-chev { width: 15px !important; height: 15px !important; color: var(--text-3); transition: transform .2s var(--ease); }
.kselect.open .ks-chev { transform: rotate(180deg); }
.ks-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex-shrink: 0; }

.ks-drop {
  position: fixed; z-index: 120; display: flex; flex-direction: column; max-height: 320px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .12s, transform .15s var(--ease), visibility .12s;
}
.ks-drop.up { transform: translateY(4px); }
/* visibility must flip instantly on open: at t=0 of a transition the box is still
   "hidden", and hidden elements can't take focus (the search box needs it) */
.ks-drop.open { opacity: 1; visibility: visible; transform: none; transition: opacity .12s, transform .15s var(--ease), visibility 0s; }
.ks-search { display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 38px; border-bottom: 1px solid var(--border); color: var(--text-3); flex-shrink: 0; }
.ks-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 13px; }
.ks-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; font-size: 11.5px; color: var(--text-3); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ks-bar button { color: var(--text-2); font-weight: 500; padding: 2px 6px; border-radius: 5px; }
.ks-bar button:hover { background: var(--surface-2); color: var(--text); }
.ks-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; overscroll-behavior: contain; }
.ks-list [role=option] {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px;
  font-size: 13px; cursor: pointer; scroll-margin: 4px;
}
.ks-list [role=option].active { background: var(--surface-2); }
.ks-list [role=option][aria-disabled=true] { opacity: .45; cursor: not-allowed; }
.ks-check { width: 16px; height: 16px; flex-shrink: 0; display: grid; place-items: center; border-radius: 4px; color: transparent; }
.ks-check .lucide { width: 13px; height: 13px; }
.ks-drop:has(.ks-bar) .ks-check { border: 1.5px solid var(--control-border); }
.ks-list [aria-selected=true] .ks-check { color: var(--primary); }
.ks-drop:has(.ks-bar) [aria-selected=true] .ks-check { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.ks-text { display: flex; flex-direction: column; min-width: 0; }
.ks-text small { color: var(--text-3); font-size: 11.5px; }
.ks-list mark { background: color-mix(in srgb, var(--orange) 28%, transparent); color: inherit; border-radius: 2px; }
.ks-group { padding: 8px 8px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.ks-create { color: var(--blue); font-weight: 500; }
.ks-create .lucide { width: 14px; height: 14px; }
.ks-empty { padding: 14px 8px; text-align: center; font-size: 12.5px; color: var(--text-3); }

/* ================= RICH TEXT EDITOR (assets/js/editor.js) ================= */
.ke-native { display: none !important; }
.keditor {
  display: flex; flex-direction: column;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.keditor.focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.ke-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 5px 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.ke-group { display: flex; align-items: center; gap: 1px; }
.ke-group + .ke-group { margin-left: 4px; padding-left: 5px; border-left: 1px solid var(--border-strong); }
.ke-spacer { flex: 1; }
.ke-spacer + .ke-group { border-left: 0; }
.ke-toolbar button {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; color: var(--text-2);
  transition: background .12s, color .12s;
}
.ke-toolbar button:hover { background: var(--surface-3); color: var(--text); }
.ke-toolbar button.ql-active { background: var(--primary); color: var(--primary-fg); }
.ke-toolbar button:disabled { opacity: .35; pointer-events: none; }
.ke-toolbar .lucide { width: 15px; height: 15px; }
.ke-toolbar select { width: 120px; height: 28px; font-size: 12px; box-shadow: none; }
.ke-linkbar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--border); color: var(--text-3); animation: fadeUp .15s var(--ease-out); }
.ke-linkbar[hidden] { display: none; }
.ke-linkbar input { flex: 1; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 6px; outline: 0; background: var(--surface); font-size: 12.5px; }
.ke-linkbar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.ke-body { position: relative; }
.ke-body .ql-container { font: 13.5px/1.6 var(--font); color: var(--text); }
.ke-body .ql-editor { min-height: var(--ke-height, 180px); max-height: 520px; padding: 14px 16px; overflow-y: auto; }
.keditor.minimal .ke-body .ql-editor { min-height: var(--ke-height, 90px); }
.ke-body .ql-editor.ql-blank::before { left: 16px; right: 16px; font-style: normal; color: var(--text-3); }
.ke-body .ql-editor h2 { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin: .6em 0 .3em; }
.ke-body .ql-editor h3 { font-size: 15px; font-weight: 600; margin: .6em 0 .3em; }
.ke-body .ql-editor a { color: var(--blue); text-decoration: underline; }
.ke-body .ql-editor blockquote { margin: .5em 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.ke-body .ql-editor code, .ke-body .ql-editor .ql-code-block-container {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-3); border-radius: 5px;
}
.ke-body .ql-editor code { padding: 1px 5px; }
.ke-body .ql-editor .ql-code-block-container { margin: .5em 0; padding: 10px 12px; }
.ke-body .ql-editor img { max-width: 100%; border-radius: 6px; }
.ke-source-view {
  width: 100%; min-height: 180px; padding: 14px 16px; border: 0; outline: 0; resize: vertical; display: block;
  background: var(--surface-2); color: var(--text); font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.ke-source-view[hidden] { display: none; }
.ke-foot { display: flex; justify-content: space-between; gap: 12px; padding: 6px 12px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }
.ke-foot kbd { font-family: inherit; padding: 0 4px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-2); font-size: 11px; }
.ke-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.ke-count.warn { color: var(--red); font-weight: 600; }
.keditor.fullscreen { position: fixed; inset: 16px; z-index: 95; box-shadow: 0 0 0 100vmax var(--overlay), var(--shadow-lg); }
.keditor.fullscreen .ke-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.keditor.fullscreen .ql-container { flex: 1; min-height: 0; }
.keditor.fullscreen .ql-editor { height: 100%; max-height: none; max-width: 780px; margin: 0 auto; padding: 32px 24px; }

.kx-output { max-height: 180px; overflow: auto; }
.comment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.comment-list li { display: flex; gap: 10px; animation: fadeUp .25s var(--ease-out); }
.comment-list .bubble { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; }
.comment-list .bubble p { margin: 0; }
.comment-list .bubble small { color: var(--text-3); font-size: 11px; }
.comment-list .bubble a { color: var(--blue); }
.kx-details summary { cursor: pointer; margin-top: 10px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.kx-details[open] summary { margin-bottom: 8px; }

/* ================= ILLUSTRATIONS GALLERY (illustrations.html) ================= */
.ill-controls { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.ill-controls .spacer { flex: 1; }
.ill-search { width: 240px; height: 34px; }
.ill-picker { display: flex; align-items: center; gap: 8px; }
.swatches { display: flex; gap: 6px; }
.swatch {
  position: relative; width: 22px; height: 22px; border-radius: 50%;
  background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
  transition: transform .15s var(--ease), box-shadow .15s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.swatch.custom { display: grid; place-items: center; background: conic-gradient(#e5484d, #f5b63e, #1baf7a, #2a78d6, #6d5ce8, #e0609a, #e5484d); cursor: pointer; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swatch.custom .lucide { width: 12px; height: 12px; color: #fff; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .4)); pointer-events: none; }

.ill-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.ill-card[hidden] { display: none; }
.ill-card .card-body { padding: 18px 12px; display: grid; place-items: center; }
.ill-card .card-foot { padding: 8px 6px 4px 10px; }
.ill-card .card-foot > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.ill-card .card-foot b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.ill-card .card-foot small { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-3); }
.ill-actions { display: flex; gap: 2px; }

.ill-examples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ill-examples .card-body { display: grid; place-items: center; min-height: 100%; }
.ill-onboard { display: flex !important; align-items: center; gap: 16px; }
.ill-onboard > div:first-child { flex-shrink: 0; width: 150px; }
.ill-onboard h4 { margin: 0 0 4px; font-size: 14px; }
.ill-onboard p { color: var(--text-2); font-size: 12.5px; }
.ill-steps { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.ill-steps li { display: flex; align-items: center; gap: 8px; }
.ill-steps .lucide { width: 15px; height: 15px; color: var(--text-3); }
.ill-steps li.done { color: var(--text); }
.ill-steps li.done .lucide { color: var(--green); }

.ill-usage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.ill-usage h4 { margin: 0 0 8px; font-size: 13px; }
.code-block {
  margin: 0 0 8px; padding: 12px 14px; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  font: 11.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--text);
}

@media (max-width: 1100px) {
  .ill-examples, .ill-usage { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .ill-search { width: 100%; }
  .ill-onboard { flex-direction: column; text-align: center; }
  .ill-steps { align-items: center; }
}

/* ================= SHOWCASE PAGE (components.html & tables.html) ================= */
.jump-nav {
  position: sticky; top: calc(52px + var(--hnav-h)); z-index: 5;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  margin: 0 -24px; padding: 10px 24px;
  background: var(--topbar-bg); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.jump-nav a {
  flex-shrink: 0; height: 28px; padding: 0 10px; border-radius: 999px;
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 500; color: var(--text-2);
  border: 1px solid var(--border); background: var(--surface);
  transition: background .15s, color .15s, border-color .15s;
}
.jump-nav a:hover { color: var(--text); background: var(--surface-2); }
.jump-nav a.active { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }

html:has(.jump-nav) { scroll-padding-top: calc(120px + var(--hnav-h)); } /* topbar + jump nav (+ top menu) */
.showcase { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.showcase > .span-2 { grid-column: 1 / -1; }
.showcase > section { scroll-margin-top: calc(110px + var(--hnav-h)); }
.class-hint {
  padding: 2px 7px; border-radius: 5px; background: var(--surface); border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-2);
  cursor: copy; transition: background .15s, color .15s;
}
.class-hint:hover { background: var(--surface-3); color: var(--text); }
.demo-label { margin: 18px 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.demo-label:first-child { margin-top: 0; }
.demo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.demo-stack { display: flex; flex-direction: column; gap: 12px; }
.demo-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.demo-surface { padding: 16px; border-radius: 10px; background: var(--surface-2); }

@media (max-width: 1100px) {
  .showcase { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .jump-nav { margin: 0 -16px; padding: 10px 16px; }
  .form-grid, .demo-split { grid-template-columns: minmax(0, 1fr); }
  .stepper .step-label { font-size: 11px; }
  .modal.drawer .modal-dialog { max-width: 100%; }
}
