:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --ink: #171b1c;
  --muted: #667174;
  --panel: #ffffff;
  --line: #d9ddd6;
  --deep: #182221;
  --teal: #0f8b7f;
  --lime: #c8f24a;
  --amber: #e8a336;
  --red: #c64b45;
  --blue: #3f6ed3;
  --shadow: 0 18px 46px rgba(29, 34, 33, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  padding: 2px 5px;
  border-radius: 6px;
  background: #eef1ea;
  font-size: 0.92em;
}

.app-shell {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  min-height: 100vh;
}

.home-mode .app-shell,
.results-mode .home-screen {
  display: none;
}

.home-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
  background: #fbfcf8;
}

.home-search {
  display: grid;
  width: min(760px, 100%);
  justify-items: center;
  gap: 24px;
  transform: translateY(-6vh);
}

.home-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(44px, 7vw, 78px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.home-wordmark span:nth-child(1) {
  color: #2f6fdf;
}

.home-wordmark span:nth-child(2) {
  color: #12a876;
}

.home-wordmark span:nth-child(3) {
  color: #202426;
}

.home-searchbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  min-height: 60px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 10px 34px rgba(29, 34, 33, 0.08);
}

.home-searchbar input {
  min-height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
}

.home-searchbar button {
  min-width: 118px;
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--lime);
  color: #14211d;
  font-weight: 900;
}

.home-seeds {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 680px;
}

.home-seeds button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid #e0e4dc;
  border-radius: 999px;
  background: #ffffff;
  color: #4d5857;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(29, 34, 33, 0.05);
}

.home-seeds button:hover,
.home-seeds button:focus-visible {
  border-color: rgba(15, 139, 127, 0.32);
  background: #f1f8f4;
  color: #0f665e;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  overflow: auto;
  background: var(--deep);
  color: #eef3ee;
}

.brand {
  display: flex;
  align-items: center;
  margin-bottom: 28px;
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: #f4f8f3;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.brand-wordmark span:nth-child(1) {
  color: #8db4ff;
}

.brand-wordmark span:nth-child(2) {
  color: var(--lime);
}

.brand-wordmark span:nth-child(3) {
  color: #f4f8f3;
}

