:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --surface-hover: #f0f4f8;
  --text: #1a2b3d;
  --text-muted: #5a7184;
  --text-light: #8da2b5;
  --primary: #0f766e;
  --primary-hover: #0d9488;
  --primary-light: #ccfbf1;
  --primary-bg: rgba(15, 118, 110, 0.06);
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-light: #fef2f2;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

p {
  margin: 0;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 13px;
}

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

input,
textarea,
select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea {
  resize: vertical;
}

/* ── Buttons ──────────────────────────────────────────────── */

button {
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(15, 118, 110, 0.25);
}

.primary-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.3);
}

.secondary-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.secondary-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: #cbd5e1;
}

.danger-btn {
  background: var(--danger);
  color: white;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.25);
}

.danger-btn:hover {
  background: var(--danger-hover);
}

/* ── Topbar ───────────────────────────────────────────────── */

.topbar {
  padding: 0 28px;
  height: 56px;
  background: linear-gradient(135deg, #134e4a 0%, #1b5e4f 50%, #1a4731 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0;
}

.topbar-icon {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.subtitle {
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

/* ── Session Panel ────────────────────────────────────────── */

.session-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.session-panel span {
  background: rgba(255, 255, 255, 0.12);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
}

.session-panel .secondary-btn {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 5px 12px;
  font-size: 12px;
}

.session-panel .secondary-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ── Container ────────────────────────────────────────────── */

.container {
  max-width: 1100px;
  margin: 24px auto 60px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Card ─────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* ── Login Card ───────────────────────────────────────────── */

.login-card {
  max-width: 440px;
  margin: 80px auto 0;
  text-align: center;
  padding: 36px 32px;
}

.login-card h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.login-card .muted {
  margin-bottom: 20px;
  font-size: 12px;
  line-height: 1.5;
}

.login-card .login-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  margin-bottom: 20px;
}

.login-card .primary-btn {
  width: 100%;
  padding: 11px;
  font-size: 14px;
}

.login-accent {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin: 0 auto 16px;
}

/* ── Muted ────────────────────────────────────────────────── */

.muted {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 8px;
}

/* ── Tabs ─────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  flex: 1;
  background: transparent;
  color: var(--text-muted);
  border-radius: 8px;
  padding: 9px 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  text-align: center;
}

.tab-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: none;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 4px rgba(15, 118, 110, 0.25);
}

.tab-btn.active:hover {
  transform: none;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Grid ─────────────────────────────────────────────────── */

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

.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ── Section Head ─────────────────────────────────────────── */

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

.section-desc {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

/* ── Result Box ───────────────────────────────────────────── */

.result-box {
  width: 100%;
  overflow: auto;
  margin: 12px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: #1e293b;
  color: #94e8d3;
  font-family: "SF Mono", "Fira Code", Consolas, Monaco, monospace;
  font-size: 12px;
  line-height: 1.6;
  min-height: 80px;
  max-height: 400px;
  border: 1px solid #334155;
}

/* ── Hidden ───────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Actions ──────────────────────────────────────────────── */

.actions {
  display: flex;
  gap: 10px;
  margin: 8px 0 12px;
  align-items: center;
}

/* ── Subpanel ─────────────────────────────────────────────── */

.subpanel {
  background: var(--surface-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.subpanel:last-child {
  margin-bottom: 0;
}

.subpanel h3 {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── Form sections ────────────────────────────────────────── */

.form-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.form-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  background: var(--surface-muted);
  transition: border-color var(--transition), background var(--transition);
  margin: 12px 0;
}

.file-upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
}

.file-upload-area label {
  display: block;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.file-upload-area input[type="file"] {
  margin-top: 8px;
}

/* ── Deploy panels ────────────────────────────────────────── */

.deploy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.deploy-panel {
  background: var(--surface-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
}

.deploy-panel h3 {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.deploy-panel .danger-btn {
  margin-top: 12px;
}

/* ── Message Box ──────────────────────────────────────────── */

.message-box {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 400px;
  padding: 12px 18px;
  border-radius: var(--radius);
  color: #fff;
  background: #475569;
  z-index: 100;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-box.error {
  background: var(--danger);
}

.message-box.success {
  background: var(--primary);
}

/* ── Table ────────────────────────────────────────────────── */

.table-wrap {
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

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

thead {
  background: var(--surface-muted);
}

th {
  border-bottom: 2px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

td {
  border-bottom: 1px solid var(--border-light);
  padding: 10px 12px;
  font-size: 13px;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--primary-bg);
}

td code {
  background: var(--surface-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
}

td .primary-btn,
td .secondary-btn {
  padding: 5px 10px;
  font-size: 12px;
}

/* ── Status badge ─────────────────────────────────────────── */

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Admin section ────────────────────────────────────────── */

.admin-forms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.admin-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-lists .subpanel {
  margin-bottom: 0;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 900px) {
  .two-cols,
  .three-cols,
  .deploy-grid,
  .admin-forms,
  .admin-lists {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    padding: 12px 16px;
  }

  .subtitle {
    display: none;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab-btn {
    min-width: 80px;
    flex: none;
  }

  .container {
    padding: 0 12px;
  }

  .card {
    padding: 16px;
  }

  .login-card {
    margin-top: 40px;
  }
}
