:root {
  --bg: #0f1419;
  --bg-soft: #1a2332;
  --panel: #1e2a3a;
  --line: #2d3f55;
  --text: #e7eef7;
  --muted: #8aa0b8;
  --accent: #3d9cf0;
  --accent-hover: #5aadf5;
  --ok: #3ecf8e;
  --warn: #e6b35c;
  --err: #ef6b6b;
  --radius: 10px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1b3a5c 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #163028 0%, transparent 50%),
    var(--bg);
}

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

a:hover {
  color: var(--accent-hover);
}

.wrap {
  width: min(1280px, calc(100% - 24px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.card {
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 0.85rem;
}

.pill.ok {
  border-color: color-mix(in srgb, var(--ok) 50%, var(--line));
  color: var(--ok);
}

.pill.bad {
  border-color: color-mix(in srgb, var(--err) 50%, var(--line));
  color: var(--err);
}

.pill.warn {
  border-color: color-mix(in srgb, var(--warn) 50%, var(--line));
  color: var(--warn);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.92rem;
}

th {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

/* 站点列表：站点列加宽完整显示；域名列收窄、字号加大 */
table.sites-table th:nth-child(1),
table.sites-table td:nth-child(1) { width: 36px; }
table.sites-table th:nth-child(2),
table.sites-table td:nth-child(2) { width: 18%; }
table.sites-table th:nth-child(3),
table.sites-table td:nth-child(3) { width: 7%; }
table.sites-table th:nth-child(4),
table.sites-table td:nth-child(4) { width: 10%; }
table.sites-table th:nth-child(5),
table.sites-table td:nth-child(5) { width: 16%; }
table.sites-table th:nth-child(6),
table.sites-table td:nth-child(6) { width: 18%; }
table.sites-table th:nth-child(7),
table.sites-table td:nth-child(7) { width: 14%; }
table.sites-table th:nth-child(8),
table.sites-table td:nth-child(8) { width: 72px; white-space: nowrap; }

table.sites-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

table.sites-table td.col-site {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
  line-height: 1.35;
  font-size: 0.95rem;
}

table.sites-table td.col-status {
  white-space: normal;
}

table.sites-table td.col-status .hint-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 4px;
  font-size: 0.78rem;
}

table.sites-table td.col-domain {
  white-space: normal;
  overflow: visible;
}

.domains {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.domains .tag {
  display: inline-block;
  margin-right: 0;
  font-size: 0.95rem;
  padding: 3px 8px;
}

.tag {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.col-path {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.8rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

button,
.btn {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.92rem;
}

button:hover,
.btn:hover {
  background: var(--accent-hover);
}

button.secondary,
.btn.secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

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

.login-box {
  width: min(400px, calc(100% - 32px));
  margin: 12vh auto 0;
}

.login-box h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

.alert {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--err) 18%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--err) 45%, var(--line));
  color: #ffd2d2;
  font-size: 0.9rem;
}

.alert.info {
  background: color-mix(in srgb, var(--warn) 16%, var(--panel));
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
  color: #ffe6b8;
}

pre.log {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  max-height: 280px;
  overflow: auto;
  font-size: 0.8rem;
  color: #c7d5e6;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
}

.badge.success {
  color: var(--ok);
}
.badge.failed {
  color: var(--err);
}
.badge.running,
.badge.pending {
  color: var(--warn);
}
.badge.partial {
  color: var(--warn);
}

details {
  margin-top: 8px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-soft) 80%, transparent);
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.filter-item.grow {
  flex: 1 1 220px;
  min-width: 200px;
}

.filter-item input[type="search"] {
  width: 100%;
  min-width: 180px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
}

.cert-expiring {
  color: var(--err);
  font-weight: 600;
}

tr.row-expiring td.col-expire .cert-expiring {
  color: var(--err);
}

tr.row-hidden {
  opacity: 0.85;
}

.tag-hidden {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
}

.btn-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* 自定义下拉：与确认申请弹层同风格 */
.menu-select {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.menu-select-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 168px;
  max-width: min(480px, 100%);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
  line-height: 1.35;
}

.menu-select-btn::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  flex: 0 0 auto;
}

.menu-select.is-open .menu-select-btn {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}

.menu-select-btn-sm {
  min-width: 56px;
  padding: 4px 10px;
  font-size: 0.9rem;
}

.menu-select-inline {
  vertical-align: middle;
  margin: 0 4px;
}

.menu-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  z-index: 45;
  width: min(360px, calc(100vw - 48px));
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.45));
}

