* { box-sizing: border-box; }

:root {
  --green: #10bf6f;
  --green-600: #0aa95f;
  --green-700: #078d4f;
  --green-050: #eafaf2;
  --green-100: #d3f4e3;
  --ink: #0c231b;
  --ink-2: #16382c;
  --text: #24352f;
  --muted: #7a8b84;
  --line: #e6eeea;
  --line-strong: #d7e4dd;
  --bg: #f3f7f5;
  --card: #ffffff;
  --sidebar: #08271d;
  --danger: #e5484d;
  --orange: #ef7d3a;
  --blue: #2f8ff0;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(12, 60, 40, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
button { cursor: pointer; }
[hidden] { display: none !important; }
code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(10, 169, 95, 0.09);
  color: var(--green-700);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

/* ============ Login ============ */
.login-view {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 60px;
  overflow: hidden;
  background: radial-gradient(1200px 600px at 15% -10%, #1a7f58 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 110%, #0d5e42 0%, transparent 55%),
              linear-gradient(135deg, #06251c 0%, #0a3427 55%, #08291f 100%);
}

.login-backdrop { position: absolute; inset: 0; pointer-events: none; }
.login-backdrop::before,
.login-backdrop::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  border: 1px solid rgba(85, 226, 165, 0.16);
}
.login-backdrop::before {
  width: 620px;
  height: 620px;
  top: -260px;
  right: -120px;
  box-shadow: 0 0 0 80px rgba(85, 226, 165, 0.03), 0 0 0 160px rgba(85, 226, 165, 0.02);
}
.login-backdrop::after {
  width: 460px;
  height: 460px;
  bottom: -220px;
  left: -100px;
  box-shadow: 0 0 0 60px rgba(85, 226, 165, 0.03);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 38px 38px 30px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #17d180, #079a54);
  color: #eafff4;
  box-shadow: 0 10px 24px rgba(16, 191, 111, 0.35);
  flex: none;
}
.brand-mark svg { width: 28px; height: 28px; }
.brand h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: 0.2px; color: var(--ink); }
.brand p { margin: 0; font-size: 12.5px; color: var(--muted); }

.login-form label { display: block; margin-bottom: 16px; }
.login-form label span { display: block; margin-bottom: 7px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.login-form input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fbfdfc;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.login-form input:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(16, 191, 111, 0.12);
}
.form-error { min-height: 18px; margin: -4px 0 10px; font-size: 12.5px; color: var(--danger); }
.login-hint {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f4faf7;
  border: 1px dashed var(--line-strong);
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
.login-footer {
  position: relative;
  margin-top: 26px;
  font-size: 12px;
  color: rgba(224, 255, 240, 0.55);
}

/* ============ Layout ============ */
.app-view { min-height: 100vh; display: flex; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(420px 220px at 20% 0%, rgba(26, 150, 104, 0.28), transparent 70%),
    var(--sidebar);
  color: #d8eee5;
  z-index: 20;
}

.side-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.brand-mark-sm { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 8px 18px rgba(8, 140, 88, 0.3); }
.brand-mark-sm svg { width: 21px; height: 21px; }
.side-brand strong { display: block; font-size: 15px; letter-spacing: 1px; color: #f2fff9; }
.side-brand em { display: block; margin-top: 1px; font-size: 10.5px; font-style: normal; color: rgba(197, 233, 217, 0.55); letter-spacing: 1px; }

.side-nav { flex: 1; overflow-y: auto; padding-top: 2px; }
.side-nav::-webkit-scrollbar { width: 4px; }
.side-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 4px; }
.nav-label {
  padding: 16px 12px 8px;
  font-size: 10.5px;
  letter-spacing: 2px;
  color: rgba(190, 228, 210, 0.42);
}
.side-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 42px;
  padding: 0 12px;
  margin-bottom: 3px;
  border-radius: 10px;
  font-size: 13.5px;
  color: rgba(219, 240, 230, 0.72);
  transition: background 0.16s, color 0.16s;
}
.side-nav a svg { width: 17px; height: 17px; fill: currentColor; opacity: 0.85; flex: none; }
.side-nav a:hover { background: rgba(255, 255, 255, 0.055); color: #fff; }
.side-nav a.active {
  background: linear-gradient(90deg, rgba(25, 203, 122, 0.22), rgba(25, 203, 122, 0.08));
  color: #57f0a9;
}
.side-nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 3px;
  border-radius: 3px;
  background: #2de18c;
  box-shadow: 0 0 12px rgba(45, 225, 140, 0.7);
}
.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10.5px;
  line-height: 18px;
  text-align: center;
}

