* {
  box-sizing: border-box;
}

/* Dark theme (default) */
:root,
[data-theme="dark"] {
  --bg-color: #1a1a2e;
  --bg-secondary: #16213e;
  --surface-color: #16213e;
  --primary-color: #0f3460;
  --accent-color: #e94560;
  --accent-hover: #d13a54;
  --text-color: #eee;
  --text-primary: #eee;
  --text-muted: #aaa;
  --border-color: #2a3a5a;
  --success-color: #4caf50;
  --error-color: #e94560;
}

/* Light theme */
[data-theme="light"] {
  --bg-color: #f5f7fa;
  --bg-secondary: #ffffff;
  --surface-color: #ffffff;
  --primary-color: #e8ecf1;
  --accent-color: #e94560;
  --accent-hover: #d13a54;
  --text-color: #1a1a2e;
  --text-primary: #1a1a2e;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --success-color: #22c55e;
  --error-color: #ef4444;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

.preamble {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem 0;
}

.preamble a,
header h1 a,
.subtitle a {
  color: inherit;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}

.preamble a:hover,
header h1 a:hover,
.subtitle a:hover {
  color: var(--accent-color);
  text-decoration-style: solid;
}

header h1 {
  font-size: 2.5rem;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(135deg, var(--accent-color), #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header h1 a {
  background: linear-gradient(135deg, var(--accent-color), #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header h1 a:hover {
  -webkit-text-fill-color: var(--accent-color);
}

.subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 1.1rem;
}

.merger-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--surface-color);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.controls-row > label {
  font-weight: 600;
  font-size: 1.1rem;
}

.mode-select {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--primary-color);
  color: var(--text-color);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.mode-select:hover {
  border-color: var(--accent-color);
  background: var(--surface-color);
}

.mode-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.2);
}

.input-section {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
}

.swap-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}

.swap-button:hover:not(:disabled) {
  border-color: var(--accent-color);
  color: var(--text-color);
  background: var(--surface-color);
}

.swap-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Hide vertical symbol by default, show horizontal */
.swap-button .swap-vertical {
  display: none;
}

.swap-button .swap-horizontal {
  display: inline;
}

@media (max-width: 768px) {
  .input-section {
    grid-template-columns: 1fr;
  }

  .swap-button {
    justify-self: center;
  }

  /* Show vertical symbol on mobile, hide horizontal */
  .swap-button .swap-vertical {
    display: inline;
  }

  .swap-button .swap-horizontal {
    display: none;
  }
}

.input-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  overflow: hidden;
}

.input-box.drop-zone {
  position: relative;
}

.input-box.drop-zone.dragging textarea {
  border-color: var(--accent-color);
  border-style: dashed;
  background: rgba(233, 69, 96, 0.05);
}

.drop-overlay {
  position: absolute;
  top: 1.75rem;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(233, 69, 96, 0.15);
  border: 2px dashed var(--accent-color);
  border-radius: 8px;
  pointer-events: none;
  z-index: 10;
}

.drop-overlay span {
  background: var(--accent-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.input-box > label,
.input-header label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-color);
}

.input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.input-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.file-picker-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 28px;
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: border-color 0.2s, background-color 0.2s;
}

.file-picker-button:hover {
  border-color: var(--accent-color);
  background: var(--surface-color);
}

.file-picker-button input[type="file"] {
  display: none;
}

.clear-input-button {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-color);
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.clear-input-button:hover {
  border-color: var(--error-color);
  background: var(--surface-color);
  color: var(--error-color);
}

.input-tabs {
  display: flex;
  gap: 0;
  background: var(--primary-color);
  border-radius: 6px;
  padding: 2px;
}

.input-tab {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.15s, color 0.15s;
  position: relative;
}

.input-tab:hover {
  color: var(--text-color);
}

.input-tab.active {
  background: var(--surface-color);
  color: var(--text-color);
}

.input-tab.has-error {
  color: var(--error-color);
}

.input-tab.has-error.active {
  color: var(--error-color);
}

.tab-error-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 0.65rem;
  font-weight: 700;
  background: var(--error-color);
  color: white;
  border-radius: 50%;
  margin-left: 0.35rem;
}

.input-preview-container {
  width: 100%;
  height: 300px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
  overflow: auto;
  min-width: 0;
}

.input-preview-container .xml-tree-view {
  min-width: fit-content;
}

.input-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-style: italic;
}

.input-preview-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  text-align: center;
  gap: 0.5rem;
}

.input-preview-error .error-icon {
  font-size: 2rem;
  color: var(--error-color);
}

.input-preview-error .error-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--error-color);
}

