:root {
  --ink: #162033;
  --muted: #6c7a89;
  --soft: #f4f7fb;
  --line: #dfe8f1;
  --card: rgba(255, 255, 255, 0.92);
  --brand: #0f766e;
  --brand-2: #15b8a6;
  --gold: #f4b42f;
  --danger: #e54848;
  --warn: #e99d18;
  --shadow: 0 18px 48px rgba(22, 32, 51, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 6%, rgba(21, 184, 166, 0.2), transparent 24%),
    radial-gradient(circle at 85% 0%, rgba(244, 180, 47, 0.18), transparent 24%),
    linear-gradient(180deg, #eff8f6 0%, #f6f8fc 46%, #eef4f8 100%);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  padding: 11px 16px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.2);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(21, 184, 166, 0.78);
  box-shadow: 0 0 0 4px rgba(21, 184, 166, 0.12);
}

.sidebar {
  width: 292px;
  min-height: 100vh;
  position: sticky;
  top: 0;
  padding: 28px 18px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(11, 34, 45, 0.98), rgba(15, 43, 58, 0.96)),
    radial-gradient(circle at 40% 0%, rgba(21, 184, 166, 0.22), transparent 30%);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 8px 10px 28px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-2), var(--gold));
  color: #06313a;
  font-size: 25px;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(21, 184, 166, 0.28);
}

.brand h1 {
  margin: 0;
  font-size: 21px;
}

.brand p {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  padding: 13px 15px;
  border-radius: 15px;
  color: rgba(255, 255, 255, 0.74);
  text-decoration: none;
  transition: 0.18s ease;
}

nav a:hover,
nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  margin-bottom: 20px;
}

.eyebrow,
.section-kicker {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar h2 {
  margin: 6px 0 0;
  font-size: 34px;
  letter-spacing: -0.02em;
}

.topbar p,
.panel-title span,
.sync-banner p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

.ghost-btn {
  color: var(--brand);
  background: #fff;
  border: 1px solid rgba(15, 118, 110, 0.2);
  box-shadow: none;
}

.danger-btn {
  background: linear-gradient(135deg, #e35a4e, #f2a341);
  box-shadow: 0 10px 22px rgba(229, 72, 72, 0.18);
}

.small-btn {
  padding: 8px 12px;
  border-radius: 11px;
  font-size: 13px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: #f4f7fb;
  box-shadow: none;
  font-size: 24px;
}

.sync-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 18px 20px;
  border: 1px solid rgba(233, 157, 24, 0.28);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 250, 235, 0.96), rgba(255, 255, 255, 0.9));
  box-shadow: 0 14px 34px rgba(111, 78, 18, 0.08);
}

.sync-banner a {
  flex: 0 0 auto;
  color: var(--brand);
  font-weight: 900;
  text-decoration: none;
}

.panel {
  margin-bottom: 24px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 26px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

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

.panel-title h3 {
  margin: 4px 0 0;
  font-size: 24px;
}

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

.metric-card,
.mini-panel,
.card,
.price-item,
.editor-card,
.sync-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 19px;
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(21, 184, 166, 0.11);
}

.metric-value {
  position: relative;
  z-index: 1;
  color: var(--brand);
  font-size: 31px;
  font-weight: 950;
}

.metric-label {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  color: var(--muted);
}

.quick-grid,
.content-grid,
.sync-grid {
  display: grid;
  gap: 16px;
}

.quick-grid {
  grid-template-columns: 1fr 1fr;
  margin-top: 16px;
}

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

.sync-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mini-panel,
.editor-card,
.sync-card {
  padding: 18px;
}

.mini-panel h4,
.card h4,
.editor-card h4 {
  margin: 0 0 12px;
}

.mini-panel p,
.sync-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.todo-list {
  display: grid;
  gap: 9px;
}

.todo-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: #7a4b05;
  background: #fff7e6;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px auto;
  gap: 12px;
  margin-bottom: 16px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: #486176;
  background: #f7fafc;
  white-space: nowrap;
}