.side-footer {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.admin-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.admin-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg, #35dfa0, #0b9b5b);
  color: #04251a;
  font-weight: 700;
  font-size: 14px;
  flex: none;
}
.admin-chip strong { display: block; font-size: 13px; color: #eafff5; }
.admin-chip em { display: block; margin-top: 2px; font-size: 10.5px; font-style: normal; color: rgba(201, 235, 220, 0.5); }
.logout-btn {
  width: 100%;
  height: 36px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(224, 245, 235, 0.7);
  font-size: 12.5px;
  transition: 0.16s;
}
.logout-btn:hover { border-color: rgba(255, 120, 120, 0.4); color: #ffb4b4; background: rgba(255, 80, 80, 0.08); }

.main {
  flex: 1;
  min-width: 0;
  margin-left: 236px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 32px 16px;
  background: rgba(243, 247, 245, 0.88);
  backdrop-filter: blur(14px);
}
.page-heading h2 { margin: 0; font-size: 22px; letter-spacing: 0.2px; color: var(--ink); }
.page-heading p { margin: 5px 0 0; font-size: 12.5px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 20px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.status-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #bdc9c4;
  box-shadow: 0 0 0 3px rgba(189, 201, 196, 0.18);
}
.status-pill.online { color: var(--green-700); border-color: var(--green-100); background: #f2fcf7; }
.status-pill.online i { background: var(--green); box-shadow: 0 0 0 3px rgba(16, 191, 111, 0.15); }
.status-pill.mock { color: #b45309; border-color: #fde9c8; background: #fffaf1; }
.status-pill.mock i { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16); }

.icon-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  transition: 0.16s;
}
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.icon-btn:hover { color: var(--green-700); border-color: var(--green-100); background: var(--green-050); }
.icon-btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.page-content { flex: 1; padding: 6px 32px 36px; }

/* ============ Common UI ============ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 0;
}
.card-head h3 { margin: 0; font-size: 15px; color: var(--ink); }
.card-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.card-body { padding: 20px 22px; }

.grid { display: grid; gap: 16px; }
.grid-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  transition: 0.16s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; fill: currentColor; }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 6px 16px rgba(16, 191, 111, 0.22); }
.btn-primary:hover { background: var(--green-600); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: #fff; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--green); color: var(--green-700); background: var(--green-050); }
.btn-danger { background: #fff1f1; color: var(--danger); border-color: #ffdada; }
.btn-danger:hover { background: #ffe7e7; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; height: 46px; font-size: 14.5px; letter-spacing: 2px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-green { background: var(--green-050); color: var(--green-700); }
.pill-red { background: #fff0f0; color: #cf2027; }
.pill-gray { background: #f1f5f3; color: #6b7d76; }
.pill-orange { background: #fff4e8; color: #b45309; }
.pill-blue { background: #eef6ff; color: #1d6fd1; }

.platform-tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: #f2f6f4;
  color: #445a51;
  font-size: 11.5px;
  font-weight: 600;
}

/* ============ Overview ============ */
.stat-card { padding: 20px 22px; display: flex; align-items: flex-start; gap: 14px; }
.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.stat-icon svg { width: 21px; height: 21px; fill: currentColor; }
.stat-icon.green { background: var(--green-050); color: var(--green-600); }
.stat-icon.blue { background: #eef6ff; color: #2f8ff0; }
.stat-icon.orange { background: #fff4e8; color: #e8822e; }
.stat-icon.purple { background: #f4efff; color: #8558e8; }
.stat-meta { min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { margin-top: 6px; font-size: 26px; font-weight: 700; letter-spacing: -0.5px; color: var(--ink); line-height: 1.1; }
.stat-value small { margin-left: 3px; font-size: 12px; font-weight: 500; color: var(--muted); }
.stat-foot { margin-top: 7px; font-size: 11.5px; color: var(--muted); }
.stat-foot b { color: var(--green-600); font-weight: 600; }

.chart-wrap { padding: 12px 10px 0; }
.chart-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 18px; padding: 0 22px 18px; font-size: 12px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { position: relative; width: 132px; height: 132px; border-radius: 50%; flex: none; }
.donut::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: #fff;
}
.donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.donut-center b { font-size: 22px; color: var(--ink); line-height: 1; }
.donut-center span { margin-top: 4px; font-size: 10.5px; color: var(--muted); }
.legend-list { flex: 1; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text); }
.legend-row .dot { flex: none; }
.legend-row em { margin-left: auto; font-style: normal; color: var(--muted); font-size: 11.5px; }

/* ============ Table ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: #f8fbf9;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th:first-child { border-top-left-radius: 10px; }
th:last-child { border-top-right-radius: 10px; }
td {
  padding: 13px 14px;
  border-bottom: 1px solid #eff4f1;
  font-size: 12.5px;
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafdfb; }
.td-title { max-width: 300px; }
.td-title strong {
  display: block;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.td-muted { color: var(--muted); font-size: 11.5px; }
.td-time { white-space: nowrap; color: var(--muted); font-size: 11.5px; }
.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-state .empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: #f2f7f4;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state svg { width: 24px; height: 24px; fill: #b8c8c0; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.toolbar .grow { flex: 1; }
.input, .select, .textarea {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fbfdfc;
  color: var(--text);
  outline: none;
  transition: 0.16s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(16, 191, 111, 0.1);
}
.input::placeholder, .textarea::placeholder { color: #a9b9b2; }
.search-input { position: relative; flex: 1; min-width: 180px; max-width: 300px; }
.search-input .input { width: 100%; padding-left: 34px; }
.search-input svg {
  position: absolute;
  left: 11px;
  top: 11px;
  width: 16px;
  height: 16px;
  fill: #a9b9b2;
  pointer-events: none;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.pager button {
  min-width: 32px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 12px;
}
.pager button:hover:not(:disabled) { border-color: var(--green); color: var(--green-700); }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager .pager-info { margin-right: auto; }

/* ============ Forms ============ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--text); }
.field small { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.field .input, .field .select, .field .textarea { width: 100%; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.input-group .btn { flex: none; }
.secret-wrap { position: relative; }
.secret-wrap .input { padding-right: 58px; }
.secret-toggle {
  position: absolute;
  right: 6px;
  top: 6px;
  height: 26px;
  padding: 0 9px;
  border: none;
  border-radius: 6px;
  background: #f1f6f3;
  color: var(--muted);
  font-size: 11px;
}
.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px dashed var(--line);
}
.switch-row:last-child { border-bottom: none; }
.switch-copy strong { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.switch-copy p { margin: 4px 0 0; font-size: 11.5px; line-height: 1.6; color: var(--muted); }
.switch {
  position: relative;
  width: 40px;
  height: 23px;
  border-radius: 12px;
  border: none;
  background: #dbe5e0;
  transition: 0.2s;
  flex: none;
  margin-top: 1px;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: 0.2s;
}
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(17px); }

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}
.section-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--green);
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: #fbfdfc;
  border-radius: 0 0 var(--radius) var(--radius);
}
.save-hint { margin-right: auto; font-size: 11.5px; color: var(--muted); }

.hint-box {
  padding: 14px 16px;
  border-radius: 11px;
  background: #f5faf7;
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.8;
  color: #5c6f67;
}
.hint-box b { color: var(--green-700); }
.hint-box a { color: var(--green-700); text-decoration: underline; }

.platform-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.platform-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfdfc;
  transition: 0.16s;
}
.platform-toggle.on { border-color: var(--green-100); background: var(--green-050); }
.platform-toggle .p-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.platform-toggle strong { font-size: 12.5px; font-weight: 600; }
.platform-toggle small { margin-left: auto; font-size: 11px; color: var(--muted); }

.endpoint-row { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: center; margin-bottom: 10px; }
.endpoint-row label { font-size: 12.5px; font-weight: 600; color: #4c6158; }
.endpoint-row .input { height: 36px; font-size: 12px; font-family: "SFMono-Regular", Consolas, monospace; }

/* app list editor */
.app-list { display: flex; flex-direction: column; gap: 10px; }
.app-row {
  display: grid;
  grid-template-columns: 36px 1.1fr 1.6fr 130px 34px;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfdfc;
}
.app-row .app-ico {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef7f2;
  color: var(--green-700);
  font-size: 11px;
  font-weight: 700;
}
.app-row .input, .app-row .select { height: 34px; font-size: 12px; }
.remove-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #f3dada;
  background: #fff6f6;
  color: #d54a4a;
  font-size: 16px;
  line-height: 1;
}
.remove-btn:hover { background: #ffecec; }

/* ad banners */
.ad-tabs { display: flex; gap: 6px; padding: 4px; background: #f1f6f3; border-radius: 10px; width: fit-content; }
.ad-tabs button {
  height: 32px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.ad-tabs button.active { background: #fff; color: var(--green-700); box-shadow: 0 2px 8px rgba(20, 60, 40, 0.08); }

.ad-editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.ad-preview-card {
  padding: 14px;
  border-radius: 14px;
  background: #f7faf8;
  border: 1px solid var(--line);
}
.ad-preview-title { margin: 0 0 10px; font-size: 11.5px; color: var(--muted); letter-spacing: 0.5px; }
.ad-banner {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(20, 50, 40, 0.06);
}
.ad-banner-img {
  position: relative;
  width: 96px;
  height: 108px;
  border-radius: 4px;
  overflow: hidden;
  background: #edf1ef;
  flex: none;
}
.ad-banner-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-tag {
  position: absolute;
  left: 0;
  top: 0;
  padding: 2px 5px;
  font-size: 9px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  letter-spacing: 0.5px;
}
.ad-banner-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ad-banner-body h4 {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: #1e2c26;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ad-promoter { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.ad-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e7efe9;
  color: #8aa094;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: none;
}
.ad-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ad-promoter span { font-size: 10px; color: #7c8d85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-cta {
  margin-top: auto;
  align-self: flex-start;
  padding: 5px 14px;
  border-radius: 3px;
  background: #0bc36c;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

/* ============ Feedback ============ */
.feedback-list { display: flex; flex-direction: column; gap: 12px; }
.feedback-item { padding: 18px 20px; }
.feedback-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.feedback-top b { font-size: 13px; color: var(--ink); }
.feedback-top time { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.feedback-content { margin: 10px 0 0; font-size: 13px; line-height: 1.75; color: #40534b; white-space: pre-wrap; }
.feedback-contact { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.feedback-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ============ Modal / Toast ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-mask { position: absolute; inset: 0; background: rgba(8, 30, 22, 0.45); backdrop-filter: blur(2px); }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  animation: modalIn 0.18s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.985); } }
.modal-card.narrow { max-width: 440px; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 15px; color: var(--ink); }
.modal-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: #f3f7f5;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.modal-close:hover { background: #eaf1ed; color: var(--text); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: #fbfdfc;
}
.modal-foot:empty { display: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 200;
  transform: translateX(-50%);
  padding: 11px 20px;
  border-radius: 10px;
  background: rgba(12, 43, 32, 0.94);
  color: #eafff4;
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  animation: toastIn 0.2s ease-out;
}
.toast.error { background: rgba(160, 32, 38, 0.95); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* test result */
.test-result { margin-top: 16px; }
.result-preview {
  display: flex;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fbfdfc;
}
.result-cover {
  width: 88px;
  height: 112px;
  border-radius: 8px;
  object-fit: cover;
  background: #eef3f0;
  flex: none;
}
.result-info { min-width: 0; flex: 1; }
.result-info h4 { margin: 0 0 8px; font-size: 13px; line-height: 1.6; color: var(--ink); }
.result-info p { margin: 0 0 5px; font-size: 11.5px; color: var(--muted); }
.result-links { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.result-links code { display: block; padding: 6px 8px; font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attempt-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 7px;
  background: #f7faf8;
  font-size: 11px;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  margin-bottom: 5px;
}
.attempt-row .ok { color: var(--green-600); font-weight: 700; }
.attempt-row .bad { color: var(--danger); font-weight: 700; }

@media (max-width: 1180px) {
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .ad-editor { grid-template-columns: 1fr; }
  .ad-preview-card { max-width: 340px; }
}

@media (max-width: 860px) {
  .sidebar {
    position: static;
    width: 100%;
    padding: 14px 14px 10px;
    flex-direction: column;
  }
  .app-view { flex-direction: column; }
  .side-nav { display: flex; gap: 4px; overflow-x: auto; padding: 6px 0 2px; }
  .nav-label { display: none; }
  .side-nav a { flex: none; height: 38px; margin: 0; padding: 0 12px; }
  .side-nav a.active::before { display: none; }
  .side-footer { display: none; }
  .main { margin-left: 0; }
  .topbar { padding: 16px 18px 12px; }
  .page-content { padding: 4px 18px 28px; }
  .grid-stats { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
  .platform-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-row { grid-template-columns: 1fr; }
  .endpoint-row { grid-template-columns: 1fr; }
}