.control-block {
  margin-bottom: 18px;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.control-block label,
.label {
  display: block;
  margin-bottom: 9px;
  color: #c9d4cf;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

select option {
  color: var(--ink);
}

.primary-action,
.download-action {
  width: 100%;
  min-height: 44px;
  margin-bottom: 18px;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.primary-action {
  background: var(--lime);
  color: #14211d;
}

.download-action {
  background: var(--amber);
  color: #211808;
}

.primary-action:disabled,
.download-action:disabled {
  background: #59635f;
  color: #b5bfba;
  box-shadow: none;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.segmented button,
.toolbar-actions button {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #edf4f1;
  font-weight: 800;
}

.segmented button.active {
  background: var(--lime);
  color: #14211d;
  border-color: var(--lime);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.control-block .toggle-row {
  margin-bottom: 0;
  color: #eef3ee;
  font-size: 13px;
  font-weight: 800;
  text-transform: none;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row small {
  margin-top: 3px;
  color: #b9c6c1;
  font-size: 12px;
  line-height: 1.3;
}

.toggle-row input {
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  min-height: 0;
  accent-color: var(--lime);
}

.status-box {
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #d6dfdb;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.provider-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: -28px -28px 22px;
  padding: 28px 28px 14px;
  background: rgba(246, 247, 242, 0.93);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(217, 221, 214, 0.72);
}

.provider-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 900;
  box-shadow: var(--shadow);
}

.provider-tabs button.active {
  border-color: var(--teal);
  background: #e6f4ef;
  color: #0f665e;
  outline: 3px solid rgba(15, 139, 127, 0.16);
}

.site-icon {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  color: #111819;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.gameui-icon {
  background: var(--lime);
}

.all-icon {
  background: #202426;
  color: #ffffff;
  font-size: 11px;
}

.local-icon {
  background: #14a876;
  color: #ffffff;
  font-size: 10px;
}

.dribbble-icon {
  border-radius: 50%;
  background: #ea4c89;
  color: #ffffff;
}

.huaban-icon {
  background: #e94d5f;
  color: #ffffff;
}

.behance-icon {
  background: #1769ff;
  color: #ffffff;
  font-size: 12px;
}

.pinterest-icon {
  border-radius: 50%;
  background: #bd081c;
  color: #ffffff;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.toolbar[hidden] {
  display: none;
}

.internal-provider .results-grid {
  margin-top: 4px;
}

.internal-provider .result-card {
  grid-template-rows: auto;
}

.internal-provider .card-body {
  padding: 16px;
}

.internal-provider .card-body h3 {
  font-size: 15px;
}

.internal-provider .badge-row {
  margin-top: 10px;
}

.toolbar h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.toolbar-actions button {
  min-width: 98px;
  padding: 0 12px;
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.toolbar-actions .segmented {
  width: 190px;
}

.toolbar-actions .segmented button {
  min-width: 0;
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.toolbar-actions .segmented button.active {
  border-color: var(--teal);
  background: #e6f4ef;
  color: #0f665e;
}

.toolbar-actions .download-action {
  width: auto;
  min-width: 132px;
  margin: 0;
  background: var(--amber);
  color: #211808;
}

.toolbar-actions .download-action:disabled {
  background: #d7ddd4;
  color: #89928d;
}

.toolbar-status {
  grid-column: 1 / -1;
  min-height: 44px;
  padding: 11px 12px;
  border-color: var(--line);
  background: var(--panel);
  color: var(--muted);
}

.search-loading .toolbar-status {
  border-color: rgba(15, 139, 127, 0.24);
  background: #eef8f5;
  color: #0f665e;
}

.internal-resource-panel {
  display: grid;
  grid-template-columns: 1fr;
  margin-bottom: 14px;
}

.internal-resource-panel[hidden] {
  display: none;
}

.internal-account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.internal-account-row strong {
  color: var(--ink);
}

.internal-account-row em {
  color: #0f665e;
  font-size: 12px;
  font-style: normal;
}

.internal-account-row button {
  width: auto;
  min-height: 30px;
  margin-left: auto;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f6f1;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.internal-status,
.internal-scope {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.internal-status {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.internal-status strong,
.internal-scope-head strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.internal-status p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.internal-status.ready {
  border-color: rgba(20, 168, 118, 0.28);
}

.internal-status.pending {
  border-color: rgba(236, 165, 49, 0.34);
}

.internal-scope {
  padding: 12px;
}

.internal-scope-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.internal-scope-head button {
  width: auto;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #f4f6f1;
  color: var(--muted);
  font-size: 12px;
}

.internal-scope-head button:disabled {
  opacity: 0.48;
}

.internal-projects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.internal-projects button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: auto;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf5;
  color: var(--ink);
  font-size: 13px;
}

.internal-projects button.active {
  border-color: var(--teal);
  background: #e6f4ef;
  color: #0f665e;
}

.internal-projects em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

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

.facet-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.facet-panel[hidden] {
  display: none;
}

.facet-summary {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.facet-summary strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.facet-summary button {
  margin-left: auto;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f5ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.facet-group {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.facet-group strong {
  padding-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.facet-group div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.facet-group button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f4;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.facet-group button span {
  color: var(--muted);
  font-size: 12px;
}

.facet-group button.active {
  border-color: var(--teal);
  background: #e6f4ef;
  color: #0f665e;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.result-card {
  display: grid;
  grid-template-rows: 210px auto;
  overflow: hidden;
  cursor: zoom-in;
}

.loading-card {
  cursor: wait;
}

.skeleton-thumb,
.skeleton-line,
.skeleton-badges span {
  display: block;
  position: relative;
  overflow: hidden;
  background: #edf1ed;
}

.skeleton-thumb {
  min-height: 210px;
}

.skeleton-thumb.wide {
  background: #e7ede8;
}

.skeleton-line {
  height: 14px;
  margin-top: 12px;
  border-radius: 999px;
}

.skeleton-line.title {
  width: 72%;
  height: 18px;
}

.skeleton-line.medium {
  width: 54%;
}

.skeleton-line.short {
  width: 38%;
}

.skeleton-badges {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.skeleton-badges span {
  width: 62px;
  height: 26px;
  border-radius: 8px;
}

.skeleton-thumb::after,
.skeleton-line::after,
.skeleton-badges span::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.76), transparent);
  animation: skeleton-shimmer 1.25s infinite;
}

@keyframes skeleton-shimmer {
  100% {
    transform: translateX(100%);
  }
}

.result-card.selected {
  border-color: var(--teal);
  outline: 3px solid rgba(15, 139, 127, 0.22);
}

.thumb {
  position: relative;
  overflow: hidden;
  background: #202928;
}

.thumb.broken::after {
  position: absolute;
  inset: 48px 14px 14px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  color: #d6dfdb;
  content: "preview unavailable";
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb.broken img {
  opacity: 0.08;
}

.thumb input {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: 22px;
  height: 22px;
  min-height: 0;
  accent-color: var(--lime);
  cursor: pointer;
}

.thumb.external {
  display: grid;
  place-items: center;
  padding: 18px;
  color: #d6dfdb;
  font-weight: 900;
  text-align: center;
}

.thumb.external span {
  display: block;
  max-width: 180px;
  line-height: 1.3;
}

.card-body {
  padding: 14px;
}

.card-body h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0;
}

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

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 8px;
  background: #ecefe8;
  color: #39413d;
  font-size: 12px;
  font-weight: 800;
}

.badge.disabled {
  background: #f5e7d4;
  color: #8b5c12;
}

.badge.score {
  background: #e5f4f2;
  color: #0f665e;
}

.badge.match {
  background: #edf0ff;
  color: #314c9f;
}

.badge.facet {
  background: #eef4e3;
  color: #425a1d;
}

.match-snippets {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.match-snippets p {
  margin: 0;
  padding: 8px;
  border-radius: 8px;
  background: #f6f8f3;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.match-snippets strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 11px;
}

.source-link {
  display: inline-flex;
  margin-top: 12px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 180px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

.modal-open {
  overflow: hidden;
}

.preview-modal[hidden] {
  display: none;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
}

.preview-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(9, 14, 14, 0.72);
}

.preview-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  width: min(1180px, 100%);
  height: min(820px, calc(100vh - 56px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.36);
}

.preview-dialog.text-preview {
  grid-template-columns: 1fr;
  width: min(760px, 100%);
  height: min(720px, calc(100vh - 56px));
}

.preview-dialog.text-preview .preview-image-wrap {
  display: none;
}

.preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-weight: 900;
}

.preview-image-wrap {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background: #101615;
}

.preview-image-wrap img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-meta {
  padding: 28px;
  overflow: auto;
}

.preview-meta h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.preview-meta p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.preview-summary {
  margin-top: 14px;
}

.preview-match-list {
  display: grid;
  gap: 10px;
}

.preview-match-list section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf5;
}

.preview-match-list strong {
  display: inline-block;
  margin-right: 8px;
  color: var(--ink);
  font-size: 13px;
}

.preview-match-list small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.preview-match-list p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

#preview-source,
#preview-download {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  background: #edf1f4;
  color: var(--blue);
  font-size: 14px;
  font-weight: 900;
}

#preview-download {
  background: var(--amber);
  color: #211808;
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(17, 24, 23, 0.46);
  backdrop-filter: blur(8px);
}

.auth-dialog {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.auth-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  place-items: center;
  border-radius: 12px;
  background: #14a876;
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
}

.auth-dialog h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.auth-copy {
  margin: 10px 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.auth-field input {
  min-height: 48px;
  border-color: var(--line);
  background: #f9fbf6;
  color: var(--ink);
}

.auth-error {
  min-height: 20px;
  margin: 8px 0 0;
  color: #b13b2e;
  font-size: 13px;
  font-weight: 800;
}

.auth-error.info {
  color: #0f665e;
}

.auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.auth-primary,
.auth-secondary {
  min-height: 44px;
  padding: 0 14px;
}

.auth-primary {
  flex: 1;
  background: var(--lime);
  color: #111819;
}

.auth-secondary {
  width: auto;
  border-color: var(--line);
  background: #f0f3ef;
  color: var(--muted);
}

.auth-primary:disabled,
.auth-secondary:disabled,
.auth-field input:disabled {
  opacity: 0.68;
  cursor: wait;
}

@media (max-width: 1240px) {
  .provider-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .results-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    height: auto;
  }

  .provider-tabs {
    top: 0;
  }

  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .internal-resource-panel {
    grid-template-columns: 1fr;
  }

  .preview-dialog {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .preview-meta {
    max-height: 280px;
  }
}

@media (max-width: 640px) {
  .workspace,
  .rail {
    padding: 18px;
  }

  .results-grid,
  .control-grid {
    grid-template-columns: 1fr;
  }

  .provider-tabs {
    grid-template-columns: 1fr;
    margin: -18px -18px 18px;
    padding: 18px;
  }

  .home-screen {
    padding: 22px;
  }

  .home-search {
    gap: 18px;
    transform: none;
  }

  .home-wordmark {
    gap: 6px;
    font-size: clamp(34px, 11vw, 44px);
  }

  .home-searchbar {
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .home-searchbar input,
  .home-searchbar button {
    border-radius: 14px;
  }

  .home-seeds {
    gap: 8px;
  }

  .home-seeds button {
    min-height: 32px;
    padding: 0 12px;
  }

  .toolbar {
    display: block;
  }

  .toolbar-actions {
    margin-top: 12px;
  }

  .facet-group {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .facet-group strong {
    padding-top: 0;
  }

  .preview-modal {
    padding: 14px;
  }

.preview-image-wrap {
    min-height: 0;
  }
}

.admin-page {
  min-height: 100vh;
  background: var(--bg);
}

.admin-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0;
}

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

.admin-header h1 {
  margin: 0;
  font-size: 28px;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-refresh,
.admin-logout,
.admin-login-card button {
  min-width: 86px;
  padding: 11px 16px;
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.admin-refresh,
.admin-login-card button {
  background: var(--lime);
  color: #14211d;
}

.admin-logout {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.admin-login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-login-card h1 {
  margin: 0;
  font-size: 30px;
}

.admin-login-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.admin-login-card input {
  width: 100%;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.admin-login-card button:disabled,
.admin-refresh:disabled,
.admin-logout:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.admin-login-error {
  min-height: 18px;
  margin: 0;
  color: #d14a54;
  font-size: 13px;
  font-weight: 800;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin: 8px 0 5px;
  font-size: 26px;
  line-height: 1;
}

.report-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-card.wide {
  grid-column: auto;
}

.admin-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.admin-table {
  max-height: 360px;
  overflow: auto;
}

.admin-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
}

.admin-empty {
  margin: 0;
  color: var(--muted);
}

.report-bars {
  display: grid;
  gap: 12px;
}

.report-bar {
  display: grid;
  gap: 6px;
}

.report-bar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.report-bar-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-bar-head strong {
  color: var(--ink);
}

.report-bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef1ea;
}

.report-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--lime));
}

@media (max-width: 760px) {
  .admin-header {
    display: grid;
  }

  .admin-grid,
  .report-grid,
  .report-summary {
    grid-template-columns: 1fr;
  }
}
