:root {
  --bg: #0c1017;
  --card: #151b26;
  --border: #263246;
  --text: #e7edf5;
  --muted: #8b9bb8;
  --accent: #07c160;
  --accent-dim: #069652;
  --danger: #e55353;
  --warn: #f0b429;
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(165deg, #121a28 0%, var(--bg) 45%);
  color: var(--text);
}

.screen {
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-card {
  width: min(440px, 100%);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.35rem 1.25rem;
  margin-bottom: 1rem;
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
}

.muted {
  color: var(--muted);
}

.hint {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 1rem;
}

.hint.small {
  font-size: 0.82rem;
  margin-top: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.field span {
  font-size: 0.82rem;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d121a;
  color: var(--text);
  font-size: 0.95rem;
}

textarea {
  resize: vertical;
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: #fff;
}

.btn.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn.sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.msg {
  min-height: 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--danger);
}

.msg.ok {
  color: var(--accent);
}

/* App layout */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.brand strong {
  font-size: 1.1rem;
}

.brand span {
  margin-left: 0.5rem;
  font-size: 0.88rem;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  font-size: 0.92rem;
}

.tab.active {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-color: var(--card);
  margin-bottom: -1px;
}

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 3rem;
}

.tab-panel.hidden {
  display: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.proj-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.proj-row.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(7, 193, 96, 0.25);
}

.proj-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.proj-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.form-card {
  margin-top: 1.25rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 880px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.qr-wrap {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0e14;
  border-radius: 8px;
  padding: 1rem;
}

.qr-wrap img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.log-card {
  margin-top: 1rem;
}

.log {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  padding: 0.75rem;
  background: #080b10;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: #b8c9e0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

th {
  background: #111722;
  color: var(--muted);
  font-weight: 600;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.78rem;
}

.tag.ok {
  background: rgba(7, 193, 96, 0.15);
  color: var(--accent);
}

.tag.fail {
  background: rgba(229, 83, 83, 0.15);
  color: var(--danger);
}

.footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.78rem;
}

.main-simple {
  max-width: 720px;
}

.notice-banner {
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  background: rgba(7, 193, 96, 0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.btn-wide {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
}

.btn-upload-main {
  margin-top: 0.5rem;
}

.pem-key {
  min-height: 160px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.adv-details {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.adv-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.adv-details .inner-head {
  margin-top: 1rem;
}

.foot-hint {
  margin-top: 1rem;
}

.foot-hint code {
  font-size: 0.8em;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.hero-upload h2 {
  margin-top: 0;
}
