#storeTrendyDrinkMonitor-view {
  --tdm-ink: #14231f;
  --tdm-muted: #65736e;
  --tdm-line: #dfe7e3;
  --tdm-surface: #ffffff;
  --tdm-green: #15803d;
  --tdm-red: #dc2626;
  --tdm-amber: #b45309;
  color: var(--tdm-ink);
}

.tdm-shell {
  display: grid;
  gap: 16px;
}

.tdm-command {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding: 28px 30px;
  border: 1px solid #172b25;
  border-radius: 22px;
  color: #f6fbf8;
  background: #142b24;
}

.tdm-command::after {
  content: "07";
  position: absolute;
  right: 18px;
  top: -28px;
  color: rgba(255, 255, 255, 0.055);
  font-size: 150px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -12px;
  pointer-events: none;
}

.tdm-command > * {
  position: relative;
  z-index: 1;
}

.tdm-kicker {
  display: block;
  margin-bottom: 10px;
  color: #9ed2b6;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.tdm-command h2 {
  margin: 0;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.tdm-command p {
  margin: 10px 0 0;
  color: #bdd0c8;
  font-size: 14px;
}

.tdm-command-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  max-width: 460px;
}

.tdm-command-actions > span {
  width: 100%;
  color: #9fb4ac;
  font-size: 12px;
  text-align: right;
}

.tdm-command-actions button {
  min-height: 40px;
  border-color: rgba(255, 255, 255, 0.24);
}

.tdm-command-actions .secondary-button {
  color: #eef8f2;
  background: rgba(255, 255, 255, 0.08);
}

.tdm-source-strip {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  border: 1px solid var(--tdm-line);
  border-radius: 14px;
  background: #f8faf9;
}

.tdm-source-strip span {
  flex: 0 0 auto;
  padding: 11px 14px;
  color: var(--tdm-muted);
  font-size: 12px;
  white-space: nowrap;
}

.tdm-source-strip span + span {
  border-left: 1px solid var(--tdm-line);
}

.tdm-source-strip strong {
  margin-right: 7px;
  color: var(--tdm-ink);
  font-weight: 700;
}

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

.tdm-summary-card {
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid var(--tdm-line);
  border-radius: 16px;
  background: var(--tdm-surface);
}

.tdm-summary-card.base {
  border-top: 3px solid #69a981;
}

.tdm-summary-card.advanced {
  border-top: 3px solid #d6a757;
}

.tdm-summary-card span,
.tdm-summary-card small {
  display: block;
  overflow: hidden;
  color: var(--tdm-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tdm-summary-card strong {
  display: block;
  margin: 7px 0 5px;
  font-size: 27px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.tdm-filter-panel {
  padding: 16px 18px;
}

.tdm-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 0.7fr)) minmax(230px, 1.4fr);
  gap: 10px;
}

.tdm-filter-grid label {
  display: grid;
  gap: 6px;
  color: var(--tdm-muted);
  font-size: 12px;
  font-weight: 650;
}

.tdm-filter-grid input,
.tdm-filter-grid select {
  width: 100%;
  min-height: 42px;
}

.tdm-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 13px;
  color: var(--tdm-muted);
  font-size: 12px;
}

.tdm-legend > span:first-child {
  margin-right: auto;
}

.tdm-badge {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 720;
  line-height: 1;
  white-space: nowrap;
}

.tdm-badge.pass {
  border-color: #b9ddc7;
  color: var(--tdm-green);
  background: #edf8f1;
}

.tdm-badge.fail {
  border-color: #efc2c2;
  color: var(--tdm-red);
  background: #fff1f1;
}

.tdm-badge.boundary,
.tdm-badge.pending {
  border-color: #ead2a5;
  color: var(--tdm-amber);
  background: #fff8e9;
}

.tdm-badge.missing {
  border-color: #d6ddda;
  color: #6b7571;
  background: #f3f5f4;
}

.tdm-table-panel {
  padding: 0;
  overflow: hidden;
}

.tdm-table-scroll {
  width: 100%;
  overflow: auto;
  max-height: min(70vh, 860px);
}

