/* =========================================================
   Floating Tab Assistant - Overlay Styles
   Dense workspace shell, unified skin system, state-first motion
   ========================================================= */

:host {
  --tfa-radius-xs: 6px;
  --tfa-radius-sm: 10px;
  --tfa-radius-md: 12px;
  --tfa-radius-lg: 16px;
  --tfa-radius-xl: 22px;

  --tfa-space-xs: 4px;
  --tfa-space-sm: 8px;
  --tfa-space-md: 14px;
  --tfa-space-lg: 20px;
  --tfa-space-xl: 28px;

  --tfa-dur-fast: 120ms;
  --tfa-dur-norm: 180ms;
  --tfa-dur-slow: 280ms;
  --tfa-dur-slower: 420ms;

  --tfa-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --tfa-ease-spring: cubic-bezier(0.2, 0.85, 0.25, 1);

  --tfa-backdrop-bg: rgba(4, 8, 18, 0.58);
  --tfa-panel-bg: rgba(14, 18, 29, 0.92);
  --tfa-panel-border: rgba(255, 255, 255, 0.08);
  --tfa-panel-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  --tfa-panel-glow: radial-gradient(circle at top, rgba(124, 140, 255, 0.12), transparent 40%);

  --tfa-text-primary: #eef2ff;
  --tfa-text-secondary: #a8b0c5;
  --tfa-text-tertiary: #707b91;
  --tfa-border-soft: rgba(255, 255, 255, 0.06);
  --tfa-border-medium: rgba(255, 255, 255, 0.12);
  --tfa-border-strong: rgba(255, 255, 255, 0.18);

  --tfa-card-bg: rgba(255, 255, 255, 0.035);
  --tfa-card-hover-bg: rgba(255, 255, 255, 0.06);
  --tfa-group-bg: rgba(255, 255, 255, 0.03);
  --tfa-hdr-bg: rgba(255, 255, 255, 0.025);
  --tfa-input-bg: rgba(255, 255, 255, 0.045);
  --tfa-input-focus-bg: rgba(255, 255, 255, 0.065);
  --tfa-btn-bg: rgba(255, 255, 255, 0.045);
  --tfa-btn-hover-bg: rgba(255, 255, 255, 0.085);

  --tfa-accent: #7c8cff;
  --tfa-accent-2: #5b6df4;
  --tfa-accent-rgb: 124, 140, 255;
  --dock-accent-contrast: #050816;
  --dock-tile-surface: rgb(255, 255, 255);
  --tfa-success: #34d399;
  --tfa-success-rgb: 52, 211, 153;
  --tfa-warning: #fbbf24;
  --tfa-danger: #f87171;
  --tfa-danger-rgb: 248, 113, 113;

  --tfa-skeleton-base: rgba(255, 255, 255, 0.05);
  --tfa-skeleton-shine: rgba(255, 255, 255, 0.09);
  --tfa-overlay-gutter: clamp(24px, 5vw, 96px);
  --tfa-grid-columns: 4;

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

:host,
:host * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== Permanent activation settings ===== */
.settings-tool-btn {
  width: 36px;
  padding: 0;
  justify-content: center;
}

.settings-tool-btn svg {
  width: 17px;
  height: 17px;
}

.settings-tool-btn.member {
  color: var(--tfa-accent);
  background: rgba(var(--tfa-accent-rgb), 0.12);
  border-color: rgba(var(--tfa-accent-rgb), 0.28);
  box-shadow: inset 0 0 0 1px rgba(var(--tfa-accent-rgb), 0.04);
}

.settings-tool-btn:hover,
.settings-dialog-close:hover,
.activation-link-btn:hover,
.purchase-preview-close:hover {
  background: var(--tfa-btn-hover-bg);
  color: var(--tfa-text-primary);
}

.settings-tool-btn:focus-visible,
.settings-dialog-close:focus-visible,
.activation-link-btn:focus-visible,
.activation-image-button:focus-visible,
.activation-input:focus-visible,
.activation-submit:focus-visible,
.purchase-preview-close:focus-visible {
  outline: 2px solid var(--tfa-accent);
  outline-offset: 2px;
}

.settings-dialog-shell,
.purchase-preview {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.settings-dialog-shell.show,
.purchase-preview.show {
  opacity: 1;
}

.settings-dialog-overlay,
.purchase-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, 0.56);
  backdrop-filter: blur(9px) saturate(1.08);
  -webkit-backdrop-filter: blur(9px) saturate(1.08);
}

.settings-dialog {
  position: relative;
  width: min(780px, 92vw);
  height: min(720px, 82vh);
  max-height: min(720px, 82vh);
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--tfa-panel-border);
  border-radius: 18px;
  background: var(--tfa-panel-bg);
  box-shadow: var(--tfa-panel-shadow);
  transform: translateY(12px) scale(0.985);
  transition: transform 0.24s cubic-bezier(0.2, 0.85, 0.25, 1);
}

.settings-dialog-shell.show .settings-dialog {
  transform: translateY(0) scale(1);
}

.settings-sidebar {
  min-height: 0;
  padding: 20px 14px;
  overflow-y: auto;
  border-right: 1px solid var(--tfa-border-soft);
  background: var(--tfa-hdr-bg);
}

.settings-sidebar-title {
  margin: 0 8px 14px;
  color: var(--tfa-text-tertiary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-nav-item {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid rgba(var(--tfa-accent-rgb), 0.06);
  border-radius: 12px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 12.5px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
  transform: translateY(0);
  transition: transform 160ms var(--tfa-ease-out), background 160ms var(--tfa-ease-out), border-color 160ms var(--tfa-ease-out), color 160ms var(--tfa-ease-out), box-shadow 160ms var(--tfa-ease-out);
}

.settings-nav-item + .settings-nav-item {
  margin-top: 4px;
}

.settings-nav-item:not(:disabled):hover {
  border-color: rgba(var(--tfa-accent-rgb), 0.20);
  background: rgba(var(--tfa-accent-rgb), 0.06);
  color: var(--tfa-text-primary);
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.07), 0 1px 0 rgba(255, 255, 255, 0.72) inset;
  transform: translateY(-1px);
}

.settings-nav-item.active {
  border-color: rgba(var(--tfa-accent-rgb), 0.30);
  background: linear-gradient(135deg, rgba(var(--tfa-accent-rgb), 0.16), rgba(var(--tfa-accent-rgb), 0.08));
  color: var(--tfa-accent);
  box-shadow: 0 8px 20px rgba(var(--tfa-accent-rgb), 0.11), 0 1px 0 rgba(255, 255, 255, 0.74) inset;
}

.settings-nav-item.active::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: var(--tfa-accent);
}

.settings-nav-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 8px;
  background: var(--tfa-card-bg);
  color: var(--tfa-text-tertiary);
  transition: color 160ms var(--tfa-ease-out), background 160ms var(--tfa-ease-out), border-color 160ms var(--tfa-ease-out), transform 160ms var(--tfa-ease-out);
}

.settings-nav-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-nav-item:not(:disabled):hover .settings-nav-icon {
  border-color: rgba(var(--tfa-accent-rgb), 0.22);
  color: var(--tfa-accent);
  transform: scale(1.04);
}

.settings-nav-item.active .settings-nav-icon {
  border-color: rgba(var(--tfa-accent-rgb), 0.28);
  background: rgba(var(--tfa-accent-rgb), 0.15);
  color: var(--tfa-accent);
}

.settings-nav-item:focus-visible {
  outline: 2px solid var(--tfa-accent);
  outline-offset: 2px;
}

.settings-nav-item:active {
  background: rgba(var(--tfa-accent-rgb), 0.18);
  transform: translateY(0) scale(0.985);
}

.settings-nav-item:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.settings-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

#settingsContent {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y;
}

.settings-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--tfa-border-soft);
  background: var(--tfa-hdr-bg);
}

.settings-dialog-header h2,
.activation-success h3 {
  margin: 3px 0 0;
  color: var(--tfa-text-primary);
  font-size: 18px;
  line-height: 1.3;
}

.settings-dialog-header p {
  margin: 5px 0 0;
  color: var(--tfa-text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.settings-dialog-close,
.purchase-preview-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 10px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 18px;
}

.activation-panel {
  display: grid;
  gap: 14px;
  padding: 20px 22px 22px;
}

.activation-card,
.activation-success,
.activation-purchase-row {
  border: 1px solid var(--tfa-border-soft);
  border-radius: 14px;
  background: var(--tfa-card-bg);
  padding: 14px;
}

.activation-eyebrow {
  color: var(--tfa-accent);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.activation-card-title {
  margin-top: 4px;
  color: var(--tfa-text-primary);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
}

.activation-copy,
.activation-helper {
  color: var(--tfa-text-secondary);
  font-size: 12px;
  line-height: 1.58;
}

.activation-copy {
  margin: 7px 0 0;
}

.activation-helper {
  margin-top: 7px;
  color: var(--tfa-text-tertiary);
}

.activation-purchase-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 17px;
}

.activation-image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 11px;
  overflow: hidden;
  background: var(--tfa-input-bg);
  cursor: zoom-in;
}

.activation-purchase-image {
  display: block;
  width: 100%;
  max-height: 255px;
  object-fit: contain;
}

.activation-purchase-copy {
  min-width: 0;
}

.activation-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.activation-link-btn {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 9px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
}

.activation-purchase-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.activation-purchase-row .activation-helper {
  margin-top: 3px;
}

.activation-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 13px;
}

.activation-input {
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--tfa-border-medium);
  border-radius: 10px;
  outline: none;
  background: var(--tfa-input-bg);
  color: var(--tfa-text-primary);
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

.activation-input::placeholder {
  color: var(--tfa-text-tertiary);
}

.activation-input:disabled,
.activation-submit:disabled {
  cursor: wait;
  opacity: 0.62;
}

.activation-submit {
  height: 42px;
  gap: 8px;
}

.activation-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: activation-spin 0.72s linear infinite;
}

@keyframes activation-spin {
  to {
    transform: rotate(360deg);
  }
}

.activation-error {
  margin-top: 9px;
  color: var(--tfa-danger);
  font-size: 12px;
  line-height: 1.45;
}

.activation-error[hidden] {
  display: none;
}

.activation-success {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  background: rgba(var(--tfa-success-rgb), 0.08);
  border-color: rgba(var(--tfa-success-rgb), 0.2);
}

.activation-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(var(--tfa-success-rgb), 0.16);
  color: var(--tfa-success);
  font-size: 17px;
  font-weight: 800;
}

.activation-used-note {
  margin-top: 10px;
  color: var(--tfa-success);
  font-size: 12px;
  font-weight: 750;
}

.activation-code-mask {
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 9px;
  background: var(--tfa-input-bg);
  color: var(--tfa-text-primary);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.activation-success-actions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--tfa-border-soft);
}

.activation-deactivate {
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--tfa-danger);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.activation-deactivate:hover,
.activation-deactivate:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.deactivation-confirm {
  position: absolute;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.deactivation-confirm.show {
  opacity: 1;
  pointer-events: auto;
}

.deactivation-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.deactivation-dialog {
  position: relative;
  width: min(420px, 92vw);
  padding: 22px;
  border: 1px solid var(--tfa-panel-border);
  border-radius: 16px;
  background: var(--tfa-panel-bg);
  color: var(--tfa-text-primary);
  box-shadow: var(--tfa-panel-shadow);
  transform: translateY(8px) scale(0.985);
  transition: transform 0.18s ease;
}

.deactivation-confirm.show .deactivation-dialog {
  transform: translateY(0) scale(1);
}

.deactivation-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  cursor: pointer;
}

.deactivation-close:hover {
  background: rgba(var(--tfa-danger-rgb), 0.12);
  color: var(--tfa-danger);
}

.deactivation-close:focus-visible,
.deactivation-danger:focus-visible {
  outline: 2px solid var(--tfa-accent);
  outline-offset: 2px;
}

.deactivation-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: rgba(var(--tfa-danger-rgb), 0.14);
  color: var(--tfa-danger);
  font-size: 18px;
  font-weight: 800;
}

.deactivation-dialog h3 {
  margin: 0;
  color: var(--tfa-text-primary);
  font-size: 17px;
}

.deactivation-dialog p {
  margin: 8px 34px 0 0;
  color: var(--tfa-text-secondary);
  font-size: 12.5px;
  line-height: 1.6;
}

.deactivation-error {
  margin-top: 12px;
  color: var(--tfa-danger);
  font-size: 12px;
  line-height: 1.45;
}

.deactivation-error[hidden] {
  display: none;
}

.deactivation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.deactivation-actions .btn {
  min-width: 88px;
  justify-content: center;
}

.deactivation-actions .deactivation-danger {
  gap: 8px;
  border-color: transparent;
  background: var(--tfa-danger);
  color: #fff;
}

.deactivation-actions .deactivation-danger:hover {
  filter: brightness(1.06);
}

.deactivation-close:disabled,
.deactivation-actions .btn:disabled {
  cursor: wait;
  opacity: 0.62;
}

.purchase-preview {
  z-index: 90;
}

.purchase-preview-dialog {
  position: relative;
  max-width: min(760px, 90vw);
  max-height: 88vh;
  padding: 14px;
  border: 1px solid var(--tfa-panel-border);
  border-radius: 18px;
  background: var(--tfa-panel-bg);
  box-shadow: var(--tfa-panel-shadow);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.22s cubic-bezier(0.2, 0.85, 0.25, 1);
}

.purchase-preview.show .purchase-preview-dialog {
  transform: translateY(0) scale(1);
}

.purchase-preview-image {
  display: block;
  max-width: 100%;
  max-height: calc(88vh - 28px);
  object-fit: contain;
  border-radius: 12px;
}

