/* ============================================
   DESIGN SYSTEM - defaultcreds.lol
   Intelligence Console UI
   ============================================ */

/* Honor the OS-level reduce-motion preference. Animations and transitions
   collapse to effectively-instant; scroll-behavior drops its smooth easing.
   JS-driven skeleton glitch effects have their own feature check in
   animations.js — CSS alone can't stop setInterval/setTimeout. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- CSS Variables --- */
:root {
  /* Colors - Dark Theme */
  --color-bg: #121212;
  --color-bg-elevated: #1e1e1e;
  --color-bg-hover: #2a2a2a;
  --color-text: #e5e5e5;
  --color-text-secondary: #a0a0a0;
  --color-text-muted: #6b6b6b;
  --color-border: #2e2e2e;
  --color-border-strong: #404040;
  --color-accent: #22c55e;
  --color-accent-soft: rgba(34, 197, 94, 0.15);
  --color-accent-hover: #4ade80;
  --color-success: #34d399;
  --color-warning: #fbbf24;
  --color-error: #f87171;
  --color-highlight: rgba(34, 197, 94, 0.2);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Layout */
  --sidebar-width: 320px;
  --header-height: 64px;
  --border-radius: 8px;
  --border-radius-sm: 6px;
  --border-radius-lg: 12px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-hover);
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select {
  font-family: inherit;
  font-size: inherit;
}

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

/* --- Site Header --- */
.site-header {
  position: sticky;
  top: 0;
  /* Must out-rank .sidebar (z:100). The faux-URL dropdown (#creds-history) is
     a descendant of this header's stacking context, so whatever z-index the
     dropdown carries is clamped by this root. When the dropdown extends
     downward past the header and overlaps the pinned sidebar, the header
     subtree needs to win the paint order. See AUDIT.md F053. */
  z-index: 110;
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-border);
  height: var(--header-height);
}

.header-content {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.logo:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.logo:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.logo-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 2;
}

.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
  font-size: inherit;
}

.refresh-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.refresh-btn:active {
  background: var(--color-bg);
}

.refresh-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.refresh-btn svg {
  width: 18px;
  height: 18px;
  color: inherit;
  stroke: currentColor;
}

.address-bar-wrapper {
  position: relative;
  flex: 1;
  max-width: 600px;
}

.faux-url {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all var(--transition-base);
  user-select: none;
  min-width: 280px;
  position: relative;
  z-index: 1;
}

.faux-url:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
}

.faux-url:focus,
.faux-url[aria-expanded="true"] {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
  background: var(--color-bg);
}

.faux-url[aria-expanded="true"] {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.address-bar-icon {
  flex-shrink: 0;
  color: var(--color-success);
  opacity: 0.8;
}

.url-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.address-bar-dropdown-icon {
  flex-shrink: 0;
  color: var(--color-text-muted);
  opacity: 0.6;
  transition: transform var(--transition-fast);
}

.faux-url[aria-expanded="true"] .address-bar-dropdown-icon {
  transform: rotate(180deg);
  opacity: 1;
}

.url-protocol { color: var(--color-accent); }
.url-creds { color: var(--color-text-secondary); }
.url-password { color: var(--color-warning); }
.url-host { color: var(--color-success); }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}


/* --- Sidebar Hover Trigger --- */
.sidebar-hover-trigger {
  position: fixed;
  left: 0;
  top: var(--header-height);
  width: 20px;
  height: calc(100vh - var(--header-height));
  z-index: 90;
  cursor: pointer;
  background: #2a2a2a;
  border-top: 1px solid var(--color-accent);
  border-right: 1px solid var(--color-accent);
  border-bottom: 1px solid var(--color-accent);
  transition: background var(--transition-fast), width var(--transition-base);
}

.sidebar-hover-trigger:hover {
  background: var(--color-accent-soft);
  border-right-color: var(--color-accent);
  width: 24px;
}

.sidebar-indicator {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  opacity: 0.7;
  transition: opacity var(--transition-fast), transform var(--transition-fast), color var(--transition-fast);
  pointer-events: none;
}

.sidebar-hover-trigger:hover .sidebar-indicator {
  opacity: 1;
  transform: translateY(-50%) translateX(3px);
  color: var(--color-accent);
}