.tdm-table {
  width: 100%;
  min-width: 1580px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.tdm-table th,
.tdm-table td {
  padding: 12px 13px;
  border-right: 1px solid #edf1ef;
  border-bottom: 1px solid #e7ece9;
  vertical-align: top;
  text-align: left;
}

.tdm-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  color: #40504a;
  background: #f5f8f6;
  box-shadow: 0 1px 0 #dfe7e3;
  font-weight: 730;
}

.tdm-table thead .tdm-group-head th {
  top: 0;
  height: 34px;
  padding-top: 8px;
  padding-bottom: 8px;
  color: #708078;
  background: #edf3ef;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tdm-table thead tr:nth-child(2) th {
  top: 34px;
}

.tdm-table tbody tr:hover td {
  background: #fafcfb;
}

.tdm-store-id,
.tdm-store-name {
  position: sticky;
  z-index: 2;
  background: #fff;
}

.tdm-store-id {
  left: 0;
  width: 104px;
  min-width: 104px;
}

.tdm-store-name {
  left: 104px;
  width: 210px;
  min-width: 210px;
  box-shadow: 1px 0 0 #dfe7e3;
}

.tdm-table thead th:nth-child(1),
.tdm-table thead th:nth-child(2) {
  z-index: 6;
}

.tdm-table thead tr:nth-child(2) th:nth-child(1) {
  left: 0;
}

.tdm-table thead tr:nth-child(2) th:nth-child(2) {
  left: 104px;
}

.tdm-store-name small {
  display: block;
  margin-top: 5px;
  color: var(--tdm-muted);
  font-weight: 450;
}

.tdm-metric-cell {
  min-width: 160px;
}

.tdm-metric-cell.fail {
  background: #fffafa;
}

.tdm-metric-cell.unavailable {
  background: #fafbfa;
}

.tdm-metric-value {
  margin-bottom: 6px;
  font-size: 20px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: -0.035em;
}

.tdm-metric-cell small,
.tdm-metric-reason {
  display: block;
  margin-top: 7px;
  color: var(--tdm-muted);
  font-size: 10px;
  line-height: 1.45;
}

.tdm-metric-reason {
  color: #8b5a5a;
}

.tdm-empty {
  padding: 46px !important;
  color: var(--tdm-muted);
  text-align: center !important;
}

.tdm-methodology {
  padding: 0;
}

.tdm-methodology summary {
  padding: 16px 18px;
  cursor: pointer;
  color: #3d4c47;
  font-weight: 700;
}

.tdm-methodology-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  padding: 0 18px 18px;
}

.tdm-methodology-grid p {
  display: flex;
  gap: 9px;
  margin: 0;
  color: var(--tdm-muted);
  font-size: 12px;
  line-height: 1.6;
}

.tdm-methodology-grid strong {
  color: #7e8b86;
}

.tdm-state {
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 40px;
  color: var(--tdm-muted);
  text-align: center;
}

.tdm-state strong {
  margin: 10px 0 5px;
  color: var(--tdm-ink);
  font-size: 18px;
}

.tdm-state span {
  max-width: 620px;
}

.tdm-state button {
  margin-top: 18px;
}

.tdm-state.error strong {
  color: var(--tdm-red);
}

.tdm-loader {
  width: 28px;
  height: 28px;
  border: 3px solid #dbe8e1;
  border-top-color: var(--tdm-green);
  border-radius: 50%;
  animation: tdm-spin 0.8s linear infinite;
}

@keyframes tdm-spin {
  to { transform: rotate(360deg); }
}

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

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

  .tdm-query {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .tdm-command {
    align-items: flex-start;
    flex-direction: column;
    padding: 22px;
  }

  .tdm-command-actions {
    justify-content: flex-start;
    width: 100%;
    max-width: none;
  }

  .tdm-command-actions > span {
    text-align: left;
  }

  .tdm-summary-grid,
  .tdm-methodology-grid {
    grid-template-columns: 1fr;
  }

  .tdm-filter-grid {
    grid-template-columns: 1fr;
  }

  .tdm-query {
    grid-column: auto;
  }

  .tdm-store-id {
    position: static;
  }

  .tdm-store-name {
    left: 0;
  }

  .tdm-table thead tr:nth-child(2) th:nth-child(1) {
    position: static;
  }

  .tdm-table thead tr:nth-child(2) th:nth-child(2) {
    left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tdm-loader {
    animation-duration: 1.8s;
  }
}