.purchase-preview-close {
  position: absolute;
  z-index: 1;
  top: 22px;
  right: 22px;
  background: var(--tfa-panel-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

/* ===== Web Dock settings ===== */
.ai-settings {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 18px 24px 24px;
  color: var(--tfa-text-primary);
}

.ai-settings-state,
.ai-settings-policy,
.ai-settings-channel,
.ai-settings-preview {
  border: 1px solid var(--tfa-border-soft);
  border-radius: 14px;
  background: var(--tfa-card-bg);
}

.ai-settings-state {
  padding: 10px 12px;
  color: var(--tfa-text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.ai-settings-state.is-loading { border-color: rgba(var(--tfa-accent-rgb), .24); color: var(--tfa-accent); }
.ai-settings-state.is-success { border-color: rgba(var(--tfa-success-rgb), .24); color: var(--tfa-success); }
.ai-settings-state.is-error { border-color: rgba(var(--tfa-danger-rgb), .25); color: var(--tfa-danger); }

.ai-settings-policy {
  padding: 14px;
  border-left: 3px solid var(--tfa-accent);
  background: rgba(var(--tfa-accent-rgb), .06);
}

.ai-settings-policy strong { display: block; font-size: 13px; }
.ai-settings-policy p,
.ai-settings-channel header p,
.ai-settings-preview p,
.ai-settings-local-note { margin: 5px 0 0; color: var(--tfa-text-secondary); font-size: 11.5px; line-height: 1.55; }

.ai-settings-switches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.ai-settings-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  min-height: 64px;
  padding: 11px 12px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 12px;
  background: var(--tfa-card-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 160ms var(--tfa-ease-out), border-color 160ms var(--tfa-ease-out), opacity 160ms var(--tfa-ease-out);
}

.ai-settings-switch:not(:disabled):hover { border-color: rgba(var(--tfa-accent-rgb), .25); background: rgba(var(--tfa-accent-rgb), .05); }
.ai-settings-switch[aria-checked="true"] .dock-switch-track { border-color: rgba(var(--tfa-accent-rgb), .7); background: var(--tfa-accent); }
.ai-settings-switch[aria-checked="true"] .dock-switch-thumb { transform: translateX(18px); }

.ai-settings-channel { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 9px 12px; padding: 14px; }
.ai-settings-channel header { grid-column: 1 / -1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.ai-settings-channel header h3 { margin: 0; font-size: 13px; }
.ai-settings-channel header span { flex: 0 0 auto; padding: 4px 8px; border: 1px solid rgba(var(--tfa-accent-rgb), .22); border-radius: 999px; background: rgba(var(--tfa-accent-rgb), .08); color: var(--tfa-accent); font-size: 10.5px; font-weight: 750; }
.ai-settings-channel > label { align-self: center; color: var(--tfa-text-secondary); font-size: 11.5px; font-weight: 700; }
.ai-settings-channel > input,
.ai-settings-key input {
  min-width: 0;
  height: 40px;
  box-sizing: border-box;
  padding: 0 11px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 10px;
  background: var(--tfa-input-bg);
  color: var(--tfa-text-primary);
  font: inherit;
  font-size: 12px;
}

.ai-settings-key { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; min-width: 0; }
.ai-settings-key button,
.ai-settings-actions button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 10px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 11.5px;
  font-weight: 750;
  cursor: pointer;
}

.ai-settings-local-note { grid-column: 2; }
.ai-settings-preview { padding: 12px 14px; }
.ai-settings-preview summary { color: var(--tfa-text-primary); font-size: 12px; font-weight: 750; cursor: pointer; }
.ai-settings-preview dl { display: grid; gap: 7px; margin: 12px 0; }
.ai-settings-preview dl div { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; }
.ai-settings-preview dt { color: var(--tfa-text-secondary); font-size: 11px; font-weight: 750; }
.ai-settings-preview dd { margin: 0; color: var(--tfa-text-primary); font-size: 11px; line-height: 1.45; }
.ai-settings-preview > strong { color: var(--tfa-warning); font-size: 11px; line-height: 1.5; }

.ai-settings-actions {
  position: sticky;
  z-index: 4;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 2px -22px -24px;
  padding: 13px 22px;
  border-top: 1px solid var(--tfa-border-soft);
  background: color-mix(in srgb, var(--tfa-panel-bg) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
}

.ai-settings-actions > span { min-width: 0; margin-right: auto; color: var(--tfa-text-tertiary); font-size: 11px; }
.ai-settings-actions .dock-settings-save { color: var(--dock-accent-contrast); }
.ai-settings button:not(:disabled):hover { border-color: rgba(var(--tfa-accent-rgb), .3); color: var(--tfa-text-primary); }
.ai-settings button:disabled,
.ai-settings input:disabled { cursor: wait; opacity: .55; }
.ai-settings button:focus-visible,
.ai-settings input:focus-visible,
.ai-settings summary:focus-visible { outline: 2px solid var(--tfa-accent); outline-offset: 2px; }

.web-dock-settings {
  display: grid;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 24px 24px;
  overflow-x: clip;
  color: var(--tfa-text-primary);
}

.dock-toggle-section,
.dock-site-section,
.dock-appearance-section,
.dock-motion-section {
  min-width: 0;
}

.dock-toggle-section {
  display: flex;
  gap: 8px;
  padding: 16px 0;
}

.dock-site-section,
.dock-appearance-section,
.dock-motion-section {
  padding: 16px 0;
  border-top: 1px solid var(--tfa-border-soft);
}

.dock-site-section h3,
.dock-appearance-section h3,
.dock-motion-section h3 {
  margin: 0 0 8px;
  color: var(--tfa-text-primary);
  font-size: 13px;
  line-height: 1.4;
}

.dock-site-row button,
#dockSiteForm button,
#dockMotionReset {
  border: 1px solid var(--tfa-border-soft);
  border-radius: 9px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms var(--tfa-ease-out), border-color 160ms var(--tfa-ease-out), color 160ms var(--tfa-ease-out), opacity 160ms var(--tfa-ease-out);
}

.dock-toggle-section button {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 12px;
  background: var(--tfa-card-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.58) inset;
  transition: background 160ms var(--tfa-ease-out), border-color 160ms var(--tfa-ease-out), box-shadow 160ms var(--tfa-ease-out), opacity 160ms var(--tfa-ease-out);
}

.dock-site-row button:hover,
#dockMotionReset:hover {
  border-color: var(--tfa-border-medium);
  background: var(--tfa-btn-hover-bg);
  color: var(--tfa-text-primary);
}

.dock-site-row button:active,
#dockMotionReset:active {
  background: rgba(var(--tfa-accent-rgb), 0.14);
}

.dock-toggle-section button:not(:disabled):hover {
  border-color: rgba(var(--tfa-accent-rgb), 0.25);
  background: rgba(var(--tfa-accent-rgb), 0.035);
  box-shadow: 0 7px 18px rgba(16, 24, 40, 0.07), 0 1px 0 rgba(255, 255, 255, 0.68) inset;
}

.dock-toggle-section button:active {
  background: rgba(var(--tfa-accent-rgb), 0.08);
}

.dock-switch-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.dock-switch-copy strong {
  color: var(--tfa-text-primary);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.dock-switch-copy small {
  overflow: hidden;
  color: var(--tfa-text-tertiary);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  box-sizing: border-box;
  padding: 3px;
  border: 1px solid rgba(101, 112, 133, 0.18);
  border-radius: 999px;
  background: rgba(101, 112, 133, 0.22);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12) inset;
  transition: background 180ms var(--tfa-ease-out), border-color 180ms var(--tfa-ease-out), box-shadow 180ms var(--tfa-ease-out);
}

.dock-switch-thumb {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(16, 24, 40, 0.22);
  transform: translateX(0);
  transition: transform 190ms cubic-bezier(0.2, 0.85, 0.25, 1.12);
}

.dock-toggle-section button[aria-checked="true"] .dock-switch-track {
  border-color: rgba(var(--tfa-accent-rgb), 0.70);
  background: var(--tfa-accent);
  box-shadow: 0 2px 7px rgba(var(--tfa-accent-rgb), 0.28) inset, 0 0 0 2px rgba(var(--tfa-accent-rgb), 0.08);
}

.dock-toggle-section button[aria-checked="true"] .dock-switch-thumb {
  transform: translateX(18px);
}

.dock-toggle-section button:disabled,
.dock-toggle-section button[aria-disabled="true"] {
  opacity: 0.52;
  cursor: not-allowed;
}

.dock-toggle-section button:focus-visible,
.dock-site-row input:focus-visible,
.dock-site-row button:focus-visible,
#dockSiteForm input:focus-visible,
#dockSiteForm button:focus-visible,
.dock-motion-control input:focus-visible,
#dockMotionReset:focus-visible {
  outline: 2px solid var(--tfa-accent);
  outline-offset: 2px;
}

#dockSiteList {
  display: grid;
  gap: 6px;
  min-height: 56px;
  max-height: min(360px, 44vh);
  padding-right: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.dock-site-row {
  display: grid;
  grid-template-columns: 20px 40px minmax(110px, 0.8fr) minmax(170px, 1.35fr) auto auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 11px;
  background: transparent;
  transition: background 160ms var(--tfa-ease-out), border-color 160ms var(--tfa-ease-out), opacity 160ms var(--tfa-ease-out);
}

.dock-site-row.is-dragging {
  z-index: 2;
  opacity: .76;
  border-color: rgba(var(--tfa-accent-rgb), .42);
  background: rgba(var(--tfa-accent-rgb), .07);
  cursor: grabbing;
  will-change: transform;
}

.dock-site-row.is-drop-before {
  box-shadow: inset 0 2px 0 var(--tfa-accent);
}

.dock-site-row.is-drop-after {
  box-shadow: inset 0 -2px 0 var(--tfa-accent);
}

.dock-site-row:focus-within,
.dock-site-row:active {
  border-color: rgba(var(--tfa-accent-rgb), 0.28);
  background: rgba(var(--tfa-accent-rgb), 0.05);
}

.dock-site-drag-handle {
  color: var(--tfa-text-secondary);
  font-size: 14px;
  line-height: 1;
  text-align: center;
  user-select: none;
  cursor: grab;
  touch-action: none;
}

.dock-site-drag-handle:active {
  cursor: grabbing;
}

.dock-settings-favicon-wrap {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 9px;
  background: var(--dock-tile-surface);
  box-shadow: inset 0 0 0 1px var(--tfa-border-soft);
}

.dock-settings-favicon,
.dock-settings-favicon-fallback {
  position: absolute;
  inset: 0;
  width: 40px;
  height: 40px;
  box-sizing: border-box;
  border-radius: inherit;
}

.dock-settings-favicon {
  z-index: 1;
  padding: 5px;
  object-fit: contain;
  background: transparent;
}

.dock-settings-favicon[hidden],
.dock-settings-favicon-fallback[hidden] {
  display: none !important;
}

.dock-settings-favicon-fallback {
  inset: 5px;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.dock-site-row input,
#dockSiteForm input {
  min-width: 0;
  height: 36px;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid var(--tfa-border-medium);
  border-radius: 9px;
  outline: none;
  background: var(--tfa-input-bg);
  color: var(--tfa-text-primary);
  font: inherit;
  font-size: 12px;
  transition: background 160ms var(--tfa-ease-out), border-color 160ms var(--tfa-ease-out);
}

.dock-site-row input:focus,
#dockSiteForm input:focus {
  border-color: rgba(var(--tfa-accent-rgb), 0.54);
  background: var(--tfa-input-focus-bg);
}

.dock-site-row button {
  min-height: 32px;
  padding: 0 9px;
}

.dock-site-row [data-dock-site-delete] {
  color: var(--tfa-danger);
}

.dock-site-inline-error {
  grid-column: 3 / -1;
  min-height: 16px;
}

.dock-site-empty {
  padding: 12px 0;
  color: var(--tfa-text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

#dockSiteForm {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--tfa-border-soft);
}

#dockSiteForm label {
  color: var(--tfa-text-secondary);
  font-size: 11px;
  font-weight: 650;
}

#dockSiteForm label[for="dockSiteName"] { grid-column: 1; grid-row: 1; }
#dockSiteForm #dockSiteName { grid-column: 1; grid-row: 2; }
#dockSiteForm label[for="dockSiteUrl"] { grid-column: 2; grid-row: 1; }
#dockSiteForm #dockSiteUrl { grid-column: 2; grid-row: 2; }
#dockSiteForm button[type="submit"] {
  grid-column: 3;
  grid-row: 2;
  min-height: 36px;
  padding: 0 13px;
  border-color: transparent;
  background: var(--tfa-accent);
  color: var(--dock-accent-contrast);
}

#dockSiteForm button[type="submit"]:hover {
  background: color-mix(in srgb, var(--tfa-accent) 86%, white);
}

#dockSiteError,
.dock-site-inline-error,
.dock-settings-error,
.dock-motion-error {
  color: var(--tfa-danger);
  font-size: 11.5px;
  line-height: 1.45;
}

#dockSiteError,
.dock-settings-error,
.dock-motion-error {
  min-height: 16px;
}

#dockSiteError {
  grid-column: 1 / -1;
  grid-row: 3;
}

#dockSiteError[hidden],
.dock-settings-error[hidden],
.dock-motion-error[hidden] {
  display: block !important;
  visibility: hidden;
}

.dock-site-inline-error[hidden] {
  display: block !important;
  visibility: hidden;
}

.dock-settings-error {
  margin-top: 8px;
}

.dock-motion-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
}

.dock-motion-control {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dock-motion-control label {
  color: var(--tfa-text-secondary);
  font-size: 11.5px;
}

.dock-motion-control input[type="range"] {
  min-width: 0;
  accent-color: var(--tfa-accent);
  cursor: pointer;
}

.dock-appearance-control {
  grid-template-columns: 96px minmax(0, 1fr) 46px;
}

.dock-color-control {
  grid-template-columns: 96px minmax(0, 1fr) 68px;
}

.dock-color-control input[type="color"] {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 3px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 9px;
  background: var(--tfa-input-bg);
  cursor: pointer;
}

.dock-color-control input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.dock-color-control input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 6px;
}

.dock-motion-control output {
  color: var(--tfa-text-primary);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dock-preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 16px 0 8px;
  color: var(--tfa-text-secondary);
  font-size: 11.5px;
  font-weight: 700;
}

#dockMotionPreview {
  --dock-icon-size: 48px;
  --dock-tile-size: 58px;
  --dock-tray-padding: 10px;
  --dock-gap: 8px;
  --dock-tray-surface: rgba(30, 34, 42, .38);
  --dock-tray-fallback: rgba(30, 34, 42, .94);
  --dock-tray-highlight: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .09) 38%, rgba(255, 255, 255, .025));
  --dock-tray-border: rgba(255, 255, 255, .38);
  --dock-tray-shadow: 0 18px 46px rgba(0, 0, 0, .30), 0 5px 14px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .24), inset 0 -1px 0 rgba(0, 0, 0, .14);
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: safe center;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-height: var(--dock-preview-min-height, 182px);
  padding: var(--dock-preview-clearance, 86px) 28px 18px;
  overflow-x: auto;
  overflow-y: hidden;
  border-block: 1px solid var(--tfa-border-soft);
  background:
    radial-gradient(circle at 50% 100%, rgba(var(--tfa-accent-rgb), 0.10), transparent 58%),
    var(--tfa-group-bg);
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  touch-action: pan-x;
}

#dockMotionPreview .dock-preview-track {
  flex: 0 0 auto;
  width: max-content;
  max-width: none;
  margin-inline: auto;
  padding: var(--dock-tray-padding);
  border: 1px solid var(--dock-tray-border);
  border-radius: 16px;
  background: var(--dock-tray-highlight), var(--dock-tray-surface);
  box-shadow: var(--dock-tray-shadow);
  backdrop-filter: blur(24px) saturate(1.45);
  -webkit-backdrop-filter: blur(24px) saturate(1.45);
}

#dockMotionPreview [data-dock-preview-site] {
  cursor: default;
  pointer-events: none;
}

#dockMotionPreview [role="tooltip"] {
  display: none;
}

#dockMotionReset {
  min-height: 36px;
  padding: 0 12px;
}

.dock-motion-error {
  margin-top: 8px;
}

.dock-platform-note {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--tfa-border-soft);
  color: var(--tfa-text-secondary);
  font-size: 11.5px;
  line-height: 1.6;
}

.dock-settings-save-bar {
  position: sticky;
  z-index: 5;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px -22px 0;
  padding: 14px 22px;
  border-top: 1px solid var(--tfa-border-soft);
  background: color-mix(in srgb, var(--tfa-panel-bg) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  color: var(--tfa-text-tertiary);
  font-size: 12px;
}

.dock-settings-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 126px;
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid rgba(var(--tfa-accent-rgb), .72);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--tfa-accent), var(--tfa-accent-2));
  color: var(--dock-accent-contrast);
  box-shadow: 0 10px 24px rgba(var(--tfa-accent-rgb), .24);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.dock-settings-save:not(:disabled):hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 13px 28px rgba(var(--tfa-accent-rgb), .3); }
.dock-settings-save:focus-visible { outline: 2px solid var(--tfa-accent); outline-offset: 3px; }
.dock-settings-save:disabled { cursor: wait; opacity: .62; }

.dock-settings-save-icon { font-size: 15px; line-height: 1; }
.dock-settings-save-icon.is-spinning { animation: dock-save-spin .75s linear infinite; }
@keyframes dock-save-spin { to { transform: rotate(360deg); } }

/* ===== Web Dock add dialog ===== */
.dock-add-shell {
  position: absolute;
  z-index: 78;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 24px;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 180ms ease;
}

.dock-add-shell.show { opacity: 1; }

.dock-add-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, .62);
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
}

.dock-add-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(780px, 94vw);
  height: min(720px, 90vh);
  max-height: min(720px, 90vh);
  overflow: hidden;
  border: 1px solid var(--tfa-panel-border);
  border-radius: 22px;
  background: var(--tfa-panel-bg);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255, 255, 255, .06);
  opacity: 0;
  transform: translateY(18px) scale(.975);
  transition: opacity 180ms ease, transform 220ms var(--tfa-ease-out);
}

.dock-add-shell.show .dock-add-dialog { opacity: 1; transform: translateY(0) scale(1); }

.dock-add-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--tfa-border-soft);
}

.dock-add-header > div > span {
  display: block;
  margin-bottom: 5px;
  color: var(--tfa-accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
}

.dock-add-header h2 { margin: 0; color: var(--tfa-text-primary); font-size: 21px; line-height: 1.25; }
.dock-add-header p { margin: 6px 0 0; color: var(--tfa-text-tertiary); font-size: 12.5px; }

.dock-add-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 22px;
  cursor: pointer;
}

.dock-add-close:hover { border-color: var(--tfa-border-strong); color: var(--tfa-text-primary); }

.dock-add-mode-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 18px 24px 0;
  padding: 5px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 14px;
  background: var(--tfa-hdr-bg);
}

.dock-add-mode-switch button,
.dock-add-icon-tabs button,
.dock-add-actions button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
}

.dock-add-mode-switch button.active {
  border-color: rgba(var(--tfa-accent-rgb), .32);
  background: rgba(var(--tfa-accent-rgb), .15);
  color: var(--tfa-accent);
}

.dock-add-form {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.dock-add-scroll-area {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 218px;
  align-items: start;
  gap: 18px;
  min-height: 0;
  padding: 20px 24px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.dock-add-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.dock-add-catalog {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-bottom: 8px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 14px;
  background: var(--tfa-hdr-bg);
}

.dock-add-catalog[hidden] { display: none !important; }

.dock-add-catalog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--tfa-text-primary);
  font-size: 12px;
  font-weight: 800;
}

.dock-add-catalog-heading strong {
  color: var(--tfa-accent);
  font-size: 10.5px;
}

