:root {
  color-scheme: light;
  --bg: #f5f6f7;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --text: #161616;
  --muted: #676b70;
  --line: #dedede;
  --line-soft: #ececec;
  --teal: #0f766e;
  --teal-soft: #e7f4f1;
  --rose: #b42318;
  --rose-soft: #fff0ef;
  --amber: #946200;
  --amber-soft: #fff7df;
  --indigo: #4338ca;
  --indigo-soft: #eef2ff;
  --green: #147d3f;
  --green-soft: #e9f8ef;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

code {
  border-radius: 6px;
  background: #f1f2f3;
  color: #333;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  padding: 3px 6px;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfbfb;
  padding: 18px 14px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  padding: 4px 6px 18px;
}

.brand-mark {
  align-items: center;
  background: #101010;
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  height: 40px;
  justify-content: center;
  letter-spacing: 0;
  width: 40px;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
}

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

.nav {
  display: grid;
  gap: 6px;
}

.nav-group {
  position: relative;
}

.nav-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #2d2f33;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  width: 100%;
}

.nav-button:hover {
  background: #efefef;
}

.nav-button.active {
  background: #101010;
  color: #fff;
}

.nav-label {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.nav-desc {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.nav-button.active .nav-desc {
  color: rgba(255, 255, 255, 0.68);
}

.nav-caret {
  color: currentColor;
  flex: 0 0 auto;
  font-size: 20px;
  line-height: 1;
  opacity: 0.65;
}

.submenu {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  display: none;
  gap: 4px;
  left: calc(100% - 1px);
  min-width: 190px;
  padding: 6px;
  position: absolute;
  top: 0;
  z-index: 20;
}

.nav-group:hover .submenu,
.nav-group:focus-within .submenu {
  display: grid;
}

.submenu-button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #2d2f33;
  display: block;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}

.submenu-button:hover,
.submenu-button.active {
  background: #f0f0f0;
}

.submenu-button.active .nav-label {
  color: var(--teal);
}

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

.topbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.topbar h1 {
  font-size: 28px;
  letter-spacing: 0;
  line-height: 1.2;
  margin: 4px 0 0;
}

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

.icon-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: #202124;
  display: inline-flex;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
}

.button-icon {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--teal);
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.status-pill,
.badge {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 650;
  gap: 6px;
  min-height: 26px;
  padding: 4px 8px;
  white-space: nowrap;
}

.status-ok,
.badge-ok {
  background: var(--green-soft);
  border-color: #b8e5c7;
  color: var(--green);
}

.status-warn,
.badge-warn {
  background: var(--amber-soft);
  border-color: #efd178;
  color: var(--amber);
}

.status-bad,
.badge-bad {
  background: var(--rose-soft);
  border-color: #f4b4ae;
  color: var(--rose);
}

.badge-neutral {
  background: #f4f4f4;
  border-color: var(--line);
  color: #444;
}

.status-strip {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  margin-top: 16px;
  padding: 12px;
}