.input-preview-error .error-message {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 300px;
  word-break: break-word;
}

.input-box textarea,
.output-box {
  width: 100%;
  height: 300px;
  padding: 1rem;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
  color: var(--text-color);
  resize: vertical;
  transition: border-color 0.2s;
}

.input-box textarea:focus,
.output-box:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.2);
}

.input-box textarea::placeholder,
.output-box::placeholder {
  color: var(--text-muted);
}

.error {
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid var(--error-color);
  color: var(--error-color);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}

.output-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.output-header label {
  font-weight: 600;
  font-size: 1rem;
}

.output-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.output-actions {
  margin-left: auto;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 150px;
  max-width: 300px;
}

.search-input {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-color);
  color: var(--text-color);
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.25rem;
  line-height: 1;
}

.search-clear:hover {
  color: var(--accent-color);
}

.view-toggle {
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.view-toggle:hover:not(:disabled) {
  border-color: var(--accent-color);
  color: var(--text-color);
}

.view-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.output-tree-container {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--primary-color);
  min-height: 250px;
  max-height: 400px;
  overflow: auto;
}

.output-actions {
  display: flex;
  gap: 0.5rem;
}

.copy-button,
.download-button {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--accent-color);
  border-radius: 6px;
  background: transparent;
  color: var(--accent-color);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.copy-button:hover:not(:disabled),
.download-button:hover:not(:disabled) {
  background: var(--accent-color);
  color: white;
}

.copy-button:disabled,
.download-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.output-box {
  height: 250px;
  background: var(--primary-color);
}

/* Advanced Options Styles */
.advanced-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.advanced-toggle:hover {
  color: var(--text-color);
  border-color: var(--accent-color);
}

.toggle-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.toggle-arrow.open {
  transform: rotate(90deg);
}

.advanced-panel {
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.advanced-option {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-color);
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-color);
  transition: border-color 0.2s, background-color 0.2s;
}

.radio-label:hover {
  border-color: var(--accent-color);
}

.radio-label:has(input:checked) {
  border-color: var(--accent-color);
  background: rgba(233, 69, 96, 0.1);
}

.radio-label input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  background: var(--surface-color);
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s;
}

.radio-label input[type="radio"]:checked {
  border-color: var(--accent-color);
}

.radio-label input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: var(--accent-color);
  border-radius: 50%;
}

.default-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

footer {
  margin-top: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Navigation Styles */
.navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-color);
  font-weight: 600;
  font-size: 1.25rem;
}

.nav-logo:hover {
  color: var(--accent-color);
}

.logo-icon {
  font-size: 1.5rem;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-color);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.nav-dropdown-trigger:hover {
  border-color: var(--accent-color);
  background: var(--primary-color);
}

.dropdown-arrow {
  font-size: 0.7rem;
  opacity: 0.7;
  transition: transform 0.2s;
}

.nav-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  min-width: 260px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 100;
}

.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text-color);
  font-size: 0.9rem;
  transition: background-color 0.15s;
}

.nav-dropdown-item:first-child {
  border-radius: 7px 7px 0 0;
}

.nav-dropdown-item:last-child {
  border-radius: 0 0 7px 7px;
}

.nav-dropdown-item:hover {
  background: var(--primary-color);
}

.nav-dropdown-item.active {
  background: var(--primary-color);
  color: var(--accent-color);
}

.coming-soon-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  background: rgba(233, 69, 96, 0.2);
  color: var(--accent-color);
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Coming Soon Page Styles */
.coming-soon-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 3rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.coming-soon-badge-large {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  background: rgba(233, 69, 96, 0.15);
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
}

.coming-soon-title {
  font-size: 2.5rem;
  margin: 0 0 1rem 0;
  background: linear-gradient(135deg, var(--accent-color), #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.coming-soon-description {
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 2rem 0;
}

.coming-soon-features {
  width: 100%;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: left;
}

.coming-soon-features h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  color: var(--text-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.coming-soon-features ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.coming-soon-features li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.coming-soon-features li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent-color);
}

.vote-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  color: white;
  background: linear-gradient(135deg, var(--accent-color), #ff6b6b);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.vote-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(233, 69, 96, 0.3);
}