.dock-add-catalog-tools { margin-top: 10px; }

.dock-add-catalog-tools input {
  width: 100%;
  height: 34px;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid var(--tfa-input-border);
  border-radius: 9px;
  outline: none;
  background: var(--tfa-input-bg);
  color: var(--tfa-text-primary);
  font: inherit;
  font-size: 11.5px;
}

.dock-add-catalog-tools input:focus { border-color: var(--tfa-accent); }

.dock-add-catalog-categories {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding: 2px 1px;
  overflow: visible;
}

.dock-add-catalog-category {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 9px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 10.5px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms var(--tfa-ease-out), border-color 150ms var(--tfa-ease-out), color 150ms var(--tfa-ease-out), transform 150ms var(--tfa-ease-out);
}

.dock-add-catalog-category em {
  min-width: 17px;
  padding: 1px 4px;
  border-radius: 999px;
  background: var(--tfa-input-bg);
  color: var(--tfa-text-tertiary);
  font-size: 9px;
  font-style: normal;
  text-align: center;
}

.dock-add-catalog-category:hover {
  border-color: rgba(var(--tfa-accent-rgb), 0.24);
  background: rgba(var(--tfa-accent-rgb), 0.07);
  color: var(--tfa-text-primary);
  transform: translateY(-1px);
}

.dock-add-catalog-category.active,
.dock-add-catalog-category[aria-selected="true"] {
  border-color: rgba(var(--tfa-accent-rgb), 0.34);
  background: rgba(var(--tfa-accent-rgb), 0.14);
  color: var(--tfa-accent);
}

.dock-add-catalog-category.active em,
.dock-add-catalog-category[aria-selected="true"] em {
  background: rgba(var(--tfa-accent-rgb), 0.16);
  color: var(--tfa-accent);
}

.dock-add-catalog-category:focus-visible {
  outline: 2px solid var(--tfa-accent);
  outline-offset: 2px;
}

.dock-add-catalog-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  max-height: 196px;
  margin-top: 8px;
  padding-right: 3px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dock-add-catalog-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 7px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--tfa-card-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  cursor: pointer;
}

.dock-add-catalog-item:hover,
.dock-add-catalog-item:focus-visible {
  border-color: rgba(var(--tfa-accent-rgb), .38);
  background: rgba(var(--tfa-accent-rgb), .1);
  color: var(--tfa-text-primary);
}

.dock-add-catalog-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  max-width: 32px;
  max-height: 32px;
  aspect-ratio: 1 / 1;
  flex: none;
  align-self: center;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
}

.dock-add-catalog-icon img,
.dock-add-catalog-icon b {
  border-radius: inherit;
}

.dock-add-catalog-icon img {
  position: absolute;
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  max-width: calc(100% - 6px);
  max-height: calc(100% - 6px);
  object-fit: contain;
  object-position: center;
}

.dock-add-catalog-icon b {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, var(--tfa-accent), var(--tfa-accent-2));
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  line-height: 1;
}

.dock-add-catalog-icon [hidden] { display: none !important; }

.dock-add-catalog-item span {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 9.5px;
}

.dock-add-catalog-item[hidden] { display: none !important; }

.dock-add-bookmarks {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 14px;
  background: var(--tfa-hdr-bg);
}

.dock-add-bookmarks[hidden],
[data-dock-add-standard-field][hidden] { display: none !important; }

.dock-add-bookmark-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--tfa-text-primary);
  font-size: 12px;
}

.dock-add-bookmark-heading span { color: var(--tfa-accent); font-size: 10.5px; font-weight: 800; }

#dockAddBookmarkSearch {
  box-sizing: border-box;
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--tfa-input-border);
  border-radius: 10px;
  outline: none;
  background: var(--tfa-input-bg);
  color: var(--tfa-text-primary);
  font: inherit;
  font-size: 12px;
}

#dockAddBookmarkSearch:focus { border-color: var(--tfa-accent); box-shadow: 0 0 0 3px rgba(var(--tfa-accent-rgb), .12); }

.dock-add-bookmark-state {
  display: grid;
  min-height: 112px;
  place-items: center;
  color: var(--tfa-text-tertiary);
  font-size: 12px;
  text-align: center;
}

.dock-add-bookmark-state[hidden] { display: none !important; }

.dock-add-bookmark-permission {
  display: block;
  justify-self: center;
  min-height: 34px;
  margin: -76px auto 16px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: var(--tfa-accent);
  cursor: pointer;
}

.dock-add-bookmark-permission[hidden] { display: none; }
.dock-add-bookmark-permission:disabled { cursor: wait; opacity: .65; }

.dock-add-bookmark-list {
  display: grid;
  gap: 10px;
  max-height: 308px;
  padding-right: 3px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.dock-add-bookmark-group h3 {
  margin: 0 0 6px;
  color: var(--tfa-text-tertiary);
  font-size: 10.5px;
  font-weight: 800;
}

.dock-add-bookmark-group > div { display: grid; gap: 5px; }

.dock-add-bookmark-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 11px;
  background: var(--tfa-card-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dock-add-bookmark-item:hover { border-color: rgba(var(--tfa-accent-rgb), .34); background: rgba(var(--tfa-accent-rgb), .07); }
.dock-add-bookmark-item.selected { border-color: rgba(var(--tfa-accent-rgb), .5); background: rgba(var(--tfa-accent-rgb), .13); }
.dock-add-bookmark-item > span:nth-child(2) { min-width: 0; }
.dock-add-bookmark-item strong,
.dock-add-bookmark-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-add-bookmark-item strong { color: var(--tfa-text-primary); font-size: 11.5px; }
.dock-add-bookmark-item small { margin-top: 2px; color: var(--tfa-text-tertiary); font-size: 9.5px; }
.dock-add-bookmark-item i { color: var(--tfa-accent); font-size: 14px; font-style: normal; font-weight: 900; text-align: center; }

.dock-add-bookmark-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 9px;
  background: #fff;
}

.dock-add-bookmark-icon img {
  position: absolute;
  inset: 4px;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  object-fit: contain;
}

.dock-add-bookmark-icon b {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: linear-gradient(145deg, var(--tfa-accent), var(--tfa-accent-2));
  color: #fff;
}

.dock-add-bookmark-icon [hidden] { display: none !important; }

.dock-add-fields > label,
.dock-add-icon-field label,
.dock-add-icon-picker legend { color: var(--tfa-text-secondary); font-size: 12px; font-weight: 750; }

.dock-add-fields > label { display: inline-flex; align-items: center; gap: 6px; }

.dock-add-inline-icon,
.dock-add-icon-tabs svg,
.dock-add-upload-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dock-add-fields > input,
.dock-add-icon-field input {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--tfa-input-border);
  border-radius: 11px;
  outline: none;
  background: var(--tfa-input-bg);
  color: var(--tfa-text-primary);
  font: inherit;
  font-size: 13px;
}

.dock-add-fields > input:focus,
.dock-add-icon-field input:focus { border-color: var(--tfa-accent); box-shadow: 0 0 0 3px rgba(var(--tfa-accent-rgb), .14); }
.dock-add-fields > input[readonly] { color: var(--tfa-text-tertiary); cursor: default; }

.dock-add-icon-picker {
  min-width: 0;
  margin: 8px 0 0;
  padding: 14px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 14px;
  background: var(--tfa-hdr-bg);
}

.dock-add-icon-picker legend { padding: 0 5px; }
.dock-add-icon-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }

.dock-add-icon-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 36px;
  padding: 0 8px;
  border-color: var(--tfa-border-soft);
  background: var(--tfa-card-bg);
  font-size: 11.5px;
}

.dock-add-icon-tabs button[aria-pressed="true"] {
  border-color: rgba(var(--tfa-accent-rgb), .5);
  background: rgba(var(--tfa-accent-rgb), .13);
  color: var(--tfa-accent);
}

.dock-add-icon-field, .dock-add-upload-field { margin-top: 12px; }
.dock-add-icon-field[hidden], .dock-add-upload-field[hidden] { display: none !important; }
.dock-add-icon-field label { display: block; margin-bottom: 7px; }

.dock-add-text-icon-field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dock-add-text-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.dock-add-text-color {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--dock-add-text-color);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.dock-add-text-color:hover { transform: translateY(-1px); }

.dock-add-text-color[aria-pressed="true"] {
  border-color: var(--tfa-text-primary);
  box-shadow: 0 0 0 2px var(--tfa-card-bg), 0 0 0 4px rgba(var(--tfa-accent-rgb), .48);
}

.dock-add-text-color:focus-visible {
  outline: 2px solid var(--tfa-accent);
  outline-offset: 2px;
}

#dockAddIconTextCount {
  color: var(--tfa-text-tertiary);
  font-size: 10.5px;
  font-weight: 700;
}

.dock-add-upload-field { display: flex; align-items: center; gap: 10px; min-width: 0; }

.dock-add-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid rgba(var(--tfa-accent-rgb), .45);
  border-radius: 10px;
  background: rgba(var(--tfa-accent-rgb), .12);
  color: var(--tfa-accent);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

#dockAddUploadName {
  min-width: 0;
  overflow: hidden;
  color: var(--tfa-text-tertiary);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.dock-add-preview-panel {
  position: sticky;
  top: 0;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  max-width: 218px;
  overflow: hidden;
  padding: 15px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 16px;
  background: linear-gradient(155deg, rgba(var(--tfa-accent-rgb), .11), var(--tfa-hdr-bg) 58%);
}

.dock-add-preview-caption { color: var(--tfa-text-tertiary); font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.dock-add-preview-card { display: flex; flex-direction: column; align-items: center; margin-top: 22px; text-align: center; }

.dock-add-preview-icon {
  position: relative;
  display: block;
  width: 76px;
  height: 76px;
  margin-bottom: 14px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--dock-tile-surface);
  box-shadow: inset 0 0 0 1px var(--tfa-border-soft);
}

.dock-add-preview-icon img,
.dock-add-preview-icon > span { position: absolute; border-radius: inherit; }
.dock-add-preview-icon img {
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: contain;
  object-position: center;
}
.dock-add-preview-icon > span { inset: 0; width: 100%; height: 100%; }
.dock-add-preview-icon > span { display: grid; place-items: center; color: #fff; font-size: 28px; font-weight: 900; }
.dock-add-preview-icon > span[data-icon-text-length="3"],
.dock-add-preview-icon > span[data-icon-text-length="4"] { font-size: 21px; }
.dock-add-preview-icon > span[data-icon-text-length="5"],
.dock-add-preview-icon > span[data-icon-text-length="6"] { font-size: 17px; }
.dock-add-preview-icon > span[data-icon-text-length="7"],
.dock-add-preview-icon > span[data-icon-text-length="8"],
.dock-add-preview-icon > span[data-icon-text-length="9"],
.dock-add-preview-icon > span[data-icon-text-length="10"] { font-size: 13px; }
.dock-add-preview-icon [hidden] { display: none !important; }

.dock-add-preview-card strong,
.dock-add-preview-card > span:last-child {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-add-preview-card strong { color: var(--tfa-text-primary); font-size: 14px; }
.dock-add-preview-card > span:last-child { margin-top: 5px; color: var(--tfa-text-tertiary); font-size: 10.5px; }
.dock-add-preview-panel p { margin: 22px 0 0; color: var(--tfa-text-tertiary); font-size: 10.5px; line-height: 1.55; text-align: center; }

.dock-add-error {
  grid-column: 1 / -1;
  margin-top: -10px;
  padding: 9px 11px;
  border: 1px solid rgba(248, 113, 113, .28);
  border-radius: 10px;
  background: rgba(248, 113, 113, .09);
  color: #fca5a5;
  font-size: 12px;
}

.dock-add-error[hidden] { display: none !important; }
.dock-add-actions {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--tfa-border-soft);
  background: var(--tfa-panel-bg);
  box-shadow: 0 -12px 28px rgba(15, 23, 42, 0.06);
}

.dock-add-actions button {
  min-width: 104px;
  padding: 0 17px;
  border-color: var(--tfa-border-soft);
  background: var(--tfa-btn-bg);
}

.dock-add-actions .dock-add-submit {
  min-width: 146px;
  border-color: rgba(var(--tfa-accent-rgb), .68);
  background: var(--tfa-accent);
  color: var(--dock-accent-contrast);
  box-shadow: 0 10px 24px rgba(var(--tfa-accent-rgb), .22);
}

.dock-add-mode-switch button:focus-visible,
.dock-add-close:focus-visible,
.dock-add-icon-tabs button:focus-visible,
.dock-add-upload-button:focus-within,
.dock-add-actions button:focus-visible { outline: 2px solid var(--tfa-accent); outline-offset: 2px; }
.dock-add-dialog[aria-busy="true"] { cursor: wait; }

/* ===== Web Dock search dialog ===== */
.dock-search-shell {
  position: absolute;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 20px;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 150ms ease;
}

.dock-search-shell.show { opacity: 1; }

.dock-search-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, .58);
  backdrop-filter: blur(10px) saturate(1.08);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
}

.dock-search-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(720px, 94vw);
  max-height: min(620px, 86vh);
  overflow: hidden;
  border: 1px solid var(--tfa-panel-border);
  border-radius: 22px;
  background: var(--tfa-panel-bg);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .44), inset 0 1px 0 rgba(255, 255, 255, .06);
  opacity: 0;
  transform: translateY(10px) scale(.985);
  transition: opacity 150ms ease, transform 190ms var(--tfa-ease-out);
}

.dock-search-shell.show .dock-search-dialog { opacity: 1; transform: translateY(0) scale(1); }

.dock-search-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--tfa-border-soft);
}

.dock-search-header > div > span {
  display: block;
  margin-bottom: 4px;
  color: var(--tfa-accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .16em;
}

.dock-search-header h2 { margin: 0; color: var(--tfa-text-primary); font-size: 21px; line-height: 1.25; }
.dock-search-header p { margin: 5px 0 0; color: var(--tfa-text-tertiary); font-size: 12px; }

.dock-search-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 22px;
  cursor: pointer;
}

.dock-search-close:hover { border-color: var(--tfa-border-strong); color: var(--tfa-text-primary); }

.dock-search-body { min-height: 0; padding: 18px 22px 22px; }

.dock-search-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.dock-search-input-wrap {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 48px;
  box-sizing: border-box;
  padding: 0 8px 0 14px;
  border: 1px solid var(--tfa-input-border);
  border-radius: 14px;
  background: var(--tfa-input-bg);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.dock-search-input-wrap:focus-within {
  border-color: var(--tfa-accent);
  box-shadow: 0 0 0 3px rgba(var(--tfa-accent-rgb), .12);
}

.dock-search-input-wrap > svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--tfa-text-tertiary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#dockSearchInput {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--tfa-text-primary);
  font: inherit;
  font-size: 14px;
}

#dockSearchInput::-webkit-search-cancel-button { display: none; }

.dock-search-clear {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 18px;
  cursor: pointer;
}

.dock-search-clear[hidden] { visibility: hidden; }
.dock-search-clear:hover { background: var(--tfa-btn-hover-bg); color: var(--tfa-text-primary); }

.dock-search-engines { display: flex; gap: 6px; }

.dock-search-engine {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 7px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 12px;
  background: var(--tfa-btn-bg);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms var(--tfa-ease-out);
}

.dock-search-engine img { width: 100%; height: 100%; object-fit: contain; border-radius: 7px; }
.dock-search-engine:hover { border-color: rgba(var(--tfa-accent-rgb), .35); background: rgba(var(--tfa-accent-rgb), .08); transform: translateY(-1px); }
.dock-search-engine:focus-visible,
.dock-search-clear:focus-visible,
.dock-search-close:focus-visible { outline: 2px solid var(--tfa-accent); outline-offset: 2px; }

.dock-search-results {
  min-height: 264px;
  max-height: min(360px, 48vh);
  margin-top: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  contain: layout paint;
  scrollbar-width: thin;
}

.dock-search-results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 30px;
  padding: 0 4px 6px;
  color: var(--tfa-text-primary);
  font-size: 12px;
  font-weight: 800;
}

.dock-search-results-heading small { color: var(--tfa-text-tertiary); font-size: 10px; font-weight: 650; }
.dock-search-result-list { display: grid; gap: 6px; }
.dock-search-permission-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  padding: 9px 10px;
  border: 1px solid rgba(var(--tfa-accent-rgb), .24);
  border-radius: 10px;
  background: rgba(var(--tfa-accent-rgb), .06);
  color: var(--tfa-text-secondary);
  font-size: 11px;
  line-height: 1.4;
}

.dock-search-permission-status > span {
  flex: 1 1 auto;
  min-width: 0;
}

