:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --background: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e1e5eb;
  --border-strong: #cbd2dc;
  --text: #18202d;
  --muted: #687386;
  --primary: #ce3150;
  --primary-dark: #a92742;
  --success: #167c57;
  --success-bg: #edf9f4;
  --warning: #96600a;
  --warning-bg: #fff8e7;
  --danger: #b4233e;
  --danger-bg: #fff1f3;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
  color: var(--text);
}

body {
  min-height: 100vh;
  margin: 0;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

code,
.mono,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

strong,
h1,
h2,
h3,
p {
  margin: 0;
}

small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(178px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  height: 58px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand img {
  width: 31px;
  height: 31px;
}

.brand span {
  display: flex;
  flex-direction: column;
}

.brand strong {
  font-size: 14px;
  line-height: 16px;
}

.brand small {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.topbar nav {
  display: flex;
  min-width: 0;
  align-items: stretch;
  align-self: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar nav::-webkit-scrollbar {
  display: none;
}

.topbar nav a,
.account-link {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.topbar nav a:hover,
.topbar nav a.active,
.account-link:hover,
.account-link.active {
  border-bottom-color: var(--primary);
  color: var(--text);
}

.topbar-side {
  display: flex;
  align-self: stretch;
  align-items: center;
  gap: 8px;
}

.environment {
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.content {
  width: min(100%, 1900px);
  margin: 0 auto;
  padding: 26px 28px 48px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.page-header p,
.card-header p,
.admin-action-copy p,
.widget > p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.actions,
.row-actions,
.download-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.card-actions {
  margin-top: 18px;
}

.button,
.download-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
.download-button:hover {
  border-color: #9aa5b4;
  background: #fbfcfd;
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

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

.button.primary:hover,
.download-button.primary:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

.button.quiet {
  border-color: var(--border);
  background: var(--surface-muted);
}

.button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.button.danger-text {
  border-color: #f3c4cc;
  background: var(--danger-bg);
  color: var(--danger);
}

.button.wide {
  width: 100%;
  min-height: 40px;
}

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

.metric-link {
  text-decoration: none;
}

.metric {
  height: 100%;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-link:hover .metric {
  border-color: var(--border-strong);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.metric strong {
  display: block;
  margin: 8px 0 3px;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.metric small {
  margin: 0;
}

.card {
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  font-size: 14px;
  line-height: 1.3;
}

.card-body {
  padding: 16px;
}

.card-body > .table-wrap {
  margin: -16px;
}

.badge {
  display: inline-flex;
  min-height: 21px;
  align-items: center;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: #4f5a6c;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.badge.success {
  border-color: #a9dbc8;
  background: var(--success-bg);
  color: var(--success);
}

.badge.warning {
  border-color: #ead29b;
  background: var(--warning-bg);
  color: var(--warning);
}

.badge.danger {
  border-color: #f0b8c2;
  background: var(--danger-bg);
  color: var(--danger);
}

.summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -8px 0 16px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

input,
select,
textarea {
  width: 100%;
  min-height: 35px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  outline: none;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

textarea {
  min-height: 108px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, monospace;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(206 49 80 / 10%);
}

.filters input {
  width: min(280px, 100%);
}

.filters select {
  width: auto;
  min-width: 130px;
}

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

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  color: #3b4555;
  font-size: 11px;
  font-weight: 650;
}

label.check {
  flex-direction: row;
  align-items: center;
}

label.check input {
  width: 15px;
  min-height: 15px;
  margin: 0;
}

.inline-details {
  min-width: min(520px, 80vw);
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.inline-details summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.inline-details[open] summary {
  margin-bottom: 12px;
}

.table-wrap {
  max-width: calc(100% + 32px);
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 12px;
}

thead {
  background: var(--surface-muted);
  color: var(--muted);
}

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

th {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fcfcfd;
}

td a {
  color: var(--text);
  text-decoration: none;
}

td a:hover strong {
  color: var(--primary);
}

td code {
  font-size: 10px;
  word-break: break-all;
}

.row-actions {
  flex-wrap: nowrap;
}

.row-actions .button {
  min-height: 27px;
  padding: 5px 7px;
  font-size: 10px;
  white-space: nowrap;
}

.truncate {
  display: block;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danger-text {
  color: var(--danger);
}

.definition-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.definition-list > div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  min-height: 37px;
  border-bottom: 1px solid var(--border);
}

.definition-list > div:nth-child(odd) {
  border-right: 1px solid var(--border);
}

.definition-list > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.definition-list dt,
.definition-list dd {
  margin: 0;
  padding: 9px 10px;
}

.definition-list dt {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.definition-list dd {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.admin-actions {
  display: grid;
  gap: 12px;
}

.admin-action-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 2fr) auto;
  align-items: end;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-muted);
}

.widget-grid {
  display: grid;
  gap: 12px;
}

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

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

.widget {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.widget h3 {
  font-size: 13px;
}

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

.widget-fields > div {
  padding: 9px;
  border-radius: 6px;
  background: var(--surface-muted);
}

.widget-fields dt,
.widget-fields dd {
  margin: 0;
}

.widget-fields dt {
  color: var(--muted);
  font-size: 10px;
}

.widget-fields dd {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 650;
}

pre {
  max-height: 420px;
  margin: 10px 0 0;
  overflow: auto;
  padding: 12px;
  border-radius: 6px;
  background: #111827;
  color: #e5e7eb;
  font-size: 11px;
  line-height: 1.55;
}

.preserve {
  white-space: pre-wrap;
}

.notice {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: #445066;
  font-size: 12px;
}

.notice.success {
  border-color: #a9dbc8;
  background: var(--success-bg);
  color: var(--success);
}

.notice.error {
  border-color: #f0b8c2;
  background: var(--danger-bg);
  color: var(--danger);
}

.empty-state,
.center-state,
.error-page {
  padding: 28px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.center-state,
.error-page {
  display: grid;
  min-height: 100vh;
  place-content: center;
  gap: 12px;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 10%, rgb(206 49 80 / 9%), transparent 34%),
    var(--background);
}

.auth-card {
  display: flex;
  width: min(100%, 360px);
  flex-direction: column;
  gap: 15px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgb(30 41 59 / 10%);
}

.auth-card > img {
  width: 42px;
  height: 42px;
  margin: 0 auto;
}

.auth-card > div {
  text-align: center;
}

.auth-card h1 {
  font-size: 20px;
}

.auth-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.install-page {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 8%, rgb(239 69 101 / 13%), transparent 30%),
    radial-gradient(circle at 92% 80%, rgb(52 120 246 / 11%), transparent 28%),
    #f7f8fb;
}

.install-hero {
  display: grid;
  width: min(1180px, calc(100% - 40px));
  min-height: 760px;
  margin: 0 auto;
  grid-template-columns: minmax(0, 0.9fr) minmax(480px, 1.1fr);
  align-items: center;
  gap: 70px;
}

.install-copy h1 {
  margin-top: 24px;
  font-size: clamp(46px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.065em;
}

.install-copy h1 em {
  display: block;
  color: #ef4565;
  font-style: normal;
}

.install-copy > p {
  max-width: 560px;
  margin-top: 24px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.release-line {
  display: flex;
  margin-top: 24px;
  flex-direction: column;
  gap: 4px;
  padding-left: 12px;
  border-left: 2px solid #ef4565;
}

.release-line span {
  color: var(--muted);
  font-size: 12px;
}

.download-actions {
  margin-top: 28px;
}

.download-button {
  min-height: 46px;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
}

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

.install-copy ul {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 26px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  list-style: none;
}

.install-copy li::before {
  margin-right: 7px;
  color: #ef4565;
  content: "●";
}

.install-visual {
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 26px;
  background: rgb(255 255 255 / 65%);
  box-shadow: 0 35px 90px rgb(18 29 50 / 15%);
}

.install-visual img {
  display: block;
  width: 100%;
  border-radius: 17px;
}

.install-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px max(24px, calc((100vw - 1180px) / 2));
  border-top: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
}

.install-footer div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.install-footer img {
  width: 28px;
  height: 28px;
}

.install-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.install-footer nav a {
  color: #4f5b70;
  font-size: 13px;
  font-weight: 650;
  text-underline-offset: 4px;
}

.install-footer nav a:hover {
  color: var(--primary);
}

.route-progress {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  width: 35%;
  height: 2px;
  animation: route-progress 1s ease-in-out infinite;
  background: var(--primary);
}

@keyframes route-progress {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(360%);
  }
}

@media (max-width: 1050px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .install-hero {
    min-height: auto;
    padding: 80px 0;
    grid-template-columns: 1fr;
  }

  .install-copy {
    text-align: center;
  }

  .install-copy > p {
    margin-right: auto;
    margin-left: auto;
  }

  .release-line {
    align-items: center;
    border-left: 0;
  }

  .download-actions,
  .install-copy ul {
    justify-content: center;
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px;
    padding: 0 12px;
  }

  .brand span,
  .environment {
    display: none;
  }

  .topbar nav a,
  .account-link {
    padding: 0 10px;
  }

  .content {
    padding: 20px 14px 40px;
  }

  .page-header {
    flex-direction: column;
  }

  .page-header .actions,
  .inline-details {
    width: 100%;
    min-width: 0;
  }

  .definition-list,
  .form-grid,
  .widget-grid.two-column,
  .widget-grid.three-column,
  .widget-fields {
    grid-template-columns: 1fr;
  }

  .definition-list > div:nth-child(odd) {
    border-right: 0;
  }

  .definition-list > div:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

  .definition-list > div:last-child {
    border-bottom: 0;
  }

  .admin-action-form {
    grid-template-columns: 1fr;
  }

  .install-footer {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 520px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .filters > * {
    width: 100% !important;
  }

  .definition-list > div {
    grid-template-columns: 100px minmax(0, 1fr);
  }

  .install-hero {
    width: min(100% - 28px, 1180px);
    padding: 55px 0;
  }

  .install-copy h1 {
    font-size: 48px;
  }

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