.sidebar-indicator svg {
  width: 16px;
  height: 16px;
}

/* --- App Layout --- */
.app-layout {
  min-height: calc(100vh - var(--header-height));
  max-width: 1600px;
  margin: 0 auto;
  transition: padding-left var(--transition-base);
}

.app-layout.sidebar-pinned {
  padding-left: var(--sidebar-width);
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--header-height);
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-lg);
}

.sidebar.pinned,
.sidebar.revealed,
.sidebar:focus-within {
  transform: translateX(0);
}

/* Keyboard/SR users can't hover, so :focus-within is the accessible path into
   the sidebar. Once revealed, Tab reaches the pin button and the rest of the
   controls become operable. */

.app-layout.sidebar-pinned .sidebar-hover-trigger {
  display: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.sidebar-pin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-pin-btn:hover,
.sidebar-pin-btn:focus-visible {
  background: var(--color-bg-hover);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.sidebar-pin-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.sidebar-pin-btn .pin-icon {
  position: absolute;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.sidebar-pin-btn .pin-icon.pinned {
  opacity: 0;
  transform: scale(0.8);
}

.sidebar.pinned .sidebar-pin-btn .pin-icon:not(.pinned) {
  opacity: 0;
  transform: scale(0.8);
}

.sidebar.pinned .sidebar-pin-btn .pin-icon.pinned {
  opacity: 1;
  transform: scale(1);
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

/* --- Panels --- */
.panel {
  background: var(--color-bg-elevated);
  border: none;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  overflow: hidden;
}

.panel:last-child {
  border-bottom: none;
}

.panel-header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: none;
  border-left: 2px solid var(--color-accent);
  cursor: default;
}

.panel-title {
  flex: 1;
  text-align: left;
}

.panel-status {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-right: var(--space-2);
}

.panel-content {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* --- Feed Controls --- */
.feed-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.feed-controls-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
  z-index: 1;
}

.feed-actions {
  display: flex;
  gap: var(--space-1);
  flex-shrink: 0;
}

.btn-sm {
  padding: 2px var(--space-2);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  border: 1px solid var(--color-border);
  border-radius: 0;
  color: var(--color-text-secondary);
  background: var(--color-bg);
  transition: all var(--transition-fast);
}

.btn-sm:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

.btn-sm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.feed-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.feed-action-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

.feed-action-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.feed-action-btn svg {
  width: 14px;
  height: 14px;
}

/* Category Filter Button */
.feed-filter-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.feed-filter-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

.feed-filter-btn[aria-expanded="true"] {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-soft);
}

.feed-filter-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.feed-filter-btn svg {
  width: 14px;
  height: 14px;
}

/* Filter Popup */
.feed-filter-popup {
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  width: 200px;
  z-index: 200;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 0;
  box-shadow: var(--shadow-md);
  max-height: 300px;
  overflow-y: auto;
}

.feed-filter-popup-content {
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.feed-filter-checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  color: var(--color-text);
  transition: background var(--transition-fast);
  border-radius: 0;
}

.feed-filter-checkbox-label:hover,
.feed-filter-checkbox-label:focus-within {
  background: var(--color-bg-hover);
}

.feed-filter-checkbox {
  width: 14px;
  height: 14px;
  accent-color: var(--color-accent);
  cursor: pointer;
  flex-shrink: 0;
}

.feed-filter-checkbox-label span {
  flex: 1;
}


/* Feed Search */
.feed-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
}

.feed-search-wrapper .search-icon {
  position: absolute;
  left: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  width: 14px;
  height: 14px;
}

.feed-search {
  width: 100%;
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-7);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  border: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-bg);
  color: var(--color-text);
  transition: all var(--transition-fast);
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}

.feed-search::-webkit-search-decoration,
.feed-search::-webkit-search-cancel-button,
.feed-search::-webkit-search-results-button,
.feed-search::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
}

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

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

/* Feed List */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: var(--space-2);
  max-height: 280px;
  overflow-y: auto;
}

.feed-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  border: none;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  background: var(--color-bg);
  transition: all var(--transition-fast);
  position: relative;
}