.coming-soon-note {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* XML Tree View Styles */
.xml-tree-view {
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 1rem;
}

.tree-content {
  white-space: nowrap;
}

.tree-empty,
.tree-error {
  color: var(--text-muted);
  font-style: italic;
  padding: 2rem;
  text-align: center;
}

.tree-error {
  color: var(--error-color);
}

.tree-declaration {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.tree-node {
  user-select: text;
}

.tree-node-header {
  display: inline-flex;
  align-items: flex-start;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background-color 0.15s;
}

.tree-node-header:hover {
  background: rgba(255, 255, 255, 0.05);
}

.tree-expand-icon {
  display: inline-block;
  width: 1em;
  font-size: 0.6em;
  color: var(--text-muted);
  transition: transform 0.15s;
  margin-right: 0.25rem;
  margin-top: 0.3em;
  flex-shrink: 0;
}

.tree-expand-icon.expanded {
  transform: rotate(90deg);
}

.tree-expand-placeholder {
  display: inline-block;
  width: 1em;
  margin-right: 0.25rem;
  flex-shrink: 0;
}

.tree-tag {
  color: var(--text-muted);
}

.tree-tag-name {
  color: #ff79c6;
}

.tree-attribute {
  color: var(--text-muted);
}

.tree-attr-name {
  color: #8be9fd;
}

.tree-attr-value {
  color: #f1fa8c;
}

.tree-text {
  color: var(--text-color);
  margin: 0 0.25rem;
}

.tree-children {
  border-left: 1px dashed var(--border-color);
  margin-left: 0.5rem;
}

.tree-close-tag {
  padding: 2px 4px;
}

.search-highlight {
  background: rgba(241, 250, 140, 0.4);
  color: #f1fa8c;
  padding: 0 2px;
  border-radius: 2px;
}

.tree-match-count {
  color: var(--text-muted);
  font-size: 0.75em;
  margin-left: 0.5em;
  opacity: 0.6;
}

.search-results-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
}

/* Stats Box Styles */
.stats-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
}

.stats-box.output-stats {
  margin-top: 0.75rem;
}

.stats-types {
  color: var(--text-muted);
}

.stats-separator {
  color: var(--border-color);
  margin: 0 0.1rem;
}

.stats-total {
  color: var(--text-color);
  font-weight: 500;
}

.stats-mode {
  color: var(--accent-color);
  font-weight: 600;
}

.stats-detail {
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   ACTION HISTORY PANEL
   ============================================ */

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

/* History Badge (collapsed state) */
.history-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.history-badge:hover,
.history-badge.active {
  border-color: var(--accent-color);
  background: var(--primary-color);
}

.history-badge-add {
  color: var(--success-color);
  font-weight: 600;
}

.history-badge-rm {
  color: var(--error-color);
  font-weight: 600;
}

.history-badge-empty {
  color: var(--text-muted);
}

/* History Panel (expanded state) */
.history-panel {
  position: absolute;
  top: 100%;
  right: 0;
  width: 300px;
  max-height: 350px;
  margin-top: 0.5rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.history-panel-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-color);
}

.history-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.history-panel-close:hover {
  color: var(--accent-color);
}

.history-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.history-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 1.5rem 1rem;
  font-style: italic;
  line-height: 1.5;
}

/* Individual history entry */
.history-entry {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 6px;
  background: var(--primary-color);
  margin-bottom: 0.5rem;
}

.history-entry:last-child {
  margin-bottom: 0;
}

.history-entry-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.history-entry-icon.add {
  background: rgba(76, 175, 80, 0.2);
  color: var(--success-color);
}

.history-entry-icon.remove {
  background: rgba(233, 69, 96, 0.2);
  color: var(--error-color);
}

.history-entry-content {
  flex: 1;
  min-width: 0;
}

.history-entry-description {
  font-size: 0.8rem;
  color: var(--text-color);
  word-break: break-word;
}

.history-entry-undo {
  flex-shrink: 0;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.history-entry-undo:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

/* ============================================
   TREE NODE CONTROLS
   ============================================ */

.tree-node-header {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background-color 0.15s;
}

/* When controls exist (output view with feed), reserve space for add button */
.tree-node-header.has-controls {
  padding-left: 24px;
  margin-left: -20px;
}

/* Add button (left side) - absolutely positioned within the padded area */
.tree-node-add-btn {
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--success-color);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}

.tree-node-header:hover .tree-node-add-btn,
.tree-node-header.controls-visible .tree-node-add-btn {
  opacity: 1;
}

.tree-node-add-btn:hover {
  filter: brightness(1.15);
}

/* Remove button (right side) - sticky to stay visible within scroll container */
.tree-node-remove-btn {
  position: sticky;
  right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  background: var(--error-color);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.tree-node-header:hover .tree-node-remove-btn,
.tree-node-header.controls-visible .tree-node-remove-btn {
  opacity: 1;
}

.tree-node-remove-btn:hover {
  filter: brightness(1.15);
}

/* ============================================
   ADD FEED FORM MODAL
   ============================================ */

.add-feed-form-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.add-feed-form {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.add-feed-form-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1.25rem 0;
  color: var(--text-color);
}

.add-feed-form-field {
  margin-bottom: 1rem;
}

.add-feed-form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 0.35rem;
}

