:root {
  --bg: #f5f1e6;
  --surface: #ffffff;
  --surface-2: #f0ebe0;
  --sidebar: #f7f3eb;
  --accent: #0f766e;
  --accent-2: #1f2937;
  --text: #1a1c1d;
  --muted: #6b7280;
  --border: rgba(15, 23, 42, 0.12);
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "DM Sans", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #ffffff 0%, var(--bg) 45%, #efe9dd 100%);
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(420px, 2.4fr) minmax(190px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 20px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.2);
}

.brand-title {
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.subscribe-form {
  display: flex;
  gap: 14px;
  align-items: center;
  width: min(820px, 100%);
  justify-self: center;
  background: linear-gradient(180deg, #f7f3ea, #f2ece1);
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.subscribe-form input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 15px;
  outline: none;
  min-width: 0;
}

.subscribe-form button {
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
}

.topbar-side {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-shortcuts {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
}

.topbar-shortcuts-button {
  border: none;
  background: transparent;
  color: var(--muted);
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.topbar-shortcuts-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.topbar-shortcuts-button:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.45);
  outline-offset: 2px;
}

.topbar-shortcuts-button[aria-expanded="true"] {
  color: var(--accent);
  background: rgba(15, 118, 110, 0.1);
}

.topbar-shortcuts-icon {
  width: 14px;
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
}

.topbar-shortcuts-icon span {
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.topbar-shortcuts-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 360px;
  max-width: min(520px, calc(100vw - 44px));
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  background:
    linear-gradient(145deg, rgba(248, 252, 252, 0.98), rgba(238, 247, 246, 0.96)),
    var(--surface);
  box-shadow:
    0 18px 38px rgba(15, 23, 42, 0.15),
    0 8px 16px rgba(15, 118, 110, 0.1);
  backdrop-filter: blur(6px);
  z-index: 20;
}

.topbar-shortcuts-title {
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.topbar-shortcuts-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 10px;
}

.topbar-shortcuts-grid {
  display: grid;
  gap: 8px;
}

.topbar-shortcuts-divider {
  height: 1px;
  margin: 12px 0 10px;
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.05), rgba(15, 118, 110, 0.28), rgba(15, 118, 110, 0.05));
}

.topbar-shortcuts-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.topbar-shortcuts-action {
  font-size: 13px;
  color: var(--text);
}

.topbar-shortcuts-keys {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.topbar-shortcuts kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(15, 118, 110, 0.35);
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.topbar-shortcuts-title-secondary {
  margin-bottom: 8px;
}

.topbar-shortcuts-import-form {
  margin: 0;
}

.topbar-shortcuts-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(15, 118, 110, 0.35);
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.25;
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  text-decoration: none;
  cursor: pointer;
}

.topbar-shortcuts-control:hover {
  background: rgba(15, 118, 110, 0.18);
}

.topbar-shortcuts-control:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.45);
  outline-offset: 2px;
}

.topbar-shortcuts-control-button {
  appearance: none;
  cursor: pointer;
}

.message {
  max-width: 180px;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message:empty {
  display: none;
}

.message.success {
  color: var(--accent);
}

.message.error {
  color: #b91c1c;
}

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  flex: 1;
  gap: 24px;
  padding: 24px 28px 32px;
}

@media (min-width: 961px) {
  .app:has(#feed-list .feed-list.edit-mode) {
    grid-template-columns: 380px 1fr;
  }
}

.sidebar-pane,
.content-pane {
  min-height: 0;
}

.sidebar {
  background: var(--sidebar);
  border-radius: 20px;
  padding: 20px 16px;
  border: 1px solid var(--border);
  height: fit-content;
  position: sticky;
  top: 110px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 12px;
}

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

.feed-edit-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.feed-edit-actions .chip {
  padding: 4px 10px;
  font-size: 11px;
}

