:root {
  --pane-bar-height: 2.75rem;
  --app-bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #f8f9fb;
  --pane-bar-bg: #f8f9fb;
  --topbar-bg: #eaecf0;
  --content-bg: #faf9f6;
  --grid-line: #dde1e7;
  --text: #2f343d;
  --muted: #7b8491;
  --selected-day-bg: #3d4552;
  --day-tile-bg: #eef0f4;
  --selected-artifact-bg: #eaf3ff;
  --selected-artifact-rail: #dcecff;
  --control-border: #d9dee6;
  /* Neutrals/accents that were previously hardcoded in rules, pulled into
     variables so the dark override below can flip them in one place. */
  --accent: #3d4552;
  --accent-border: #343b46;
  --on-accent: #ffffff;
  --control-bg: #f0f2f5;
  --row-hover: #f6f9fd;
  --time-rail-bg: #f3f5f7;
  --splitter-hover: #b8c0cc;
  --scrollbar-thumb: rgba(61, 69, 82, 0.35);
  --focus-ring: #8ab4f8;
  /* Semantic accents (success = kept, info = shared, today, danger). */
  --success-bg: #eaf7ed;
  --success-text: #28583a;
  --success-border: #9bd4ab;
  --info-bg: #eaf2fb;
  --info-text: #1d4d85;
  --info-border: #9cc0ed;
  --today-bg: #d8f1df;
  --today-text: #245238;
  --danger-bg: #fdecea;
  --danger-text: #a3312a;
  --danger-text-plain: #c14f4f;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--app-bg);
  color: var(--text);
}

[data-theme="dark"] {
  --app-bg: #15171c;
  --surface: #1d2026;
  --surface-alt: #242832;
  --pane-bar-bg: #242832;
  --topbar-bg: #191c21;
  --content-bg: #16181d;
  --grid-line: #333842;
  --text: #e3e6eb;
  --muted: #99a2b0;
  --selected-day-bg: #4a6ea8;
  --day-tile-bg: #2a2f3a;
  --selected-artifact-bg: #26344a;
  --selected-artifact-rail: #32405a;
  --control-border: #3a404b;
  --accent: #4a6ea8;
  --accent-border: #3d5a8a;
  --on-accent: #ffffff;
  --control-bg: #2a2f3a;
  --row-hover: #262b34;
  --time-rail-bg: #22262e;
  --splitter-hover: #4a525f;
  --scrollbar-thumb: rgba(160, 170, 190, 0.35);
  --focus-ring: #8ab4f8;
  --success-bg: #1e3a2a;
  --success-text: #7fce9c;
  --success-border: #2f5a40;
  --info-bg: #1c3050;
  --info-text: #8fb8e8;
  --info-border: #34517d;
  --today-bg: #1e3a2a;
  --today-text: #7fce9c;
  --danger-bg: #3a2020;
  --danger-text: #e89b95;
  --danger-text-plain: #e89b95;
  color-scheme: dark;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.topbar {
  align-items: center;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--grid-line);
  color: var(--text);
  display: grid;
  flex: 0 0 auto;
  gap: 0;
  grid-template-columns: max-content 1fr max-content;
  padding: 0;
}

.topbar-actions {
  align-items: center;
  display: flex;
  gap: 0.4rem;
  padding: 0.32rem 0.8rem;
  position: relative;
}

.icon-button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
}

.icon-button:hover {
  background: var(--surface);
  border-color: var(--control-border);
}

.avatar-button {
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  line-height: 0;
  padding: 2px;
}

.avatar-button:hover .avatar,
.avatar-button:focus-visible .avatar {
  box-shadow: 0 0 0 2px var(--content-bg), 0 0 0 4px var(--control-border);
}

.avatar {
  align-items: center;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 600;
  height: 2rem;
  justify-content: center;
  line-height: 1;
  width: 2rem;
}

.user-menu-name {
  border-bottom: 1px solid var(--control-border);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  padding: 0.5rem 0.8rem;
}