.dock-search-permission {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(var(--tfa-accent-rgb), .34);
  border-radius: 9px;
  background: rgba(var(--tfa-accent-rgb), .10);
  color: var(--tfa-accent);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.dock-search-permission:hover { background: rgba(var(--tfa-accent-rgb), .16); }
.dock-search-permission:focus-visible { outline: 2px solid var(--tfa-accent); outline-offset: 2px; }
.dock-search-permission:disabled { cursor: wait; opacity: .65; }

.dock-search-result {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--tfa-card-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dock-search-result:hover,
.dock-search-result.active,
.dock-search-result:focus-visible {
  border-color: rgba(var(--tfa-accent-rgb), .32);
  background: rgba(var(--tfa-accent-rgb), .09);
  outline: none;
}

.dock-search-result > span:nth-child(2) { min-width: 0; }
.dock-search-result strong,
.dock-search-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-search-result strong { color: var(--tfa-text-primary); font-size: 12.5px; }
.dock-search-result small { margin-top: 3px; color: var(--tfa-text-tertiary); font-size: 10px; }

.dock-search-source,
.dock-search-result-symbol {
  display: grid;
  place-items: center;
  width: 40px;
  height: 36px;
  border-radius: 10px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font-size: 10px;
  font-weight: 850;
}

.dock-search-source-tab { color: var(--tfa-accent); background: rgba(var(--tfa-accent-rgb), .12); }
.dock-search-source-bookmark { color: #d97706; background: rgba(245, 158, 11, .12); }
.dock-search-source-browser { color: #0ea5e9; background: rgba(14, 165, 233, .12); }
.dock-search-result-symbol svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dock-search-result-enter { color: var(--tfa-text-tertiary); font-size: 15px; text-align: center; }

.dock-search-empty {
  display: grid;
  place-items: center;
  min-height: 210px;
  padding: 20px;
  color: var(--tfa-text-tertiary);
  font-size: 12px;
  text-align: center;
}

/* ===== Page-level Web Dock ===== */
.web-dock-shell {
  --dock-icon-size: 48px;
  --dock-tile-size: 58px;
  --dock-tray-padding: 10px;
  --dock-gap: 8px;
  --dock-tray-surface: rgba(30, 34, 42, .38);
  --dock-tray-fallback: rgba(30, 34, 42, .94);
  --dock-tray-highlight: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, .09) 38%, rgba(255, 255, 255, .025));
  --dock-tray-border: rgba(255, 255, 255, .38);
  --dock-tray-shadow: 0 18px 46px rgba(0, 0, 0, .30), 0 5px 14px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .24), inset 0 -1px 0 rgba(0, 0, 0, .14);
  --dock-tooltip-surface: rgb(38, 38, 40);
  --dock-tooltip-text: rgb(250, 250, 252);
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: max-content;
  max-width: var(--dock-visual-viewport-width, 100vw);
  transform: translateX(-50%) scale(var(--dock-page-zoom-inverse, 1));
  transform-origin: center bottom;
  pointer-events: none !important;
}

.web-dock-shell[hidden] {
  display: none !important;
}

.web-dock-shell[data-recent-open="true"] {
  min-height: calc(var(--dock-tile-size) + var(--dock-tray-padding) + var(--dock-tray-padding) + 230px);
  pointer-events: auto !important;
}

.web-dock {
  display: flex;
  align-items: flex-end;
  gap: var(--dock-gap);
  max-width: calc(var(--dock-visual-viewport-width, 100vw) - 16px);
  box-sizing: border-box;
  padding: var(--dock-tray-padding);
  overflow: visible;
  border: 1px solid var(--dock-tray-border);
  border-radius: 16px;
  background: var(--dock-tray-highlight), var(--dock-tray-surface);
  box-shadow: var(--dock-tray-shadow);
  backdrop-filter: blur(24px) saturate(1.45);
  -webkit-backdrop-filter: blur(24px) saturate(1.45);
  opacity: 1;
  transform: translate3d(0, 0, 0);
  pointer-events: none;
  transition: transform 220ms var(--tfa-ease-out), opacity 180ms var(--tfa-ease-out), background 180ms var(--tfa-ease-out), border-color 180ms var(--tfa-ease-out);
}

.web-dock-control {
  --dock-item-scale: 1;
  --dock-label-scale: calc(1 / var(--dock-item-scale));
  position: relative;
  display: block;
  width: var(--dock-tile-size);
  height: var(--dock-tile-size);
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 var(--dock-tile-size);
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--tfa-text-primary);
  font: inherit;
  cursor: pointer;
  transform-origin: center bottom;
  will-change: transform;
  transition: filter 150ms ease;
}

.web-dock-control-icon {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: inherit;
  background: var(--tfa-btn-bg);
  background: color-mix(in srgb, var(--tfa-btn-bg) 88%, var(--tfa-accent) 12%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .11);
}

.web-dock-control-icon svg {
  width: calc(var(--dock-icon-size) * .54);
  height: calc(var(--dock-icon-size) * .54);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.web-dock-add-control,
.web-dock-search-control,
.web-dock-settings-control,
.web-dock-recent-control { color: var(--tfa-accent); }

.web-dock-control:hover,
.web-dock-control[data-dock-active="true"],
.web-dock-control:focus-visible {
  z-index: 3;
  filter: brightness(1.08);
}

.web-dock-control:focus-visible {
  outline: 2px solid var(--tfa-accent);
  outline-offset: 3px;
}

.web-dock-control-label {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(100% + 11px);
  display: block;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 11px;
  background: var(--dock-tooltip-surface);
  color: var(--dock-tooltip-text);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .34);
  opacity: 0;
  visibility: hidden;
  transform: translateX(calc(-50% + var(--dock-label-shift, 0px))) translateY(calc(15px - var(--dock-label-gap, 11px))) scale(.82);
  transform-origin: 50% 100%;
  pointer-events: none;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.25;
  transition: opacity 120ms ease, transform 120ms ease, visibility 0s linear 160ms;
}

.web-dock-control:hover .web-dock-control-label,
.web-dock-control[data-dock-active="true"] .web-dock-control-label,
.web-dock-control:focus-visible .web-dock-control-label {
  opacity: 1;
  visibility: visible;
  transform: translateX(calc(-50% + var(--dock-label-shift, 0px))) translateY(calc(11px - var(--dock-label-gap, 11px))) scale(var(--dock-label-scale, 1));
  transition-delay: 0s;
}

.web-dock-shell[data-auto-hide="true"][data-expanded="false"] .web-dock-control-label,
.web-dock-shell[data-suspended="true"] .web-dock-control-label,
.web-dock-shell[data-reordering="true"] .web-dock-control-label {
  opacity: 0 !important;
  visibility: hidden !important;
  transition: none !important;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .web-dock {
    background: var(--dock-tray-fallback);
  }

  #dockMotionPreview .dock-preview-track {
    background: var(--dock-tray-fallback);
  }
}

.web-dock-shell[data-expanded="true"] .web-dock,
.web-dock-shell[data-auto-hide="false"] .web-dock {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  pointer-events: auto;
}

.web-dock-shell[data-auto-hide="true"][data-expanded="false"] .web-dock {
  opacity: 0;
  transform: translate3d(0, calc(100% + 12px), 0);
  pointer-events: none;
  transition-duration: 160ms;
}

.web-dock-track {
  display: flex;
  align-items: flex-end;
  gap: var(--dock-gap);
  width: max-content;
  overflow: visible;
  touch-action: pan-x;
}

/* Avoid two flex gaps around an empty site track, so the three controls stay evenly spaced. */
.web-dock-track:empty {
  display: none;
}

.web-dock-recent-panel {
  position: absolute;
  z-index: 12;
  right: var(--dock-tray-padding);
  bottom: calc(100% + 12px);
  width: min(286px, calc(var(--dock-visual-viewport-width, 100vw) - 20px));
  box-sizing: border-box;
  padding: 11px;
  overflow: visible;
  border: 1px solid var(--dock-tray-border);
  border-radius: 14px;
  background-color: var(--dock-tray-fallback, rgba(30, 34, 42, .96));
  background-image: var(--dock-tray-highlight);
  box-shadow: var(--dock-tray-shadow);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  color: var(--dock-tray-text, var(--tfa-text-primary));
  pointer-events: auto;
}

.web-dock-shell[data-recent-open="true"] .web-dock-recent-panel {
  bottom: calc(var(--dock-tile-size) + var(--dock-tray-padding) + var(--dock-tray-padding) + 12px);
}

.web-dock-recent-panel[hidden] { display: none !important; }

.web-dock-recent-header {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px 8px;
  color: var(--dock-tray-text, var(--tfa-text-primary));
}

.web-dock-recent-header strong {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  line-height: 1.3;
}

.web-dock-recent-header span {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(var(--tfa-accent-rgb), .12);
  color: var(--tfa-accent);
  font-size: 9px;
  font-weight: 750;
  text-align: center;
}

.web-dock-recent-status {
  min-height: 112px;
  display: grid;
  place-items: center;
  padding: 12px;
  color: var(--dock-tray-muted, var(--tfa-text-tertiary));
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.web-dock-recent-status[hidden],
.web-dock-recent-list[hidden] { display: none !important; }

.web-dock-recent-list {
  max-height: 156px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  padding: 1px 2px 2px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--tfa-border-strong) transparent;
}

.web-dock-recent-item {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 10px;
  background: var(--dock-tile-surface);
  color: var(--tfa-text-primary);
  cursor: pointer;
}

.web-dock-recent-item:hover {
  z-index: 2;
  border-color: rgba(var(--tfa-accent-rgb), .38);
  background: color-mix(in srgb, var(--dock-tile-surface) 88%, var(--tfa-accent) 12%);
  transform: translateY(-1px);
}

.web-dock-recent-item:focus-visible {
  z-index: 2;
  outline: 2px solid var(--tfa-accent);
  outline-offset: 1px;
}

.web-dock-recent-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
}

.web-dock-recent-icon img {
  width: 100%;
  height: 100%;
  display: block;
  padding: 4px;
  box-sizing: border-box;
  object-fit: contain;
}

.web-dock-recent-icon b {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--tfa-accent);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.web-dock-recent-icon img[hidden],
.web-dock-recent-icon b[hidden] { display: none !important; }

.web-dock-recent-label {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(100% + 7px);
  max-width: 190px;
  padding: 6px 8px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--dock-tooltip-surface);
  color: var(--dock-tooltip-text);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .28);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 4px);
  pointer-events: none;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1.3;
  text-overflow: ellipsis;
  transition: opacity 120ms ease, transform 120ms ease, visibility 0s linear 120ms;
}

.web-dock-recent-item:hover .web-dock-recent-label,
.web-dock-recent-item:focus-visible .web-dock-recent-label {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}

.web-dock-item {
  --dock-item-scale: 1;
  --dock-label-scale: calc(1 / var(--dock-item-scale));
  position: relative;
  display: block;
  width: var(--dock-tile-size);
  height: var(--dock-tile-size);
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 var(--dock-tile-size);
  flex-basis: var(--dock-tile-size);
  box-sizing: border-box;
  padding: 0;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--tfa-text-primary);
  font: inherit;
  cursor: grab;
  touch-action: none;
  transform-origin: center bottom;
  will-change: transform;
}

.web-dock-item:hover,
.web-dock-item[data-dock-active="true"],
.web-dock-item:focus-visible {
  z-index: 2;
}

.web-dock-item[data-dock-dragging="true"] {
  z-index: 3;
  opacity: 1;
  cursor: grabbing;
}

.web-dock-item[data-dock-placeholder="true"] .web-dock-icon-wrap {
  opacity: .16;
  transform: scale(.88);
  filter: saturate(.55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .10);
}

.web-dock-shell[data-reordering="true"] .web-dock-track {
  cursor: grabbing;
}

.web-dock-shell[data-reordering="true"] .web-dock-icon-wrap {
  will-change: transform;
}

.web-dock-drag-ghost {
  position: fixed;
  z-index: 80;
  left: 0;
  top: 0;
  box-sizing: border-box;
  pointer-events: none;
  transform-origin: center bottom;
  will-change: transform, opacity;
  filter: drop-shadow(0 16px 18px rgba(0, 0, 0, .34));
}

.web-dock-drag-ghost .web-dock-icon-wrap {
  width: 100%;
  height: 100%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 8px 18px rgba(0, 0, 0, .28);
}

.web-dock-item:focus-visible {
  outline: 2px solid var(--tfa-accent);
  outline-offset: 3px;
}

.web-dock-icon-wrap {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 12px;
  background: var(--dock-tile-surface);
  box-shadow: inset 0 0 0 1px var(--tfa-border-soft);
}

.web-dock-removal-ghost {
  position: fixed;
  z-index: 82;
  display: block;
  box-sizing: border-box;
  pointer-events: none;
  transform-origin: center bottom;
  will-change: transform, opacity;
}

.web-dock-favicon,
.dock-favicon-fallback {
  position: absolute;
  box-sizing: border-box;
  border-radius: inherit;
}

.web-dock-favicon {
  left: 50%;
  top: 50%;
  width: min(var(--dock-icon-size), calc(100% - 8px));
  height: min(var(--dock-icon-size), calc(100% - 8px));
  max-width: calc(100% - 8px);
  max-height: calc(100% - 8px);
  object-fit: contain;
  object-position: center;
  background: transparent;
  transform: translate(-50%, -50%);
}

/* Monochrome dark brand marks need the light variant on the dark preview tray.
   Keep multicolor marks (Google, YouTube, etc.) untouched. */
#dockMotionPreview [data-dock-site-url^="https://github.com/"] .web-dock-favicon,
#dockMotionPreview [data-dock-site-url^="https://chatgpt.com/"] .web-dock-favicon,
.web-dock-shell [data-dock-site-url^="https://github.com/"] .web-dock-favicon,
.web-dock-shell [data-dock-site-url^="https://chatgpt.com/"] .web-dock-favicon {
  filter: none;
}

:host([data-theme="snow"]) #dockMotionPreview [data-dock-site-url^="https://github.com/"] .web-dock-favicon,
:host([data-theme="snow"]) #dockMotionPreview [data-dock-site-url^="https://chatgpt.com/"] .web-dock-favicon,
:host([data-theme="snow"]) .web-dock-shell [data-dock-site-url^="https://github.com/"] .web-dock-favicon,
:host([data-theme="snow"]) .web-dock-shell [data-dock-site-url^="https://chatgpt.com/"] .web-dock-favicon,
:host([data-theme="light"]) #dockMotionPreview [data-dock-site-url^="https://github.com/"] .web-dock-favicon,
:host([data-theme="light"]) #dockMotionPreview [data-dock-site-url^="https://chatgpt.com/"] .web-dock-favicon,
:host([data-theme="light"]) .web-dock-shell [data-dock-site-url^="https://github.com/"] .web-dock-favicon,
:host([data-theme="light"]) .web-dock-shell [data-dock-site-url^="https://chatgpt.com/"] .web-dock-favicon {
  filter: none;
}

.dock-favicon-fallback {
  inset: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  color: #fff;
  font-size: calc(var(--dock-icon-size) * 0.34);
  font-weight: 800;
}

.web-dock-item[data-icon-mode="text"] .dock-favicon-fallback {
  padding: 5px;
  line-height: 1;
  text-align: center;
  overflow-wrap: anywhere;
}

.web-dock-item[data-icon-mode="text"][data-icon-text-length="3"] .dock-favicon-fallback,
.web-dock-item[data-icon-mode="text"][data-icon-text-length="4"] .dock-favicon-fallback { font-size: calc(var(--dock-icon-size) * .27); }
.web-dock-item[data-icon-mode="text"][data-icon-text-length="5"] .dock-favicon-fallback,
.web-dock-item[data-icon-mode="text"][data-icon-text-length="6"] .dock-favicon-fallback { font-size: calc(var(--dock-icon-size) * .22); }
.web-dock-item[data-icon-mode="text"][data-icon-text-length="7"] .dock-favicon-fallback,
.web-dock-item[data-icon-mode="text"][data-icon-text-length="8"] .dock-favicon-fallback,
.web-dock-item[data-icon-mode="text"][data-icon-text-length="9"] .dock-favicon-fallback,
.web-dock-item[data-icon-mode="text"][data-icon-text-length="10"] .dock-favicon-fallback { font-size: calc(var(--dock-icon-size) * .18); }

.web-dock-favicon[hidden],
.dock-favicon-fallback[hidden] {
  display: none !important;
}

.web-dock-context-menu {
  position: fixed;
  z-index: 2147483647;
  display: grid;
  width: 124px;
  padding: 6px;
  border: 1px solid var(--tfa-border-medium);
  border-radius: 12px;
  background: var(--tfa-panel-bg);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .24);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  pointer-events: auto;
}

.web-dock-context-menu button {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--tfa-text-primary);
  font: 600 13px/1 system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
}