.add-feed-form-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--primary-color);
  color: var(--text-color);
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.add-feed-form-input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.add-feed-form-input.error {
  border-color: var(--error-color);
}

.add-feed-form-input::placeholder {
  color: var(--text-muted);
}

.add-feed-form-error {
  font-size: 0.75rem;
  color: var(--error-color);
  margin-top: 0.35rem;
}

.add-feed-form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.add-feed-form-cancel {
  flex: 1;
  padding: 0.6rem 1rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  font-size: 0.9rem;
}

.add-feed-form-cancel:hover {
  border-color: var(--text-muted);
  color: var(--text-color);
}

.add-feed-form-submit {
  flex: 1;
  padding: 0.6rem 1rem;
  background: var(--accent-color);
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 0.9rem;
}

.add-feed-form-submit:hover:not(:disabled) {
  background: #ff6b6b;
}

.add-feed-form-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .navigation {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-dropdown-menu {
    right: auto;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
  }

  .output-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .output-toolbar .search-box {
    max-width: none;
  }

  .output-toolbar .output-actions {
    justify-content: flex-end;
  }

  .nav-dropdown:hover .nav-dropdown-menu {
    transform: translateX(-50%) translateY(0);
  }

  .coming-soon-title {
    font-size: 2rem;
  }

  /* History panel - full width on mobile */
  .history-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 60vh;
    margin-top: 0;
    border-radius: 12px 12px 0 0;
  }

  /* Larger touch targets for tree node controls on mobile */
  .tree-node-add-btn,
  .tree-node-remove-btn {
    width: 24px;
    height: 24px;
    font-size: 1rem;
  }

  .tree-node-remove-btn {
    font-size: 0.75rem;
  }
}

/* ============================================
   NAVIGATION AUTH BUTTONS
   ============================================ */

.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-auth-link {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-auth-link:hover {
  color: var(--text-color);
}

.nav-auth-button {
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
  text-decoration: none;
  background: var(--accent-color);
  border-radius: 6px;
  transition: background-color 0.2s, transform 0.2s;
}

.nav-auth-button:hover {
  background: #ff6b6b;
  transform: translateY(-1px);
}

/* ============================================
   AUTH PAGES (Login / Signup)
   ============================================ */

.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: 2rem;
}

.auth-container {
  width: 100%;
  max-width: 400px;
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(135deg, var(--accent-color), #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 1rem;
}

.auth-form {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
}

.auth-error {
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid var(--error-color);
  color: var(--error-color);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-info {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1.5rem 0;
  text-align: center;
}

.auth-info strong {
  color: var(--text-color);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--primary-color);
  color: var(--text-color);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.auth-button {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: var(--accent-color);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
  margin-bottom: 0.75rem;
}

.auth-button:hover:not(:disabled) {
  background: #ff6b6b;
  transform: translateY(-1px);
}

.auth-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-button.secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.auth-button.secondary:hover:not(:disabled) {
  border-color: var(--text-muted);
  color: var(--text-color);
  background: transparent;
  transform: none;
}

.auth-button.passkey-button {
  background: transparent;
  border: 2px solid var(--accent-color);
  color: var(--accent-color);
}

.auth-button.passkey-button:hover:not(:disabled) {
  background: var(--accent-color);
  color: white;
  transform: translateY(-1px);
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 1rem 0;
  gap: 1rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.auth-divider span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
}

.auth-footer p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

.auth-footer a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-success {
  text-align: center;
  padding: 2rem;
}

.auth-success .success-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 1rem;
  background: var(--success-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
}

.auth-success p {
  color: var(--text-muted);
  margin: 0;
}

/* Signup Steps Indicator */
.signup-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.signup-steps .step {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 50%;
  background: var(--primary-color);
  color: var(--text-muted);
  border: 2px solid var(--border-color);
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.signup-steps .step.active {
  border-color: var(--accent-color);
  background: rgba(233, 69, 96, 0.15);
  color: var(--accent-color);
}

.signup-steps .step.done {
  border-color: var(--success-color);
  background: var(--success-color);
  color: white;
}

.signup-steps .step-line {
  width: 30px;
  height: 2px;
  background: var(--border-color);
}

/* Mobile auth adjustments */
@media (max-width: 768px) {
  .nav-auth {
    width: 100%;
    justify-content: center;
  }

  .auth-page {
    align-items: flex-start;
    padding-top: 1rem;
  }

  .auth-form {
    padding: 1.5rem;
  }

  .auth-header h1 {
    font-size: 1.75rem;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   User Menu (Hamburger when logged in)
   ───────────────────────────────────────────────────────────────────────────── */

.user-menu {
  position: relative;
}

.user-menu-loading {
  width: 40px;
  height: 40px;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-menu-trigger:hover {
  background: var(--bg-secondary);
  border-color: var(--text-muted);
}

.user-menu.open .user-menu-trigger {
  background: var(--bg-secondary);
  border-color: var(--accent-color);
}

/* Hamburger icon */
.hamburger-icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 20px;
  height: 20px;
  gap: 4px;
}

.hamburger-line {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all 0.3s ease;
}

.user-menu.open .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.user-menu.open .hamburger-line:nth-child(2) {
  opacity: 0;
}

.user-menu.open .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Dropdown menu */
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  overflow: hidden;
  animation: menuSlideIn 0.2s ease forwards;
  backdrop-filter: blur(8px);
}

@keyframes menuSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* User header in dropdown */
.user-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary);
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 50%;
  flex-shrink: 0;
}

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

.user-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Divider */
.user-menu-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

/* Menu items */
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.9375rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}

.user-menu-item:hover {
  background: var(--bg-secondary);
}

.user-menu-item.logout {
  color: var(--error-color);
}

.user-menu-item.logout:hover {
  background: rgba(239, 68, 68, 0.1);
}

.menu-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .user-menu-dropdown {
    min-width: 200px;
  }

  .user-menu-header {
    padding: 12px;
  }

  .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.8125rem;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Nav Controls Container
   ───────────────────────────────────────────────────────────────────────────── */

.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Theme Picker
   ───────────────────────────────────────────────────────────────────────────── */

.theme-picker {
  position: relative;
}

.theme-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-color);
}

