:root {
  --color-primary: #6279ab;
  --color-secondary: #697351;
  --color-background: #e9e5dc;
  --app-topbar-height: 64px;
  --dashboard-bar-height: 58px;
}

body {
  background: var(--color-background);
  color: #1f2937;
}

main {
  padding-top: calc(var(--app-topbar-height) + 0.75rem);
}

.button {
  color: #fff !important;
  font-weight: 600;
  border-radius: 0.375rem;
  padding: 0.4rem 0.8rem;
}

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

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

.badge-primary {
  background: var(--color-primary);
  color: #fff;
  border: 1px solid var(--color-primary);
}

.app-topbar {
  background: var(--color-primary);
  color: #fff;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 70;
}

.app-brand {
  color: #fff;
}

.app-topbar-inner {
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.app-user-email {
  color: #bfdbfe;
}

.app-header-right {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: flex-end;
  margin-left: auto;
  min-width: 0;
}

.app-main-nav {
  align-items: center;
  display: flex;
  gap: 1.5rem;
}

.app-main-nav .sidebar-feed-menu {
  align-items: center;
  display: inline-flex;
}

.header-feeds-link {
  align-items: center;
  display: inline-flex;
  gap: 0.35rem;
}

.header-feeds-count {
  color: #bfdbfe;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.header-page-tools {
  align-items: center;
  display: flex;
  gap: 0.75rem;
}

.header-account-menu {
  margin-left: 0.25rem;
}

.header-account-trigger {
  align-items: center;
  border-radius: 9999px;
  color: #bfdbfe;
  display: inline-flex;
  flex-shrink: 0;
  gap: 0.35rem;
  height: auto;
  min-height: 2rem;
  padding: 0.25rem 0.55rem;
  width: auto;
}

.header-account-email {
  display: inline-block;
  max-width: none;
  overflow: visible;
  white-space: nowrap;
}

.header-account-trigger:hover,
.header-account-trigger:focus-visible,
.header-account-menu[open] .header-account-trigger {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.header-account-trigger svg {
  fill: currentColor;
  height: 1rem;
  width: 1rem;
}

.header-account-label {
  font-weight: 600;
}

.entries-layout {
  display: block;
  gap: 1rem;
}

.entries-content {
  margin-top: 1rem;
}

.feed-section-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.feed-section-title-link {
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.feed-section-title-link:hover,
.feed-section-title-link:focus-visible,
.feed-section-title-link.is-active {
  color: var(--color-primary);
}

.feed-section-arrow-form {
  margin: 0;
}

.feed-section-arrow-toggle {
  background: transparent;
  border: 0;
  padding: 0;
  transform: translateX(-2px);
}

.feed-section-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-section-chevron {
  height: 1.7rem;
  transition: transform 0.15s ease;
  width: 1.7rem;
}

.feed-section.is-collapsed .feed-section-chevron {
  transform: rotate(-90deg);
}

.feed-section.is-collapsed .feed-section-list {
  display: none;
}

.sidebar-feed-row {
  align-items: center;
  border-radius: 0.375rem;
  display: flex;
  gap: 0.35rem;
  padding: 0.1rem;
}

.sidebar-feed-row:hover {
  background: #e5e7eb;
}

.sidebar-feed-row.is-active {
  background: #e5e7eb;
}

.sidebar-feed-link {
  align-items: center;
  border-radius: 0.375rem;
  color: #374151;
  display: flex;
  flex: 1;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.15rem 0.35rem;
}

.sidebar-feed-link:hover {
  color: var(--color-primary);
}

.sidebar-feed-row.is-active .sidebar-feed-link {
  color: var(--color-primary);
}

.sidebar-feed-menu {
  position: relative;
}

.sidebar-feed-menu summary {
  list-style: none;
}

.sidebar-feed-menu summary::-webkit-details-marker {
  display: none;
}

.sidebar-feed-menu-trigger {
  align-items: center;
  border-radius: 9999px;
  color: #6b7280;
  cursor: pointer;
  display: inline-flex;
  height: 1.6rem;
  justify-content: center;
  width: 1.6rem;
}

.sidebar-feed-menu-trigger:hover,
.sidebar-feed-menu-trigger:focus-visible,
.sidebar-feed-menu[open] .sidebar-feed-menu-trigger {
  background: #d1d5db;
  color: var(--color-primary);
}

.sidebar-feed-menu-trigger svg {
  fill: currentColor;
  height: 1rem;
  width: 1rem;
}

/* Header account trigger should look like a top-nav item, not a circular icon button. */
.header-top-menu .header-account-trigger {
  align-items: center;
  background: transparent;
  border-radius: 0;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.875rem;
  font-weight: 600;
  gap: 0.25rem;
  height: auto;
  justify-content: flex-start;
  min-height: 0;
  padding: 0;
  width: auto;
}

.header-top-menu .header-account-trigger:hover,
.header-top-menu .header-account-trigger:focus-visible,
.header-top-menu[open] .header-account-trigger {
  background: transparent;
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.header-top-menu .header-account-trigger svg {
  fill: currentColor;
  height: 0.9rem;
  transition: transform 0.15s ease;
  width: 0.9rem;
}

.header-top-menu[open] .header-account-trigger svg {
  transform: rotate(180deg);
}

.settings-subheader {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.settings-subheader-link {
  border-radius: 0.375rem;
  color: #111827;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 0.9rem;
}

.settings-subheader-link:hover,
.settings-subheader-link:focus-visible {
  background: #eef2ff;
  color: var(--color-primary);
}

.settings-subheader-link.is-active {
  background: var(--color-primary);
  color: #ffffff;
}

.sidebar-feed-menu-list {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.14);
  min-width: 12rem;
  padding: 0.25rem;
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  z-index: 12;
}

.sidebar-feed-menu-item {
  background: transparent;
  border: 0;
  border-radius: 0.35rem;
  color: #111827;
  cursor: pointer;
  display: block;
  font-size: 0.85rem;
  padding: 0.45rem 0.55rem;
  text-align: left;
  width: 100%;
}

.sidebar-feed-menu-info {
  border-bottom: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
  overflow: hidden;
  padding: 0.35rem 0.55rem 0.45rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-feed-menu-item:hover,
.sidebar-feed-menu-item:focus-visible {
  background: #eef2ff;
  color: var(--color-primary);
}

.sidebar-feed-refresh {
  background: transparent;
  border: 0;
  border-radius: 9999px;
  color: #6b7280;
  cursor: pointer;
  font-size: 0.95rem;
  height: 1.6rem;
  line-height: 1;
  width: 1.6rem;
}

.sidebar-feed-refresh:hover,
.sidebar-feed-refresh:focus-visible {
  background: #d1d5db;
  color: var(--color-primary);
}

.feed-details-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.75rem;
}

.feed-details-grid strong {
  color: #4b5563;
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.feed-details-grid p {
  color: #111827;
  margin-top: 0.15rem;
}

.feed-url-copy-wrap {
  margin-top: 1rem;
}

.feed-url-copy-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.feed-url-input {
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  color: #111827;
  flex: 1;
  font-size: 0.9rem;
  padding: 0.5rem 0.6rem;
}

.button-danger {
  background-color: #b91c1c;
}

.favicon-slot {
  border-radius: 0.125rem;
  display: inline-block;
  flex: 0 0 1rem;
  height: 1rem;
  object-fit: cover;
  width: 1rem;
}

.favicon-slot.placeholder {
  background: #d1d5db;
}

.entry-thumb-fallback {
  align-items: center;
  background: linear-gradient(135deg, #f0f4ff 0%, #dde7ff 100%);
  display: flex;
  height: 9rem;
  justify-content: center;
  width: 100%;
}

.entry-card-actions {
  display: flex;
  gap: 0.4rem;
  position: absolute;
  right: 0.65rem;
  top: 0.65rem;
  z-index: 8;
}

.entry-card-icon-btn {
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(31, 41, 55, 0.16);
  border-radius: 9999px;
  color: #374151;
  display: inline-flex;
  flex: 0 0 2rem;
  height: 2rem;
  justify-content: center;
  max-height: 2rem;
  max-width: 2rem;
  min-height: 2rem;
  min-width: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  width: 2rem;
}

.entry-card-icon-btn svg {
  fill: currentColor;
  height: 1rem;
  width: 1rem;
}

.entry-card-star:hover,
.entry-card-star:focus-visible {
  border-color: #f59e0b;
  color: #b45309;
}

.entry-card-star.is-active {
  border-color: #f59e0b;
  color: #b45309;
}

.card-meta-row {
  align-items: center;
  color: #4b5563;
  display: flex;
  font-size: 0.875rem;
  gap: 0.75rem;
  justify-content: space-between;
}

.card-meta-source {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  min-width: 0;
}

.card-meta-source span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-meta-date {
  color: #6b7280;
  flex: 0 0 auto;
  font-size: 0.78rem;
  white-space: nowrap;
}

.entry-grid-card:hover .entry-card-icon-btn,
.entry-grid-card:focus-within .entry-card-icon-btn {
  opacity: 1;
  pointer-events: auto;
}

.entry-grid-card.entry-state-unread {
  border-color: #93c5fd;
  box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.45);
}

.entry-grid-card.entry-state-read {
  border-color: #d1d5db;
  box-shadow: none;
}

.entry-grid-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
}

.entries-load-more-sentinel {
  color: #4b5563;
  font-size: 0.85rem;
  grid-column: 1 / -1;
  padding: 0.5rem 0.25rem 0.25rem;
  text-align: center;
}

.grid-content-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.grid-content-clamp-3 {
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.dashboard-fullbleed {
  margin-left: calc(50% - 50vw);
  margin-top: 0;
  width: 100vw;
}

.dashboard-stats-bar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid #d1d5db;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  left: 0;
  padding: 0.75rem 1.25rem;
  position: fixed;
  right: 0;
  top: var(--app-topbar-height);
  z-index: 65;
}

.dashboard-stat {
  align-items: baseline;
  display: flex;
  gap: 0.5rem;
}

.dashboard-stat-label {
  color: #4b5563;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dashboard-stat-value {
  color: var(--color-primary);
  font-size: 1.25rem;
}

.dashboard-stat-actions {
  justify-content: flex-end;
}

.dashboard-stat-sort {
  align-items: center;
}

.dashboard-sort-form {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.dashboard-sort-select {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  color: #111827;
  font-size: 0.85rem;
  padding: 0.3rem 0.45rem;
}

.dashboard-entries-wrap {
  padding: calc(var(--dashboard-bar-height) + 0.75rem) 1.25rem 0.75rem;
}

.dashboard-entries-wrap .entries-content {
  margin-top: 0;
}

.entry-overlay:empty {
  display: none;
}

.entry-overlay.is-open {
  display: flex !important;
}

.entry-overlay {
  align-items: flex-start;
  background: rgba(17, 24, 39, 0.55);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  overflow: auto;
  padding: calc(var(--app-topbar-height) + var(--dashboard-bar-height) + 1rem) 1rem 1rem;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 90;
}

html.page-overlay-open,
body.page-overlay-open {
  overflow: hidden;
}

.overlay-card {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.2);
  max-width: 56rem;
  padding: 1.25rem;
  width: min(56rem, 100%);
}

.overlay-header {
  align-items: flex-start;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.overlay-header .entry-card-icon-btn {
  flex-shrink: 0;
  opacity: 1;
  pointer-events: auto;
}

.overlay-title {
  color: var(--color-primary);
  font-family: "Noto Serif", serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.overlay-meta {
  color: #4b5563;
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.overlay-content {
  color: #1f2937;
}

.accordion-item {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 0.6rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Keep hash navigation targets visible below the fixed top bar. */
.accordion-item[id^="feed-"] {
  scroll-margin-top: calc(var(--app-topbar-height) + 1rem);
}

.accordion-header {
  align-items: center;
  cursor: pointer;
  display: flex;
  list-style: none;
  padding: 0.75rem 1rem;
}

.accordion-header::-webkit-details-marker {
  display: none;
}

.accordion-item-title {
  align-items: center;
  color: #111827;
  display: flex;
  gap: 0.75rem;
  width: 100%;
}

.shortlink {
  color: var(--color-primary);
  font-weight: 700;
  max-width: 30rem;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: underline;
  white-space: nowrap;
}

.accordion-meta-inline {
  align-items: center;
  display: inline-flex;
  gap: 0.5rem;
  margin-left: auto;
}

.accordion-pill {
  background: #e0e7ff;
  border: 1px solid #c7d2fe;
  border-radius: 9999px;
  color: #312e81;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
}

.accordion-arrow {
  border-bottom: 2px solid #4b5563;
  border-right: 2px solid #4b5563;
  display: inline-block;
  height: 0.5rem;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  width: 0.5rem;
}

.accordion-item[open] .accordion-arrow {
  transform: rotate(225deg);
}

.feeds-section-group-head {
  align-items: center;
  display: flex;
  gap: 0.6rem;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}

.feeds-section-group-title {
  color: #374151;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.feeds-section-group-count {
  background: #e5e7eb;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  color: #374151;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 0.22rem 0.5rem;
}

.linka-feed-card {
  background: #f3f4f6;
  border-color: #d1d5db;
  box-shadow: none;
}

.linka-feed-header {
  background: #f9fafb;
  border-radius: 0.6rem 0.6rem 0 0;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
}

.linka-feed-header-grid {
  display: grid;
  flex: 1;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
  min-width: 0;
}

.linka-feed-title {
  max-width: 100%;
}

.linka-feed-header-cell {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.linka-feed-header-target {
  gap: 0.1rem;
}

.linka-feed-header-label {
  color: #4b5563;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.linka-feed-header-value {
  color: #111827;
  font-size: 0.84rem;
  line-height: 1.25;
}

.linka-feed-subline {
  color: #4b5563;
  font-size: 0.72rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.linka-feed-type-pill {
  background: #e9d5ff;
  border-radius: 9999px;
  color: #6b21a8;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
  padding: 0.3rem 0.5rem;
}

.linka-feed-target-row {
  background: #e5e7eb;
  border-radius: 0 0 0.6rem 0.6rem;
  padding-top: 0.65rem;
}

.linka-target-label {
  color: #111827;
  font-size: 0.85rem;
  font-weight: 700;
  margin-right: 0.35rem;
}

.accordion-content {
  background: #f4f5f7;
  border-radius: 0 0 0.6rem 0.6rem;
  padding: 0.25rem 1rem 1rem;
}

.feed-details-inline {
  background: transparent;
  border: 0;
  padding: 0.25rem 0;
}

@media (min-width: 800px) {
  .entries-sidebar {
    height: calc(100vh - var(--app-topbar-height) - 1rem);
    left: 1.25rem;
    overflow: auto;
    position: fixed;
    top: calc(var(--app-topbar-height) + 0.5rem);
    width: 20rem;
  }

  .entries-content {
    margin-left: 21rem;
    margin-top: 0;
    min-height: calc(100vh - var(--app-topbar-height) - 1rem);
  }

  .dashboard-entries-wrap .entries-sidebar {
    height: calc(100vh - var(--app-topbar-height) - var(--dashboard-bar-height) - 3rem);
    top: calc(var(--app-topbar-height) + var(--dashboard-bar-height) + 1.5rem);
  }

  .dashboard-entries-wrap .entries-content {
    min-height: calc(100vh - var(--app-topbar-height) - var(--dashboard-bar-height) - 1rem);
  }

  .dashboard-stats-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .linka-feed-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .linka-feed-header-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .linka-feed-header .accordion-meta-inline {
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .linka-feed-header-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 1100px) {
  .app-header-right {
    width: 100%;
  }

  .app-main-nav {
    flex-wrap: wrap;
    gap: 1rem;
  }
}