.feed-option[data-selected="true"][data-active="true"] {
  background: var(--color-accent-soft);
}

.feed-option[data-selected="true"][data-active="true"]:hover {
  background: var(--color-highlight);
}

.feed-option:last-child {
  border-bottom: none;
}

.feed-option:hover {
  background: var(--color-bg-hover);
}

/* Active state takes priority - inactive feeds are always dimmed and disabled */
.feed-option[data-active="false"] {
  opacity: 0.4;
  pointer-events: none;
}

/* Unselected feeds are dimmed, but only if they're active (inactive feeds handled above) */
.feed-option[data-selected="false"][data-active="true"] {
  opacity: 0.6;
}

.feed-option-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
  cursor: pointer;
  font-size: var(--text-sm);
}

.feed-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-option-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--color-accent);
}

.feed-option-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.feed-option:hover .feed-option-actions {
  opacity: 1;
}

.feed-move {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 11px;
  border: 1px solid var(--color-border);
  border-radius: 0;
  color: var(--color-text-muted);
  background: var(--color-bg);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.feed-move:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.feed-move:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.feed-move:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

/* --- Cred Widget --- */
#cred-of-week .panel-header {
  justify-content: space-between;
}

.icon-btn-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 0;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.icon-btn-sm:hover,
.icon-btn-sm:focus-visible {
  background: var(--color-bg-hover);
  color: var(--color-accent);
}

.icon-btn-sm:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

#refresh-cred:hover svg {
  transform: rotate(180deg);
  transition: transform var(--transition-slow);
}

.cred-entry {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-warning);
  /* SecLists entries are arbitrary strings — a password with no spaces, a
     hash, a long account:password pair. Sidebar is 320px wide; no wrap here
     means layout breakage. */
  overflow-wrap: anywhere;
  margin-bottom: var(--space-1);
}

.cred-meta {
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.cred-links a {
  color: var(--color-accent);
  font-size: 11px;
}

.cred-links a:focus-visible,
.cred-footnote a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.cred-count {
  font-size: 10px;
  color: var(--color-text-muted);
}

.cred-footnote {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

/* --- System Status --- */
.system-status {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg);
  border: none;
  border-left: 2px solid var(--color-text-muted);
  border-radius: 0;
  font-size: 11px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-label {
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-value {
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
}

.feed-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px var(--space-1);
  border-radius: 0;
  font-size: 10px;
  font-weight: 500;
  border: 1px solid;
}

.feed-status-indicator.loaded {
  border-color: var(--color-success);
  color: var(--color-success);
}

.feed-status-indicator.slow {
  border-color: var(--color-warning);
  color: var(--color-warning);
}

.feed-status-indicator.failed {
  border-color: var(--color-error);
  color: var(--color-error);
}

/* --- Main Content --- */
.main-content {
  min-height: calc(100vh - var(--header-height));
  padding: var(--space-6);
  background: var(--color-bg);
  transition: margin-left var(--transition-base);
}

/* --- Filter Bar --- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 280px;
}

.search-wrapper .search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-12);
  font-size: var(--text-base);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

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

.search-clear {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--border-radius-sm);
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.search-clear:hover {
  background: var(--color-bg-hover);
  color: var(--color-text);
}

.search-clear[hidden] {
  display: none;
}

.filter-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.filter-count {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

.sort-select {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sort-select:hover {
  border-color: var(--color-border-strong);
}

.sort-select:focus {
  outline: none;
  border-color: var(--color-accent);
}

/* --- Loading State --- */
/* Loading is now handled by skeleton placeholders in feed sections */

/* --- News Feed --- */
.news-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Feed Section */
.feed-section {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: 0;
  border-left: 2px solid var(--color-accent);
  overflow: hidden;
  margin-bottom: -1px;
}

/* Collapse rule targets the real DOM — feed-renderer builds each section as
   <section class="feed-section"><h2>...</h2><article>...</article>...</section>,
   so hiding everything that isn't the h2 collapses the feed cleanly. */
.feed-section.collapsed > *:not(h2) {
  display: none;
}

.feed-section h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--color-bg);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.feed-section h2:hover {
  background: var(--color-bg-hover);
}

.feed-section h2:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: -2px;
}

