:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #647085;
  --line: #dfe5ef;
  --primary: #1463ff;
  --primary-dark: #0d47bd;
  --green: #12805c;
  --red: #c24132;
  --amber: #9b5f00;
  --ink: #22304a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.span-4 {
  grid-column: span 4;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

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

label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

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

button,
.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

button.secondary,
.button.secondary {
  background: #fff;
  color: var(--primary);
  border-color: #b9cdfd;
}

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

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

.login {
  max-width: 380px;
  margin: 12vh auto 0;
}

.hidden {
  display: none !important;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #edf2fb;
  color: var(--ink);
}

.status.ready {
  background: #dff4eb;
  color: var(--green);
}

.status.processing {
  background: #fff1cf;
  color: var(--amber);
}

.status.failed {
  background: #ffe3df;
  color: var(--red);
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.app-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.app-card {
  min-height: 164px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
}

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #26374f;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  overflow: hidden;
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 800;
}

.app-desc {
  min-height: 42px;
  margin: 8px 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

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

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

.standard-grid span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border: 1px solid #cfe0ff;
  border-radius: 6px;
  background: #f4f8ff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.message {
  min-height: 24px;
  color: var(--muted);
}

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

.message.ok {
  color: var(--green);
}

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

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

.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.category-chip {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.category-chip.active {
  border-color: #b9cdfd;
  background: #edf5ff;
  color: var(--primary);
}

.private-gateway {
  min-height: calc(100vh - 64px);
  display: grid;
  align-content: center;
  gap: 16px;
}

.gateway-panel {
  max-width: 680px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.gateway-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
}

.gateway-kicker {
  margin: 18px 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.gateway-panel h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

.gateway-copy {
  max-width: 560px;
  margin: 14px 0 0;
  color: #485466;
  font-size: 15px;
  line-height: 1.7;
}

.gateway-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.gateway-form {
  margin-top: 22px;
}

.gateway-form label {
  color: var(--ink);
  font-weight: 800;
}

.gateway-password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.gateway-password-row input {
  min-height: 44px;
}

.gateway-password-row button {
  min-height: 44px;
  white-space: nowrap;
}

.gateway-meta {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.gateway-note {
  max-width: 680px;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid #d7e4fb;
  border-radius: 8px;
  background: #f4f8ff;
  color: var(--muted);
}

.gateway-note strong {
  color: var(--ink);
}

@media (max-width: 820px) {
  .shell {
    padding: 16px;
  }

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

  .span-4,
  .span-8 {
    grid-column: span 12;
  }

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

  .gateway-panel {
    padding: 24px;
  }

  .gateway-panel h1 {
    font-size: 24px;
  }

  .gateway-password-row {
    grid-template-columns: 1fr;
  }
}