.menu-popover[hidden] {
  display: none !important;
}

.menu-popover-inner {
  position: relative;
  background: color-mix(in srgb, var(--panel) 96%, #0a1018);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 12px;
  padding: 12px;
}

.menu-popover-inner::before {
  content: "";
  position: absolute;
  left: 28px;
  top: -6px;
  width: 12px;
  height: 12px;
  background: inherit;
  border-left: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-top: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  transform: rotate(45deg);
}

.menu-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 10px;
  padding: 0 4px;
}

.menu-options {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow: auto;
}

.menu-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.menu-option:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--bg-soft) 70%, var(--bg));
}

.menu-option.is-active {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 14%, var(--bg));
}

.menu-option-main {
  font-weight: 600;
}

.menu-option-sub {
  font-size: 0.8rem;
}

#ca-menu .menu-select-btn {
  width: min(100%, 520px);
}

body.menu-open::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 16, 0.28);
  z-index: 35;
  pointer-events: none;
}

.pager-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.pager-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.pager-links {
  display: flex;
  gap: 8px;
}


.row-disabled {
  opacity: 0.72;
}

.opt-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 0.92rem;
  cursor: pointer;
}

.opt-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.card-inner {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.confirm-opts {
  margin: 0 0 12px;
  padding-left: 1.1em;
  font-size: 0.85rem;
  line-height: 1.5;
}

.actions-issue {
  position: relative;
  flex-wrap: wrap;
}

.confirm-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  z-index: 40;
  width: min(420px, calc(100vw - 48px));
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.45));
}

.confirm-popover[hidden] {
  display: none !important;
}

.confirm-popover-inner {
  position: relative;
  background: color-mix(in srgb, var(--panel) 96%, #0a1018);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 12px;
  padding: 16px 16px 14px;
}

.confirm-popover-inner::after {
  content: "";
  position: absolute;
  left: 220px;
  bottom: -7px;
  width: 12px;
  height: 12px;
  background: inherit;
  border-right: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  transform: rotate(45deg);
}

.confirm-title {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.confirm-desc {
  margin: 0 0 10px;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
}

.confirm-sites {
  margin: 0 0 10px;
  padding: 10px 12px;
  list-style: none;
  max-height: 140px;
  overflow: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 0.88rem;
}

.confirm-sites li {
  padding: 3px 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--line) 70%, transparent);
}

.confirm-sites li:last-child {
  border-bottom: 0;
}

.confirm-note {
  margin: 0 0 12px;
  font-size: 0.8rem;
  line-height: 1.4;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

body.confirm-open::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 16, 0.35);
  z-index: 30;
  pointer-events: none;
}

@media (max-width: 720px) {
  .confirm-popover {
    left: 0;
    right: 0;
    width: 100%;
  }
  .confirm-popover-inner::after {
    left: 50%;
    margin-left: -6px;
  }
}

.progress-wrap {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 70%, var(--line));
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-wrap.overall {
  height: 12px;
}

.progress-wrap.item-progress {
  margin-top: 10px;
  height: 8px;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2b7fc4, var(--accent));
  transition: width 0.45s ease;
  position: relative;
}

.progress-bar.is-ok {
  background: linear-gradient(90deg, #2a9a68, var(--ok));
}

.progress-bar.is-failed {
  background: linear-gradient(90deg, #b94a4a, var(--err));
}

.progress-bar.is-warn {
  background: linear-gradient(90deg, #b8893a, var(--warn));
}

.progress-bar.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    transparent 0%,
    rgba(255, 255, 255, 0.22) 45%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: progress-shine 1.2s linear infinite;
}

@keyframes progress-shine {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -80% 0;
  }
}

@media (max-width: 720px) {
  .hide-sm {
    display: none;
  }
  th,
  td {
    font-size: 0.84rem;
  }
}