.theme-picker-trigger:hover {
  background: var(--bg-secondary);
  border-color: var(--text-muted);
}

.theme-picker.open .theme-picker-trigger {
  background: var(--bg-secondary);
  border-color: var(--accent-color);
}

.theme-picker-trigger svg {
  width: 20px;
  height: 20px;
}

.theme-picker-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  overflow: hidden;
  animation: menuSlideIn 0.2s ease forwards;
  backdrop-filter: blur(8px);
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}

.theme-option:hover {
  background: var(--bg-secondary);
}

.theme-option.active {
  color: var(--accent-color);
  background: var(--bg-secondary);
}

.theme-option svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Mobile adjustments for nav controls */
@media (max-width: 768px) {
  .nav-controls {
    gap: 6px;
  }

  .theme-picker-trigger {
    width: 36px;
    height: 36px;
  }

  .theme-picker-trigger svg {
    width: 18px;
    height: 18px;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Settings / Profile Pages
   ───────────────────────────────────────────────────────────────────────────── */

.settings-layout {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
  min-height: calc(100vh - 80px);
}

.settings-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
}

.settings-with-sidebar {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  padding: 0;
}

.settings-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Settings Header */
.settings-header {
  margin-bottom: 1.5rem;
}

.settings-header h1,
.settings-header h2 {
  margin: 0 0 0.5rem 0;
  color: var(--text-color);
  font-size: 1.5rem;
  font-weight: 600;
}

.settings-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* Settings Sidebar */
.settings-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 16px 0 0 16px;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-color);
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.settings-nav-item:hover {
  background: var(--primary-color);
}

.settings-nav-item.active {
  background: var(--accent-color);
  color: white;
}

.nav-icon {
  font-size: 1.125rem;
}

/* Settings Content */
.settings-content {
  padding: 2rem;
}

