:root {
  color-scheme: light dark;
  --page-bg: #f4f7fb;
  --panel-bg: #ffffff;
  --panel-border: #d9e2ec;
  --text: #18212b;
  --heading: #111827;
  --muted: #617082;
  --field-border: #cfd9e5;
  --field-bg: #ffffff;
  --soft-bg: #eef3f8;
  --hover-bg: #edf4ff;
  --primary: #1f6feb;
  --primary-hover: #1558c7;
  --secondary: #314256;
  --secondary-hover: #243348;
  --danger: #c9352b;
  --focus-ring: rgb(31 111 235 / 0.22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--page-bg);
  color: var(--text);
}

body.dark {
  --page-bg: #111418;
  --panel-bg: #1b2027;
  --panel-border: #303946;
  --text: #e6edf5;
  --heading: #f7fbff;
  --muted: #9aa8b7;
  --field-border: #3a4655;
  --field-bg: #151a20;
  --soft-bg: #252d37;
  --hover-bg: #23344c;
  --primary: #4c8dff;
  --primary-hover: #6aa0ff;
  --secondary: #3a4655;
  --secondary-hover: #465568;
  --danger: #d74c42;
  --focus-ring: rgb(76 141 255 / 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page-bg);
  color: var(--text);
}

body:not(.dark) {
  color-scheme: light;
}

body.dark {
  color-scheme: dark;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.file-fallback {
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
  min-height: 38px;
  padding: 8px 13px;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:not(:disabled):hover,
.file-fallback:hover {
  background: var(--primary-hover);
}

button:not(:disabled):active,
.file-fallback:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
  outline: none;
}

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

.topbar {
  align-items: center;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--panel-border);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(220px, 1fr) auto;
  padding: 14px 18px;
}

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

.brand-logo {
  display: block;
  flex: 0 0 136px;
  height: 68px;
  position: relative;
  width: 136px;
}

.brand-logo-image {
  display: block;
  height: 100%;
  object-fit: contain;
  width: 100%;
}

.logo-dark {
  display: none;
}

.dark .logo-light {
  display: none;
}

.dark .logo-dark {
  display: block;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
}

h2 {
  font-size: 15px;
  line-height: 1.3;
}

p {
  color: var(--muted);
  font-size: 13px;
}

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

.page-menu {
  position: relative;
}

.page-menu[hidden],
.page-nav[hidden],
.page-menu-item[hidden],
.page-nav-divider[hidden] {
  display: none;
}

.page-nav {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgb(15 23 42 / 0.18);
  display: grid;
  gap: 4px;
  min-width: 216px;
  padding: 6px;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
}