td small {
  color: var(--muted);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions button {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.tag {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--brand);
  background: rgba(21, 184, 166, 0.12);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.tag.warn {
  color: #9b5f05;
  background: rgba(233, 157, 24, 0.15);
}

.tag.danger {
  color: var(--danger);
  background: rgba(229, 72, 72, 0.12);
}

.progress {
  display: grid;
  gap: 5px;
}

.progress span {
  color: var(--muted);
  font-size: 12px;
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

.progress-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.split {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 16px;
}

.card {
  padding: 18px;
}

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

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--brand);
  background: #eef8f6;
  font-size: 13px;
}

.chip button {
  padding: 0;
  color: #8aa19e;
  background: transparent;
  box-shadow: none;
}

.log-list {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
}

.log-item {
  padding: 12px;
  border-radius: 14px;
  color: #9a3412;
  background: #fff7ed;
  font-size: 13px;
  line-height: 1.65;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.price-item {
  padding: 16px;
}

.price-item strong {
  display: block;
  color: var(--brand);
  font-size: 18px;
}

.price-item span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.price-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.price-actions button {
  flex: 1;
  padding: 8px 10px;
  border-radius: 11px;
  font-size: 13px;
}

.pricing-toolbar {
  grid-template-columns: minmax(220px, 1fr) auto;
}

.editor-card {
  display: grid;
  gap: 10px;
}

.sync-card.warning {
  border-color: rgba(233, 157, 24, 0.34);
  background: #fff9eb;
}

.sync-card strong {
  display: block;
  margin-bottom: 8px;
}

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(8, 18, 28, 0.42);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
  max-height: 86vh;
  overflow: auto;
  padding: 20px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
}

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

.modal-head h3 {
  margin: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 1180px) {
  .metrics,
  .price-grid,
  .sync-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  body {
    display: block;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
    position: static;
  }

  nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .panel-title,
  .sync-banner {
    display: block;
  }

  .top-actions {
    justify-content: flex-start;
    margin-top: 14px;
  }

  .toolbar,
  .quick-grid,
  .split,
  .metrics,
  .price-grid,
  .sync-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* 后台扩展面板（家长 / 分账 / 聊天监控 / 规则） */
.rules-tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 10px;
  flex-wrap: wrap;
}
.rules-tab {
  padding: 6px 14px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #fff;
  color: #475569;
  border-radius: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.rules-tab:hover { border-color: var(--brand, #0f766e); color: var(--brand, #0f766e); }
.rules-tab.active {
  background: var(--brand, #0f766e);
  color: #fff;
  border-color: var(--brand, #0f766e);
}
.hit-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}
.hit-badge-clean { background: #ecfdf5; color: #059669; }
.hit-badge-hit   { background: #fef2f2; color: #dc2626; }
.metric-card {
  padding: 14px 18px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.metric-card strong {
  display: block;
  font-size: 22px;
  color: #0f172a;
}
.metric-card span {
  font-size: 12px;
  color: #94a3b8;
}

/* 支付配置表单 */
.form-grid {
  display: grid;
  gap: 12px;
}
.form-grid label {
  display: block;
  font-size: 13px;
  color: #475569;
  font-weight: 500;
}
.form-grid input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  box-sizing: border-box;
}
.form-grid input:focus {
  outline: none;
  border-color: var(--brand);
}

/* badge 样式 */
.badge { padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-err { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-muted { background: #f1f5f9; color: #64748b; }

/* small danger button */
.small-btn.danger { background: #fee2e2; color: #dc2626; }
.small-btn.danger:hover { background: #fecaca; }

/* 统计图表 */
.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stats-card {
  background: var(--soft);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}
.stats-card strong {
  display: block;
  font-size: 22px;
  color: var(--brand);
  margin-bottom: 4px;
}
.stats-card span {
  font-size: 12px;
  color: #64748b;
}
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}
.bar {
  width: 100%;
  max-width: 20px;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-radius: 3px 3px 0 0;
  transition: height 0.3s;
}
.bar-col:hover .bar { opacity: 0.7; }
.bar-label {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 4px;
  white-space: nowrap;
}

/* --- Vibe Tailwind Additions --- */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background-color: #334155; border-radius: 20px; }

#sideNav a.active { background-color: #1e293b; color: #ffffff; font-weight: 600; }
#sideNav a.active [data-lucide] { stroke: #14b8a6; }

.panel { animation: fadeSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards !important; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