.user-menu-dropdown {
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  min-width: 10rem;
  position: absolute;
  right: 0.8rem;
  top: calc(100% + 4px);
  z-index: 20;
}

.user-menu-dropdown[hidden] {
  display: none;
}

.user-menu-dropdown a,
.user-menu-dropdown button {
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.5rem 0.8rem;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover {
  background: var(--surface-alt);
}

.user-menu-dropdown form {
  margin: 0;
}

.brandline {
  align-items: center;
  display: flex;
  gap: 0.55rem;
  padding: 0.38rem 0.8rem;
}

.brand-link {
  align-items: center;
  color: inherit;
  display: flex;
  gap: 0.45rem;
  text-decoration: none;
}

.brand-logo {
  height: 2rem;
  width: auto;
}

.brand-link:hover {
  opacity: 0.75;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin: 0 0 0.18rem;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(1.2rem, 2vw, 1.75rem);
  line-height: 1;
  margin: 0;
}

.toolbar {
  align-items: center;
  align-self: stretch;
  background: var(--topbar-bg);
  display: flex;
  gap: 0.45rem;
  justify-content: center;
  min-width: 0;
  padding: 0.32rem 0.6rem;
}

.filter {
  align-items: end;
  display: flex;
  gap: 0.35rem;
}

.filter label {
  color: var(--muted);
  display: grid;
  font-size: 0.68rem;
  gap: 0.08rem;
}

.filter select,
.filter input {
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  padding: 0.32rem 0.62rem;
}

.filter input {
  width: 9rem;
}

.filter button {
  background: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 4px;
  color: var(--on-accent);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0.32rem 0.7rem;
}

.view-toggle {
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: 4px;
  display: flex;
  padding: 0.12rem;
}

.view-toggle a {
  border-radius: 3px;
  color: var(--text);
  font-size: 0.76rem;
  padding: 0.3rem 0.58rem;
  text-decoration: none;
}

.view-toggle a.selected {
  background: var(--accent);
  color: var(--on-accent);
}

.feed {
  --artifacts-width: 280px;
  --days-width: 144px;
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: var(--days-width) 1px var(--artifacts-width) 1px minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.source-sidebar,
.artifact-sidebar,
.preview-pane {
  min-width: 0;
  padding: 0;
}

.source-sidebar,
.artifact-sidebar {
  min-height: 0;
  overflow-x: hidden;
  scrollbar-color: transparent transparent;
  scrollbar-width: none;
}

.source-sidebar {
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
}

.artifact-sidebar {
  display: flex;
  flex-direction: column;
  overflow-y: hidden;
  padding: 0;
}

.source-list,
.artifact-list {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Source sidebar: scrollbar hidden until hover (short list, rarely scrolls). */
.source-list {
  flex: 1 1 auto;   /* fill available height so system folders pin to the bottom */
  scrollbar-color: transparent transparent;
  scrollbar-width: none;
}

.source-sidebar:hover .source-list {
  scrollbar-color: var(--scrollbar-thumb) transparent;
  scrollbar-width: thin;
}

.source-list::-webkit-scrollbar {
  width: 0;
}

.source-sidebar:hover .source-list::-webkit-scrollbar {
  width: 6px;
}

/* Artifact list: scrollbar always visible so it doesn't jump on hover. */
.artifact-list {
  scrollbar-color: var(--scrollbar-thumb) transparent;
  scrollbar-width: thin;
}

.artifact-list::-webkit-scrollbar {
  width: 8px;
}

.source-list::-webkit-scrollbar-thumb,
.artifact-list::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
}

.source-list::-webkit-scrollbar-track,
.artifact-list::-webkit-scrollbar-track {
  background: transparent;
}

.source-sidebar {
  background: var(--surface-alt);
}

/* Grey like the source sidebar; the artifact rows themselves stay white
   (they set --surface), so they read as cards floating on the grey. */
.artifact-sidebar {
  background: var(--surface-alt);
}

.preview-pane {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  padding: 0;
}

.splitter {
  background: var(--grid-line);
  cursor: col-resize;
  position: relative;
  touch-action: none;
}

.splitter::after {
  background: transparent;
  bottom: 0;
  content: "";
  left: -4px;
  position: absolute;
  right: -4px;
  top: 0;
}

.splitter:hover,
.is-resizing .splitter {
  background: var(--splitter-hover);
}

.is-resizing {
  cursor: col-resize;
  user-select: none;
}

.source-sidebar h2,
.pane-heading h2 {
  color: var(--text);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  margin: 0;
  text-transform: uppercase;
}

.source-list {
  display: grid;
}

.source-list {
  align-content: start;
  flex: 1 1 auto;
  gap: 0.35rem;
  padding: 0.55rem;
}

.source-link,
.artifact-row {
  color: inherit;
  text-decoration: none;
}

.source-link {
  align-items: center;
  background: var(--day-tile-bg);
  border-radius: 6px;
  display: flex;
  gap: 0.4rem;
  justify-content: space-between;
  padding: 0.45rem 0.55rem;
}

.source-link:hover {
  background: var(--surface);
  box-shadow: none;
}

.source-link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.source-link.selected {
  background: var(--selected-day-bg);
  color: var(--on-accent);
}

.source-link.selected .source-name,
.source-link.selected .source-count {
  color: var(--on-accent);
}

.source-name {
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-count {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 0.7rem;
}

/* The unread badge doubles as a "mark all as read" button. */
.source-count[data-mark-read] {
  cursor: pointer;
  border-radius: 8px;
  padding: 0 0.35rem;
}

.source-count[data-mark-read]:hover {
  background: rgba(74, 110, 168, 0.28);
  color: var(--text);
}

.pane-heading span,
.artifact-time {
  color: var(--muted);
  font-size: 0.7rem;
}

.day-separator {
  align-items: center;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--grid-line);
  color: var(--muted);
  display: flex;
  font-size: 0.7rem;
  font-weight: 700;
  justify-content: space-between;
  letter-spacing: 0.04em;
  padding: 0.32rem 0.55rem;
  position: sticky;
  text-transform: uppercase;
  top: 0;
  z-index: 5;
}

.day-separator-count {
  font-weight: 400;
}

.feed-more {
  height: 1px;
}

.today-badge {
  background: var(--today-bg);
  border-radius: 999px;
  color: var(--today-text);
  display: inline-block;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 500;
  margin-left: 0.35rem;
  padding: 0.08rem 0.38rem;
}


.pane-bar {
  align-items: baseline;
  background: var(--pane-bar-bg);
  box-sizing: border-box;
  display: flex;
  flex: 0 0 var(--pane-bar-height);
  gap: 0.55rem;
  height: var(--pane-bar-height);
  justify-content: space-between;
  margin: 0;
  min-height: var(--pane-bar-height);
  padding: 0 0.65rem;
}

.pane-heading,
.preview-actions {
  border-bottom: 1px solid var(--grid-line);
}

.source-sidebar .pane-bar,
.artifact-sidebar .pane-bar {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.artifact-sidebar .pane-heading {
  flex-direction: column;
  gap: 0.04rem;
}

.artifact-list {
  align-content: start;
  flex: 1 1 auto;
}

.artifact-row {
  align-items: stretch;
  background: var(--surface);
  border: 0;
  border-bottom: 1px solid var(--grid-line);
  border-radius: 0;
  display: grid;
  gap: 0;
  grid-template-columns: 3.15rem minmax(0, 1fr) 7rem;
  min-height: 2.7rem;
  overflow: hidden;
  padding: 0;
}

/* When a single source is selected, the per-row source column is redundant
   (every row has the same source), so drop it and give the space back to the
   title. Shown only under "All sources". */
.artifact-list.no-source-col .artifact-row {
  grid-template-columns: 3.15rem minmax(0, 1fr);
}

.artifact-list.no-source-col .artifact-source {
  display: none;
}

.artifact-list.no-source-col .artifact-row-main {
  border-right: 0;
}

.artifact-row:hover {
  background: var(--row-hover);
  box-shadow: none;
}

.artifact-row:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 1px var(--focus-ring);
}

.artifact-row.selected {
  background: var(--selected-artifact-bg);
  color: var(--text);
}

.artifact-row.selected .artifact-time {
  background: var(--selected-artifact-rail);
}

.artifact-row.selected .artifact-title,
.artifact-row.selected .artifact-time {
  color: var(--text);
}

.artifact-row-main {
  align-items: center;
  border-right: 1px solid var(--grid-line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
  min-width: 0;
  padding: 0.42rem 0.55rem;
}

.artifact-row.unread .artifact-title {
  font-weight: 700;
}

.artifact-row.unread .artifact-source {
  color: var(--text);
}

.artifact-row-main > .artifact-title {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--text);
  display: -webkit-box;
  font-size: 0.86rem;
  overflow: hidden;
}

.artifact-kind-text {
  background: var(--day-tile-bg);
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.68rem;
  padding: 0.1rem 0.34rem;
  white-space: nowrap;
}

.kept-badge {
  align-items: center;
  background: var(--success-bg);
  border-radius: 4px;
  color: var(--success-text);
  display: inline-flex;
  font-size: 0.66rem;
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  padding: 0.14rem 0.3rem;
  white-space: nowrap;
}

.kept-badge[hidden] {
  display: none;
}

.shared-badge {
  align-items: center;
  background: var(--info-bg);
  border-radius: 4px;
  color: var(--info-text);
  display: inline-flex;
  font-size: 0.66rem;
  font-weight: 700;
  justify-content: center;
  line-height: 1;
  padding: 0.14rem 0.3rem;
  white-space: nowrap;
}

.shared-badge[hidden] {
  display: none;
}

.artifact-source {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.72rem;
  overflow: hidden;
  padding: 0.42rem 0.55rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.24rem;
}

.tag-chip {
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 600;
  line-height: 1;
  padding: 0.18rem 0.44rem;
  white-space: nowrap;
}

.artifact-time {
  align-items: center;
  background: var(--time-rail-bg);
  border-right: 1px solid var(--grid-line);
  display: flex;
  justify-content: flex-end;
  justify-self: stretch;
  line-height: 1;
  padding: 0 0.48rem;
  text-align: right;
  white-space: nowrap;
}

.empty {
  background: var(--surface);
  border-radius: 16px;
  padding: 1.2rem;
}

.empty.compact {
  padding: 1rem;
}

.empty.compact h3,
.preview-empty h2 {
  margin-top: 0;
}

.preview-empty {
  max-width: 34rem;
}

kbd {
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: 4px;
  color: var(--text);
  font: 0.85em ui-monospace, SFMono-Regular, Consolas, monospace;
  padding: 0.08rem 0.28rem;
}

.preview-body {
  align-items: stretch;
  background: var(--content-bg);
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.preview-body > .preview-empty {
  align-self: center;
  margin: auto;
}

.preview-frame-wrap {
  align-items: center;
  display: flex;
  flex: 1;
  justify-content: center;
  min-height: 0;
}

.preview-actions {
  align-items: center;
  background: var(--pane-bar-bg);
  display: flex;
  flex: 0 0 auto;
  gap: 0.75rem;
  justify-content: space-between;
  justify-content: space-between;
}

.preview-title {
  color: var(--text);
  flex: 1 1 auto;
  font-size: 0.78rem;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-actions .view-toggle,
.preview-actions .artifact-action-links {
  flex: 0 0 auto;
}

.artifact-action-links {
  align-items: center;
  display: flex;
  gap: 0.35rem;
}

.artifact-action-links a,
.artifact-action-links button {
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  line-height: 1;
  padding: 0.42rem 0.65rem;
  text-decoration: none;
}

.view-toggle a.disabled,
.artifact-action-links a.disabled {
  cursor: not-allowed;
  opacity: 0.48;
  pointer-events: none;
}

.artifact-action-links button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.preview-frame {
  background: #fff;
  border: 0;
  height: 100%;
  width: 100%;
}

.preview-image {
  background: #fff;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

@media (max-width: 720px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .topbar {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .toolbar,
  .filter,
  .preview-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .feed {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .splitter {
    display: none;
  }

  .source-sidebar,
  .artifact-sidebar {
    border-bottom: 1px solid var(--grid-line);
    border-right: 0;
    max-height: 32vh;
  }
}

.login-page {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  overflow: auto;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 2rem;
  width: 20rem;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.login-card label span {
  color: var(--muted);
  font-size: 0.78rem;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  border: 1px solid var(--control-border);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
}

.login-remember {
  align-items: center;
  flex-direction: row !important;
  gap: 0.5rem !important;
}

.login-error {
  color: var(--danger-text-plain);
  font-size: 0.82rem;
}

.settings-layout {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: 14rem 1fr;
  min-height: 0;
  overflow: auto;
}

.settings-nav {
  background: var(--surface-alt);
  border-right: 1px solid var(--grid-line);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.6rem;
}

.settings-nav a {
  border-radius: 6px;
  color: var(--text);
  padding: 0.5rem 0.7rem;
  text-decoration: none;
}

.settings-nav a:hover {
  background: var(--surface);
}

.settings-nav a.selected {
  background: var(--day-tile-bg);
  font-weight: 600;
}

.settings-nav-back {
  border-bottom: 1px solid var(--grid-line);
  color: var(--muted) !important;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.7rem !important;
}

.settings-nav-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.9rem;
}

.settings-nav-heading {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.7rem;
  text-transform: uppercase;
}

.settings-panel {
  max-width: 42rem;
  padding: 1.6rem 2rem;
}

.settings-messages {
  background: var(--success-bg);
  border-radius: 8px;
  color: var(--success-text);
  list-style: none;
  margin: 0 0 1.2rem;
  padding: 0.6rem 0.9rem;
}

.token-value {
  background: var(--surface-alt);
  border-radius: 6px;
  display: inline-block;
  padding: 0.4rem 0.6rem;
  word-break: break-all;
}

.muted {
  color: var(--muted);
}

/* Newly live-inserted feed rows briefly highlight, then settle. */
@keyframes agentfeed-row-arrive {
  from { background: var(--surface-alt); }
  to { background: transparent; }
}

.artifact-row.just-arrived {
  animation: agentfeed-row-arrive 1.5s ease-out;
}

/* Hover/focus row actions (delete in the feed, undelete in Trash) */
.artifact-row {
  position: relative;
}

.row-actions {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.15rem;
  opacity: 0;
}

.artifact-row:hover .row-actions,
.artifact-row:focus-within .row-actions {
  opacity: 1;
}

.row-action {
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
}

.row-action:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.row-delete:hover {
  color: var(--danger-text-plain);
}

/* Per-row actions menu (opened by the ⋯ trigger or right-click) */
.row-menu {
  position: fixed;
  z-index: 100;
  min-width: 9rem;
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
}

.row-menu[hidden] {
  display: none;
}

.row-menu button {
  background: transparent;
  border: 0;
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.row-menu button:hover {
  background: var(--surface-alt);
}

.row-menu button.danger {
  color: var(--danger-text-plain);
}

.row-menu-divider {
  border-top: 1px solid var(--grid-line);
  margin: 0.25rem 0;
}

.row-menu-labels {
  display: flex;
  flex-direction: column;
  max-height: 13rem;
  overflow-y: auto;
}

.row-menu-label {
  align-items: center;
  display: flex;
  gap: 0.45rem;
}

.row-menu-dot {
  border-radius: 50%;
  flex: 0 0 auto;
  height: 0.7rem;
  width: 0.7rem;
}

.row-menu-label-name {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Checkmark only visible once the label is applied to the row. */
.row-menu-check {
  flex: 0 0 auto;
  opacity: 0;
}

.row-menu-label.applied .row-menu-check {
  opacity: 1;
}

/* System folders (Keep / Deleted): pinned at the bottom of the sidebar,
   below the scrolling source list. */
.system-folders {
  border-top: 1px solid var(--grid-line);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 0.25rem;   /* space Keep / Deleted apart */
  padding: 0.4rem 0.6rem 0.3rem;
}

/* "Special" sidebar entries — "All sources" and the Keep/Deleted folders —
   share a distinct look (bold + subtle blue tint) to set them apart from the
   individual sources. */
.all-sources-link,
.folder-link {
  font-weight: 600;
}

.all-sources-link:not(.selected),
.folder-link:not(.selected) {
  background: rgba(74, 110, 168, 0.14);
}

.all-sources-link:not(.selected):hover,
.folder-link:not(.selected):hover {
  background: rgba(74, 110, 168, 0.22);
}

.empty-trash-button {
  background: var(--danger-bg);
  border: 1px solid var(--danger-text);
  border-radius: 6px;
  color: var(--danger-text);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0.2rem 0.55rem;
}

.api-key-create {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.api-key-create label {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  gap: 0.3rem;
}

.password-change {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 22rem;
}

.password-change .form-field {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  gap: 0.3rem;
}

.password-change button {
  align-self: start;
}

.form-errors {
  color: var(--danger, #d1453b);
  font-weight: 400;
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0;
}

.api-key-table {
  border-collapse: collapse;
  width: 100%;
}

.api-key-table th,
.api-key-table td {
  border-bottom: 1px solid var(--accent-border);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: middle;
}

.api-key-table th {
  color: var(--muted);
  font-size: 0.85em;
  font-weight: 600;
}

.api-key-cell {
  align-items: center;
  display: flex;
  gap: 0.5rem;
}

.api-key-cell .token-value {
  font-size: 0.85em;
}

.api-key-copy {
  flex-shrink: 0;
}

.api-key-revoke {
  background: var(--danger-bg);
  border: 1px solid var(--danger-text);
  color: var(--danger-text);
}

.about-head {
  align-items: center;
  display: flex;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.about-head h2 {
  margin: 0;
}

.about-logo {
  height: 3rem;
  width: auto;
}

.about-version {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.15rem 0 0;
}

.keep-button.kept {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success-text);
}

.share-button.shared {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info-text);
}

.share-link-box {
  align-items: center;
  display: flex;
  gap: 0.35rem;
  padding: 0 0.9rem 0.6rem;
}

.share-link-box[hidden] {
  display: none;
}

.share-link-box input {
  background: var(--surface-alt);
  border: 1px solid var(--control-border);
  border-radius: 4px;
  color: var(--muted);
  flex: 1 1 auto;
  font: inherit;
  font-size: 0.76rem;
  padding: 0.35rem 0.55rem;
}

.share-link-box button {
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  padding: 0.35rem 0.65rem;
}

.details-panel {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--grid-line);
  flex: 0 0 auto;
  max-height: 40%;
  overflow-y: auto;
  padding: 0.7rem 1rem;
}

.details-grid {
  display: grid;
  gap: 0.25rem 1rem;
  grid-template-columns: max-content 1fr;
  margin: 0;
}

.details-grid dt {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.details-grid dd {
  font-size: 0.82rem;
  margin: 0;
  word-break: break-word;
}

.usage-bar {
  background: var(--day-tile-bg);
  border-radius: 999px;
  height: 0.75rem;
  margin: 0.5rem 0;
  overflow: hidden;
}

.usage-bar-fill {
  background: #5aa552;
  border-radius: 999px;
  height: 100%;
  transition: width 0.3s ease;
}

.usage-bar-fill--warn {
  background: #d98b2b;
}

.usage-bar-fill--full {
  background: #c14f4f;
}

.usage-summary {
  font-size: 0.9rem;
}

.storage-facts {
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.7;
  padding-left: 1.1rem;
}

.storage-note {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.storage-warning {
  background: var(--danger-bg);
  border-radius: 8px;
  color: var(--danger-text);
  font-size: 0.85rem;
  padding: 0.6rem 0.9rem;
}
