:root {
  --bg: #0d1110;
  --panel: #181c1a;
  --panel-2: #222624;
  --line: #343a37;
  --text: #f4f6f3;
  --muted: #aeb5af;
  --accent: #d7ff00;
  --accent-text: #151700;
  --danger: #d34b4b;
  --success: #6fd46f;
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

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

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  color: var(--text);
  background: #111514;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

button {
  border: 0;
  cursor: pointer;
}

code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #e3ff4a;
  background: #0f1312;
  border: 1px solid #2b312d;
  border-radius: 6px;
  padding: 3px 6px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
  padding: 0 18px;
}

.text-button {
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  padding: 0;
}

.text-button.danger {
  color: #ff8a8a;
}

.small-link {
  color: var(--accent);
  font-weight: 700;
}

.notice {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  background: #141817;
}

.notice.success {
  color: var(--success);
  border-color: rgba(111, 212, 111, .35);
}

.notice.error {
  color: #ff9b9b;
  border-color: rgba(211, 75, 75, .45);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}

.panel h3,
.panel h2 {
  margin: 0 0 16px;
}

.admin-body {
  min-height: 100vh;
  background: #0b0d0d;
}

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

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: #131514;
  border-right: 1px solid var(--line);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 900;
  margin-bottom: 18px;
}

.admin-sidebar h1 {
  margin: 0;
  font-size: 23px;
}

.admin-sidebar p {
  margin: 8px 0 22px;
  color: var(--muted);
}

.admin-sidebar nav {
  display: grid;
  gap: 10px;
}

.admin-sidebar a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius);
  color: #dfe4df;
  background: transparent;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
  background: var(--panel-2);
  color: var(--accent);
}

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

.page-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.page-title h2 {
  margin: 0 0 6px;
  font-size: 28px;
}

.page-title p {
  margin: 0;
  color: var(--muted);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

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

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-card strong {
  display: block;
  font-size: 30px;
  color: var(--accent);
}

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

.form-grid label {
  display: grid;
  gap: 8px;
  color: #d8ded8;
  font-weight: 700;
}

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

.check-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

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

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

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

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

.sub-row td {
  background: #111514;
  color: #cbd2cc;
  font-size: 13px;
}

.inline-form {
  display: inline;
}

.code-list {
  display: grid;
  gap: 10px;
}

.login-shell,
.install-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
}

.login-panel h1,
.install-panel h1 {
  margin: 0 0 18px;
}

.login-panel label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  font-weight: 700;
}

.install-panel {
  width: min(820px, 100%);
}

.brand-row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.brand-row p {
  margin: -8px 0 0;
  color: var(--muted);
}

.store-body {
  min-height: 100vh;
  background: #0b100d;
}

.store-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 clamp(18px, 4vw, 54px);
  border-bottom: 1px solid #243029;
  background: rgba(13, 17, 16, .96);
}

.store-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.store-logo span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 34px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 900;
}

.store-logo strong {
  font-size: 24px;
}

.store-topbar nav {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-weight: 700;
}

.store-topbar nav a:hover {
  color: var(--accent);
}

.store-shell {
  width: min(1220px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 54px;
}

.store-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 34px 0 30px;
  border-bottom: 1px solid #243029;
}

.store-hero h1 {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.05;
}

.store-hero p {
  max-width: 760px;
  margin: 0;
  color: #c5cbc6;
  font-size: 18px;
  line-height: 1.7;
}

.hero-button {
  flex: 0 0 auto;
}

.store-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 22px 0;
}

.category-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.category-tabs a {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius);
  background: #171d1a;
  color: #dce3dd;
  font-weight: 800;
}

.category-tabs a.active {
  background: var(--accent);
  color: var(--accent-text);
}

.search-form {
  display: flex;
  gap: 8px;
  width: min(360px, 100%);
}

.search-form input {
  min-width: 0;
}

.search-form button {
  flex: 0 0 auto;
  min-height: 42px;
  border-radius: var(--radius);
  padding: 0 16px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 800;
}

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

.app-card {
  overflow: hidden;
  border: 1px solid #313a34;
  border-radius: var(--radius);
  background: #151a17;
}

.app-cover {
  aspect-ratio: 16 / 10;
  background: #202720;
}

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

.cover-fallback {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 42px;
  font-weight: 900;
  background:
    linear-gradient(135deg, rgba(215, 255, 0, .12), rgba(255, 255, 255, .04)),
    #17201a;
}

.app-card-body {
  padding: 18px;
}

.app-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.app-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  padding: 0 8px;
  color: #dfe9d9;
  background: #263128;
  font-size: 12px;
  font-weight: 800;
}

.app-card h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.app-card p {
  min-height: 48px;
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
}

.app-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  color: #c4ccc5;
}

.app-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: var(--radius);
  padding: 0 14px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 900;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  color: var(--muted);
  background: var(--panel);
}

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

  .admin-sidebar {
    position: static;
    height: auto;
  }

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

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

  .store-hero,
  .store-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}

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

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

  .store-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .store-topbar nav,
  .search-form {
    width: 100%;
  }

  .store-topbar nav {
    justify-content: space-between;
  }

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