.settings-section {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Settings Form */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.settings-form-title {
  margin: 0 0 0.5rem 0;
  color: var(--text-color);
  font-size: 1.125rem;
  font-weight: 600;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-field label {
  color: var(--text-color);
  font-size: 0.875rem;
  font-weight: 500;
}

.settings-field input,
.settings-field textarea {
  padding: 10px 14px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  font-size: 0.9375rem;
  transition: border-color 0.15s ease;
}

.settings-field input:focus,
.settings-field textarea:focus {
  outline: none;
  border-color: var(--accent-color);
}

.settings-field input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.settings-field textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.field-hint {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* Settings Divider */
.settings-divider {
  height: 1px;
  background: var(--border-color);
  margin: 1.5rem 0;
}

/* Settings Actions */
.settings-actions {
  display: flex;
  gap: 12px;
  margin-top: 0.5rem;
}

/* Settings Buttons */
.settings-button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-button.primary {
  background: var(--accent-color);
  color: white;
}

.settings-button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.settings-button.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.settings-button.secondary {
  background: var(--primary-color);
  color: var(--text-color);
}

.settings-button.secondary:hover {
  background: var(--border-color);
}

.settings-button.danger {
  background: transparent;
  border: 1px solid var(--error-color);
  color: var(--error-color);
}

.settings-button.danger:hover {
  background: var(--error-color);
  color: white;
}

/* Settings Message */
.settings-message {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}

.settings-message.success {
  background: rgba(76, 175, 80, 0.15);
  border: 1px solid var(--success-color);
  color: var(--success-color);
}

.settings-message.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--error-color);
  color: var(--error-color);
}

/* Profile Avatar Section */
.profile-avatar-section {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1rem;
}

.profile-avatar-large {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
  color: white;
  font-size: 1.75rem;
  font-weight: 600;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-avatar-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-username {
  margin: 0;
  color: var(--text-color);
  font-size: 1.25rem;
  font-weight: 600;
}

.profile-email {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* Tier Badge */
.tier-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 4px;
}

.tier-badge.tier-free {
  background: var(--primary-color);
  color: var(--text-muted);
}

.tier-badge.tier-pro {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1a2e;
}

.tier-badge.tier-enterprise {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
}

/* Toggle Fields */
.toggle-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color);
}

.toggle-field:last-child {
  border-bottom: none;
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toggle-info label {
  color: var(--text-color);
  font-size: 0.9375rem;
  font-weight: 500;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--border-color);
  border: none;
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle-switch.on {
  background: var(--accent-color);
}

.toggle-slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.toggle-switch.on .toggle-slider {
  transform: translateX(22px);
}

/* Security Status */
.security-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.security-status-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.security-status-info p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  width: fit-content;
}

.status-badge.enabled {
  background: rgba(76, 175, 80, 0.2);
  color: var(--success-color);
}

.status-badge.disabled {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error-color);
}

/* Danger Zone */
.danger-zone .settings-header h2 {
  color: var(--error-color);
}

.danger-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
}

.danger-info h3 {
  margin: 0 0 6px 0;
  color: var(--text-color);
  font-size: 1rem;
  font-weight: 600;
}

.danger-info p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  max-width: 400px;
}

/* Email Verification */
.email-field-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.email-field-wrapper input {
  flex: 1;
}

.email-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 20px;
}

