:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --text: #182033;
  --muted: #667085;
  --line: #e4e9f2;
  --primary: #3557d6;
  --primary-dark: #2743b0;
  --green: #0f9b6c;
  --green-bg: #e8f8f1;
  --amber: #b7791f;
  --amber-bg: #fff7e6;
  --red: #c0392b;
  --red-bg: #fdecea;
  --gray: #667085;
  --gray-bg: #eef2f7;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(24, 32, 51, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3557d6, #6a8cff);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 6px 14px rgba(53, 87, 214, 0.28);
  flex: 0 0 auto;
}

.brand-text {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.01em;
}

.brand-text small {
  display: block;
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.nav-link:hover {
  background: var(--gray-bg);
  color: var(--text);
  text-decoration: none;
}

.nav-link.is-active {
  background: #eef2ff;
  color: var(--primary);
}

.logout-form {
  margin: 0 0 0 4px;
}

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
}

h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.server-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.status-orb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
  flex: 0 0 auto;
}

.status-copy {
  flex: 1;
  min-width: 0;
}

.status-copy strong {
  display: block;
  font-size: 15px;
}

.status-copy span {
  color: var(--muted);
  font-size: 13px;
}

.status-valid {
  border-left: 4px solid var(--green);
}

.status-warning,
.status-critical {
  border-left: 4px solid var(--amber);
}

.status-expired {
  border-left: 4px solid var(--red);
}

.status-missing {
  border-left: 4px solid var(--gray);
}

.status-valid .status-orb {
  background: var(--green-bg);
  color: var(--green);
}

.status-warning .status-orb,
.status-critical .status-orb {
  background: var(--amber-bg);
  color: var(--amber);
}

.status-expired .status-orb {
  background: var(--red-bg);
  color: var(--red);
}

.status-missing .status-orb {
  background: var(--gray-bg);
  color: var(--gray);
}

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

.span-7 {
  grid-column: span 7;
}

.span-5 {
  grid-column: span 5;
}

.span-12 {
  grid-column: span 12;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ok {
  background: var(--green-bg);
  color: var(--green);
}

.badge-warn {
  background: var(--amber-bg);
  color: var(--amber);
}

.badge-bad {
  background: var(--red-bg);
  color: var(--red);
}

.badge-muted {
  background: var(--gray-bg);
  color: var(--gray);
}

.cert-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f7f9ff, #eef3ff);
  margin-bottom: 18px;
}

.big-number {
  font-size: 56px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--primary);
}

.big-number span {
  font-size: 16px;
  font-weight: 600;
  margin-left: 6px;
  letter-spacing: 0;
  color: var(--muted);
}

.cert-hero-meta {
  flex: 1;
  min-width: 0;
}

.cert-hero-meta p {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 14px;
}

.cert-hero-meta small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.cert-progress {
  width: 100%;
  height: 8px;
  appearance: none;
  border: none;
  border-radius: 999px;
  overflow: hidden;
  background: #dfe7f7;
  display: block;
}

.cert-progress::-webkit-progress-bar {
  background: #dfe7f7;
}

.cert-progress::-webkit-progress-value {
  background: linear-gradient(90deg, #3557d6, #6a8cff);
  border-radius: 999px;
}

.cert-progress::-moz-progress-bar {
  background: linear-gradient(90deg, #3557d6, #6a8cff);
  border-radius: 999px;
}

.kv {
  margin: 0;
  display: grid;
  gap: 12px;
}

.kv > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.kv > div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.kv dt {
  color: var(--muted);
  font-size: 13px;
  flex: 0 0 auto;
}

.kv dd {
  margin: 0;
  text-align: right;
  font-size: 13px;
  font-weight: 500;
  word-break: break-word;
}

.kv dd small {
  color: var(--muted);
  font-weight: 400;
}

.kv-compact > div {
  padding-bottom: 8px;
}

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

.kv-grid > div {
  border-bottom: 1px dashed var(--line);
}

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

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 9px;
  background: #f2f5fb;
  border: 1px solid #e6ebf5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: #344054;
}

.split-status {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.split-status > div {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.action-stack {
  display: grid;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(53, 87, 214, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #eef2ff;
  color: var(--primary);
  border-color: #dfe6ff;
}

.btn-secondary:hover:not(:disabled) {
  background: #e3eaff;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--gray-bg);
  color: var(--text);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 7px 11px;
  font-size: 13px;
  border-radius: 9px;
}

.btn.is-busy {
  position: relative;
  color: transparent;
}

.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}

.btn-secondary.is-busy::after,
.btn-ghost.is-busy::after {
  border-color: rgba(53, 87, 214, 0.75);
  border-top-color: transparent;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.output-panel pre {
  margin: 0;
  padding: 18px;
  border-radius: 12px;
  background: #0f172a;
  color: #d7e3ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.65;
  overflow: auto;
  max-height: 420px;
  white-space: pre-wrap;
  word-break: break-word;
}

.output-panel pre:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  padding: 12px 14px;
  border-radius: 11px;
  font-size: 13px;
  border: 1px solid transparent;
}

.flash-error {
  background: #fdecea;
  color: #a93226;
  border-color: #f5c6c0;
}

.flash-message,
.flash-success {
  background: #e8f8f1;
  color: #0f7a56;
  border-color: #bfe9d8;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.login-body {
  min-height: 100vh;
  background: radial-gradient(1000px 600px at 15% 10%, #e7edff 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 90%, #e6f7f1 0%, transparent 55%), var(--bg);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 48px;
  padding-bottom: 48px;
}

.login-wrap {
  width: 100%;
  max-width: 430px;
}

.login-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 22px;
  padding: 32px;
  box-shadow: 0 24px 60px rgba(24, 32, 51, 0.12);
  backdrop-filter: blur(10px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.brand-mark-lg {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  font-size: 22px;
}

.login-brand h1 {
  font-size: 20px;
  margin: 0;
}

.login-brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  font-size: 13px;
  font-weight: 600;
  color: #344054;
}

.field input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid #d5dbe7;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(53, 87, 214, 0.12);
}

.login-hint {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

.login-footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 18px;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

::selection {
  background: rgba(53, 87, 214, 0.18);
}

@media (max-width: 900px) {
  .span-7,
  .span-5 {
    grid-column: span 12;
  }

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

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .server-time {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .page {
    padding: 24px 16px 48px;
  }

  h1 {
    font-size: 25px;
  }

  .panel {
    padding: 18px;
  }

  .cert-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .big-number {
    font-size: 48px;
  }

  .kv > div {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .kv dd {
    text-align: left;
  }

  .status-strip {
    align-items: flex-start;
  }

  .status-strip > .badge {
    display: none;
  }

  .login-card {
    padding: 24px;
  }
}