/* Article Cards - Terminal Style */
.news-feed article {
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-mono);
  transition: background var(--transition-fast);
}

.news-feed article:last-child {
  border-bottom: none;
}

.news-feed article:hover {
  background: var(--color-bg-hover);
}

.news-feed article header h3 {
  font-size: var(--text-sm);
  font-weight: 400;
  line-height: 1.4;
  /* RSS titles can contain unbreakable strings (long URLs, hashtag chains,
     non-spaced CJK). Without overflow-wrap, a 200-char URL in a title blows
     out the article width and can force horizontal page scroll. */
  overflow-wrap: anywhere;
  margin: 0 0 var(--space-1);
}

.news-feed article header h3 a {
  color: var(--color-text);
  transition: color var(--transition-fast);
}

.news-feed article header h3 a:hover,
.news-feed article header h3 a:focus-visible {
  color: var(--color-accent);
}

.news-feed article header h3 a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.news-feed article footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.news-feed article footer small {
  font-size: 11px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

/* Search Highlight */
mark.search-highlight {
  background: var(--color-highlight);
  color: inherit;
  padding: 1px 3px;
  border-radius: 3px;
}

/* Status Messages */
.status {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-style: italic;
  padding: var(--space-4);
}

.status.error {
  color: var(--color-error);
  font-style: normal;
  font-weight: 500;
}

/* Retry Button */
.retry-button {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--color-accent);
  color: white;
  border-radius: var(--border-radius-sm);
  transition: all var(--transition-fast);
  margin: var(--space-2) var(--space-4);
}

.retry-button:hover {
  background: var(--color-accent-hover);
}

.retry-button:focus-visible {
  outline: 2px solid var(--color-accent-hover);
  outline-offset: 2px;
}

/* --- Skeleton Placeholders (Glitchy Hacker/Terminal Style) --- */
.skeleton-article {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-bg-elevated);
  position: relative;
  overflow: hidden;
  animation: skeleton-glitch-flicker 0.1s infinite;
}

.skeleton-article::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(34, 197, 94, 0.03) 2px,
    rgba(34, 197, 94, 0.03) 4px
  );
  pointer-events: none;
  animation: skeleton-scanlines 0.15s infinite;
  z-index: 1;
}

@keyframes skeleton-scanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

.skeleton-article::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: skeleton-scan-sweep 2s infinite;
  pointer-events: none;
  z-index: 2;
}

@keyframes skeleton-scan-sweep {
  0% { left: -100%; }
  100% { left: 150%; }
}

@keyframes skeleton-glitch-flicker {
  0%, 100% { 
    filter: brightness(1) contrast(1) hue-rotate(0deg);
    transform: translateX(0) translateY(0);
  }
  10% { 
    filter: brightness(1.15) contrast(1.15) hue-rotate(5deg);
    transform: translateX(-1px) translateY(0.5px);
  }
  20% { 
    filter: brightness(0.9) contrast(1.1) hue-rotate(-5deg);
    transform: translateX(1px) translateY(-0.5px);
  }
  30% { 
    filter: brightness(1.05) contrast(0.95) hue-rotate(3deg);
    transform: translateX(-0.5px) translateY(0.3px);
  }
  40% { 
    filter: brightness(0.98) contrast(1.08) hue-rotate(-3deg);
    transform: translateX(0.5px) translateY(-0.3px);
  }
  50% { 
    filter: brightness(1.1) contrast(1.05) hue-rotate(2deg);
    transform: translateX(-0.3px) translateY(0.2px);
  }
  60% { 
    filter: brightness(0.95) contrast(1.12) hue-rotate(-2deg);
    transform: translateX(0.3px) translateY(-0.2px);
  }
  70% { 
    filter: brightness(1.08) contrast(0.98) hue-rotate(1deg);
    transform: translateX(-0.2px) translateY(0.1px);
  }
  80% { 
    filter: brightness(0.97) contrast(1.05) hue-rotate(-1deg);
    transform: translateX(0.2px) translateY(-0.1px);
  }
  90% { 
    filter: brightness(1.02) contrast(1.02) hue-rotate(0.5deg);
    transform: translateX(-0.1px) translateY(0.05px);
  }
}

