:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #dce6f1;
  --nav: #050b1f;
  --blue: #2563eb;
  --cyan: #11b8c8;
  --green: #10b981;
  --red: #f43f5e;
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  color: #dbeafe;
  background: var(--nav);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  font-weight: 800;
  background: #14336f;
  border-radius: 8px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.credit-card span,
.credit-card small {
  color: #93a4bd;
}

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

.nav-item {
  padding: 13px 14px;
  text-align: left;
  color: #b8c6dc;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.nav-item.active,
.nav-item:hover {
  color: white;
  background: var(--blue);
}

.credit-card {
  margin-top: auto;
  padding: 18px;
  background: #0d1731;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
}

.credit-card strong {
  display: block;
  margin: 8px 0;
  font-size: 34px;
}

.main {
  min-width: 0;
  padding: 24px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

.user-pill {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-pill span,
.badge,
.site-tags span {
  padding: 7px 12px;
  color: #334155;
  background: #edf4fb;
  border-radius: 999px;
}

.user-pill button,
.toolbar button,
.drawer button:not(.icon-button),
.store-card button,
#mockCollectBtn {
  padding: 10px 16px;
  color: white;
  background: var(--blue);
  border: 0;
  border-radius: 8px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.metric-card,
.panel,
.store-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.metric-card {
  padding: 22px;
  border-top: 4px solid var(--cyan);
}

.metric-card span,
.metric-card em,
.panel-title span {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 12px 0;
  font-size: 38px;
}

.metric-card em {
  font-style: normal;
}

.panel {
  padding: 24px;
  margin-bottom: 22px;
}

.panel-title {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-title h2 {
  margin-bottom: 0;
}

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

.timeline-step,
.oauth-step {
  padding: 14px;
  text-align: center;
  background: #f1f5f9;
  border-radius: 8px;
}

.timeline-step.done,
.oauth-step.done {
  color: #065f46;
  background: #d1fae5;
}

.oauth-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar {
  display: flex;
  gap: 14px;
  margin-bottom: 18px;
}

.toolbar input {
  width: min(420px, 100%);
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  color: #1e293b;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

th {
  color: #52647a;
  font-size: 13px;
  background: #f8fafc;
}

.product-cell {
  display: flex;
  min-width: 360px;
  gap: 14px;
}

.product-cell img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: #edf2f7;
}

.product-cell strong {
  display: block;
  max-width: 420px;
}

.meta-line {
  margin-top: 6px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
}

.product-cell a {
  display: inline-block;
  margin-top: 6px;
  color: var(--blue);
  text-decoration: none;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 58px);
  gap: 6px;
  margin-bottom: 8px;
}

.mini-grid input {
  padding: 7px;
}

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

.actions {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 150px;
}

.actions button {
  padding: 9px 12px;
  color: var(--blue);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
}

.actions button.danger {
  color: var(--red);
  background: #fff1f2;
  border-color: #fecdd3;
}

.workflow-list {
  display: grid;
  gap: 14px;
}

.workflow-card {
  display: grid;
  grid-template-columns: 1fr 210px;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-card .actions {
  align-self: start;
}

.badge {
  display: inline-block;
  width: fit-content;
}

.workflow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.workflow-steps span {
  padding: 7px 10px;
  color: #475569;
  background: #f1f5f9;
  border-radius: 999px;
}

.progress {
  height: 9px;
  overflow: hidden;
  background: #e2e8f0;
  border-radius: 999px;
}

.progress div {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.store-card {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 18px;
  align-items: center;
  padding: 20px;
}

.site-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

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

.form-grid label {
  color: #475569;
  font-weight: 700;
}

.form-grid input,
.form-grid select {
  margin-top: 8px;
}

.install-box {
  display: grid;
  gap: 14px;
}

.panel-subsection {
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

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

.site-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.check-option input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.check-option span {
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.check-option small {
  color: var(--muted);
}

code {
  display: block;
  padding: 14px;
  overflow-x: auto;
  color: #0f172a;
  background: #f1f5f9;
  border-radius: 8px;
}

.payload-preview {
  max-height: 360px;
  padding: 14px;
  overflow: auto;
  color: #dbeafe;
  background: #0f172a;
  border-radius: 8px;
  white-space: pre-wrap;
}

.drawer {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: flex-end;
  background: rgba(15, 23, 42, 0.35);
}

.drawer.open {
  display: flex;
}

.drawer-panel {
  width: min(680px, 100vw);
  height: 100%;
  padding: 26px;
  overflow-y: auto;
  background: white;
}

.icon-button {
  float: right;
  width: 36px;
  height: 36px;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-image {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.image-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.image-strip img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-section {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.data-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.data-chip {
  max-width: 100%;
  padding: 7px 10px;
  color: #334155;
  background: #eef6ff;
  border: 1px solid #cfe4ff;
  border-radius: 999px;
  font-size: 12px;
}

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

.attribute-grid div {
  min-width: 0;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.attribute-grid strong,
.attribute-grid span {
  display: block;
  overflow-wrap: anywhere;
}

.attribute-grid strong {
  color: #475569;
  font-size: 12px;
}

.attribute-grid span {
  margin-top: 4px;
}

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

.detail-form label {
  font-weight: 700;
  color: #475569;
}

.detail-form input,
.detail-form textarea {
  margin-top: 7px;
}

.detail-form .wide {
  grid-column: 1 / -1;
}

.real-publish {
  display: grid;
  gap: 18px;
}

.warning-text {
  padding: 12px 14px;
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
}

.publish-result {
  padding: 14px;
  color: #064e3b;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
}

.publish-result a {
  color: #047857;
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: none;
  max-width: 380px;
  padding: 14px 16px;
  color: white;
  background: #0f172a;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
}

.toast.show {
  display: block;
}

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

  .sidebar {
    position: static;
  }

	  .metric-grid,
	  .timeline,
	  .oauth-flow,
	  .site-picker,
	  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .main {
    padding: 20px 14px;
  }

  .topbar,
  .panel-title,
  .toolbar,
  .store-card,
  .workflow-card {
    display: grid;
    grid-template-columns: 1fr;
  }

	  .metric-grid,
	  .timeline,
	  .oauth-flow,
	  .site-picker,
	  .form-grid,
  .attribute-grid,
  .detail-form {
    grid-template-columns: 1fr;
  }
}