.sidebar-count {
  font-size: 12px;
  color: var(--muted);
  background: rgba(15, 118, 110, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
}

.edit-feeds-button {
  border: none;
  background: transparent;
  color: var(--muted);
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 0;
  box-shadow: none;
}

.edit-feeds-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.feed-list.edit-mode .feed-row {
  border-radius: 12px;
}

.feed-list.edit-mode .feed-row.dragging {
  opacity: 0.55;
}

.feed-drag-handle {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0;
  border-radius: 8px;
  cursor: grab;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.feed-drag-handle:active {
  cursor: grabbing;
}

.feed-drag-handle:hover {
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent);
}

.feed-drag-handle:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.45);
  outline-offset: 2px;
}

.feed-drag-handle .icon {
  width: 16px;
  height: 16px;
}

.feed-delete-toggle {
  display: none;
}

.feed-remove {
  display: none;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.feed-list.edit-mode .feed-remove {
  display: inline-flex;
}

.feed-list.edit-mode .feed-row.pending-delete .feed-remove {
  border-radius: 50%;
  background: rgba(185, 28, 28, 0.12);
}

.feed-remove:hover {
  transform: scale(1.05);
}

.feed-edit-form {
  margin: 0;
}

.feed-edit-title {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  background: transparent;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-2);
}

.feed-edit-title:focus {
  outline: none;
  background: var(--surface);
  border-color: rgba(15, 118, 110, 0.25);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.08);
}

.feed-edit-title.active {
  background: rgba(15, 118, 110, 0.06);
  border-color: rgba(15, 118, 110, 0.2);
}

.feed-list.edit-mode .feed-row.pending-delete .feed-edit-title {
  color: #7f1d1d;
  text-decoration: line-through;
  opacity: 0.72;
}

.feed-title-revert {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: all 0.2s ease;
}

.feed-title-revert:hover {
  background: var(--surface);
  border-color: rgba(15, 118, 110, 0.2);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.08);
}

.feed-title-revert:focus-visible {
  outline: none;
  background: var(--surface);
  border-color: rgba(15, 118, 110, 0.25);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.08);
}

.feed-title-revert .icon {
  width: 18px;
  height: 18px;
}

.feed-list.edit-mode .feed-row.pending-delete .feed-title-revert {
  opacity: 0.35;
  pointer-events: none;
}

.feed-delete-pending {
  display: none;
  flex-basis: 100%;
  margin-left: 28px;
  font-size: 12px;
  color: #7f1d1d;
  font-weight: 600;
}

.feed-list.edit-mode .feed-row.pending-delete .feed-delete-pending {
  display: inline-flex;
}

.icon {
  width: 18px;
  height: 18px;
  display: block;
}

.edit-feeds-button .icon {
  width: 16px;
  height: 16px;
}

.feed-remove .icon {
  width: 20px;
  height: 20px;
}

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

.feed-link {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 10px 12px;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  flex: 1;
  min-width: 0;
}

.feed-link:hover,
.feed-link.active {
  background: var(--surface);
  border-color: rgba(15, 118, 110, 0.2);
  box-shadow: 0 10px 24px rgba(15, 118, 110, 0.08);
}

.feed-title {
  font-weight: 600;
  color: var(--accent-2);
  line-height: 1.3;
}

.feed-count {
  font-size: 11px;
  color: var(--muted);
}

.feed-empty {
  font-size: 13px;
  color: var(--muted);
  padding: 12px;
}

.feed-more-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-more-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feed-more-button {
  list-style: none;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  border: 1px solid rgba(15, 118, 110, 0.3);
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.feed-more-button::-webkit-details-marker {
  display: none;
}

.feed-more-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.12);
}

.feed-more-label-expanded {
  display: none;
}

.feed-zero-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.feed-more-details[open] .feed-more-label-collapsed {
  display: none;
}

.feed-more-details[open] .feed-more-label-expanded {
  display: inline;
}

.feed-more-details[open] .feed-zero-list {
  display: flex;
}

.content {
  background: var(--surface);
  border-radius: 24px;
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: none;
}

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

.items-title {
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-size: 22px;
  font-weight: 700;
}

.items-meta {
  font-size: 12px;
  color: var(--muted);
}

