:root {
  --bg: #0b1220;
  --panel: rgba(231, 236, 255, 0.05);
  --text: #e7ecff;
  --muted: rgba(231, 236, 255, 0.72);
  --border: rgba(231, 236, 255, 0.12);
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.35);
  --brand: #6ea8fe;
  --good: #35d07f;
  --bad: #ff5d6c;
  --warn: #ffcc66;
}

* { box-sizing: border-box; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 800px at 20% 10%, rgba(110, 168, 254, 0.18), transparent 60%),
    radial-gradient(900px 600px at 85% 25%, rgba(53, 208, 127, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
  margin: 0;
  padding: 22px;
}

.page { max-width: 1600px; margin: 0 auto; }
.hidden { display: none !important; }

.login-wrap {
  min-height: calc(100vh - 44px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(460px, 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(231, 236, 255, 0.07), rgba(231, 236, 255, 0.025));
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-card h1 { margin: 0 0 12px; font-size: 26px; text-align: center; }
.login-sub { margin: 0 0 24px; color: var(--muted); line-height: 1.5; text-align: center; font-size: 14px; }
.login-form { display: grid; gap: 16px; }
.message { min-height: 20px; margin: 0; font-size: 13px; text-align: center; }

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

.title h1 { margin: 0; font-size: 22px; letter-spacing: 0.2px; }
.title .subtitle { font-size: 14px; font-weight: normal; color: var(--brand); }
.title p { margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.btn-shadowbot,
#btnShadowbotForward {
  border-color: rgba(255, 149, 0, 0.75);
  background: rgba(255, 149, 0, 0.18);
  color: #ffbf66;
  font-weight: 600;
}

label.btn { cursor: pointer; }

.modal-actions { display: flex; gap: 12px; align-items: center; }

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.btn {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(231, 236, 255, 0.08), rgba(231, 236, 255, 0.03));
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.06s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:hover { border-color: rgba(110, 168, 254, 0.55); background: rgba(231, 236, 255, 0.08); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn.primary {
  border-color: rgba(110, 168, 254, 0.65);
  background: linear-gradient(180deg, rgba(110, 168, 254, 0.22), rgba(110, 168, 254, 0.08));
}

.btn.danger {
  border-color: rgba(255, 93, 108, 0.6);
  background: linear-gradient(180deg, rgba(255, 93, 108, 0.18), rgba(255, 93, 108, 0.06));
}

.btn.warn {
  border-color: var(--warn);
  background: rgba(255, 204, 102, 0.15);
  color: var(--warn);
}

.mini { padding: 6px 10px; border-radius: 8px; font-size: 12px; }

.panel {
  background: linear-gradient(180deg, rgba(231, 236, 255, 0.06), rgba(231, 236, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.filters {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 0.8fr auto;
  gap: 12px;
  align-items: end;
}

.list-stats {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
  margin-top: -4px;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }

.field input, .field select, .field textarea {
  width: 100%;
  background: rgba(11, 18, 32, 0.6);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s ease;
}

.field textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }

.table-wrap { overflow: auto; border-radius: 16px; padding: 0; max-height: calc(100vh - 320px); }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1200px;
}

thead th {
  position: sticky;
  top: 0;
  background: rgba(15, 26, 51, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  text-align: left;
  padding: 14px 16px;
  white-space: nowrap;
  z-index: 10;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(231, 236, 255, 0.06);
  vertical-align: top;
  font-size: 14px;
}

tbody tr:hover td { background: rgba(110, 168, 254, 0.04); }

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px !important;
  font-size: 14px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: rgba(231, 236, 255, 0.9);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  white-space: nowrap;
}

.badge.good { border-color: rgba(53, 208, 127, 0.4); background: rgba(53, 208, 127, 0.1); color: var(--good); }
.badge.bad { border-color: rgba(255, 93, 108, 0.4); background: rgba(255, 93, 108, 0.1); color: var(--bad); }
.badge.warn { border-color: rgba(255, 204, 102, 0.4); background: rgba(255, 204, 102, 0.1); color: var(--warn); }
.badge.checking { border-color: rgba(110, 168, 254, 0.4); background: rgba(110, 168, 254, 0.1); color: var(--brand); }

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

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(231, 236, 255, 0.2);
  border-radius: 50%;
  border-top-color: var(--brand);
  animation: spin 1s linear infinite;
}

.app-loading {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: grid;
  place-items: center;
  z-index: 9999;
  transition: opacity 0.28s ease;
}

.app-loading.fade-out { opacity: 0; pointer-events: none; }

.app-loading-inner { text-align: center; }

.app-loading .spinner.large {
  width: 40px;
  height: 40px;
  border-width: 3px;
  margin-bottom: 16px;
}

.app-loading-text {
  color: var(--brand);
  font-size: 14px;
  letter-spacing: 1px;
}

.cell-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.link-list { display: grid; gap: 8px; }

.link-item {
  background: rgba(231, 236, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.link-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.link-item-text {
  flex: 1;
  line-height: 1.6;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.link-item-actions {
  display: flex;
  gap: 10px;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid rgba(231, 236, 255, 0.05);
}

.add-post-btn {
  margin-top: 4px;
  width: 100%;
  height: 36px;
  background: rgba(110, 168, 254, 0.05);
}

.user-cell { display: flex; flex-direction: column; gap: 6px; }
.user-cell-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.username { font-size: 16px; }
.ip-badge { border-color: var(--brand); color: var(--brand); }
.update-time { color: rgba(231, 236, 255, 0.4); font-size: 11px; }

.time-cell { font-size: 12px; }
.time-cell-actions { display: flex; gap: 8px; margin-top: 4px; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 100;
}

.modal-card {
  width: min(800px, 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #0f172a;
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: modalIn 0.3s ease-out;
}

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

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 18px; margin: 0; font-weight: 600; }
.modal-sub { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.modal-body { padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-height: 70vh; overflow-y: auto; }
.modal-body .span-2 { grid-column: span 2; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 12px; align-items: center; background: rgba(231, 236, 255, 0.02); }

.note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.exp-badge { background: rgba(255, 204, 102, 0.1); border: 1px solid rgba(255, 204, 102, 0.3); color: var(--warn); font-size: 11px; padding: 2px 8px; border-radius: 6px; }

.progress-container { position: fixed; top: 0; left: 0; width: 100%; height: 4px; background: rgba(231, 236, 255, 0.05); z-index: 1000; display: none; }
.progress-bar { height: 100%; background: var(--brand); width: 0%; transition: width 0.3s ease; box-shadow: 0 0 10px var(--brand); }

.check-log {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  max-height: 240px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  font-size: 12px;
  overflow-y: auto;
  z-index: 90;
  display: none;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.log-item { margin-bottom: 6px; border-bottom: 1px solid rgba(231, 236, 255, 0.05); padding-bottom: 4px; line-height: 1.4; }
.log-item.error { color: var(--bad); }
.log-item.success { color: var(--good); }

.schedule-panel { margin-bottom: 16px; }
.schedule-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.schedule-mode {
  margin-left: 10px;
  color: var(--brand);
  font-size: 13px;
  font-weight: normal;
}
.schedule-meta { margin-left: auto; color: var(--muted); font-size: 13px; }
.schedule-queue {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}
.schedule-row {
  display: grid;
  grid-template-columns: 36px 1fr 90px 80px 90px 100px auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(231, 236, 255, 0.03);
  font-size: 13px;
}
.schedule-row.ineligible { opacity: 0.55; }
.schedule-row .score { font-variant-numeric: tabular-nums; color: var(--brand); font-weight: 600; }
.schedule-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }
.nurture-meta { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 4px; }
.badge.white { border-color: rgba(110, 168, 254, 0.5); color: var(--brand); }
.badge.posted { border-color: rgba(255, 204, 102, 0.5); color: var(--warn); }

@media (max-width: 980px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .span-mobile { grid-column: span 2; }
  .modal-body { grid-template-columns: 1fr; }
  .modal-body .span-2 { grid-column: span 1; }
  .table-wrap { max-height: calc(100vh - 420px); }
}