.web-dock-context-menu button:hover,
.web-dock-context-menu button:focus-visible {
  outline: none;
  background: var(--tfa-btn-hover-bg);
}

.web-dock-context-menu button[data-dock-context-action="delete"] { color: var(--tfa-danger); }

.web-dock-label {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: calc(100% + 11px);
  display: block;
  max-width: min(260px, var(--dock-tooltip-max-width, calc(100vw - 16px)));
  box-sizing: border-box;
  padding: 7px 10px;
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 11px;
  background: var(--dock-tooltip-surface);
  color: var(--dock-tooltip-text);
  box-shadow: 0 4px 8px rgba(0, 0, 0, .34);
  opacity: 0;
  visibility: hidden;
  transform: translateX(calc(-50% + var(--dock-label-shift, 0px))) translateY(calc(15px - var(--dock-label-gap, 11px))) scale(.82);
  transform-origin: 50% 100%;
  pointer-events: none;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  line-height: 1.25;
  transition: opacity 120ms ease, visibility 0s linear 160ms;
}

.web-dock-label-text {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.web-dock-label::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 100%;
  width: 9px;
  height: 9px;
  box-sizing: border-box;
  border-right: 1px solid rgba(255, 255, 255, .08);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: var(--dock-tooltip-surface);
  transform: translate(calc(-50% + var(--dock-label-arrow-shift, 0px)), -55%) rotate(45deg);
  pointer-events: none;
}

.web-dock-item[data-dock-active="true"] .web-dock-label {
  opacity: 1;
  visibility: visible;
  transform: translateX(calc(-50% + var(--dock-label-shift, 0px))) translateY(calc(11px - var(--dock-label-gap, 11px))) scale(var(--dock-label-scale, 1));
  transition-delay: 0s;
}

.web-dock-item:hover:not([data-dock-active="true"]) .web-dock-label,
.web-dock-item:focus-visible:not([data-dock-active="true"]) .web-dock-label {
  opacity: 1;
  visibility: visible;
  transform: translateX(calc(-50% + var(--dock-label-shift, 0px))) translateY(calc(11px - var(--dock-label-gap, 11px))) scale(var(--dock-label-scale, 1));
  transition-delay: 0s;
}

.web-dock-shell[data-auto-hide="true"][data-expanded="false"] .web-dock-label {
  opacity: 0 !important;
  visibility: hidden !important;
  transition: none !important;
}

.web-dock-item[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--tfa-accent);
  box-shadow: 0 0 4px rgba(var(--tfa-accent-rgb), 0.52);
  transform: translateX(-50%);
}

.web-dock-item[data-dock-insert="before"]::before,
.web-dock-item[data-dock-insert="after"]::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 999px;
  background: var(--tfa-accent);
}

.web-dock-item[data-dock-insert="before"]::before {
  left: calc(var(--dock-gap) / -2);
}

.web-dock-item[data-dock-insert="after"]::before {
  right: calc(var(--dock-gap) / -2);
}

.web-dock-shell[data-reordering="true"] .web-dock-label {
  opacity: 0 !important;
  visibility: hidden !important;
  transition: none !important;
}

.web-dock-shell[data-suspended="true"] .web-dock-label,
.web-dock-shell[hidden] .web-dock-label {
  opacity: 0 !important;
  visibility: hidden !important;
  transition: none !important;
}

.web-dock-trigger {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 0;
  width: min(240px, calc(100vw - 32px));
  min-width: 160px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  opacity: 1;
  transform: translateX(-50%);
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 160ms var(--tfa-ease-out);
}

.web-dock-trigger::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: 24px;
  height: 4px;
  border-radius: 999px;
  background: var(--tfa-border-strong);
  transform: translateX(-50%);
}

.web-dock-trigger:focus-visible {
  outline: 2px solid var(--tfa-accent);
  outline-offset: 2px;
}

.web-dock-shell[data-auto-hide="true"][data-expanded="true"] .web-dock-trigger {
  opacity: 0;
  pointer-events: none;
}

.web-dock-shell[data-auto-hide="false"] .web-dock-trigger {
  opacity: 0;
  pointer-events: none;
}

.web-dock-shell[data-suspended="true"] .web-dock,
.web-dock-shell[data-suspended="true"] .web-dock-trigger {
  opacity: 0;
  pointer-events: none;
  transition-duration: 150ms;
}

.web-dock-shell[data-opening="true"] .web-dock-item {
  pointer-events: none;
}

.web-dock-shell[data-suspended="true"] .web-dock {
  transform: translate3d(0, calc(100% + 12px), 0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 780px) {
  .settings-dialog-shell,
  .purchase-preview,
  .dock-add-shell,
  .dock-search-shell {
    padding: 12px;
  }

  .dock-search-body { padding: 14px; }
  .dock-search-toolbar { grid-template-columns: minmax(0, 1fr); }
  .dock-search-engines { justify-content: flex-end; overflow-x: auto; }
  .dock-search-results { min-height: 230px; }

  .dock-add-dialog {
    max-height: 92vh;
  }

  .dock-add-form {
    grid-template-columns: minmax(0, 1fr) 210px;
    gap: 16px;
  }

  .settings-dialog {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    width: 96vw;
    height: 88vh;
    max-height: 88vh;
  }

  .settings-sidebar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--tfa-border-soft);
  }

  .settings-sidebar-title {
    display: none;
  }

  .settings-nav-item {
    width: auto;
  }

  .settings-nav-item + .settings-nav-item {
    margin-top: 0;
  }

  .dock-site-row {
    grid-template-columns: 20px 40px minmax(0, 1fr) auto auto;
  }

  .dock-site-row [data-dock-site-title] {
    grid-column: 3;
    grid-row: 1;
  }

  .dock-site-row [data-dock-site-url] {
    grid-column: 3;
    grid-row: 2;
  }

  .dock-site-row [data-dock-site-save] {
    grid-column: 4;
    grid-row: 1 / 3;
  }

  .dock-site-row [data-dock-site-delete] {
    grid-column: 5;
    grid-row: 1 / 3;
  }

  .dock-site-inline-error {
    grid-column: 3 / -1;
    grid-row: 3;
  }

  #dockSiteForm {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  #dockSiteForm label[for="dockSiteName"] { grid-column: 1; grid-row: 1; }
  #dockSiteForm #dockSiteName { grid-column: 1; grid-row: 2; }
  #dockSiteForm label[for="dockSiteUrl"] { grid-column: 1; grid-row: 3; }
  #dockSiteForm #dockSiteUrl { grid-column: 1; grid-row: 4; }
  #dockSiteForm button[type="submit"] { grid-column: 2; grid-row: 4; }
  #dockSiteError { grid-column: 1 / -1; grid-row: 5; }

  .activation-purchase-layout {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .activation-form-row {
    grid-template-columns: 1fr;
  }

  .activation-submit {
    width: 100%;
    justify-content: center;
  }

  .ai-settings-switches { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .settings-dialog-header,
  .activation-panel,
  .web-dock-settings,
  .ai-settings {
    padding-left: 16px;
    padding-right: 16px;
  }

  .ai-settings-channel { grid-template-columns: minmax(0, 1fr); }
  .ai-settings-channel > label,
  .ai-settings-channel > input,
  .ai-settings-key,
  .ai-settings-local-note { grid-column: 1; }
  .ai-settings-key { grid-template-columns: minmax(0, 1fr) 1fr 1fr; }
  .ai-settings-key input { grid-column: 1 / -1; }
  .ai-settings-preview dl div { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .ai-settings-actions { flex-wrap: wrap; margin-inline: -16px; padding-inline: 16px; }
  .ai-settings-actions > span { flex-basis: 100%; }
  .ai-settings-actions button { flex: 1 1 0; }

  .settings-sidebar {
    overflow-x: auto;
  }

  .settings-nav-item {
    flex: 1 0 auto;
    justify-content: center;
    min-height: 44px;
  }

  .settings-dialog-close {
    width: 44px;
    height: 44px;
  }

  .dock-settings-save-bar {
    align-items: stretch;
    flex-direction: column;
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .dock-settings-save { width: 100%; }

  .dock-add-header { padding: 18px 16px 15px; }
  .dock-add-mode-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 14px 16px 0; }
  .dock-add-scroll-area { grid-template-columns: 1fr; padding: 16px; }
  .dock-add-preview-panel { max-width: none; min-height: 190px; }
  .dock-add-preview-card { margin-top: 12px; }
  .dock-add-preview-panel p { margin-top: 12px; }
  .dock-add-actions { flex-direction: column-reverse; padding: 12px 16px 16px; }
  .dock-add-actions button { width: 100%; }
  .dock-add-icon-tabs { grid-template-columns: 1fr; }

  .web-dock-trigger {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .web-dock-recent-panel {
    right: 4px;
    width: min(286px, calc(var(--dock-visual-viewport-width, 100vw) - 12px));
  }

  .dock-toggle-section {
    flex-direction: column;
  }

  .dock-site-row {
    grid-template-columns: 44px 44px minmax(0, 1fr);
    min-height: 44px;
  }

  .dock-site-row .dock-site-drag-handle { grid-column: 1; grid-row: 1; }
  .dock-site-row .dock-settings-favicon-wrap { grid-column: 2; grid-row: 1; justify-self: center; }
  .dock-site-row [data-dock-site-title] { grid-column: 1 / -1; grid-row: 2; }
  .dock-site-row [data-dock-site-url] { grid-column: 1 / -1; grid-row: 3; }
  .dock-site-row [data-dock-site-save] { grid-column: 2; grid-row: 4; }
  .dock-site-row [data-dock-site-delete] { grid-column: 3; grid-row: 4; }
  .dock-site-inline-error { grid-column: 1 / -1; grid-row: 5; }

  #dockSiteForm {
    grid-template-columns: 1fr;
  }

  #dockSiteForm label[for="dockSiteName"] { grid-column: 1; grid-row: 1; }
  #dockSiteForm #dockSiteName { grid-column: 1; grid-row: 2; }
  #dockSiteForm label[for="dockSiteUrl"] { grid-column: 1; grid-row: 3; }
  #dockSiteForm #dockSiteUrl { grid-column: 1; grid-row: 4; }
  #dockSiteForm button[type="submit"] { grid-column: 1; grid-row: 5; width: 100%; }
  #dockSiteError { grid-column: 1; grid-row: 6; }

  .dock-motion-control label,
  #dockSiteForm label {
    font-size: 14px;
    line-height: 1.4;
  }

  .dock-site-row input,
  #dockSiteForm input {
    height: 44px;
    min-height: 44px;
    font-size: 14px;
  }

  .dock-motion-control input[type="range"] {
    min-height: 44px;
  }

  .dock-toggle-section button,
  .dock-site-row button,
  #dockSiteForm button,
  #dockMotionReset {
    min-height: 44px;
  }

  .dock-site-row button {
    min-width: 44px;
    min-height: 44px;
  }

  .dock-site-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
  }

  .dock-motion-controls {
    grid-template-columns: 1fr;
  }

  .dock-motion-control {
    grid-template-columns: 68px minmax(0, 1fr) 42px;
  }

  .dock-color-control {
    grid-template-columns: 94px minmax(0, 1fr) 68px;
  }

  .dock-appearance-control:not(.dock-color-control) {
    grid-template-columns: 94px minmax(0, 1fr) 42px;
  }

  #dockMotionPreview {
    max-width: 100%;
    min-height: var(--dock-preview-min-height, 182px);
    padding-inline: 16px;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .dock-preview-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .activation-purchase-layout {
    grid-template-columns: 1fr;
  }

  .activation-image-button {
    max-width: 180px;
    margin: 0 auto;
  }

  .deactivation-actions {
    flex-direction: column-reverse;
  }

  .deactivation-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .activation-spinner {
    animation: none;
  }

  .settings-dialog-shell,
  .settings-dialog,
  .deactivation-confirm,
  .deactivation-dialog,
  .purchase-preview,
  .purchase-preview-dialog,
  .web-dock-shell,
  .web-dock,
  .web-dock-item,
  .web-dock-label,
  .web-dock-control,
  .web-dock-control-label,
  .web-dock-recent-item,
  .web-dock-recent-label,
  .dock-add-shell,
  .dock-add-dialog,
  .dock-search-shell,
  .dock-search-dialog {
    transition: none !important;
    animation: none !important;
  }

  .web-dock-item[data-dock-placeholder="true"] .web-dock-icon-wrap {
    transition: none !important;
  }

}

@media (pointer: coarse) {
  .web-dock {
    max-width: calc(var(--dock-visual-viewport-width, 100vw) - 16px);
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  .web-dock-track {
    width: max-content;
  }

  .web-dock-item {
    transform: none !important;
  }

  .web-dock-label {
    display: none !important;
  }

  .web-dock-trigger {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }
}

@media print {
  .web-dock-shell {
    display: none !important;
  }
}

:host([data-theme="snow"]),
:host([data-theme="light"]) {
  --dock-accent-contrast: #fff;
  --dock-tile-surface: rgb(255, 255, 255);
  --tfa-backdrop-bg: rgba(241, 245, 249, 0.68);
  --tfa-panel-bg: rgba(255, 255, 255, 0.96);
  --tfa-panel-border: rgba(15, 23, 42, 0.08);
  --tfa-panel-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --tfa-panel-glow: radial-gradient(circle at top, rgba(91, 103, 241, 0.08), transparent 42%);
  --tfa-text-primary: #0f172a;
  --tfa-text-secondary: #475569;
  --tfa-text-tertiary: #94a3b8;
  --tfa-border-soft: rgba(15, 23, 42, 0.06);
  --tfa-border-medium: rgba(15, 23, 42, 0.10);
  --tfa-border-strong: rgba(15, 23, 42, 0.16);
  --tfa-card-bg: rgba(248, 250, 252, 0.96);
  --tfa-card-hover-bg: rgba(241, 245, 249, 1);
  --tfa-group-bg: rgba(15, 23, 42, 0.025);
  --tfa-hdr-bg: rgba(248, 250, 252, 0.9);
  --tfa-input-bg: rgba(248, 250, 252, 0.98);
  --tfa-input-focus-bg: #fff;
  --tfa-btn-bg: rgba(248, 250, 252, 0.98);
  --tfa-btn-hover-bg: rgba(226, 232, 240, 1);
  --tfa-accent: #5b67f1;
  --tfa-accent-2: #4f46e5;
  --tfa-accent-rgb: 91, 103, 241;
  --tfa-skeleton-base: rgba(15, 23, 42, 0.05);
  --tfa-skeleton-shine: rgba(91, 103, 241, 0.10);
}

:host([data-theme="snow"]) {
  --dock-accent-contrast: #fff;
}

:host([data-theme="snow"]) #dockSiteForm button[type="submit"]:hover,
:host([data-theme="light"]) #dockSiteForm button[type="submit"]:hover {
  background: var(--tfa-accent-2);
}

:host([data-theme="snow"]) #dockSiteForm button[type="submit"]:hover {
  background: var(--tfa-accent-2);
}

:host([data-theme="ocean"]) {
  --dock-accent-contrast: #03101a;
  --dock-tile-surface: rgb(255, 255, 255);
  --tfa-backdrop-bg: rgba(2, 10, 28, 0.68);
  --tfa-panel-bg: rgba(10, 18, 36, 0.94);
  --tfa-panel-border: rgba(96, 165, 250, 0.14);
  --tfa-panel-shadow: 0 30px 84px rgba(1, 8, 24, 0.50);
  --tfa-panel-glow: radial-gradient(circle at top, rgba(56, 189, 248, 0.12), transparent 40%);
  --tfa-text-primary: #e6eefc;
  --tfa-text-secondary: #97aac9;
  --tfa-text-tertiary: #5f7393;
  --tfa-border-soft: rgba(96, 165, 250, 0.08);
  --tfa-border-medium: rgba(96, 165, 250, 0.16);
  --tfa-border-strong: rgba(96, 165, 250, 0.24);
  --tfa-card-bg: rgba(15, 28, 54, 0.70);
  --tfa-card-hover-bg: rgba(21, 38, 70, 0.88);
  --tfa-group-bg: rgba(56, 189, 248, 0.035);
  --tfa-hdr-bg: rgba(56, 189, 248, 0.03);
  --tfa-input-bg: rgba(15, 28, 54, 0.78);
  --tfa-input-focus-bg: rgba(21, 38, 70, 0.96);
  --tfa-btn-bg: rgba(15, 28, 54, 0.76);
  --tfa-btn-hover-bg: rgba(56, 189, 248, 0.10);
  --tfa-accent: #56c7ff;
  --tfa-accent-2: #2f7ff3;
  --tfa-accent-rgb: 86, 199, 255;
}