.email-status.verified {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.email-status.unverified {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.email-status svg {
  flex-shrink: 0;
}

.email-verification-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.dev-button {
  opacity: 0.7;
  font-size: 0.75rem !important;
}

.dev-button:hover {
  opacity: 1;
}

/* 2FA Enable Section */
.twofa-enable-section {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.twofa-warning {
  font-size: 0.75rem;
  color: var(--error-color);
  font-style: italic;
}

/* Factors Table */
.factors-table-container {
  margin-top: 1.5rem;
}

.factors-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.factors-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
}

.factors-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
}

.factors-table th,
.factors-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.factors-table th {
  background: rgba(0, 0, 0, 0.1);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

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

.factors-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.factor-type {
  display: flex;
  align-items: center;
  gap: 8px;
}

.factor-icon {
  font-size: 1.25rem;
}

.factor-name {
  color: var(--text-color);
}

.factor-name-edit {
  display: flex;
  align-items: center;
  gap: 6px;
}

.factor-name-edit input {
  flex: 1;
  padding: 4px 8px;
  font-size: 0.875rem;
  background: var(--bg-color);
  border: 1px solid var(--accent-color);
  border-radius: 6px;
  color: var(--text-color);
}

.factor-date {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.factor-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
  border-radius: 6px;
  transition: all 0.2s;
  line-height: 1;
  vertical-align: middle;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.icon-button.danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
}

.settings-button.small {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 1rem;
}

.modal {
  background: var(--bg-secondary);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-color);
}

.modal-close {
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.25rem;
  border-radius: 8px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
}

.modal-body {
  padding: 1.5rem;
}

.modal-description {
  margin: 0 0 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  gap: 12px;
}

.modal-actions-left {
  display: flex;
  gap: 8px;
}

/* Backup Codes */
.backup-codes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.backup-code {
  font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 0.9375rem;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  color: var(--text-color);
  text-align: center;
  letter-spacing: 0.05em;
}

/* Factors Modal Table */
.modal-table {
  margin-bottom: 1.5rem;
}

.add-factor-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.add-factor-button {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 1rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.add-factor-button:hover {
  border-color: var(--accent-color);
  background: rgba(99, 102, 241, 0.05);
}

.add-factor-button .factor-icon {
  font-size: 1.5rem;
}

.add-factor-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.add-factor-info strong {
  color: var(--text-color);
  font-weight: 600;
}

.add-factor-info span {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

/* Passkey Setup */
.passkey-demo-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 8px;
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* TOTP Setup */
.totp-setup {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.qr-code-container {
  display: flex;
  justify-content: center;
  padding: 1rem;
}

.qr-code-image {
  background: white;
  border-radius: 12px;
  padding: 8px;
}

.secret-code-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.totp-input {
  font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 1.5rem !important;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 12px 16px !important;
}

/* Passkey Warning */
.passkey-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.totp-secret {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.totp-secret label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.secret-code {
  font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 1rem;
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  letter-spacing: 0.1em;
  color: var(--text-color);
  user-select: all;
}

/* Mobile Settings */
@media (max-width: 768px) {
  .settings-layout {
    padding: 1rem;
  }

  .settings-with-sidebar {
    grid-template-columns: 1fr;
  }

  .settings-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 16px 16px 0 0;
    padding: 1rem;
  }

  .settings-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 8px;
  }

  .settings-nav-item {
    white-space: nowrap;
    padding: 8px 12px;
  }

  .settings-content {
    padding: 1.5rem;
  }

  .profile-avatar-section {
    flex-direction: column;
    text-align: center;
  }

  .security-status {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .email-field-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .email-status {
    justify-content: center;
  }

  .email-verification-actions {
    flex-direction: column;
  }

  .danger-card {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .danger-info p {
    max-width: none;
  }

  .twofa-enable-section {
    align-items: center;
  }

  .factors-header {
    flex-direction: column;
    gap: 12px;
  }

  .factors-table th:nth-child(3),
  .factors-table td:nth-child(3) {
    display: none;
  }

  .backup-codes-grid {
    grid-template-columns: 1fr;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-actions-left {
    width: 100%;
    justify-content: center;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   FEED DISCOVER TOOL
   ═══════════════════════════════════════════════════════════════════════════ */

.discover-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Summary Sentence */
.discover-summary-sentence {
  font-size: 1.1rem;
  color: var(--text-color);
  padding: 1rem 1.25rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-style: italic;
}

.discover-summary-sentence code {
  font-family: inherit;
  font-style: normal;
  font-weight: 600;
  color: var(--accent-color);
  background: transparent;
  padding: 0;
}

/* Input Section */
.discover-input-section {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
}

.discover-input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.discover-input-header label {
  font-weight: 600;
  font-size: 1rem;
}

.url-count {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.url-count.over-limit {
  color: var(--error-color);
  font-weight: 600;
}

.pro-hint {
  font-size: 0.75rem;
  opacity: 0.7;
}

.discover-textarea {
  width: 100%;
  min-height: 200px;
  padding: 1rem;
  font-family: monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-color);
  resize: vertical;
}

.discover-textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.2);
}

.discover-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

/* Preferences Section */
.discover-preferences-section {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.discover-preferences-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.discover-preferences-toggle:hover {
  background: var(--primary-color);
}

.discover-preferences-toggle .toggle-arrow {
  transition: transform 0.2s;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.discover-preferences-toggle .toggle-arrow.open {
  transform: rotate(90deg);
}

.preferences-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: auto;
}

.discover-preferences-panel {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Format Order Picker (Drag & Drop) */
.format-order-picker {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.format-order-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.format-order-list {
  display: flex;
  gap: 0.5rem;
}

.format-order-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: grab;
  user-select: none;
  transition: border-color 0.2s, transform 0.1s;
}

.format-order-item:active {
  cursor: grabbing;
}

.format-order-item.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}

.format-order-item.drag-over {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.2);
}

.format-order-handle {
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: -2px;
}

.format-order-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--accent-color);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
}

.format-order-name {
  font-weight: 600;
  font-size: 0.9rem;
}

/* Checkbox Preference */
.discover-preference-option {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--accent-color);
}

/* Content Type Slider */
.content-type-slider {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.content-type-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.content-type-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  position: relative;
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.content-type-option {
  padding: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  z-index: 1;
  transition: color 0.2s;
}

.content-type-option.active {
  color: white;
  font-weight: 600;
}

.content-type-slider-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 33.333%;
  height: 100%;
  background: var(--accent-color);
  transition: transform 0.2s ease;
  z-index: 0;
}

/* Actions */
.discover-actions {
  display: flex;
  justify-content: center;
}

.discover-submit-button {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.discover-submit-button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.discover-submit-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Error Message */
.discover-error {
  color: var(--error-color);
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid var(--error-color);
  border-radius: 6px;
  margin-top: 0.5rem;
}

/* Results Section */
.discover-results-section {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
}

.discover-results-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.discover-results-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

/* Progress Bar */
.discover-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.discover-progress-bar {
  flex: 1;
  height: 8px;
  background: var(--primary-color);
  border-radius: 4px;
  overflow: hidden;
}

.discover-progress-fill {
  height: 100%;
  background: var(--accent-color);
  transition: width 0.3s ease;
}

.discover-progress-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  min-width: 100px;
  text-align: right;
}

/* Results List */
.discover-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  padding: 0.5rem;
  background: var(--primary-color);
  border-radius: 6px;
}

.discover-result-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.875rem;
}

.discover-result-row.pending {
  opacity: 0.6;
}

.discover-result-row.processing {
  background: rgba(233, 69, 96, 0.1);
}

.discover-result-row.completed {
  background: rgba(76, 175, 80, 0.1);
}

.discover-result-row.error {
  background: rgba(239, 68, 68, 0.1);
}

.discover-result-index {
  width: 2rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: right;
}

.discover-result-url {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: monospace;
}

.discover-result-status {
  min-width: 80px;
  text-align: right;
}

.status-icon {
  font-size: 0.8rem;
}

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

.status-icon.error {
  color: var(--error-color);
}

.status-icon.pending,
.status-icon.processing {
  color: var(--text-muted);
}

.status-icon.empty {
  color: var(--text-muted);
}

.status-icon.rate-limited {
  color: #f59e0b;
  font-size: 0.75rem;
}

.rate-limited-stat {
  color: #f59e0b;
}

.cache-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.subfeeds-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: rgba(80, 200, 120, 0.15);
  border: 1px solid rgba(80, 200, 120, 0.4);
  border-radius: 3px;
  color: #50c878;
  cursor: help;
}