.skeleton-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  color: var(--color-text-secondary);
  position: relative;
  z-index: 3;
}

.skeleton-prompt {
  color: var(--color-success);
  font-weight: 600;
  animation: skeleton-prompt-glitch 2s infinite;
}

@keyframes skeleton-prompt-glitch {
  0%, 90%, 100% { 
    color: var(--color-success);
    text-shadow: none;
  }
  5% { 
    color: var(--color-error);
    text-shadow: 2px 0 var(--color-accent), -2px 0 var(--color-warning);
  }
  10% { 
    color: var(--color-success);
    text-shadow: none;
  }
  45% { 
    color: var(--color-accent);
    transform: translateX(1px);
  }
  50% { 
    color: var(--color-success);
    transform: translateX(0);
  }
}

.skeleton-command {
  color: var(--color-text-muted);
  position: relative;
  animation: skeleton-blink 1.2s infinite, skeleton-text-glitch 3s infinite;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.skeleton-glitch-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(34, 197, 94, 0.15) 20%,
    rgba(251, 191, 36, 0.1) 40%,
    rgba(244, 113, 113, 0.12) 60%,
    rgba(52, 211, 153, 0.1) 80%,
    transparent 100%);
  background-size: 300% 100%;
  animation: skeleton-glitch-sweep 1.5s infinite, skeleton-glitch-flicker-overlay 0.3s infinite;
  mix-blend-mode: screen;
  opacity: 0.6;
}

@keyframes skeleton-glitch-flicker-overlay {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.9; }
}

@keyframes skeleton-glitch-sweep {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes skeleton-text-glitch {
  0%, 88%, 100% { 
    transform: translateX(0) translateY(0);
    filter: hue-rotate(0deg) brightness(1);
    text-shadow: none;
  }
  1% { 
    transform: translateX(-3px) translateY(1px);
    filter: hue-rotate(90deg) brightness(1.3);
    text-shadow: 2px 0 var(--color-error), -2px 0 var(--color-warning);
  }
  2% { 
    transform: translateX(3px) translateY(-1px);
    filter: hue-rotate(-90deg) brightness(0.7);
    text-shadow: -2px 0 var(--color-accent), 2px 0 var(--color-success);
  }
  3% { 
    transform: translateX(-1px) translateY(0.5px);
    filter: hue-rotate(45deg) brightness(1.1);
    text-shadow: 1px 0 var(--color-warning);
  }
  4% { 
    transform: translateX(1px) translateY(-0.5px);
    filter: hue-rotate(-45deg) brightness(0.9);
    text-shadow: -1px 0 var(--color-accent);
  }
  5% { 
    transform: translateX(0) translateY(0);
    filter: hue-rotate(0deg) brightness(1);
    text-shadow: none;
  }
  42% { 
    transform: translateX(1px) translateY(0) skewX(-3deg);
    filter: brightness(1.2);
  }
  44% { 
    transform: translateX(-1px) translateY(0) skewX(3deg);
    filter: brightness(0.8);
  }
  46% { 
    transform: translateX(0) translateY(0) skewX(0deg);
    filter: brightness(1);
  }
  65% { 
    transform: translateX(0.5px) translateY(-0.5px);
  }
  70% { 
    transform: translateX(-0.5px) translateY(0.5px);
  }
  75% { 
    transform: translateX(0) translateY(0);
  }
}

@keyframes skeleton-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}

.skeleton-progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  height: 16px;
  position: relative;
  z-index: 3;
}

.skeleton-progress-bar {
  flex: 1;
  height: 3px;
  background: var(--color-accent);
  position: relative;
  overflow: hidden;
  animation: skeleton-progress-scan 1.5s infinite, skeleton-progress-glitch 2.5s infinite, skeleton-progress-jitter 0.2s infinite;
  box-shadow: 0 0 4px var(--color-accent), 0 0 8px var(--color-accent-soft);
  border-top: 1px solid rgba(34, 197, 94, 0.3);
  transition: width 0.3s ease-out;
}