.items-observability {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.items-refresh-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.items-refresh-button {
  border: none;
  background: transparent;
  color: var(--muted);
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.items-refresh-button .icon {
  width: 16px;
  height: 16px;
}

.items-refresh-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.items-refresh-button:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.45);
  outline-offset: 2px;
}

.items-error {
  color: #b42318;
  font-weight: 600;
}

.item-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item-list:focus {
  outline: none;
}

.new-items-banner {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.new-items-banner.hidden {
  display: none;
}

.new-items-button {
  border: none;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.poller {
  display: none;
}

.item-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  background: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  scroll-margin-top: 140px;
}

.item-card.compact {
  padding: 10px 14px;
}

.item-card.clickable {
  cursor: pointer;
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.item-card.is-active {
  border-color: rgba(15, 118, 110, 0.6);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16), 0 12px 26px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.item-card.is-read {
  opacity: 0.7;
}

.item-card.expanded {
  background: linear-gradient(120deg, #ffffff 0%, #f6f7f9 100%);
}

.item-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.item-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

.item-title-row .item-title {
  min-width: 0;
}

.item-time-badge {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(100, 116, 139, 0.7);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.item-row.clickable {
  cursor: pointer;
}

.item-title {
  font-weight: 600;
  color: var(--accent-2);
  text-decoration: none;
  line-height: 1.4;
}

.item-title:hover {
  text-decoration: underline;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

.chip.danger {
  background: #b91c1c;
}

.chip.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(15, 118, 110, 0.3);
}

.items-sweep-button {
  border: none;
  background: transparent;
  color: var(--muted);
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 0;
  box-shadow: none;
}

.items-sweep-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.items-sweep-button:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.45);
  outline-offset: 2px;
}

.items-sweep-button .icon {
  width: 16px;
  height: 16px;
}

.item-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.item-summary {
  margin-top: 14px;
  line-height: 1.6;
  color: #374151;
}

.item-summary p {
  margin: 0 0 0.9em;
}

.item-summary a {
  color: var(--accent);
}

.item-summary img {
  max-width: 100%;
  max-height: 420px;
  height: auto;
  width: auto;
  object-fit: contain;
  border-radius: 12px;
}

.item-summary h1,
.item-summary h2,
.item-summary h3 {
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  margin-top: 1em;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty-state h2,
.empty-state h3 {
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  color: var(--accent-2);
  margin-bottom: 8px;
}

.empty-state.small {
  padding: 32px 16px;
}

.auth-shell {
  max-width: 40rem;
  margin: 4rem auto;
}

.auth-shell-wide {
  max-width: 48rem;
}

.auth-shell .message {
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  white-space: normal;
  overflow: visible;
}

.auth-message {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.auth-section {
  margin-top: 2rem;
}

.modal {
  border: none;
  border-radius: 18px;
  padding: 0;
  width: min(420px, 92vw);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 22px;
  background: var(--surface);
  color: var(--text);
}

.modal-card h3 {
  margin: 0;
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  font-size: 18px;
}

.modal-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.modal-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .topbar-side {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .topbar-shortcuts {
    width: 100%;
    align-items: flex-start;
  }

  .topbar-shortcuts-panel {
    position: static;
    min-width: 0;
    max-width: 100%;
    margin-top: 8px;
  }

  .message {
    text-align: left;
    max-width: 100%;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .sidebar-pane,
  .content-pane {
    overflow: visible;
  }

  .sidebar {
    position: static;
  }
}

@media (min-width: 961px) {
  body {
    height: 100vh;
    overflow: hidden;
  }

  .page {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .app {
    min-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
  }

  .sidebar-pane,
  .content-pane {
    min-height: 0;
    padding-top: 24px;
    padding-bottom: 32px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .sidebar-pane::-webkit-scrollbar,
  .content-pane::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }

  .sidebar {
    position: static;
    top: auto;
  }
}

@media (max-width: 640px) {
  .subscribe-form {
    flex-direction: column;
    align-items: stretch;
    border-radius: 16px;
  }

  .subscribe-form button {
    width: 100%;
  }

  .item-row {
    flex-direction: column;
  }

  .item-actions {
    justify-content: flex-start;
  }
}