.status-strip > div {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.alert {
  background: var(--amber-soft);
  border: 1px solid #efd178;
  border-radius: 8px;
  color: var(--amber);
  font-size: 14px;
  line-height: 1.5;
  margin-top: 14px;
  padding: 12px;
}

.hidden {
  display: none !important;
}

.mobile-tabs {
  display: none;
}

.view {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

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

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

.metric-top {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  font-size: 25px;
  font-weight: 750;
  margin-top: 8px;
}

.metric-detail {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
}

.tone-teal {
  background: var(--teal-soft);
  border: 1px solid #a9d8cf;
  color: var(--teal);
}

.tone-indigo {
  background: var(--indigo-soft);
  border: 1px solid #c4cdfd;
  color: var(--indigo);
}

.tone-rose {
  background: var(--rose-soft);
  border: 1px solid #f4b4ae;
  color: var(--rose);
}

.tone-amber {
  background: var(--amber-soft);
  border: 1px solid #efd178;
  color: var(--amber);
}

.tone-green {
  background: var(--green-soft);
  border: 1px solid #b8e5c7;
  color: var(--green);
}

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

.panel {
  min-width: 0;
}

.overview-feed-body {
  height: 426px;
}

.overview-feed-body > .table-shell,
.overview-feed-body > .empty-card {
  height: 100%;
}

.overview-feed-body tbody tr,
.overview-feed-body tbody td {
  height: 62px;
}

.overview-feed-body td.empty {
  height: 384px;
}

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

.pager {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin: 10px 0 12px;
}

.pager-bottom {
  margin: 12px 0 0;
}

.pager-center {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  min-width: 0;
}

.pager-summary {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.pager-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.pager-ellipsis {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  min-height: 34px;
  padding: 0 2px;
}

.pager-button,
.pager-page {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #202124;
  min-height: 34px;
  padding: 6px 10px;
}

.pager-page {
  min-width: 34px;
}

.pager-button:hover,
.pager-page:hover {
  border-color: #9ccbc4;
}

.pager-page.active {
  background: #101010;
  border-color: #101010;
  color: #fff;
}

.merchant-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--text);
  display: grid;
  gap: 14px;
  min-height: 170px;
  padding: 14px;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  width: 100%;
}

.merchant-card:hover {
  border-color: #9ccbc4;
  box-shadow: 0 10px 26px rgba(15, 118, 110, 0.12);
  transform: translateY(-1px);
}

.merchant-card-top,
.merchant-card-stats,
.detail-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.merchant-card-top > span:first-child {
  min-width: 0;
}

.merchant-name {
  display: block;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merchant-card-stats {
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}

.merchant-card-stats span {
  display: grid;
  gap: 3px;
}

.merchant-card-stats strong {
  font-size: 18px;
}

.merchant-card-stats span span,
.merchant-note {
  color: var(--muted);
  font-size: 12px;
}

.merchant-note {
  display: block;
  min-height: 32px;
}

.detail-head {
  align-items: center;
  margin-bottom: 12px;
}

.detail-title {
  min-width: 0;
  text-align: right;
}

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

.inventory-toolbar {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.sort-control {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  gap: 8px;
}

.sort-control select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 36px;
  padding: 6px 10px;
}

.sort-control select:focus {
  border-color: var(--teal);
  outline: 2px solid rgba(15, 118, 110, 0.12);
}

.inventory-card {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  min-width: 0;
  padding: 10px;
}

.inventory-info {
  min-width: 0;
}

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

.empty-card {
  align-items: center;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 130px;
  padding: 16px;
}

.profile-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: 180px;
  padding: 16px;
}

.profile-state {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.profile-row {
  align-items: center;
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
}

.profile-row span,
.empty-profile {
  color: var(--muted);
  font-size: 13px;
}

.empty-profile {
  align-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  margin: 14px 0 12px;
  min-height: 78px;
}

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

.section-title {
  font-size: 16px;
  font-weight: 720;
}

.section-detail {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.search-row input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 40px;
  min-width: 0;
  padding: 8px 11px;
  width: 100%;
}

.search-row input:focus {
  border-color: var(--teal);
  outline: 2px solid rgba(15, 118, 110, 0.12);
}

.table-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: auto;
}

table {
  border-collapse: collapse;
  min-width: 860px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  height: 40px;
}

td {
  font-size: 13px;
}

tbody tr:hover {
  background: #fbfbfb;
}

.wide {
  min-width: 260px;
  white-space: normal;
}

.name-cell {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 280px;
}

.item-thumb {
  align-items: center;
  background: #f4f5f6;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 42px;
  justify-content: center;
  overflow: hidden;
  width: 42px;
}

.item-thumb img {
  height: 100%;
  object-fit: contain;
  padding: 4px;
  width: 100%;
}

.truncate {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtext {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.empty {
  color: var(--muted);
  height: 118px;
  text-align: center;
}

.price {
  font-weight: 700;
}

.arrow {
  color: #9a9da1;
  padding: 0 4px;
}

.link {
  color: var(--teal);
  text-decoration: none;
}

.link:hover {
  text-decoration: underline;
}

@media (max-width: 1180px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

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

@media (max-width: 860px) {
  .shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h1 {
    font-size: 23px;
  }

  .mobile-tabs {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .mobile-tabs .nav-button {
    background: var(--panel);
    border: 1px solid var(--line);
    flex: 0 0 auto;
    padding: 8px 10px;
    width: auto;
  }

  .mobile-tabs .nav-button.active {
    background: #101010;
    color: #fff;
  }

  .mobile-tabs .nav-desc {
    display: none;
  }

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

  .merchant-grid,
  .inventory-grid {
    grid-template-columns: 1fr;
  }

  .inventory-toolbar {
    justify-content: stretch;
  }

  .sort-control,
  .sort-control select {
    width: 100%;
  }

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

  .pager-summary {
    text-align: center;
    white-space: normal;
  }

  .detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-title {
    text-align: left;
  }

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

  .icon-button {
    justify-content: center;
    width: 100%;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }
}