:host([data-theme="paper"]) {
  --dock-accent-contrast: #100500;
  --dock-tile-surface: rgb(255, 255, 255);
  --tfa-backdrop-bg: rgba(109, 82, 46, 0.20);
  --tfa-panel-bg: rgba(252, 248, 239, 0.97);
  --tfa-panel-border: rgba(126, 91, 54, 0.14);
  --tfa-panel-shadow: 0 24px 72px rgba(80, 55, 22, 0.12);
  --tfa-panel-glow: radial-gradient(circle at top, rgba(194, 120, 66, 0.10), transparent 42%);
  --tfa-text-primary: #352819;
  --tfa-text-secondary: #6b5840;
  --tfa-text-tertiary: #9c8668;
  --tfa-border-soft: rgba(126, 91, 54, 0.08);
  --tfa-border-medium: rgba(126, 91, 54, 0.15);
  --tfa-border-strong: rgba(126, 91, 54, 0.22);
  --tfa-card-bg: rgba(255, 253, 248, 0.98);
  --tfa-card-hover-bg: rgba(247, 239, 226, 1);
  --tfa-group-bg: rgba(126, 91, 54, 0.03);
  --tfa-hdr-bg: rgba(252, 248, 239, 0.92);
  --tfa-input-bg: rgba(255, 252, 246, 0.98);
  --tfa-input-focus-bg: #fff;
  --tfa-btn-bg: rgba(249, 241, 230, 0.92);
  --tfa-btn-hover-bg: rgba(241, 229, 210, 1);
  --tfa-accent: #c26128;
  --tfa-accent-2: #a64b1f;
  --tfa-accent-rgb: 194, 97, 40;
  --tfa-success: #2ea77a;
  --tfa-success-rgb: 46, 167, 122;
}

:host([data-theme="space"]) {
  --dock-accent-contrast: #050816;
  --dock-tile-surface: rgb(255, 255, 255);
  --tfa-backdrop-bg: rgba(10, 10, 14, 0.55);
  --tfa-panel-bg: rgba(30, 31, 39, 0.92);
  --tfa-panel-border: rgba(194, 197, 214, 0.08);
  --tfa-panel-shadow: 0 28px 82px rgba(0, 0, 0, 0.46);
  --tfa-panel-glow: radial-gradient(circle at top, rgba(187, 136, 255, 0.12), transparent 38%);
  --tfa-text-primary: #f0f1f8;
  --tfa-text-secondary: #a2a6b8;
  --tfa-text-tertiary: #666b7d;
  --tfa-border-soft: rgba(194, 197, 214, 0.06);
  --tfa-border-medium: rgba(194, 197, 214, 0.12);
  --tfa-border-strong: rgba(194, 197, 214, 0.18);
  --tfa-card-bg: rgba(255, 255, 255, 0.045);
  --tfa-card-hover-bg: rgba(255, 255, 255, 0.07);
  --tfa-group-bg: rgba(255, 255, 255, 0.028);
  --tfa-hdr-bg: rgba(255, 255, 255, 0.025);
  --tfa-input-bg: rgba(255, 255, 255, 0.045);
  --tfa-input-focus-bg: rgba(255, 255, 255, 0.065);
  --tfa-btn-bg: rgba(255, 255, 255, 0.045);
  --tfa-btn-hover-bg: rgba(255, 255, 255, 0.08);
  --tfa-accent: #bb88ff;
  --tfa-accent-2: #8b5cf6;
  --tfa-accent-rgb: 187, 136, 255;
}

:host([data-theme="pro"]) {
  --dock-accent-contrast: #050816;
  --dock-tile-surface: rgb(255, 255, 255);
  --tfa-backdrop-bg: rgba(17, 24, 39, 0.30);
  --tfa-panel-bg: rgba(255, 255, 255, 0.99);
  --tfa-panel-border: rgba(226, 232, 240, 1);
  --tfa-panel-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --tfa-panel-glow: none;
  --tfa-text-primary: #111827;
  --tfa-text-secondary: #6b7280;
  --tfa-text-tertiary: #9ca3af;
  --tfa-border-soft: rgba(226, 232, 240, 0.95);
  --tfa-border-medium: rgba(209, 213, 219, 1);
  --tfa-border-strong: rgba(148, 163, 184, 0.38);
  --tfa-card-bg: rgba(255, 255, 255, 1);
  --tfa-card-hover-bg: rgba(249, 250, 251, 1);
  --tfa-group-bg: rgba(249, 250, 251, 1);
  --tfa-hdr-bg: rgba(248, 250, 252, 0.92);
  --tfa-input-bg: rgba(249, 250, 251, 1);
  --tfa-input-focus-bg: #fff;
  --tfa-btn-bg: rgba(249, 250, 251, 1);
  --tfa-btn-hover-bg: rgba(243, 244, 246, 1);
  --tfa-accent: #775ff7;
  --tfa-accent-2: #4f46e5;
  --tfa-accent-rgb: 119, 95, 247;
  --tfa-skeleton-base: rgba(15, 23, 42, 0.05);
}

:host([data-theme="crypto"]) {
  --dock-accent-contrast: #050816;
  --dock-tile-surface: rgb(255, 255, 255);
  --tfa-backdrop-bg: rgba(0, 0, 0, 0.78);
  --tfa-panel-bg: rgba(11, 12, 16, 0.98);
  --tfa-panel-border: rgba(51, 55, 70, 1);
  --tfa-panel-shadow: 0 34px 90px rgba(0, 0, 0, 0.62);
  --tfa-panel-glow: radial-gradient(circle at top, rgba(99, 102, 241, 0.16), transparent 36%);
  --tfa-text-primary: #fafaff;
  --tfa-text-secondary: #a7abc0;
  --tfa-text-tertiary: #63687c;
  --tfa-border-soft: rgba(63, 63, 70, 0.72);
  --tfa-border-medium: rgba(82, 82, 91, 1);
  --tfa-border-strong: rgba(113, 113, 122, 1);
  --tfa-card-bg: rgba(22, 24, 30, 0.98);
  --tfa-card-hover-bg: rgba(30, 33, 42, 1);
  --tfa-group-bg: rgba(24, 24, 30, 0.84);
  --tfa-hdr-bg: rgba(17, 18, 24, 0.94);
  --tfa-input-bg: rgba(24, 26, 34, 0.96);
  --tfa-input-focus-bg: rgba(31, 34, 46, 1);
  --tfa-btn-bg: rgba(24, 26, 34, 0.96);
  --tfa-btn-hover-bg: rgba(53, 58, 74, 0.65);
  --tfa-accent: #6b7bff;
  --tfa-accent-2: #8b5cf6;
  --tfa-accent-rgb: 107, 123, 255;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tfa-dur-norm) ease;
  color: var(--tfa-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
  overscroll-behavior: none;
}

.backdrop {
  position: absolute;
  inset: 0;
  background: var(--tfa-backdrop-bg);
  backdrop-filter: blur(18px) saturate(1.18);
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
}

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: calc(100vw - var(--tfa-overlay-gutter));
  height: calc(100vh - var(--tfa-overlay-gutter));
  max-width: none;
  max-height: none;
  background: var(--tfa-panel-bg);
  border: 1px solid var(--tfa-panel-border);
  border-radius: var(--tfa-radius-xl);
  box-shadow: var(--tfa-panel-shadow);
  overflow: hidden;
  overscroll-behavior: contain;
  transform: translateY(22px) scale(0.97);
  opacity: 0;
  transition: transform var(--tfa-dur-slow) var(--tfa-ease-spring), opacity var(--tfa-dur-norm) ease;
}

.panel[data-columns="4"] { --tfa-grid-columns: 4; }
.panel[data-columns="5"] { --tfa-grid-columns: 5; }
.panel[data-columns="6"] { --tfa-grid-columns: 6; }

.panel::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 180px;
  background: var(--tfa-panel-glow);
  pointer-events: none;
}

.overlay.show .panel {
  transform: translateY(0) scale(1);
  opacity: 1;
}

:host([data-tfa-surface="newtab"]) {
  --tfa-overlay-gutter: 0px;
}

:host([data-tfa-surface="newtab"]) .backdrop {
  background: var(--tfa-panel-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

:host([data-tfa-surface="newtab"]) .panel {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

:host([data-tfa-surface="newtab"]) .sticky-mode .panel::after {
  display: none;
}

.hdr,
.body,
.ftr {
  position: relative;
  z-index: 1;
}

.hdr {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--tfa-border-soft);
  background: var(--tfa-hdr-bg);
}

.hdr-top,
.hdr-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hdr-top {
  justify-content: space-between;
}

.hdr-meta {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.hdr-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.hdr-kicker {
  font-size: 11px;
  line-height: 1;
  color: var(--tfa-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.hdr-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hdr-title {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--tfa-text-primary);
}

.hdr-subtitle {
  font-size: 12px;
  line-height: 1.45;
  color: var(--tfa-text-secondary);
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--tfa-card-bg);
  border: 1px solid var(--tfa-border-soft);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--tfa-text-secondary);
  white-space: nowrap;
}

.hdr-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.search {
  width: 100%;
  height: 42px;
  padding: 0 38px 0 42px;
  border-radius: 12px;
  border: 1px solid var(--tfa-border-soft);
  background: var(--tfa-input-bg);
  color: var(--tfa-text-primary);
  outline: none;
  font-size: 13.5px;
  transition: border-color var(--tfa-dur-fast), background var(--tfa-dur-fast), box-shadow var(--tfa-dur-fast);
}

.search::placeholder {
  color: var(--tfa-text-tertiary);
}

.search:focus {
  border-color: rgba(var(--tfa-accent-rgb), 0.45);
  background: var(--tfa-input-focus-bg);
  box-shadow: 0 0 0 3px rgba(var(--tfa-accent-rgb), 0.12);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  stroke: var(--tfa-text-tertiary);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 999px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: background var(--tfa-dur-fast), color var(--tfa-dur-fast), transform var(--tfa-dur-fast);
}

.search-clear:hover {
  background: rgba(var(--tfa-danger-rgb), 0.15);
  color: var(--tfa-danger);
  transform: translateY(-50%) scale(1.06);
}

.panel.trash-active .search-icon,
.panel.trash-active .search-clear {
  display: none !important;
}

.panel.trash-active .search-wrap {
  min-width: 0;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn,
.close {
  font-family: inherit;
}

.btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--tfa-border-soft);
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-primary);
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--tfa-dur-fast), border-color var(--tfa-dur-fast), transform var(--tfa-dur-fast), box-shadow var(--tfa-dur-fast);
}

.btn .ico {
  font-size: 15px;
  line-height: 1;
}

.btn:hover {
  background: var(--tfa-btn-hover-bg);
  border-color: var(--tfa-border-medium);
}

.btn:active,
.close:active,
.mini-btn:active,
.menu-item:active,
.theme-item:active,
.grp-close:active,
.cp-close:active,
.cp-preset-chip:active,
.color-dot:active {
  transform: translateY(1px) scale(0.98);
}

.btn.accent {
  background: linear-gradient(135deg, var(--tfa-accent), var(--tfa-accent-2));
  border-color: transparent;
  color: #fff;
  font-weight: 700;
}

.theme-btn {
  width: 36px;
  padding: 0;
  justify-content: center;
}

.close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--tfa-text-tertiary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--tfa-dur-fast), color var(--tfa-dur-fast), transform var(--tfa-dur-fast);
}

.close:hover {
  background: rgba(var(--tfa-danger-rgb), 0.12);
  color: var(--tfa-danger);
  transform: rotate(90deg);
}

.body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--tfa-border-medium) transparent;
}

.body::-webkit-scrollbar,
.menu::-webkit-scrollbar,
.color-picker-inner::-webkit-scrollbar {
  width: 7px;
}

.body::-webkit-scrollbar-thumb,
.menu::-webkit-scrollbar-thumb,
.color-picker-inner::-webkit-scrollbar-thumb {
  background: var(--tfa-border-medium);
  border-radius: 999px;
}

.window {
  margin-bottom: 20px;
}

.window:last-child {
  margin-bottom: 4px;
}

.window-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 2px 16px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--tfa-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  user-select: none;
  transition: background var(--tfa-dur-fast), color var(--tfa-dur-fast);
}

.window-title:hover {
  background: var(--tfa-btn-hover-bg);
  color: var(--tfa-text-primary);
}

.collapse-arrow {
  width: 12px;
  text-align: center;
  font-size: 10px;
  color: var(--tfa-text-tertiary);
  transition: transform var(--tfa-dur-norm) var(--tfa-ease-out);
}

.window-title .win-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tfa-text-tertiary);
  flex-shrink: 0;
}

.window-title .win-label {
  flex: 1;
}

.window-title .win-count {
  font-size: 11px;
  color: var(--tfa-text-secondary);
  background: var(--tfa-input-bg);
  padding: 2px 9px;
  border-radius: 999px;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.window-title.current {
  color: var(--tfa-accent);
}

.window-title.current .win-dot {
  background: var(--tfa-success);
  box-shadow: 0 0 8px rgba(var(--tfa-success-rgb), 0.48);
}

.window-title.current .win-count {
  background: rgba(var(--tfa-accent-rgb), 0.12);
  color: var(--tfa-accent);
}

.section-label {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 14px 2px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--tfa-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-label:first-child {
  margin-top: 0;
}

.section-label .grp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.show-more {
  grid-column: 1 / -1;
  padding: 11px;
  margin-top: 6px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 12px;
  background: var(--tfa-input-bg);
  color: var(--tfa-text-secondary);
  font-size: 12.5px;
  cursor: pointer;
  transition: background var(--tfa-dur-fast), color var(--tfa-dur-fast), border-color var(--tfa-dur-fast);
}

.show-more:hover {
  background: var(--tfa-btn-hover-bg);
  color: var(--tfa-text-primary);
  border-color: var(--tfa-border-medium);
}

.grid,
.group-cards,
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(var(--tfa-grid-columns), minmax(0, 1fr));
  gap: 11px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 68px;
  padding: 11px 13px;
  border-radius: var(--tfa-radius-md);
  border: 1px solid var(--tfa-border-soft);
  background: var(--tfa-card-bg);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  --drag-slot-shift: 17px;
  --drag-slot-ratio: 1;
  --drag-slot-glow: 0.34;
  transition: transform 155ms var(--tfa-ease-spring), background 145ms ease, border-color 145ms ease, box-shadow 155ms cubic-bezier(0.18, 1, 0.32, 1);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 18%);
  opacity: 0.55;
}

.body.first-render .card {
  animation: cardIn 260ms var(--tfa-ease-spring) both;
}

.card:hover {
  background: var(--tfa-card-hover-bg);
  border-color: var(--tfa-border-medium);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.16);
  transform: translateY(-2px);
}

.card.active-tab {
  border-color: rgba(var(--tfa-accent-rgb), 0.42);
  background: rgba(var(--tfa-accent-rgb), 0.06);
  box-shadow: 0 0 0 1px rgba(var(--tfa-accent-rgb), 0.14), 0 10px 24px rgba(var(--tfa-accent-rgb), 0.08);
}

.card.active-tab .card-title {
  color: var(--tfa-accent);
}

.card.active-tab::after {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--tfa-accent);
}

.card.selected {
  border-color: rgba(var(--tfa-accent-rgb), 0.6);
  background: rgba(var(--tfa-accent-rgb), 0.08);
  box-shadow: 0 0 0 1px rgba(var(--tfa-accent-rgb), 0.26), 0 10px 24px rgba(var(--tfa-accent-rgb), 0.10);
}

.card[data-has-screenshot="1"] .card-host::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--tfa-success);
  box-shadow: 0 0 5px rgba(var(--tfa-success-rgb), 0.48);
  vertical-align: middle;
}

.card.dragging {
  opacity: 1;
  border-style: solid;
  border-color: rgba(var(--tfa-accent-rgb), 0.22);
  background: linear-gradient(180deg, rgba(var(--tfa-accent-rgb), 0.04), rgba(var(--tfa-accent-rgb), 0.012));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), inset 0 0 0 1px rgba(var(--tfa-accent-rgb), 0.06), inset 0 -18px 28px rgba(0, 0, 0, 0.12);
  transform: scale(0.984);
}

.card.dragging::before {
  opacity: 0.08;
}

.card.dragging::after {
  content: '';
  position: absolute;
  inset: 8px 10px;
  border-radius: calc(var(--tfa-radius-md) - 2px);
  border: 1px dashed rgba(var(--tfa-accent-rgb), 0.22);
  background: linear-gradient(180deg, rgba(var(--tfa-accent-rgb), 0.03), rgba(var(--tfa-accent-rgb), 0.01));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), inset 0 -8px 18px rgba(0, 0, 0, 0.06);
  pointer-events: none;
  opacity: 0.9;
}

.body.dragging-active .card.dragging:not(.drag-image-proxy) .card-main,
.body.dragging-active .card.dragging:not(.drag-image-proxy) .card-tags {
  opacity: 0.18;
  filter: saturate(0.68);
  transform: scale(0.988);
}

