:root {
  --bg0: #0f1c24;
  --bg1: #1a3340;
  --card: rgba(255, 255, 255, 0.96);
  --text: #142029;
  --muted: #5a6b75;
  --accent: #0d7a6f;
  --line: #d5dde3;
  --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%, #2a6b5a 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #8a4b2a 0%, transparent 50%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 14px 48px;
}

.header { margin-bottom: 16px; color: #eef5f3; }
.brand {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
}
.sub { margin: 8px 0 0; opacity: 0.85; font-size: 14px; }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  margin-bottom: 14px;
}

.card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.subh {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 700;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.stat-row.compact {
  grid-template-columns: 1fr 1fr;
  max-width: 280px;
}
.stat {
  background: #eef6f3;
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
}
.stat-val {
  display: block;
  font-size: 20px;
  font-weight: 800;
  color: #0d7a6f;
  line-height: 1.2;
}
.stat-lab {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 480px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 12px;
}

.hint { font-weight: 400; color: var(--muted); }
.hint-block {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 10px;
}

input[type="text"],
input[type="password"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin-bottom: 12px;
}
.check input { width: auto; margin: 0; }

.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.check-row .check {
  margin-bottom: 0;
  flex: 1;
}

.home-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.home-top .brief { flex: 1; min-width: 0; }
.home-top-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

button.mini {
  width: auto;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.hidden { display: none !important; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 16, 22, 0.55);
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}
.modal-card h3 {
  margin: 0 0 12px;
  font-size: 17px;
}

button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #0a5c54);
  cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.ghost {
  background: #eef2f4;
  color: var(--text);
}

.delay-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}
.delay-row input[type="number"] {
  width: 64px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}
.actions.three { grid-template-columns: 1fr 1fr; }
.actions.train-main-actions {
  grid-template-columns: 1fr 1fr;
}

.log {
  margin: 12px 0 0;
  padding: 12px;
  max-height: 280px;
  overflow: auto;
  border-radius: 8px;
  background: #0f171c;
  color: #d7e6df;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-all;
}
.log.compact { max-height: 160px; }
.log.ok { outline: 1px solid rgba(27, 122, 61, 0.45); }
.log.err { outline: 1px solid rgba(180, 35, 24, 0.55); }

.brief .hint {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
}

.list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}
.list-item {
  text-align: left;
  background: #f3f6f7;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
.list-item.green {
  background: linear-gradient(90deg, #d8f3e3, #eef8f2);
  border: 1px solid #2f9e6b;
}
.list-item.gray {
  background: #eceff1;
  color: #6a7680;
  border: 1px solid #c5ced4;
}
.list-item.done {
  opacity: 0.55;
}
.list-item .badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
  background: rgba(0, 0, 0, 0.06);
}
.list-item.green .badge {
  background: #2f9e6b;
  color: #fff;
}

.adv {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  font-size: 13px;
}
.adv summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.hidden { display: none !important; }

code {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  background: #eef3f1;
  padding: 1px 4px;
  border-radius: 4px;
}

.alert-err {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fdecea;
  color: #b42318;
  font-size: 13px;
}

.login-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 14px;
}
.login-options .check { margin-bottom: 0; }

.portal-brief {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.account-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 10px 0 12px;
  flex-wrap: wrap;
}
.account-switch-label {
  flex: 1;
  min-width: 180px;
  margin: 0;
}
.account-switch-label select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}

a.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  width: auto;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 8px;
  background: #eef2f4;
  color: var(--text);
}

.modal-wide { max-width: 520px; max-height: 90vh; overflow: auto; }
.sep {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 14px 0;
}
.form-title {
  margin: 0 0 10px;
  font-size: 14px;
}

.accounts-list { display: grid; gap: 8px; margin-bottom: 8px; }
.account-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  background: #f3f6f7;
  border-radius: 8px;
}
.account-row-main { flex: 1; min-width: 0; }
.account-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}
.badge-def {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: #0d7a6f;
  color: #fff;
  vertical-align: middle;
}

.multi-list {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  max-height: 280px;
  overflow: auto;
}

.home-top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* admin */
.admin-page { max-width: 960px; }
.admin-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.admin-nav button.active {
  background: linear-gradient(135deg, var(--accent), #0a5c54);
  color: #fff;
}
.admin-table-wrap { overflow: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
}
.admin-table th { color: var(--muted); font-weight: 600; }
.admin-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  align-items: center;
}
.admin-toolbar input[type="text"],
.admin-toolbar input[type="password"],
.admin-toolbar select {
  width: auto;
  min-width: 120px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}
.pager button { width: auto; }
