:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d8e2ef;
  --card: rgba(255, 255, 255, .92);
  --teal: #0f766e;
  --blue: #2563eb;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font-family: Outfit, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 8% 0%, rgba(20, 184, 166, .14), transparent 30%),
    radial-gradient(circle at 92% 4%, rgba(37, 99, 235, .12), transparent 32%),
    linear-gradient(#eef4fb, #e7eef8);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.glass {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .07);
}
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 32px; text-align: center; }
.login-card h1 { margin: 12px 0 4px; font-size: 28px; }
.login-card p { color: var(--muted); }
.login-card label, .panel label { display: block; text-align: left; font-size: 14px; font-weight: 650; margin: 14px 0; }
input, select, textarea {
  width: 100%; margin-top: 6px; border: 1px solid var(--line); background: #fff;
  border-radius: 14px; padding: 12px 14px; outline: none;
}
textarea { resize: vertical; }
.btn {
  border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700;
}
.btn.gradient { color: #fff; background: linear-gradient(135deg, #0f766e, #2563eb); box-shadow: 0 12px 26px rgba(37, 99, 235, .16); }
.btn.teal { color: #0f766e; background: #ecfeff; border: 1px solid #99f6e4; }
.btn.ghost { background: #fff; border: 1px solid var(--line); }
.btn.wide { width: 100%; padding: 14px; }
.btn.danger { background: #fff1f2; color: #be123c; }
.link { border: 0; background: transparent; color: var(--blue); font-weight: 700; }
.error { color: #be123c; min-height: 1.2em; }
.hint { color: var(--muted); font-size: 13px; font-weight: 500; }
.app-view { width: min(1180px, calc(100% - 28px)); margin: 18px auto 40px; display: grid; gap: 16px; }
.app-view.has-side { width: min(1180px, calc(100% - 196px)); margin-right: 168px; margin-left: auto; }
.side-nav {
  position: fixed; right: 14px; top: 108px; z-index: 6; width: 132px;
  display: grid; gap: 8px; padding: 10px;
}
.side-nav button {
  border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 8px; font-weight: 750;
}
.side-nav button.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, #0f766e, #2563eb); }
.template-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.template-add .btn { margin-bottom: 14px; }
.header-bar { position: sticky; top: 10px; z-index: 5; display: flex; justify-content: space-between; gap: 16px; padding: 18px 20px; align-items: center; }
.brand, .account { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand h1 { margin: 0; font-size: 26px; line-height: 1.05; letter-spacing: -.4px; }
.brand-mark {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  color: #fff; font-weight: 800; background: linear-gradient(135deg, #7c3aed, #2563eb);
}
.login-card .brand-mark { margin: 0 auto; }
.console-pill {
  width: 46px; border-radius: 18px; color: #fff; background: #2563eb;
  writing-mode: vertical-rl; letter-spacing: 3px; padding: 10px 0; font-weight: 800;
}
.pill { background: #f8fafc; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; color: #334155; }
.panel { padding: 20px; }
.panel h2 { margin: 0 0 14px; font-size: 20px; }
.panel h2::after, .panel h2 { }
h2 { position: relative; }
.panel h2 { padding-bottom: 8px; }
.panel h2::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 42px; height: 3px; border-radius: 99px;
  background: linear-gradient(90deg, #14b8a6, #2563eb);
}
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-card {
  position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 20px;
  padding: 16px 16px 16px 22px; background: #f8fbff;
}
.stat-card::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 4px; border-radius: 4px;
  background: linear-gradient(#14b8a6, #2563eb);
}
.stat-card span { color: var(--muted); font-size: 14px; }
.stat-card strong { display: block; margin-top: 6px; font-size: 32px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pills span, .funnel span, .meta-pill {
  background: #f8fafc; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-size: 13px;
}
.row-between { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.row-between input { max-width: 280px; margin: 0; }
.user-grid, .domain-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; align-items: end; }
.template-picks { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #e8eef6; vertical-align: top; }
th { color: var(--muted); font-weight: 650; }
.ops { display: flex; flex-wrap: wrap; gap: 6px; }
.create-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.phone-wrap { position: sticky; top: 128px; }
.phone {
  width: 280px; height: 560px; margin: 0 auto; border-radius: 36px; padding: 10px;
  background: #2a1326; box-shadow: 0 20px 50px rgba(42, 19, 38, .28); overflow: hidden;
}
.phone iframe { width: 390px; height: 780px; border: 0; transform: scale(.667); transform-origin: top left; background: #fff; }
.media-card, .slot-group { border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin: 12px 0; background: #f8fbff; }
.media-card { display: flex; gap: 14px; align-items: center; }
.logo-preview {
  width: 92px; height: 92px; border-radius: 16px; background: #fff center/cover no-repeat;
  display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); overflow: hidden;
}
.slot-group h3 { margin: 0 0 8px; font-size: 15px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 650; }
.check input { width: auto; margin: 0; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.app-card { border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin: 12px 0; display: grid; grid-template-columns: 92px 1fr; gap: 14px; }
.app-card h3 { margin: 0 0 6px; }
.app-card .sub { color: var(--muted); font-size: 13px; line-height: 1.6; }
.funnel { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.app-card img { width: 92px; height: 92px; border-radius: 16px; object-fit: cover; background: #fff; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pager { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); display: grid; place-items: center; padding: 18px; z-index: 20; }
.modal-card { width: min(520px, 100%); padding: 18px; }
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff; border-radius: 999px; padding: 10px 16px; z-index: 30;
}
#chart svg { width: 100%; height: auto; }
@media (max-width: 900px) {
  .stat-grid, .create-grid, .user-grid, .domain-tools, .app-card, .template-add { grid-template-columns: 1fr; }
  .phone-wrap, .header-bar, .side-nav { position: static; }
  .app-view.has-side { width: min(1180px, calc(100% - 28px)); margin: 18px auto 40px; }
  .side-nav { width: auto; grid-template-columns: repeat(4, 1fr); }
}