@keyframes skeleton-progress-jitter {
  0%, 100% { 
    transform: translateY(0) scaleY(1);
  }
  25% { 
    transform: translateY(-0.5px) scaleY(1.1);
  }
  50% { 
    transform: translateY(0.5px) scaleY(0.9);
  }
  75% { 
    transform: translateY(-0.3px) scaleY(1.05);
  }
}

.skeleton-progress-glitch {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.1) 2px,
    rgba(255, 255, 255, 0.1) 4px
  );
  animation: skeleton-progress-glitch-scan 0.8s infinite;
}

@keyframes skeleton-progress-glitch-scan {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skeleton-progress-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--color-accent-hover) 50%, 
    transparent 100%);
  animation: skeleton-progress-sweep 1.5s infinite;
}

@keyframes skeleton-progress-scan {
  0% { 
    opacity: 0.4;
    box-shadow: 0 0 4px var(--color-accent);
  }
  50% { 
    opacity: 1;
    box-shadow: 0 0 8px var(--color-accent), 0 0 12px var(--color-accent-soft);
  }
  100% { 
    opacity: 0.4;
    box-shadow: 0 0 4px var(--color-accent);
  }
}

@keyframes skeleton-progress-glitch {
  0%, 82%, 100% { 
    filter: hue-rotate(0deg) saturate(1);
    transform: scaleX(1) scaleY(1);
  }
  2% { 
    filter: hue-rotate(120deg) saturate(1.5);
    transform: scaleX(1.05) scaleY(1.2);
  }
  4% { 
    filter: hue-rotate(-120deg) saturate(0.5);
    transform: scaleX(0.95) scaleY(0.8);
  }
  6% { 
    filter: hue-rotate(60deg) saturate(1.2);
    transform: scaleX(1.02) scaleY(1.1);
  }
  8% { 
    filter: hue-rotate(-60deg) saturate(0.8);
    transform: scaleX(0.98) scaleY(0.9);
  }
  10% { 
    filter: hue-rotate(0deg) saturate(1);
    transform: scaleX(1) scaleY(1);
  }
  35% { 
    filter: brightness(1.4) contrast(1.3);
    transform: scaleX(1.01);
  }
  40% { 
    filter: brightness(0.6) contrast(0.7);
    transform: scaleX(0.99);
  }
  45% { 
    filter: brightness(1) contrast(1);
    transform: scaleX(1);
  }
  60% { 
    filter: hue-rotate(30deg);
    transform: translateX(1px);
  }
  65% { 
    filter: hue-rotate(-30deg);
    transform: translateX(-1px);
  }
  70% { 
    filter: hue-rotate(0deg);
    transform: translateX(0);
  }
}

@keyframes skeleton-progress-sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.skeleton-progress-text {
  font-size: 10px;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  min-width: 35px;
  text-align: right;
  position: relative;
  animation: skeleton-text-jitter 1.8s infinite;
}

@keyframes skeleton-text-jitter {
  0%, 90%, 100% { 
    transform: translateX(0);
    color: var(--color-text-muted);
  }
  3% { 
    transform: translateX(-1px);
    color: var(--color-error);
  }
  6% { 
    transform: translateX(1px);
    color: var(--color-warning);
  }
  9% { 
    transform: translateX(0);
    color: var(--color-text-muted);
  }
  45% { 
    transform: translateX(0.5px);
    filter: brightness(1.3);
  }
  50% { 
    transform: translateX(0);
    filter: brightness(1);
  }
}

.skeleton-password-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  font-size: 11px;
  position: relative;
  z-index: 3;
}

.skeleton-password-label {
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.skeleton-password-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px var(--space-2);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 0;
  color: var(--color-warning);
  font-weight: 600;
  min-width: 0;
  text-overflow: ellipsis;
  animation: skeleton-password-glitch 2s infinite;
}

@keyframes skeleton-password-glitch {
  0%, 95%, 100% { 
    border-color: var(--color-border);
    box-shadow: none;
  }
  2% { 
    border-color: var(--color-error);
    box-shadow: 0 0 4px var(--color-error);
  }
  4% { 
    border-color: var(--color-warning);
    box-shadow: 0 0 4px var(--color-warning);
  }
  6% { 
    border-color: var(--color-border);
    box-shadow: none;
  }
}

