:root {
  --ink: #18201f;
  --muted: #64706d;
  --line: #d9dfdc;
  --paper: #f7f7f2;
  --panel: #ffffff;
  --accent: #0d6b57;
  --accent-strong: #08493d;
  --amber: #b45f06;
  --red: #a33131;
  --shadow: 0 18px 45px rgba(24, 32, 31, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button,
input,
textarea {
  font: inherit;
}

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

.sidebar {
  min-height: 100vh;
  padding: 28px 20px;
  background: #16221f;
  color: #f6f4ea;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand {
  font-size: 22px;
  font-weight: 800;
}

.brand-sub {
  margin-top: 6px;
  color: #aebbb5;
  font-size: 13px;
}

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

.nav a,
.plain-button {
  border: 1px solid transparent;
  border-radius: 8px;
  color: #dfe6e2;
  padding: 11px 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.nav a.active,
.nav a:hover,
.plain-button:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.12);
}

.workspace {
  padding: 34px;
  max-width: 1180px;
  width: 100%;
}

.page-header,
.app-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.page-header {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

.header-note,
.app-row-head p,
.plain-text,
.muted-line,
small {
  color: var(--muted);
}

.panel,
.app-row,
.empty-state,
.auth-panel,
.install-gate,
.build-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.empty-state {
  padding: 24px;
}

.admin-list {
  display: grid;
  gap: 16px;
}

.app-row {
  padding: 20px;
}

.version-table {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.version-head,
.version-line {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1.5fr 88px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
}

.version-head {
  background: #edf1ed;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.version-line + .version-line {
  border-top: 1px solid var(--line);
}

.version-line span,
.version-line form {
  min-width: 0;
}

.form-stack,
.form-grid {
  display: grid;
  gap: 18px;
}

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

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

label span {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cbd4d0;
  border-radius: 8px;
  padding: 12px 13px;
  background: #fbfcfa;
  color: var(--ink);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 107, 87, 0.13);
}

textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled {
  background: #9ba6a2;
  cursor: not-allowed;
}

.secondary-button {
  background: #eef2ef;
  border-color: #cfd8d3;
  color: var(--ink);
}

.danger-button {
  min-height: 34px;
  padding: 0 12px;
  background: #fff0ee;
  border-color: #f0c6c0;
  color: var(--red);
}

.notice {
  border-radius: 8px;
  padding: 13px 15px;
  margin: 0 0 18px;
  border: 1px solid;
}

.notice.error {
  background: #fff0ee;
  border-color: #f0c6c0;
  color: var(--red);
}

.notice.success {
  background: #eef8f1;
  border-color: #b8dfc5;
  color: #146331;
}

.notice.warning {
  background: #fff8e8;
  border-color: #efd28f;
  color: var(--amber);
}

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

.auth-panel,
.install-gate {
  width: min(440px, 100%);
  padding: 30px;
}

.install-page {
  background:
    linear-gradient(90deg, rgba(13, 107, 87, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(13, 107, 87, 0.07) 1px, transparent 1px),
    #f6f5ef;
  background-size: 28px 28px;
}

.install-wrap {
  width: min(760px, 100%);
  align-self: start;
  margin-top: 6vh;
}

.install-gate .primary-button,
.install-wrap .primary-button {
  min-height: 48px;
}

.wechat-guide p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.7;
}

.wechat-guide .notice {
  margin-bottom: 0;
}

.install-header {
  margin-bottom: 20px;
}

.install-list,
.build-stack {
  display: grid;
  gap: 12px;
}

.install-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.install-item em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-style: normal;
}

.install-item b {
  color: var(--accent);
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--accent);
  font-weight: 800;
}

.build-card {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.build-card h2 small {
  font-size: 14px;
  font-weight: 600;
}

.build-meta,
.release-notes {
  color: var(--muted);
  margin-bottom: 0;
}

.release-notes {
  margin-top: 10px;
  white-space: pre-wrap;
}

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

  .sidebar {
    min-height: auto;
    position: static;
    padding: 18px;
    gap: 16px;
  }

  .sidebar > div:first-child {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 14px;
  }

  .brand {
    font-size: 20px;
  }

  .brand-sub {
    margin-top: 0;
    text-align: right;
  }

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

  .nav a,
  .plain-button {
    min-height: 42px;
    padding: 10px 8px;
    text-align: center;
  }

  .sidebar form {
    display: none;
  }

  .workspace {
    padding: 22px;
  }

  .page-header,
  .app-row-head,
  .build-card {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header .primary-button,
  .app-row-head .secondary-button,
  .form-actions .primary-button,
  .form-actions .secondary-button {
    width: 100%;
  }

  .form-grid,
  .version-head {
    grid-template-columns: 1fr;
  }

  .version-head {
    display: none;
  }

  .version-table {
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .version-line {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fbfcfa;
  }

  .version-line + .version-line {
    margin-top: 10px;
    border-top: 1px solid var(--line);
  }

  .version-line span,
  .version-line form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: var(--ink);
  }

  .version-line span::before,
  .version-line form::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
  }

  .danger-button {
    min-width: 88px;
  }
}

@media (max-width: 560px) {
  .auth-page,
  .install-page {
    padding: 14px;
    place-items: start center;
  }

  .auth-panel,
  .install-gate {
    margin-top: 7vh;
    padding: 22px;
  }

  .install-wrap {
    margin-top: 20px;
  }

  h1 {
    font-size: 28px;
  }

  .workspace {
    padding: 16px;
  }

  .panel,
  .app-row,
  .empty-state,
  .build-card {
    padding: 16px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav a {
    min-width: 94px;
  }

  .install-item,
  .build-card {
    align-items: stretch;
  }

  .install-item {
    padding: 16px;
  }

  .install-item b {
    align-self: center;
  }

  .build-card .primary-button {
    width: 100%;
  }

  input,
  textarea {
    font-size: 16px;
  }
}
