:root {
  --bg: #07090f;
  --panel: #111522;
  --panel-soft: #171d2d;
  --text: #f5f8ff;
  --muted: #a8b1c8;
  --faint: #758099;
  --line: rgba(151, 166, 205, 0.28);
  --line-strong: rgba(195, 211, 255, 0.4);
  --green: #58f4a6;
  --cyan: #39d8ff;
  --yellow: #ffd36a;
  --red: #ff7373;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(135deg, #06080e 0%, #101421 58%, #080912 100%);
  background-size: 28px 28px, 28px 28px, auto;
}

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

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 900;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
}

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

button:disabled:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
}

button.primary {
  color: #07100c;
  border-color: rgba(88, 244, 166, 0.65);
  background: var(--green);
}

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

textarea {
  resize: vertical;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(57, 216, 255, 0.14);
}

.shell {
  width: min(1380px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 46px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

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

.topbar-actions,
.form-actions,
.storage-actions,
.list-tools,
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-code-field {
  min-width: 240px;
}

.topbar-actions .admin-code-field input {
  min-height: 40px;
}

.status-strip {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.sync-status {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.04);
}

.sync-status[data-type="loading"] {
  border-color: rgba(57, 216, 255, 0.45);
  color: var(--cyan);
}

.sync-status[data-type="success"] {
  border-color: rgba(88, 244, 166, 0.45);
  color: var(--green);
}

.sync-status[data-type="warning"] {
  border-color: rgba(255, 211, 106, 0.45);
  color: var(--yellow);
}

.sync-status[data-type="error"] {
  border-color: rgba(255, 115, 115, 0.5);
  color: #ffb5b5;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat,
.panel,
.account-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 21, 34, 0.94);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.stat {
  min-height: 88px;
  padding: 14px;
}

.stat strong,
.stat span {
  display: block;
}

.stat strong {
  font-size: 28px;
  line-height: 1;
}

.stat span {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1.08fr) minmax(340px, 0.92fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.panel {
  padding: 20px;
}

.panel-title {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-title span {
  font-size: 21px;
  font-weight: 900;
}

.panel-title small {
  color: var(--muted);
  font-size: 12px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

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

.form-actions,
.storage-actions,
.list-tools {
  margin-top: 14px;
}

.storage-note {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.7;
}

.list-tools input {
  flex: 1 1 260px;
}

.account-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.account-card {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.account-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
}

.account-head strong,
.account-head small,
.account-meta span,
.maintenance-log small {
  display: block;
}

.account-head small,
.account-meta,
.maintenance-log {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.account-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 8px 14px;
}

.account-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.04);
}

.account-note.is-closed {
  border-color: rgba(255, 115, 115, 0.36);
  color: #ffcccc;
}

.status-pill {
  min-width: 82px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
}

.status-pill.is-active,
.status-pill.is-pending {
  border-color: rgba(88, 244, 166, 0.45);
  color: var(--green);
}

.status-pill.is-expiring {
  border-color: rgba(255, 211, 106, 0.45);
  color: var(--yellow);
}

.status-pill.is-expired,
.status-pill.is-paused,
.status-pill.is-closed {
  border-color: rgba(255, 115, 115, 0.48);
  color: #ffb5b5;
}

.status-pill.is-maintenance {
  border-color: rgba(57, 216, 255, 0.45);
  color: var(--cyan);
}

.note-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.maintenance-log {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 20;
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 16px;
  border: 1px solid rgba(88, 244, 166, 0.45);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  background: #111522;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
}

@media (max-width: 1120px) {
  .stats {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1380px);
    padding-top: 16px;
  }

  .topbar,
  .account-head,
  .account-meta,
  .note-row {
    grid-template-columns: 1fr;
  }

  .topbar-actions button {
    flex: 1 1 120px;
  }

  .admin-code-field {
    width: 100%;
  }

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

  h1 {
    font-size: 28px;
  }

  .panel {
    padding: 16px;
  }

  .panel-title {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}
