.explorer-page {
  max-width: 1240px;
}

.explorer-intro {
  max-width: 760px;
  margin-bottom: 26px;
}

.explorer-intro h1 {
  margin: 0 0 10px;
}

.explorer-intro > p:last-child {
  color: var(--muted);
}

.explorer-search {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 0.28fr) minmax(140px, 0.24fr) auto auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 28, 32, 0.86);
}

.explorer-search-field,
.explorer-select-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.explorer-search label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.explorer-search input,
.explorer-search select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #111417;
  color: var(--text);
  font: inherit;
}

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

.explorer-search-button,
.explorer-clear {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #071311;
  cursor: pointer;
  font-weight: 700;
}

.explorer-search-button:hover,
.explorer-search-button:focus,
.explorer-clear:hover,
.explorer-clear:focus {
  background: #72d8ca;
  color: #071311;
}

.explorer-clear {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

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

.explorer-shell {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 20, 23, 0.78);
  box-shadow: var(--shadow);
}

.explorer-breadcrumbs ol {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.explorer-breadcrumbs li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.explorer-breadcrumbs li:not(:last-child)::after {
  content: "/";
  color: var(--subtle);
}

.explorer-breadcrumbs a,
.explorer-breadcrumbs span {
  padding: 4px 6px;
  border-radius: 4px;
}

.explorer-breadcrumbs span[aria-current="page"] {
  color: var(--text);
  background: var(--surface-strong);
}

.explorer-toolbar,
.explorer-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.explorer-toolbar {
  margin: 14px 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.explorer-status {
  margin: 0;
  color: var(--muted);
}

.explorer-status[data-state="error"],
.explorer-status[data-state="warning"] {
  color: #ffd898;
}

.explorer-view-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #111417;
}

.explorer-view-toggle button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.explorer-view-toggle button[aria-pressed="true"] {
  background: var(--surface-strong);
  color: #ffffff;
}

.explorer-folders {
  margin-bottom: 28px;
}

.explorer-folders h2,
.explorer-section-heading h2 {
  margin: 0 0 12px;
}

.explorer-folders ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.explorer-folder-card {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.explorer-folder-card:hover,
.explorer-folder-card:focus {
  border-color: var(--accent-blue);
  background: var(--surface-hover);
  color: #ffffff;
  transform: translateY(-1px);
}

.explorer-folder-card > i {
  color: var(--accent-amber);
  text-align: center;
}

.explorer-folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.explorer-section-heading {
  align-items: end;
  margin-bottom: 12px;
}

.explorer-section-heading .eyebrow {
  margin-bottom: 5px;
}

.explorer-section-heading h2 {
  margin-bottom: 0;
}

.explorer-result-count {
  color: var(--muted);
  font-size: 0.9rem;
}

.explorer-note-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.explorer-note-list[data-view="grid"] {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.explorer-note-card {
  min-width: 0;
}

.explorer-note-link {
  display: flex;
  height: 100%;
  min-height: 118px;
  flex-direction: column;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.explorer-note-link:hover,
.explorer-note-link:focus {
  border-color: var(--accent-blue);
  background: var(--surface-hover);
  color: #ffffff;
}

.explorer-note-link h3 {
  margin: 0 0 7px;
  font-size: 1.08rem;
}

.explorer-note-link p {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 0.92rem;
}

.explorer-note-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  color: var(--subtle);
  font-size: 0.78rem;
}

.explorer-badge {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #111417;
}

.explorer-badge-archived {
  border-color: rgba(242, 185, 95, 0.5);
  color: #ffd898;
}

.explorer-empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-align: center;
}

.explorer-static-fallback {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(24, 28, 32, 0.72);
}

.explorer-static-fallback summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.explorer-static-fallback ul {
  columns: 3 240px;
  margin: 14px 0 0;
  padding-left: 20px;
}

.explorer-static-fallback li {
  break-inside: avoid;
  margin-bottom: 6px;
}

@media (max-width: 900px) {
  .explorer-search {
    grid-template-columns: minmax(0, 1fr) minmax(150px, 0.4fr);
  }

  .explorer-search-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .explorer-search {
    grid-template-columns: 1fr;
  }

  .explorer-search-field {
    grid-column: auto;
  }

  .explorer-search-button,
  .explorer-clear {
    width: 100%;
  }

  .explorer-shell {
    padding: 14px;
  }

  .explorer-toolbar,
  .explorer-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .explorer-view-toggle {
    width: 100%;
  }

  .explorer-view-toggle button {
    flex: 1;
    justify-content: center;
  }

  .explorer-folders ul,
  .explorer-note-list[data-view="grid"] {
    grid-template-columns: 1fr;
  }
}

html[data-theme="light"] .explorer-search,
html[data-theme="light"] .explorer-shell,
html[data-theme="light"] .explorer-static-fallback {
  background: rgba(255, 255, 255, 0.94);
}

html[data-theme="light"] .explorer-search input,
html[data-theme="light"] .explorer-search select,
html[data-theme="light"] .explorer-view-toggle,
html[data-theme="light"] .explorer-badge {
  background: #f8fafc;
}

html[data-theme="light"] .explorer-folder-card:hover,
html[data-theme="light"] .explorer-folder-card:focus,
html[data-theme="light"] .explorer-note-link:hover,
html[data-theme="light"] .explorer-note-link:focus,
html[data-theme="light"] .explorer-view-toggle button[aria-pressed="true"] {
  color: #17212b;
}

html[data-theme="light"] .explorer-status[data-state="error"],
html[data-theme="light"] .explorer-status[data-state="warning"],
html[data-theme="light"] .explorer-badge-archived {
  color: #734500;
}