.page-menu-item {
  align-items: center;
  background: transparent;
  color: var(--text);
  display: grid;
  gap: 10px;
  grid-template-columns: 22px 1fr;
  justify-content: start;
  min-height: 40px;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

a.page-menu-item {
  border-radius: 8px;
  text-decoration: none;
}

.page-menu-item.active,
.page-menu-item:not(:disabled):hover {
  background: var(--hover-bg);
}

.page-menu-item.active {
  color: #fff;
  background: var(--primary);
}

.page-nav-divider {
  border-top: 1px solid var(--panel-border);
  margin: 4px 2px;
}

.page-menu-item svg {
  fill: none;
  height: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 21px;
}

.nav-icon-button {
  align-items: center;
  display: inline-flex;
  flex: 0 0 38px;
  height: 38px;
  justify-content: center;
  min-width: 38px;
  padding: 0;
  width: 38px;
}

.nav-icon-button svg {
  fill: none;
  height: 21px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 21px;
}

.nav-icon-button svg path:first-child:last-child {
  fill: none;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.user-identity {
  display: grid;
  line-height: 1.2;
  max-width: min(280px, 42vw);
  min-width: 0;
  text-align: right;
}

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

.user-identity strong,
.user-identity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-identity strong {
  color: var(--heading);
  font-size: 13px;
  font-weight: 700;
}

.user-identity span {
  color: var(--muted);
  font-size: 12px;
}

.authbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  grid-column: 1 / -1;
}

.authbar input {
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  color: var(--text);
  min-height: 38px;
  min-width: 180px;
  padding: 8px 10px;
}

.create-account-form {
  display: grid;
  gap: 10px;
  grid-column: 1 / -1;
  grid-template-columns: 1fr 1fr;
}

.create-account-form[hidden] {
  display: none;
}

.create-account-form input {
  grid-column: 1 / -1;
  min-width: 0;
}

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

button.secondary:not(:disabled):hover {
  background: var(--secondary-hover);
}

.file-fallback {
  background: var(--secondary);
  display: inline-grid;
  place-items: center;
  position: relative;
}

.file-fallback input {
  inset: 0;
  opacity: 0;
  position: absolute;
  width: 100%;
}

.hidden-file-input {
  display: none;
}

.workspace {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(240px, 300px) minmax(360px, 1fr) minmax(280px, 380px);
  min-height: 0;
  padding: 14px;
}

.dashboard-page {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.dashboard-page[hidden],
.price-update-page[hidden],
.admin-page[hidden],
.about-page[hidden],
.workspace[hidden] {
  display: none;
}

.price-update-page {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.admin-page {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.admin-panel {
  align-content: start;
  min-height: 420px;
}

.admin-kicker {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.admin-summary {
  background: var(--soft-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-summary-item {
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 16px;
}

.admin-summary-item + .admin-summary-item {
  border-left: 1px solid var(--panel-border);
}

.admin-summary-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.admin-summary-item strong {
  color: var(--heading);
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

.admin-message {
  color: var(--muted);
  min-height: 18px;
  margin: 0;
}

.admin-message.error {
  color: var(--danger);
}

.admin-table-wrap {
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  min-height: 240px;
  overflow: auto;
}

.admin-table {
  border-collapse: collapse;
  min-width: 1180px;
  width: 100%;
}

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

.admin-table th {
  background: var(--soft-bg);
  color: var(--heading);
  font-size: 12px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

.admin-table td {
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.admin-table th:nth-child(5),
.admin-table td:nth-child(5),
.admin-table th:nth-child(6),
.admin-table td:nth-child(6) {
  text-align: right;
}

.admin-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-table-message {
  color: var(--muted) !important;
  height: 160px;
  text-align: center !important;
  vertical-align: middle !important;
}

.admin-pagination {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.admin-pagination span {
  color: var(--muted);
  font-size: 13px;
  min-width: 72px;
  text-align: center;
}

.about-page {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.about-panel {
  gap: 0;
  min-height: 360px;
  padding: 0;
}

.about-logo {
  align-items: center;
  display: flex;
  justify-content: center;
  padding: 30px 24px 20px;
}

.about-logo-image {
  display: block;
  height: 150px;
  max-width: min(380px, 78vw);
  object-fit: contain;
  width: 380px;
}

.about-header {
  align-items: flex-start;
  background: var(--soft-bg);
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  gap: 16px;
  padding: 28px;
}

.about-mark {
  align-items: center;
  background: var(--primary);
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  flex: 0 0 42px;
  font-size: 24px;
  font-weight: 700;
  height: 42px;
  justify-content: center;
  line-height: 1;
  width: 42px;
}

.about-kicker,
.about-section-label {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.about-header h2 {
  color: var(--heading);
  font-size: 26px;
  margin: 0;
}

.about-description {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 8px 0 0;
  max-width: 680px;
}

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

.about-section {
  min-height: 150px;
  padding: 26px 28px;
}

.about-section + .about-section {
  border-left: 1px solid var(--panel-border);
}

.about-section h3 {
  color: var(--heading);
  font-size: 18px;
  margin: 0 0 8px;
}

.about-section p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.about-section a {
  color: var(--primary);
  display: inline-block;
  font-size: 16px;
  font-weight: 650;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.app-footer {
  align-items: center;
  border-top: 1px solid var(--panel-border);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0 14px;
  padding: 14px 4px 18px;
}

.app-footer p {
  line-height: 1.45;
}

.signed-out .app-footer {
  display: none;
}

.donation-footer-link {
  align-items: center;
  color: var(--primary);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
  min-height: 36px;
  padding: 7px 9px;
  position: relative;
  text-decoration: none;
}

.donation-footer-link:hover {
  color: var(--primary-hover);
}

.donation-footer-link:focus-visible {
  border-radius: 6px;
  box-shadow: 0 0 0 4px var(--focus-ring);
  outline: none;
}

.donation-footer-link svg {
  fill: none;
  height: 19px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 19px;
}

.donation-link[data-tooltip] {
  position: relative;
}

.donation-link[data-tooltip]::after {
  background: #111827;
  border-radius: 6px;
  color: #fff;
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  opacity: 0;
  padding: 8px 10px;
  pointer-events: none;
  position: absolute;
  text-align: left;
  transition: opacity 0.14s ease, visibility 0.14s ease;
  visibility: hidden;
  white-space: normal;
  width: 260px;
  z-index: 50;
}

.donation-menu-link[data-tooltip]::after {
  right: calc(100% + 9px);
  top: 50%;
  transform: translateY(-50%);
}

.donation-footer-link[data-tooltip]::after {
  bottom: calc(100% + 7px);
  right: 0;
}

.donation-link[data-tooltip]:hover::after,
.donation-link[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
}

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

  .admin-summary-item + .admin-summary-item {
    border-left: 0;
    border-top: 1px solid var(--panel-border);
  }

  .admin-pagination {
    justify-content: stretch;
  }

  .admin-pagination button {
    flex: 1 1 0;
  }

  .about-logo {
    padding: 24px 18px 14px;
  }

  .about-logo-image {
    height: 120px;
    max-width: 86vw;
  }

  .about-header {
    padding: 22px;
  }

  .about-header h2 {
    font-size: 22px;
  }

  .about-layout {
    grid-template-columns: 1fr;
  }

  .about-section {
    min-height: auto;
    padding: 22px;
  }

  .about-section + .about-section {
    border-left: 0;
    border-top: 1px solid var(--panel-border);
  }

  .app-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .donation-menu-link[data-tooltip]::after {
    display: none;
  }
}

.dashboard-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.dashboard-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.sync-status {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

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

.metric-card {
  background: var(--soft-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 14px;
}

.metric-card strong {
  color: var(--heading);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.metric-card span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.metric-icon {
  color: var(--primary);
  display: inline-flex;
  height: 30px;
  width: 30px;
}

.metric-icon svg {
  fill: color-mix(in srgb, currentColor 20%, transparent);
  height: 30px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 30px;
}

.dashboard-console-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.dashboard-valuable-list {
  display: grid;
  gap: 8px;
  grid-auto-flow: column;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(62px, auto));
}

.valuable-item-row {
  align-items: center;
  background: var(--soft-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  min-height: 62px;
  padding: 10px;
}

.valuable-rank {
  color: var(--muted);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  text-align: center;
}

.valuable-item-row strong,
.valuable-item-row span span {
  display: block;
}

.valuable-item-row strong {
  color: var(--heading);
}

.valuable-item-row span span {
  color: var(--muted);
  font-size: 12px;
}

.valuable-item-row b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dashboard-console-card {
  align-items: center;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text);
  display: grid;
  gap: 12px;
  grid-template-columns: 34px 1fr auto;
  min-height: 68px;
  padding: 10px;
  text-align: left;
}

.dashboard-console-card:not(:disabled):hover {
  background: var(--hover-bg);
}

.dashboard-console-card strong,
.dashboard-console-card span span {
  display: block;
}

.dashboard-console-card span span {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-console-card b {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

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

.price-update-summary {
  color: var(--muted);
  font-size: 13px;
  min-height: 18px;
}

.price-update-list {
  display: grid;
  gap: 6px;
}

.price-update-row {
  align-items: start;
  background: var(--soft-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 12px;
  grid-template-columns: 22px minmax(220px, 1fr) minmax(120px, max-content) minmax(150px, max-content) minmax(120px, max-content);
  min-height: 64px;
  padding: 10px;
}

.price-update-row.disabled {
  opacity: 0.62;
}

.price-update-row input {
  min-height: 18px;
  margin-top: 2px;
}

.price-update-record strong,
.price-update-record small {
  display: block;
}

.price-update-record strong {
  color: var(--heading);
}

.price-update-record small {
  color: var(--muted);
  font-size: 12px;
}

.price-update-cell {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.price-update-cell b {
  color: var(--heading);
  display: inline;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.price-update-status {
  font-variant-numeric: tabular-nums;
  grid-column: 3 / -1;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .price-update-row {
    align-items: start;
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .price-update-cell,
  .price-update-status {
    grid-column: 2;
    white-space: normal;
  }
}

body:not(.editor-open) .workspace {
  grid-template-columns: minmax(240px, 300px) minmax(360px, 1fr);
}

.signed-out .toolbar,
.signed-out .workspace {
  display: none;
}

body:not(.signed-out) .authbar {
  display: none;
}

.signed-out .app-shell {
  display: grid;
  grid-template-rows: 1fr;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.signed-out .topbar {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgb(15 23 42 / 0.14);
  display: grid;
  align-content: center;
  gap: 22px;
  grid-template-columns: 1fr;
  justify-items: center;
  max-height: min(560px, calc(100vh - 48px));
  max-width: min(440px, calc(100vw - 48px));
  min-height: 0;
  padding: 30px;
  width: min(440px, calc(100vw - 48px));
}

.signed-out .brand {
  align-self: center;
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
  width: 100%;
}

.signed-out .brand-logo {
  height: 92px;
  width: 184px;
}

.signed-out h1 {
  font-size: 24px;
}

.signed-out .authbar {
  align-self: center;
  display: grid;
  gap: 12px;
  grid-column: auto;
  grid-template-columns: 1fr 1fr;
  max-width: 360px;
  width: 100%;
}

.signed-out .authbar input {
  border-color: #b9c7d8;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
  grid-column: 1 / -1;
  min-height: 44px;
  min-width: 0;
  padding: 10px 12px;
  width: 100%;
}

.signed-out .authbar input::placeholder {
  color: #718096;
}

.dark.signed-out .authbar input {
  border-color: var(--field-border);
  box-shadow: none;
}

.dark.signed-out .authbar input::placeholder {
  color: var(--muted);
}

.signed-out.creating-account #emailInput,
.signed-out.creating-account #passwordInput,
.signed-out.creating-account #forgotPasswordButton,
.signed-out.creating-account #signInButton,
.signed-out.creating-account #googleSignInButton,
.signed-out.creating-account #createAccountButton,
.signed-out.creating-account #languageSelect,
.signed-out.creating-account #themeSelect {
  display: none;
}

.signed-out #signInButton,
.signed-out #googleSignInButton,
.signed-out #createAccountButton,
.signed-out #languageSelect,
.signed-out #themeSelect {
  min-height: 42px;
  min-width: 0;
  width: 100%;
}

.auth-link-button {
  background: transparent;
  color: var(--accent);
  grid-column: 1 / -1;
  justify-self: end;
  min-height: auto;
  padding: 0;
  text-align: right;
  width: auto;
}

.auth-link-button:not(:disabled):hover {
  background: transparent;
  text-decoration: underline;
}

.google-signin-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #b7c5d6;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.07);
  color: var(--text);
  display: inline-flex;
  gap: 10px;
  grid-column: 1 / -1;
  justify-content: center;
}

.google-signin-button:not(:disabled):hover {
  background: #f8fbff;
  border-color: #8fb2df;
}

.dark .google-signin-button {
  background: var(--field-bg);
  border-color: var(--field-border);
  box-shadow: none;
}

.dark .google-signin-button:not(:disabled):hover {
  background: var(--hover-bg);
  border-color: var(--field-border);
}

.google-logo {
  align-items: center;
  background: #fff;
  border-radius: 50%;
  display: inline-flex;
  flex: 0 0 22px;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.google-logo svg {
  display: block;
  height: 18px;
  width: 18px;
}

.signed-out #authStatus {
  color: var(--muted);
  font-size: 12px;
  grid-column: 1 / -1;
  justify-self: center;
  min-height: 18px;
  text-align: center;
  white-space: normal;
}

.signed-out .create-account-form {
  gap: 12px;
  width: 100%;
}

.signed-out .create-account-form input {
  min-height: 44px;
  padding: 10px 12px;
}

.signed-out .create-account-form button {
  min-height: 42px;
}

.signed-out.creating-account .create-account-form {
  display: grid;
}

.signed-out.creating-account .topbar {
  aspect-ratio: auto;
  min-height: min(540px, calc(100vh - 48px));
}

.signed-out.creating-account .brand {
  gap: 6px;
}

.signed-out.creating-account .brand-logo {
  height: 68px;
  width: 136px;
}

.signed-out.creating-account h1 {
  font-size: 20px;
}

.sidebar,
.results,
.editor {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  min-height: 0;
  overflow: hidden;
}

.editor[hidden] {
  display: none;
}

.sidebar,
.editor {
  display: flex;
  flex-direction: column;
}

.panel-header {
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px;
}

.sidebar .panel-header {
  flex-wrap: wrap;
}

.editor-header-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.editor-header-actions button {
  min-width: 92px;
}

.editor-header-actions .icon-button {
  min-width: 36px;
}

@media (min-width: 1101px) {
  .editor {
    align-self: start;
    max-height: calc(100vh - 28px);
    overflow: auto;
    position: sticky;
    top: 14px;
  }
}

.results .panel-header {
  flex-wrap: wrap;
}

.results .panel-header > div:first-child {
  flex: 1 1 190px;
}

.sort-control {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.result-controls {
  align-items: center;
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: flex-end;
}

.sort-control span {
  white-space: nowrap;
}

.sort-control select {
  min-height: 34px;
  min-width: 118px;
}

.page-size-control select {
  min-width: 78px;
}

.icon-button {
  border-radius: 50%;
  font-size: 22px;
  font-weight: 500;
  height: 36px;
  line-height: 1;
  padding: 0;
  width: 36px;
}

.icon-button[data-tooltip] {
  position: relative;
}

.icon-button[data-tooltip]::after {
  background: var(--heading);
  border-radius: 4px;
  bottom: -8px;
  color: var(--panel-bg);
  content: attr(data-tooltip);
  font-size: 12px;
  font-weight: 500;
  left: 50%;
  line-height: 1.25;
  max-width: 240px;
  opacity: 0;
  padding: 6px 8px;
  pointer-events: none;
  position: absolute;
  transform: translate(-50%, 100%);
  transition: opacity 120ms ease;
  white-space: nowrap;
  width: max-content;
  z-index: 60;
}

.icon-button[data-tooltip]:hover::after,
.icon-button[data-tooltip]:focus-visible::after {
  opacity: 1;
}

.toolbar-icon-button {
  align-items: center;
  display: inline-flex;
  justify-content: center;
}

.toolbar-icon-button svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 20px;
}

.search {
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  color: var(--text);
  border-radius: 8px;
  margin: 12px;
  min-height: 38px;
  padding: 8px 10px;
}

.console-list,
.game-list {
  overflow: auto;
}

.console-list {
  padding: 0 8px 10px;
}

.console-button {
  align-items: center;
  background: transparent;
  border-radius: 8px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  margin: 2px 0;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}

.console-name {
  align-items: center;
  display: inline-flex;
  gap: 9px;
  min-width: 0;
}

.console-name > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.console-icon {
  align-items: center;
  --console-icon-color: var(--primary);
  --console-icon-bg: #dceaff;
  --console-icon-border: #9ec4ff;
  background: var(--console-icon-bg);
  border: 1px solid var(--console-icon-border);
  border-radius: 8px;
  color: var(--console-icon-color);
  display: inline-flex;
  flex: 0 0 32px;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.console-icon svg {
  fill: color-mix(in srgb, currentColor 18%, transparent);
  height: 24px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 24px;
}

.console-icon svg circle {
  fill: currentColor;
}

.console-icon-logo svg {
  display: block;
  fill: currentColor;
  height: 22px;
  stroke: none;
  width: 22px;
}

.console-icon-nintendo,
.console-icon-nintendoswitch {
  --console-icon-color: #e60012;
  --console-icon-bg: #ffe1e4;
  --console-icon-border: #ffa4ad;
}

.console-icon-nintendo3ds {
  --console-icon-color: #d01928;
  --console-icon-bg: #ffe1e5;
  --console-icon-border: #ffa2ac;
}

.console-icon-snes {
  --console-icon-color: #5a4aa3;
  --console-icon-bg: #ece8ff;
  --console-icon-border: #bcb1f1;
}

.console-icon-nes {
  --console-icon-color: #4b5563;
  --console-icon-bg: #eef1f5;
  --console-icon-border: #c4ccd7;
}

.console-icon-playstation {
  --console-icon-color: #006fcd;
  --console-icon-bg: #ddecff;
  --console-icon-border: #97c6ff;
}

.console-icon-xbox {
  --console-icon-color: #107c10;
  --console-icon-bg: #ddf4dd;
  --console-icon-border: #98d598;
}

.console-icon-sega {
  --console-icon-color: #0089cf;
  --console-icon-bg: #d9f2ff;
  --console-icon-border: #91d3f5;
}

.console-icon-atari {
  --console-icon-color: #e4202e;
  --console-icon-bg: #ffe2e4;
  --console-icon-border: #ffa3aa;
}

.console-icon-cartridge-console,
.console-icon-cube-console,
.console-icon-switch {
  --console-icon-color: #e7333f;
  --console-icon-bg: #ffe1e4;
  --console-icon-border: #ff9fa8;
}

.console-icon-dual-screen,
.console-icon-handheld {
  --console-icon-color: #7b3dd6;
  --console-icon-bg: #eadfff;
  --console-icon-border: #c3a8ff;
}

.console-icon-disc-console,
.console-icon-tower {
  --console-icon-color: #2367d8;
  --console-icon-bg: #dce8ff;
  --console-icon-border: #9bbdff;
}

.console-icon-classic-console {
  --console-icon-color: #9b5a24;
  --console-icon-bg: #ffe6c8;
  --console-icon-border: #efbd84;
}

.console-icon-slim-console,
.console-icon-tablet-console {
  --console-icon-color: #189070;
  --console-icon-bg: #d6f6ec;
  --console-icon-border: #8bdcc5;
}

.console-icon-controller,
.console-icon-collection {
  --console-icon-color: #4d667f;
  --console-icon-bg: #e3ebf2;
  --console-icon-border: #b7c7d5;
}

.dark .console-icon {
  --console-icon-bg: color-mix(in srgb, var(--console-icon-color) 24%, #111418);
  --console-icon-border: color-mix(in srgb, var(--console-icon-color) 52%, #111418);
}

.console-button.active,
.console-button:hover {
  background: var(--hover-bg);
}

.count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.results {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.status {
  background: var(--soft-bg);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 9px;
  white-space: nowrap;
}

.status.changed {
  background: #fff4d5;
  color: #7a5300;
}

.status.saved {
  background: #e8f6ed;
  color: #216e39;
}

.status.error {
  background: #ffe8e6;
  color: #a5281c;
}

.status.hidden-status {
  background: transparent;
  padding-left: 0;
  padding-right: 0;
}

.save-toast {
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgb(15 23 42 / 0.18);
  font-size: 14px;
  font-weight: 700;
  left: 50%;
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 16px;
  position: fixed;
  text-align: center;
  top: 16px;
  transform: translateX(-50%);
  z-index: 100;
}

.save-toast.saved {
  background: #e8f6ed;
  border-color: #a9d8b8;
  color: #216e39;
}

.save-toast.error {
  background: #ffe8e6;
  border-color: #f0aaa5;
  color: #a5281c;
}

body.dark .save-toast.saved {
  background: #193c28;
  border-color: #2b7044;
  color: #b8efc8;
}

body.dark .save-toast.error {
  background: #4b211f;
  border-color: #8f3932;
  color: #ffc2bc;
}

.game-list {
  padding: 8px;
  overflow: auto;
}

.game-list.empty-state {
  color: var(--muted);
  display: grid;
  min-height: 280px;
  place-items: center;
  text-align: center;
}

.game-card {
  align-items: center;
  background: var(--panel-bg);
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  display: grid;
  gap: 12px;
  grid-template-columns: 56px 1fr auto;
  margin: 4px 0;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.game-card-row {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 4px 0;
}

.game-card-row .game-card {
  margin: 0;
}

.game-card.inside-row {
  grid-template-columns: 56px 1fr minmax(130px, auto);
}

.move-button {
  align-self: stretch;
  min-width: 112px;
}

.game-card strong {
  color: var(--heading);
}

.game-card:hover {
  background: var(--panel-bg);
  border-color: #a9c7f7;
}

.game-card.active {
  border-color: #a9c7f7;
  background: var(--hover-bg);
}

.game-card:hover .meta {
  color: var(--text);
}

.game-card.active .meta {
  color: var(--muted);
}

.thumb {
  align-items: center;
  background: var(--soft-bg) center / cover no-repeat;
  border-radius: 7px;
  color: var(--heading);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  height: 42px;
  justify-content: center;
  letter-spacing: 0;
  width: 56px;
}

.thumb.console-thumb {
  background: transparent;
}

.thumb .console-icon {
  border-radius: 10px;
  flex-basis: 46px;
  height: 42px;
  width: 46px;
}

.thumb .console-icon svg {
  height: 30px;
  width: 30px;
}

.thumb .console-icon-logo svg {
  height: 30px;
  width: 30px;
}

.pagination-controls {
  border-top: 1px solid var(--panel-border);
  padding: 10px;
}

.pagination-controls button {
  width: 100%;
}

.load-more-sentinel {
  color: var(--muted);
  font-size: 12px;
  min-height: 42px;
  padding: 12px;
  text-align: center;
}

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

.price {
  color: var(--text);
  display: grid;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.desired-price-field[hidden] {
  display: none;
}

.collection-only-field[hidden] {
  display: none;
}

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  overflow: auto;
  padding: 14px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 5px;
}

input,
select,
textarea {
  background: var(--field-bg);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  color: var(--text);
  min-height: 38px;
  padding: 8px 9px;
  width: 100%;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.span-2 {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.modal-backdrop {
  align-items: center;
  background: rgb(15 23 42 / 0.42);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 20;
}

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

.required-preference-dialog {
  z-index: 50;
}

.modal-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  box-shadow: 0 18px 48px rgb(15 23 42 / 0.2);
  display: grid;
  gap: 14px;
  max-width: 420px;
  padding: 18px;
  width: min(420px, 100%);
}

.modal-message {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
  min-height: 18px;
}

.modal-message.error {
  color: var(--danger);
}

.modal-message.saved {
  color: #1f8f4d;
}

.modal-message.changed {
  color: var(--muted);
}

.settings-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr;
}

.settings-actions > * {
  min-width: 0;
  width: 100%;
}

.danger {
  background: var(--danger);
}

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

body.signed-out:not(.dark) .authbar input {
  background: #ffffff !important;
  border-color: #8fa9c9;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.08), 0 0 0 1px rgb(143 169 201 / 0.18);
  caret-color: #17202b;
  color: #17202b !important;
  -webkit-text-fill-color: #17202b;
}

body.signed-out:not(.dark) .authbar input::placeholder {
  color: #5f7085;
  -webkit-text-fill-color: #5f7085;
}

body.signed-out:not(.dark) .authbar input:-webkit-autofill,
body.signed-out:not(.dark) .authbar input:-webkit-autofill:hover,
body.signed-out:not(.dark) .authbar input:-webkit-autofill:focus {
  border-color: #8fa9c9;
  box-shadow: 0 0 0 1000px #ffffff inset, 0 1px 2px rgb(15 23 42 / 0.08);
  caret-color: #17202b;
  -webkit-text-fill-color: #17202b;
}

body.signed-out:not(.dark) .google-signin-button.secondary {
  background: #ffffff;
  border: 1px solid #8fa9c9;
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.08), 0 0 0 1px rgb(143 169 201 / 0.18);
  color: #17202b;
}

body.signed-out:not(.dark) .google-signin-button.secondary:not(:disabled):hover {
  background: #f4f8ff;
  border-color: #5f8fc9;
}

.image-editor {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 10px;
}

.image-preview {
  align-items: center;
  aspect-ratio: 4 / 3;
  background: var(--soft-bg) center / contain no-repeat;
  border: 1px dashed #b8c6d6;
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 150px;
  overflow: hidden;
  text-align: center;
}

.image-preview.has-image {
  border-style: solid;
  color: transparent;
}

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

.image-actions > * {
  flex: 1 1 140px;
}

.image-file {
  text-align: center;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: minmax(220px, 280px) 1fr;
  }

  .editor {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    justify-content: stretch;
  }

  .toolbar > * {
    flex: 1 1 120px;
  }

  .page-menu {
    flex: 0 0 auto;
  }

  .page-nav {
    left: 0;
    right: auto;
  }

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

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

  .dashboard-valuable-list {
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

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

  .game-card-row {
    grid-template-columns: 1fr;
  }

  .game-card.inside-row {
    grid-template-columns: 56px 1fr;
  }

  .game-card.inside-row .price {
    grid-column: 2;
  }

  .move-button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .signed-out .app-shell {
    padding: 16px;
  }

  .signed-out .topbar {
    gap: 12px;
    max-width: calc(100vw - 32px);
    padding: 18px;
    width: calc(100vw - 32px);
  }

  .signed-out .brand {
    gap: 8px;
  }

  .signed-out .brand-logo {
    height: 72px;
    width: 144px;
  }

  .signed-out h1 {
    font-size: 20px;
  }

  .signed-out .authbar {
    gap: 8px;
  }

  .signed-out .authbar input,
  .signed-out .authbar button,
  .signed-out .authbar select {
    min-height: 34px;
    padding-bottom: 6px;
    padding-top: 6px;
  }

  .dashboard-metrics,
  .dashboard-valuable-list,
  .dashboard-console-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    align-items: stretch;
    flex-direction: column;
  }
}