.feeds-count-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 3px;
  color: #3b82f6;
}

/* Expandable Result Row */
.discover-result-row-wrapper {
  border-bottom: 1px solid var(--border-color);
}

.discover-result-row-wrapper:last-child {
  border-bottom: none;
}

.discover-result-row.expandable {
  cursor: pointer;
}

.discover-result-row.expandable:hover {
  background: rgba(255, 255, 255, 0.05);
}

.expand-arrow {
  width: 2rem;
  color: var(--text-muted);
  font-size: 0.65rem;
  text-align: center;
  transition: transform 0.2s ease;
  display: inline-block;
}

.expand-arrow.open {
  transform: rotate(90deg);
}

/* Expanded Feeds List */
.discover-feeds-expanded {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 0.5rem 0.5rem 0.5rem 2.5rem;
}

.discover-feed-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.discover-feed-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.discover-feed-item.preferred {
  background: rgba(76, 175, 80, 0.1);
  cursor: default;
}

.discover-feed-item.selected {
  background: rgba(59, 130, 246, 0.1);
}

.feed-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border-color);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: transparent;
  transition: all 0.15s ease;
}

.feed-checkbox.checked {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: white;
}

.discover-feed-item.preferred .feed-checkbox.checked {
  background: var(--success-color);
  border-color: var(--success-color);
}

.feed-type-badge {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-muted);
  font-weight: 600;
  min-width: 2.5rem;
  text-align: center;
}

.feed-url {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  color: var(--text-color);
}

.preferred-label {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: rgba(76, 175, 80, 0.2);
  border-radius: 3px;
  color: var(--success-color);
  text-transform: uppercase;
}

.feed-content-type {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  background: rgba(156, 163, 175, 0.2);
  border-radius: 3px;
  color: var(--text-muted);
}

/* Results Summary */
.discover-results-summary {
  display: flex;
  gap: 2rem;
  justify-content: center;
  padding: 1rem;
  background: var(--primary-color);
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.summary-stat {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.summary-stat strong {
  color: var(--text-color);
  font-size: 1rem;
}

/* Results Actions */
.discover-results-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.discover-action-button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.discover-action-button.primary {
  background: var(--accent-color);
  color: white;
}

.discover-action-button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.discover-action-button.secondary {
  background: var(--primary-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.discover-action-button.secondary:hover {
  border-color: var(--accent-color);
}

.discover-action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
  .format-order-list {
    flex-direction: column;
  }

  .discover-results-summary {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .discover-results-actions {
    flex-direction: column;
  }

  .discover-action-button {
    width: 100%;
  }

  .preferences-summary {
    display: none;
  }
}