.body.dragging-active .card.dragging:not(.drag-image-proxy) .card-group-bar,
.body.dragging-active .card.dragging:not(.drag-image-proxy) .pin-badge,
.body.dragging-active .card.dragging:not(.drag-image-proxy).active-tab::after {
  opacity: 0.18;
}

.body.dragging-active .card.dragging:not(.drag-image-proxy) .favicon {
  transform: none !important;
}

.card.card-closing,
.trash-item.card-closing {
  opacity: 0;
  transform: scale(0.88) translateY(-4px);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms var(--tfa-ease-spring);
}

.card.drag-over {
  border-color: rgba(var(--tfa-accent-rgb), calc(0.3 + (var(--drag-slot-glow) * 0.26)));
  box-shadow: 0 0 0 1px rgba(var(--tfa-accent-rgb), calc(0.1 + (var(--drag-slot-glow) * 0.24))), 0 16px 34px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  background: color-mix(in srgb, rgba(var(--tfa-accent-rgb), calc(0.06 + (var(--drag-slot-ratio) * 0.1))) 62%, var(--tfa-card-bg));
  transform: translateY(-1px) scale(calc(1 + (var(--drag-slot-ratio) * 0.008)));
  z-index: 2;
}

.card.drag-over:has(.drop-indicator.left) {
  background: linear-gradient(90deg, rgba(var(--tfa-accent-rgb), calc(0.15 + (var(--drag-slot-ratio) * 0.2))), rgba(var(--tfa-accent-rgb), calc(0.07 + (var(--drag-slot-ratio) * 0.11))) 18%, rgba(var(--tfa-accent-rgb), 0.035) 38%, transparent 60%), color-mix(in srgb, rgba(var(--tfa-accent-rgb), calc(0.06 + (var(--drag-slot-ratio) * 0.1))) 62%, var(--tfa-card-bg));
}

.card.drag-over:has(.drop-indicator.right) {
  background: linear-gradient(270deg, rgba(var(--tfa-accent-rgb), calc(0.15 + (var(--drag-slot-ratio) * 0.2))), rgba(var(--tfa-accent-rgb), calc(0.07 + (var(--drag-slot-ratio) * 0.11))) 18%, rgba(var(--tfa-accent-rgb), 0.035) 38%, transparent 60%), color-mix(in srgb, rgba(var(--tfa-accent-rgb), calc(0.06 + (var(--drag-slot-ratio) * 0.1))) 62%, var(--tfa-card-bg));
}

.body.dragging-active .card-actions,
.body.dragging-active .card-close {
  pointer-events: none !important;
  opacity: 0 !important;
  transform: none !important;
}

.body.dragging-active .card {
  will-change: transform;
  transition: transform 168ms cubic-bezier(0.16, 1, 0.3, 1), background 144ms ease, border-color 144ms ease, box-shadow 168ms cubic-bezier(0.16, 1, 0.3, 1), opacity 132ms ease, filter 132ms ease;
  transform-origin: center center;
}

.body.dragging-active .card:not(.dragging):not(.drag-over):not(.drag-image-proxy) {
  opacity: 0.88;
}

.body.dragging-active .card:hover {
  transform: none;
}

.body.dragging-active .card:hover .favicon {
  transform: none;
}

.body.dragging-active .card.drag-over {
  transform: translateY(-1px) scale(calc(1 + (var(--drag-slot-ratio) * 0.008))) !important;
}

.body.dragging-active .card.drag-over[data-drop-side="before"] .card-main,
.body.dragging-active .card.drag-over[data-drop-side="before"] .card-tags {
  transform: translateX(calc(var(--drag-slot-shift) * var(--drag-slot-ratio))) scale(calc(1 - (var(--drag-slot-ratio) * 0.016)));
}

.body.dragging-active .card.drag-over[data-drop-side="after"] .card-main,
.body.dragging-active .card.drag-over[data-drop-side="after"] .card-tags {
  transform: translateX(calc(var(--drag-slot-shift) * var(--drag-slot-ratio) * -1)) scale(calc(1 - (var(--drag-slot-ratio) * 0.016)));
}

.drop-indicator {
  position: absolute;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--tfa-accent), var(--tfa-accent-2));
  top: 6px;
  bottom: 6px;
  width: calc(4px + (var(--drag-slot-ratio) * 2.8px));
  box-shadow: 0 0 0 1px rgba(var(--tfa-accent-rgb), calc(0.11 + (var(--drag-slot-glow) * 0.18))), 0 0 calc(12px + (var(--drag-slot-ratio) * 14px)) rgba(var(--tfa-accent-rgb), calc(0.22 + (var(--drag-slot-glow) * 0.2))), 0 0 calc(24px + (var(--drag-slot-ratio) * 18px)) rgba(var(--tfa-accent-rgb), calc(0.1 + (var(--drag-slot-glow) * 0.16)));
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  animation: dropIndIn 158ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.drop-indicator.left { left: calc(-5px - (var(--drag-slot-ratio) * 4px)); }
.drop-indicator.right { right: calc(-5px - (var(--drag-slot-ratio) * 4px)); }

.drag-image-proxy {
  pointer-events: none;
  opacity: 0.986;
  background: var(--tfa-card-bg);
  border-style: solid;
  border-color: rgba(var(--tfa-accent-rgb), 0.2);
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.22), 0 8px 18px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(var(--tfa-accent-rgb), 0.08);
  transform: translateY(-3px) rotate(var(--drag-proxy-tilt, 0deg)) scale(1.013);
  transform-origin: var(--drag-proxy-origin-x, 28%) var(--drag-proxy-origin-y, 18%);
}

.drag-image-proxy.dragging {
  opacity: 0.986;
  background: var(--tfa-card-bg);
  border-style: solid;
  border-color: rgba(var(--tfa-accent-rgb), 0.2);
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.22), 0 8px 18px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(var(--tfa-accent-rgb), 0.08);
  transform: translateY(-3px) rotate(var(--drag-proxy-tilt, 0deg)) scale(1.013);
  transform-origin: var(--drag-proxy-origin-x, 28%) var(--drag-proxy-origin-y, 18%);
}

.drag-image-proxy::before {
  opacity: 0.68;
}

.drag-image-proxy .card-main,
.drag-image-proxy .card-tags,
.drag-image-proxy .card-group-bar,
.drag-image-proxy .pin-badge {
  opacity: 1 !important;
  filter: none !important;
}

.drag-image-proxy .card-actions,
.drag-image-proxy .card-close {
  display: none !important;
}

.drop-indicator::before,
.drop-indicator::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  left: 50%;
  width: calc(5px + (var(--drag-slot-ratio) * 2.4px));
  height: 5px;
  transform: translateX(-50%);
  background: rgba(var(--tfa-accent-rgb), 0.92);
  box-shadow: none;
}

.drop-indicator::before { top: -1px; }
.drop-indicator::after { bottom: -1px; }

.card-group-bar {
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  pointer-events: none;
}

.card-tags {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
  min-height: 0;
  max-width: 45%;
  overflow: hidden;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), opacity 130ms ease;
}

.card-tags:empty {
  display: none;
}

.card-group-tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.card-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), opacity 130ms ease;
}

.card-icon-wrap {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.favicon,
.favicon-fallback,
.trash-fav,
.trash-fav-fallback,
.preview-favicon,
.preview-favicon-fallback {
  border-radius: var(--tfa-radius-sm);
}

.favicon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px;
  transition: transform var(--tfa-dur-norm) var(--tfa-ease-spring);
}

.card:hover .favicon {
  transform: scale(1.05);
}

.favicon-fallback {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--tfa-accent), var(--tfa-accent-2));
}

.card-text-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.card-title {
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
  color: var(--tfa-text-primary);
  display: block;
  overflow: hidden;
  min-height: 0;
  padding-right: 28px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.card-host {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--tfa-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 16px;
}

.pin-badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.12);
  color: var(--tfa-warning);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.card-close {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--tfa-text-tertiary);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  z-index: 5;
  transition: opacity var(--tfa-dur-fast), background var(--tfa-dur-fast), color var(--tfa-dur-fast), transform var(--tfa-dur-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card:hover .card-close,
.card:focus-within .card-close {
  opacity: 0.75;
}

.card-close:hover {
  background: rgba(var(--tfa-danger-rgb), 0.16);
  color: var(--tfa-danger);
  opacity: 1 !important;
  transform: scale(1.08);
}

.card-actions {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 7px;
  display: flex;
  gap: 5px;
  padding: 5px 6px;
  border-radius: 10px;
  border: 1px solid var(--tfa-border-medium);
  background: color-mix(in srgb, var(--tfa-panel-bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  z-index: 2;
  transition: opacity var(--tfa-dur-norm) ease, transform var(--tfa-dur-norm) var(--tfa-ease-spring);
}

.card:hover .card-actions,
.card:focus-within .card-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.mini-btn {
  flex: 1;
  min-width: 0;
  height: 26px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--tfa-border-soft);
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-primary);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--tfa-dur-fast), color var(--tfa-dur-fast), border-color var(--tfa-dur-fast);
}

.card-preview-media {
  display: none;
}

.panel[data-view-mode="card"] .card {
  min-height: 0;
  padding: 0;
  gap: 0;
}

.panel[data-view-mode="card"] .card-main {
  padding: 11px 13px;
}

.panel[data-view-mode="card"] .card-preview-media {
  display: flex;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  align-items: center;
  justify-content: center;
  background: var(--tfa-skeleton-base);
}

.card-preview-screenshot {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top center;
}

.card-preview-placeholder {
  flex-direction: column;
  gap: 6px;
  color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(145deg, var(--dc, #4a4a6a), rgba(5, 8, 16, 0.82)) !important;
}

.card-preview-placeholder .preview-letter {
  font-size: clamp(28px, 2.4vw, 46px);
}

.card-preview-placeholder .preview-domain,
.card-preview-placeholder .preview-loading {
  max-width: 80%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel[data-view-mode="card"] .card-actions {
  bottom: 8px;
}

.mini-btn:hover {
  background: var(--tfa-btn-hover-bg);
  border-color: var(--tfa-border-medium);
}

.mini-btn-accent {
  background: rgba(var(--tfa-accent-rgb), 0.15) !important;
  border-color: rgba(var(--tfa-accent-rgb), 0.25) !important;
  color: var(--tfa-accent) !important;
}

.mini-btn-accent:hover {
  background: rgba(var(--tfa-accent-rgb), 0.25) !important;
}

.mini-btn-warn {
  background: rgba(var(--tfa-danger-rgb), 0.12) !important;
  border-color: rgba(var(--tfa-danger-rgb), 0.20) !important;
  color: var(--tfa-danger) !important;
}

.mini-btn-warn:hover {
  background: rgba(var(--tfa-danger-rgb), 0.20) !important;
}

.tab-preview {
  position: absolute;
  width: 380px;
  z-index: 50;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity var(--tfa-dur-norm) ease, transform var(--tfa-dur-norm) var(--tfa-ease-spring);
}

.tab-preview.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.preview-inner {
  background: var(--tfa-panel-bg);
  border: 1px solid var(--tfa-panel-border);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--tfa-border-soft);
}

.preview-header-text {
  flex: 1;
  min-width: 0;
}

.preview-favicon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  background: var(--tfa-skeleton-base);
}

.preview-favicon-fallback {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #fff;
}

.preview-title {
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--tfa-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-url {
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--tfa-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-snapshot {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
}

.preview-screenshot {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: top;
}

.preview-snapshot.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--dc, #4a4a6a), rgba(0, 0, 0, 0.52));
}

.preview-letter {
  font-size: 46px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1;
}

.preview-domain {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 600;
}

.preview-loading {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.54);
}

.preview-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 12px;
}

.preview-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--tfa-card-bg);
  color: var(--tfa-text-secondary);
  font-weight: 700;
  white-space: nowrap;
}

.preview-tag.tag-current {
  background: rgba(var(--tfa-success-rgb), 0.12);
  color: var(--tfa-success);
}

.preview-tag.tag-active {
  background: rgba(var(--tfa-accent-rgb), 0.12);
  color: var(--tfa-accent);
}

.preview-tag.tag-pinned {
  background: rgba(251, 191, 36, 0.12);
  color: var(--tfa-warning);
}

.select-bar {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(30px);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  border: 1px solid var(--tfa-border-medium);
  border-radius: 14px;
  background: var(--tfa-panel-bg);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.30);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tfa-dur-norm), transform var(--tfa-dur-norm) var(--tfa-ease-spring);
  z-index: 5;
}

.select-bar.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.select-bar .sel-count {
  font-size: 12.5px;
  color: var(--tfa-text-primary);
  padding: 0 6px 0 4px;
  font-weight: 800;
}

.select-bar .btn {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.menu {
  position: absolute;
  z-index: 20;
  min-width: 220px;
  max-height: 400px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--tfa-panel-border);
  border-radius: 14px;
  background: var(--tfa-panel-bg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top left;
  pointer-events: none;
  transition: opacity var(--tfa-dur-fast), transform var(--tfa-dur-fast);
  scrollbar-width: thin;
  scrollbar-color: var(--tfa-border-medium) transparent;
}

.menu.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--tfa-text-primary);
  transition: background var(--tfa-dur-fast), color var(--tfa-dur-fast);
}

.menu-item:hover {
  background: var(--tfa-btn-hover-bg);
}

.menu-item .mi-emoji {
  width: 20px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}

.menu-item .mi-title {
  flex: 1;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-item .mi-url {
  max-width: 130px;
  font-size: 10.5px;
  color: var(--tfa-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-sep {
  height: 1px;
  margin: 4px;
  background: var(--tfa-border-soft);
}

.menu-label {
  padding: 6px 11px 4px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--tfa-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.theme-menu {
  min-width: 180px;
}

.theme-item.active {
  background: var(--tfa-input-bg);
}

.theme-item .mi-emoji {
  font-size: 17px;
  width: 22px;
}

.theme-item .mi-title {
  font-size: 13px;
}

.theme-check {
  color: var(--tfa-accent);
  font-size: 13px;
  font-weight: 800;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 84px 20px;
  text-align: center;
  color: var(--tfa-text-secondary);
  font-size: 14px;
}

.empty .big {
  font-size: 40px;
  opacity: 0.34;
}

.empty-hint {
  font-size: 12px;
  color: var(--tfa-text-tertiary);
}

.ftr {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 22px;
  border-top: 1px solid var(--tfa-border-soft);
  background: var(--tfa-hdr-bg);
  font-size: 11px;
  color: var(--tfa-text-tertiary);
}

.ftr-band {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ftr-hints {
  margin-left: auto;
  justify-content: center;
}

.ftr-meta {
  justify-content: flex-end;
}

.layout-controls,
.density-control,
.view-segment,
.preview-toggle {
  display: flex;
  align-items: center;
}

.layout-controls {
  gap: 10px;
  margin-left: 6px;
  color: var(--tfa-text-secondary);
}

.density-control {
  gap: 7px;
  min-height: 32px;
}

.control-label,
.density-value {
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
}

.density-value {
  min-width: 24px;
  color: var(--tfa-text-primary);
  font-variant-numeric: tabular-nums;
}

.density-range {
  width: 70px;
  height: 20px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.density-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--tfa-accent), var(--tfa-border-medium));
}

.density-range::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  margin-top: -5.5px;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--tfa-panel-bg);
  border-radius: 50%;
  background: var(--tfa-accent);
  box-shadow: 0 0 0 1px rgba(var(--tfa-accent-rgb), 0.48);
}

.density-range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--tfa-border-medium);
}

.density-range::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--tfa-accent);
}

.density-range::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 2px solid var(--tfa-panel-bg);
  border-radius: 50%;
  background: var(--tfa-accent);
}

.density-range:focus-visible {
  outline: 2px solid rgba(var(--tfa-accent-rgb), 0.7);
  outline-offset: 2px;
  border-radius: 999px;
}

.view-segment {
  overflow: hidden;
  min-height: 32px;
  border: 1px solid var(--tfa-border-medium);
  border-radius: 9px;
  background: var(--tfa-btn-bg);
}

.view-segment-btn {
  height: 30px;
  padding: 0 11px;
  border: 0;
  border-right: 1px solid var(--tfa-border-soft);
  background: transparent;
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--tfa-dur-fast), color var(--tfa-dur-fast), box-shadow var(--tfa-dur-fast);
}

.view-segment-btn:last-child {
  border-right: 0;
}

.view-segment-btn:hover {
  color: var(--tfa-text-primary);
  background: var(--tfa-btn-hover-bg);
}

.view-segment-btn.active {
  color: var(--tfa-accent);
  background: rgba(var(--tfa-accent-rgb), 0.13);
  box-shadow: inset 0 0 0 1px rgba(var(--tfa-accent-rgb), 0.34);
}

