:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei UI", "Segoe UI", sans-serif;
  background: #151719;
  color: #e8ecef;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #151719; }
.topbar { min-height: 56px; display: flex; align-items: center; gap: 26px; padding: 0 24px; background: #202428; border-bottom: 1px solid #383e43; }
.brand { font-size: 16px; font-weight: 700; color: #f1c84b; white-space: nowrap; }
nav { display: flex; gap: 4px; flex: 1; }
nav a { color: #c9d0d5; text-decoration: none; padding: 17px 11px 15px; border-bottom: 2px solid transparent; }
nav a:hover { color: white; border-bottom-color: #f1c84b; }
.account { display: flex; align-items: center; gap: 12px; color: #aeb7bd; font-size: 13px; }
.account form, td form { margin: 0; }
.shell { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 48px; }
.page-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
h1 { margin: 0; font-size: 24px; letter-spacing: 0; }
h2 { margin: 0; font-size: 16px; letter-spacing: 0; }
p { margin: 5px 0 0; color: #98a3aa; font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); border-top: 1px solid #3b4247; border-bottom: 1px solid #3b4247; margin-bottom: 22px; }
.metrics div { padding: 17px 18px; border-right: 1px solid #3b4247; }
.metrics div:last-child { border-right: 0; }
.metrics span { display: block; color: #9fa9b0; font-size: 12px; }
.metrics strong { display: block; margin-top: 5px; font-size: 25px; color: #f2f4f5; }
.section { margin-top: 18px; }
.section-head { margin-bottom: 9px; }
.form-band { padding: 15px; background: #202428; border: 1px solid #383e43; border-radius: 6px; }
.inline-form { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)) auto; align-items: end; gap: 10px; }
.release-form { display: grid; grid-template-columns: 130px 2fr 2fr; align-items: end; gap: 10px; }
.release-form label:nth-child(5) { grid-column: 1 / 4; }
.stack-form { display: grid; gap: 14px; }
label { display: grid; gap: 5px; color: #aeb7bd; font-size: 12px; }
input, select, textarea { width: 100%; min-height: 34px; border: 1px solid #4a535a; border-radius: 4px; background: #15181a; color: #edf0f2; padding: 7px 9px; font: inherit; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #4a90c2; outline-offset: 0; }
.check { display: flex; align-items: center; gap: 7px; min-height: 34px; }
.check input { width: 16px; min-height: 16px; }
.button { min-height: 32px; border: 1px solid #59636a; border-radius: 4px; background: #30363b; color: #eef1f3; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.button:hover { background: #3a4248; }
.button.primary { background: #2879ad; border-color: #3289c0; }
.button.success { background: #277847; border-color: #34955b; }
.button.danger { background: #a83e45; border-color: #c04c54; }
.button.ghost { background: transparent; }
.table-wrap { overflow-x: auto; border: 1px solid #383e43; border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: #aeb7bd; background: #202428; font-weight: 600; padding: 10px; border-bottom: 1px solid #42494f; white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid #30363a; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #1e2225; }
code { color: #f1c84b; font-family: Consolas, monospace; white-space: nowrap; }
.compact-form { display: flex; gap: 6px; }
.compact-form input { width: 82px; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.card-actions { flex-wrap: wrap; }
.timestamp { white-space: nowrap; }
.key-cell { display: flex; align-items: center; gap: 8px; }
.copy-button { min-height: 26px; padding: 3px 8px; }
.duration-value { display: block; white-space: nowrap; }
.duration-form { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.duration-form input { width: 98px; min-height: 30px; }
.status { display: inline-block; min-width: 42px; text-align: center; padding: 3px 6px; border-radius: 3px; font-size: 12px; }
.status.ok { color: #8de4aa; background: #193c28; }
.status.off { color: #ef9ca1; background: #482529; }
.notice { padding: 10px 12px; margin-bottom: 14px; border-left: 3px solid #4a90c2; background: #202b32; overflow-wrap: anywhere; }
.notice.success { border-color: #45a56a; background: #1d3125; }
.notice.error { border-color: #cf555d; background: #382225; }
.empty { text-align: center; color: #7e898f; padding: 28px; }
.url-cell { max-width: 320px; overflow-wrap: anywhere; }
.login-panel { width: min(380px, 100%); margin: 12vh auto 0; padding: 24px; border: 1px solid #3c444a; border-radius: 6px; background: #202428; }
.login-panel h1 { margin-bottom: 20px; }
.account-form { width: min(460px, 100%); }
@media (max-width: 820px) {
  .topbar { align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
  nav { order: 3; flex: 0 0 100%; min-width: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 4px; }
  nav a { padding: 10px 6px; border: 1px solid #383e43; border-radius: 4px; text-align: center; white-space: nowrap; }
  .account { margin-left: auto; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics div:nth-child(2) { border-right: 0; }
  .inline-form, .release-form { grid-template-columns: 1fr 1fr; }
  .release-form label:nth-child(5) { grid-column: 1 / 3; }
}
@media (max-width: 680px) {
  .page-head { align-items: flex-start; }
  .table-wrap { overflow: visible; border: 0; }
  table, tbody { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  tbody { display: grid; gap: 10px; }
  tbody tr { display: block; border: 1px solid #383e43; border-radius: 6px; background: #1b1e21; overflow: hidden; }
  tbody tr:hover { background: #1b1e21; }
  td { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; align-items: start; min-height: 40px; padding: 9px 10px; overflow-wrap: anywhere; }
  td::before { content: attr(data-label); color: #98a3aa; font-size: 12px; font-weight: 600; }
  td.empty { display: block; padding: 28px 12px; }
  td.empty::before { content: none; }
  td code { white-space: normal; overflow-wrap: anywhere; }
  .key-cell, .row-actions { min-width: 0; flex-wrap: wrap; }
  .duration-form { flex-wrap: wrap; }
  .duration-form input { width: min(138px, 100%); }
  .compact-form input { width: min(120px, 100%); }
  .button { min-height: 40px; }
}
@media (max-width: 520px) {
  .shell { width: min(100% - 20px, 1440px); padding-top: 16px; }
  .topbar { padding: 10px; }
  .brand { line-height: 40px; }
  .account { gap: 6px; }
  .account span:not(:first-child) { display: none; }
  .account span:first-child { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  nav.nav-agent { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  nav.nav-admin { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  nav a { font-size: 13px; }
  .inline-form, .release-form { grid-template-columns: 1fr; }
  .release-form label:nth-child(5) { grid-column: 1; }
  input, select, textarea { min-height: 42px; }
  .form-band { padding: 12px; }
  .metrics div { padding: 14px 12px; }
  .metrics strong { font-size: 22px; }
  .login-panel { margin-top: 7vh; padding: 20px; }
}