.skeleton-meta-line {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: 11px;
  position: relative;
  z-index: 3;
}

.skeleton-meta-text {
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  animation: skeleton-blink 1.5s infinite, skeleton-meta-glitch 2.2s infinite;
  position: relative;
}

@keyframes skeleton-meta-glitch {
  0%, 88%, 100% { 
    transform: translateX(0);
    filter: hue-rotate(0deg);
  }
  2% { 
    transform: translateX(-1px) skewX(2deg);
    filter: hue-rotate(45deg);
  }
  4% { 
    transform: translateX(1px) skewX(-2deg);
    filter: hue-rotate(-45deg);
  }
  6% { 
    transform: translateX(0) skewX(0deg);
    filter: hue-rotate(0deg);
  }
  42% { 
    transform: translateY(-1px);
  }
  44% { 
    transform: translateY(1px);
  }
  46% { 
    transform: translateY(0);
  }
}

.skeleton-meta-text::after {
  content: '█';
  animation: skeleton-cursor 1s infinite, skeleton-cursor-glitch 2.5s infinite;
  color: var(--color-accent);
  margin-left: 2px;
  display: inline-block;
}

@keyframes skeleton-cursor {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

@keyframes skeleton-cursor-glitch {
  0%, 92%, 100% { 
    color: var(--color-accent);
    transform: scale(1);
  }
  3% { 
    color: var(--color-error);
    transform: scale(1.2);
  }
  6% { 
    color: var(--color-warning);
    transform: scale(0.8);
  }
  9% { 
    color: var(--color-accent);
    transform: scale(1);
  }
  45% { 
    color: var(--color-success);
  }
  50% { 
    color: var(--color-accent);
  }
}

/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  text-align: center;
  color: var(--color-text-muted);
}

.empty-state[hidden] {
  display: none;
}

.empty-state svg {
  margin-bottom: var(--space-4);
  opacity: 0.5;
}

.empty-title {
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.empty-desc {
  font-size: var(--text-sm);
}

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--color-accent);
  color: white;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
  z-index: 50;
}

.back-to-top.visible {
  display: flex;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: var(--color-accent-hover);
  transform: translateY(-2px);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--color-accent-hover);
  outline-offset: 2px;
}

/* --- Footer --- */
.site-footer {
  padding: var(--space-6);
  text-align: center;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* --- Credentials History Dropdown --- */
.creds-history {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-accent);
  border-top: none;
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 201;
  /* Can't use var(--transition-base) here — it expands to "200ms cubic-
     bezier(...)", and combining that with ease-out would put two timing
     functions in the shorthand, making the whole declaration invalid and
     the animation a no-op. Duration written explicitly to match. */
  animation: slideDown 200ms ease-out;
  margin-top: -1px;
}

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

.creds-history:not([hidden]) {
  display: block;
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--color-border);
  position: relative;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item:hover {
  background: var(--color-bg-hover);
}

.history-item:active {
  background: var(--color-accent-soft);
}

.history-item-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  opacity: 0.6;
}

.history-item-content {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-time {
  flex-shrink: 0;
  font-size: 10px;
  color: var(--color-text-muted);
  opacity: 0.7;
  margin-left: auto;
  padding-left: var(--space-2);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .sidebar-hover-trigger {
    display: none;
  }

  .sidebar {
    position: relative;
    top: 0;
    height: auto;
    transform: none;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    box-shadow: none;
  }

  .sidebar:hover {
    transform: none;
  }

  .app-layout,
  .app-layout.sidebar-pinned {
    padding-left: 0;
  }

  .feed-list {
    max-height: 200px;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .header-content {
    padding: 0 var(--space-4);
  }

  .faux-url {
    font-size: 11px;
    padding: var(--space-1) var(--space-2);
  }

  .address-bar-wrapper {
    max-width: 200px;
    margin: 0 var(--space-2);
  }

  .address-bar-icon,
  .address-bar-dropdown-icon {
    display: none;
  }

  .main-content {
    padding: var(--space-4);
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .filter-meta {
    justify-content: space-between;
  }
}

@media (max-width: 480px) {
  .feed-option {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }

  .feed-option-actions {
    align-self: flex-end;
  }
}