.view-segment-btn:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid rgba(var(--tfa-accent-rgb), 0.72);
  outline-offset: -2px;
}

.preview-toggle {
  position: relative;
  gap: 7px;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  white-space: nowrap;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.preview-toggle[hidden] {
  display: none;
}

.toggle-track {
  position: relative;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
  border: 1px solid var(--tfa-border-medium);
  border-radius: 999px;
  background: var(--tfa-input-bg);
  transition: background var(--tfa-dur-fast), border-color var(--tfa-dur-fast);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tfa-text-tertiary);
  transition: transform var(--tfa-dur-fast) var(--tfa-ease-out), background var(--tfa-dur-fast);
}

.preview-toggle[aria-checked="true"] .toggle-track {
  border-color: rgba(var(--tfa-accent-rgb), 0.55);
  background: rgba(var(--tfa-accent-rgb), 0.18);
}

.preview-toggle[aria-checked="true"] .toggle-track .toggle-thumb {
  transform: translateX(14px);
  background: var(--tfa-accent);
}

.preview-toggle:focus-visible .toggle-track {
  outline: 2px solid rgba(var(--tfa-accent-rgb), 0.72);
  outline-offset: 2px;
}

.hold-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hold-bar {
  width: 56px;
  height: 4px;
  border-radius: 999px;
  background: var(--tfa-border-medium);
  overflow: hidden;
}

.hold-bar .fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--tfa-accent), var(--tfa-accent-2));
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  padding: 1px 5px;
  border: 1px solid var(--tfa-border-soft);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
}

.group-container {
  grid-column: 1 / -1;
  margin: 8px -4px 8px;
  padding: 4px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 12px;
  background: var(--tfa-group-bg);
  transition: transform 170ms cubic-bezier(0.18, 1, 0.32, 1), opacity 140ms ease, border-color var(--tfa-dur-norm), background var(--tfa-dur-norm), box-shadow var(--tfa-dur-norm);
}

.body.dragging-active .group-container:not(.drop-active) {
  opacity: 0.94;
}

.group-container.drop-active {
  border-color: var(--group-color, rgba(var(--tfa-accent-rgb), 0.4));
  background: color-mix(in srgb, var(--group-color, var(--tfa-accent)) 5%, transparent);
  box-shadow: 0 0 0 1px var(--group-color, rgba(var(--tfa-accent-rgb), 0.24)), 0 12px 28px color-mix(in srgb, var(--group-color, var(--tfa-accent)) 12%, transparent);
  transform: translateY(-1px) scale(0.998);
}

.body.dragging-active .group-container.drop-active .group-label {
  background: color-mix(in srgb, var(--group-color, var(--tfa-accent)) 12%, transparent);
  color: var(--tfa-text-primary);
}

.group-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  margin: 4px 4px 8px;
  border-radius: 10px;
  color: var(--tfa-text-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: background var(--tfa-dur-fast), color var(--tfa-dur-fast);
}

.group-label:hover {
  background: var(--tfa-btn-hover-bg);
  color: var(--tfa-text-primary);
}

.group-label .grp-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.group-label .grp-name {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
  font-size: 12.5px;
}

.grp-count {
  font-size: 10.5px;
  color: var(--tfa-text-secondary);
  background: var(--tfa-input-bg);
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.grp-edit {
  margin-left: auto;
  font-size: 11px;
  opacity: 0;
  text-transform: none;
  letter-spacing: 0;
  transition: opacity var(--tfa-dur-fast);
}

.group-label:hover .grp-edit {
  opacity: 0.55;
}

.grp-close {
  width: 20px;
  height: 20px;
  margin-left: 4px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--tfa-text-tertiary);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--tfa-dur-fast), background var(--tfa-dur-fast), color var(--tfa-dur-fast);
}

.group-label:hover .grp-close {
  opacity: 0.5;
}

.grp-close:hover {
  opacity: 1;
  background: rgba(var(--tfa-danger-rgb), 0.18);
  color: var(--tfa-danger);
}

.group-dialog,
.color-picker-dialog {
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--tfa-dur-norm) ease;
}

.group-dialog.show,
.color-picker-dialog.show {
  opacity: 1;
  pointer-events: auto;
}

.group-dialog::before,
.color-picker-overlay {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.group-dialog {
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.group-dialog-inner {
  position: relative;
  min-width: 340px;
  padding: 20px 22px 18px;
  border: 1px solid var(--tfa-border-medium);
  border-radius: var(--tfa-radius-lg);
  background: var(--tfa-panel-bg);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(32px) saturate(1.4);
  -webkit-backdrop-filter: blur(32px) saturate(1.4);
  transform: scale(0.95);
  transition: transform var(--tfa-dur-norm) var(--tfa-ease-spring);
}

.group-dialog.show .group-dialog-inner {
  transform: scale(1);
}

.group-dialog-title {
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 800;
  color: var(--tfa-text-primary);
}

.group-title-input {
  width: 100%;
  height: 38px;
  margin-bottom: 14px;
  padding: 0 13px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 10px;
  background: var(--tfa-input-bg);
  color: var(--tfa-text-primary);
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--tfa-dur-fast), background var(--tfa-dur-fast), box-shadow var(--tfa-dur-fast);
}

.group-title-input:focus {
  border-color: rgba(var(--tfa-accent-rgb), 0.45);
  background: var(--tfa-input-focus-bg);
  box-shadow: 0 0 0 3px rgba(var(--tfa-accent-rgb), 0.12);
}

.group-title-input::placeholder,
.cp-hex-input::placeholder {
  color: var(--tfa-text-tertiary);
}

.group-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 16px;
}

.color-dot {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--tfa-dur-fast), border-color var(--tfa-dur-fast), box-shadow var(--tfa-dur-fast);
}

.color-dot:hover {
  transform: scale(1.08);
}

.color-dot.selected {
  border-color: var(--tfa-text-primary);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12), 0 0 12px currentColor;
}

.group-dialog-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
}

.group-dialog-actions .btn,
.cp-actions .btn {
  height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
}

.group-dialog-actions .btn {
  padding: 0 14px;
}

.trash-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 18px;
  font-size: 14px;
  font-weight: 800;
  color: var(--tfa-text-primary);
}

.trash-header .btn {
  height: 30px;
  padding: 0 11px;
  font-size: 11.5px;
}

.trash-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.trash-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 12px;
  background: var(--tfa-card-bg);
  transition: background var(--tfa-dur-fast), border-color var(--tfa-dur-fast), transform var(--tfa-dur-fast);
}

.trash-item:hover {
  background: var(--tfa-card-hover-bg);
  border-color: var(--tfa-border-medium);
}

.trash-fav,
.trash-fav-fallback,
.trash-group-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.trash-fav {
  object-fit: contain;
  background: var(--tfa-input-bg);
  padding: 3px;
}

.trash-fav-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--tfa-accent), var(--tfa-accent-2));
}

.trash-group-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.trash-info {
  flex: 1;
  min-width: 0;
}

.trash-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--tfa-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trash-url {
  margin-top: 2px;
  font-size: 11px;
  color: var(--tfa-text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trash-time {
  font-size: 10.5px;
  color: var(--tfa-text-tertiary);
  opacity: 0.82;
  white-space: nowrap;
  flex-shrink: 0;
}

.trash-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.toast-container {
  position: fixed;
  left: 50%;
  top: 20px;
  transform: translateX(-50%);
  z-index: 140;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--tfa-panel-border);
  border-radius: 14px;
  background: var(--tfa-panel-bg);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition: opacity var(--tfa-dur-norm) ease, transform var(--tfa-dur-norm) var(--tfa-ease-spring);
  pointer-events: auto;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 700;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.hide {
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
}

.toast-icon {
  font-size: 14px;
  line-height: 1;
}

.toast.toast-success {
  border-color: rgba(var(--tfa-success-rgb), 0.26);
}

.toast.toast-success .toast-icon {
  color: var(--tfa-success);
}

.toast.toast-error {
  border-color: rgba(var(--tfa-danger-rgb), 0.28);
}

.toast.toast-error .toast-icon {
  color: var(--tfa-danger);
}

.toast.toast-info .toast-icon {
  color: var(--tfa-accent);
}

.toast.toast-warn {
  border-color: rgba(251, 191, 36, 0.28);
}

.toast.toast-warn .toast-icon {
  color: var(--tfa-warning);
}

.skel-card {
  padding: 13px 15px 15px;
  border-radius: 12px;
  border: 1px solid var(--tfa-border-soft);
  background: var(--tfa-card-bg);
  display: flex;
  gap: 11px;
  align-items: flex-start;
  min-height: 78px;
}

.skel-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--tfa-skeleton-base);
  flex-shrink: 0;
  animation: skelPulse 1.6s ease-in-out infinite;
}

.skel-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skel-line {
  height: 11px;
  border-radius: 5px;
  background: var(--tfa-skeleton-base);
  animation: skelPulse 1.6s ease-in-out infinite;
}

.skel-line:nth-child(1) { width: 85%; }
.skel-line:nth-child(2) { width: 50%; height: 9px; }

.cp-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--tfa-text-primary);
}

.cp-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--tfa-text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--tfa-dur-fast), color var(--tfa-dur-fast), transform var(--tfa-dur-fast);
}

.cp-close:hover {
  background: rgba(var(--tfa-danger-rgb), 0.12);
  color: var(--tfa-danger);
  transform: rotate(90deg);
}

.color-picker-dialog {
  z-index: 60;
}

.color-picker-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(94vw, 480px);
  max-height: 86vh;
  overflow: auto;
  padding: 20px 22px 18px;
  border: 1px solid var(--tfa-border-medium);
  border-radius: var(--tfa-radius-xl);
  background: var(--tfa-panel-bg);
  color: var(--tfa-text-primary);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.50);
  backdrop-filter: blur(36px) saturate(1.4);
  -webkit-backdrop-filter: blur(36px) saturate(1.4);
  transform: translate(-50%, -50%) scale(0.95);
  transition: transform var(--tfa-dur-norm) var(--tfa-ease-spring);
  scrollbar-width: thin;
  scrollbar-color: var(--tfa-border-medium) transparent;
}

.color-picker-dialog.show .color-picker-inner {
  transform: translate(-50%, -50%) scale(1);
}

.color-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.cp-desc {
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--tfa-text-secondary);
}

.cp-targets {
  display: flex;
  flex-direction: column;
}

.cp-target {
  padding: 4px 0;
}

.cp-target-sep {
  height: 1px;
  margin: 6px 0;
  background: var(--tfa-border-soft);
}

.cp-target-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.cp-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.cp-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cp-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: var(--tfa-border-medium);
  border-radius: 20px;
  transition: background var(--tfa-dur-fast);
}

.cp-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform var(--tfa-dur-fast) var(--tfa-ease-spring);
}

.cp-switch input:checked + .cp-slider {
  background: var(--tfa-accent);
}

.cp-switch input:checked + .cp-slider::before {
  transform: translateX(16px);
}

.cp-target-name {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
}

.cp-preview-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--tfa-border-medium);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cp-controls {
  padding-left: 46px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity var(--tfa-dur-fast);
}

.cp-controls.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.cp-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cp-label {
  width: 42px;
  flex-shrink: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tfa-text-secondary);
}

.cp-color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.cp-color-input {
  width: 32px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--tfa-border-medium);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.cp-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.cp-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 7px;
}

.cp-hex-input {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 10px;
  background: var(--tfa-input-bg);
  color: var(--tfa-text-primary);
  font-size: 12px;
  font-family: "SF Mono", Consolas, Monaco, monospace;
  outline: none;
  transition: border-color var(--tfa-dur-fast), box-shadow var(--tfa-dur-fast);
  text-transform: lowercase;
}

.cp-hex-input:focus {
  border-color: rgba(var(--tfa-accent-rgb), 0.45);
  box-shadow: 0 0 0 3px rgba(var(--tfa-accent-rgb), 0.12);
}

.cp-range {
  flex: 1;
  height: 6px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  background: var(--tfa-border-medium);
  outline: none;
  cursor: pointer;
}

.cp-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--tfa-accent);
  box-shadow: 0 2px 6px rgba(var(--tfa-accent-rgb), 0.4);
}

.cp-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--tfa-accent);
  box-shadow: 0 2px 6px rgba(var(--tfa-accent-rgb), 0.4);
}

.cp-opacity-val {
  width: 36px;
  flex-shrink: 0;
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  color: var(--tfa-text-secondary);
  font-family: "SF Mono", Consolas, Monaco, monospace;
}

.cp-presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 14px;
  padding-top: 14px;
  border-top: 1px solid var(--tfa-border-soft);
}

.cp-preset-label {
  margin-right: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--tfa-text-tertiary);
}

.cp-preset-chip {
  height: 26px;
  padding: 0 11px;
  border: 1px solid var(--tfa-border-soft);
  border-radius: 999px;
  background: var(--tfa-btn-bg);
  color: var(--tfa-text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--tfa-dur-fast), color var(--tfa-dur-fast), border-color var(--tfa-dur-fast), transform var(--tfa-dur-fast);
}

.cp-preset-chip:hover {
  background: var(--tfa-btn-hover-bg);
  color: var(--tfa-text-primary);
  border-color: var(--tfa-border-medium);
}

.cp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.custom-color-btn .mi-emoji {
  font-size: 16px;
}

.btn.active {
  background: rgba(var(--tfa-accent-rgb), 0.15);
  border-color: rgba(var(--tfa-accent-rgb), 0.3);
  color: var(--tfa-accent);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes dropIndIn {
  from { opacity: 0; transform: scaleY(0.72) scaleX(0.88); }
  to { opacity: 1; transform: scaleY(1) scaleX(1); }
}

@keyframes skelPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (max-width: 1199px) {
  .panel[data-columns="6"] { --tfa-grid-columns: 5; }
}

@media (max-width: 999px) {
  .panel[data-columns="5"],
  .panel[data-columns="6"] { --tfa-grid-columns: 4; }

  .ftr-hints {
    display: none;
  }

  .layout-controls {
    margin-left: auto;
  }
}

@media (max-width: 839px) {
  .panel[data-columns="4"],
  .panel[data-columns="5"],
  .panel[data-columns="6"] { --tfa-grid-columns: 3; }

  .ftr {
    padding: 10px 16px;
  }

  .ftr > .ftr-band:first-child {
    display: none;
  }
}

@media (max-width: 679px) {
  .panel[data-columns="4"],
  .panel[data-columns="5"],
  .panel[data-columns="6"] { --tfa-grid-columns: 2; }

  .hdr-top,
  .hdr-bottom {
    flex-wrap: wrap;
    align-items: stretch;
  }

  .hdr-tools,
  .actions {
    width: 100%;
  }

  .search-wrap {
    min-width: 100%;
  }

  .ftr {
    align-items: flex-start;
  }

  .ftr-hints,
  .ftr-meta {
    justify-content: flex-start;
  }

  .layout-controls {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }

  .card {
    min-height: 72px;
  }

  .card-title {
    min-height: 0;
  }

  .card-tags {
    min-height: 0;
  }

  .tab-preview {
    width: min(320px, calc(100vw - 32px));
  }

  .preview-snapshot {
    height: 150px;
  }

  .toast-container {
    bottom: 56px;
  }

  .group-dialog-inner,
  .color-picker-inner {
    width: min(94vw, 480px);
  }
}

@media (max-width: 479px) {
  .panel[data-columns="4"],
  .panel[data-columns="5"],
  .panel[data-columns="6"] { --tfa-grid-columns: 1; }

  .density-control,
  .preview-toggle {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }

  .panel,
  .tab-preview,
  .select-bar,
  .toast,
  .menu,
  .group-dialog-inner,
  .color-picker-inner,
  .card {
    transform: none !important;
  }

  .drop-indicator {
    animation: none !important;
    opacity: 1;
  }

  .body.dragging-active .card.drag-over .card-main,
  .body.dragging-active .card.drag-over .card-tags {
    transform: none !important;
  }

  .drag-image-proxy {
    transform: none !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18) !important;
  }

  .body.dragging-active .card:not(.dragging):not(.drag-over):not(.drag-image-proxy) {
    opacity: 1 !important;
  }

  .body.dragging-active .card.dragging:not(.drag-image-proxy) .card-main,
  .body.dragging-active .card.dragging:not(.drag-image-proxy) .card-tags,
  .body.dragging-active .card.dragging:not(.drag-image-proxy) .card-group-bar,
  .body.dragging-active .card.dragging:not(.drag-image-proxy) .pin-badge {
    opacity: 1 !important;
    filter: none !important;
  }

  .body.dragging-active .group-container:not(.drop-active) {
    opacity: 1 !important;
  }

  .group-container.drop-active {
    transform: none !important;
  }
}
