:root {
    --bg: #f4f7f9;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #14202b;
    --muted: #697586;
    --line: #e3e8ee;
    --line-strong: #cfd8e3;
    --primary: #0f766e;
    --primary-dark: #0b5d56;
    --primary-soft: #e6f4f1;
    --accent: #b7791f;
    --danger: #b42318;
    --danger-soft: #fef3f2;
    --success: #067647;
    --success-soft: #ecfdf3;
    --warning: #b54708;
    --warning-soft: #fffaeb;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 22px; line-height: 1.35; margin-bottom: 4px; letter-spacing: -.2px; }
h2 { font-size: 18px; line-height: 1.4; margin-bottom: 12px; }
h3 { font-size: 15px; line-height: 1.5; margin-bottom: 8px; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.mono { font-family: "Cascadia Code", Consolas, monospace; }

/* Public */
.public-body { background: #fbfcfd; }
.public-header {
    max-width: 1180px;
    margin: 0 auto;
    padding: 22px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}
.public-header nav { display: flex; align-items: center; gap: 20px; }
.public-header nav a { color: var(--muted); font-size: 14px; }
.public-header nav a:hover { color: var(--ink); }
.public-main { max-width: 1180px; margin: 0 auto; padding: 12px 28px 72px; }
.public-footer {
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 28px 36px;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
    border-top: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
    width: 34px; height: 34px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: #fff; font-weight: 700; font-size: 16px;
}
.brand strong { display: block; font-size: 16px; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

.hero { padding: 58px 0 44px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 56px; align-items: center; }
.hero-kicker { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--primary); background: var(--primary-soft); padding: 5px 10px; border-radius: 99px; margin-bottom: 18px; }
.hero h1 { font-size: 42px; line-height: 1.18; letter-spacing: -1.4px; margin-bottom: 18px; }
.hero p.lead { font-size: 16px; color: var(--muted); max-width: 560px; margin-bottom: 24px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-note { margin-top: 14px; color: var(--muted); font-size: 12px; }
.hero-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow); padding: 22px;
}
.hero-card .mock-row { display: flex; gap: 10px; margin-bottom: 12px; }
.hero-card .mock-avatar { width: 30px; height: 30px; border-radius: 50%; background: #e9eef3; flex: none; }
.hero-card .mock-bubble { background: #f2f5f7; border-radius: 3px 12px 12px 12px; padding: 10px 12px; font-size: 13px; color: #3d4b5a; }
.hero-card .mock-bubble.ai { background: var(--primary-soft); color: #154c47; border-radius: 12px 3px 12px 12px; }
.hero-card .mock-label { font-size: 11px; color: var(--muted); margin-bottom: 6px; }

.section { padding: 46px 0; border-top: 1px solid var(--line); }
.section-head { max-width: 720px; margin-bottom: 26px; }
.section-head h2 { font-size: 30px; letter-spacing: -.8px; margin-bottom: 8px; }
.section-head p { color: var(--muted); margin-bottom: 0; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.feature .num { font-size: 12px; color: var(--primary); font-weight: 700; letter-spacing: .08em; margin-bottom: 18px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--muted); margin-bottom: 0; font-size: 13px; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.price-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.price-card .price { font-size: 34px; font-weight: 700; letter-spacing: -1px; margin: 10px 0 2px; }
.price-card .price small { font-size: 13px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.price-card ul { margin: 18px 0 22px; padding: 0; list-style: none; color: #455466; font-size: 13px; }
.price-card li { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.price-card .btn { margin-top: auto; }
.trust-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.trust-item { background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; color: var(--muted); font-size: 12px; }
.trust-item strong { display: block; color: var(--ink); font-size: 13px; margin-bottom: 2px; }

/* App shell */
.app-body { background: var(--bg); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { background: #0f1d2b; color: #dbe5ee; padding: 18px 14px; display: flex; flex-direction: column; min-height: 100vh; position: sticky; top: 0; }
.sidebar .brand { color: #fff; padding: 6px 8px 18px; }
.sidebar .brand small { color: #8ea3b7; }
.sidebar .brand-mark { background: #1f8f83; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { color: #aabccd; padding: 9px 12px; border-radius: 7px; font-size: 13px; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: #163244; color: #fff; box-shadow: inset 3px 0 0 #2bb3a3; }
.sidebar-bottom { margin-top: auto; padding: 16px 8px 4px; border-top: 1px solid rgba(255,255,255,.09); }
.user-chip { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #23465c; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex: none; }
.user-chip strong { display: block; font-size: 12px; color: #fff; font-weight: 500; }
.user-chip small { display: block; color: #8ea3b7; font-size: 11px; }
.logout { display: block; color: #8ea3b7; font-size: 12px; padding: 5px 0; }
.logout:hover { color: #fff; }
.main { min-width: 0; }
.topbar { padding: 26px 32px 0; }
.topbar h1 { margin-bottom: 2px; }
.content { padding: 22px 32px 48px; max-width: 1280px; }

/* Cards, grid */
.grid-2 { display: grid; grid-template-columns: 1.4fr .9fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 16px; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.7px; line-height: 1.2; }
.stat .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.card + .card { margin-top: 16px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 7px; padding: 8px 14px; font-size: 13px; font-weight: 500; line-height: 1.4; cursor: pointer; text-decoration: none; transition: .15s ease; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { border-color: #9fb0c2; color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-soft); color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #fecdca; }
.btn-danger:hover { background: #fee4e2; color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: block; font-size: 12px; color: #42505f; font-weight: 500; margin-bottom: 5px; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], select, textarea {
    width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; background: #fff; color: var(--ink);
    padding: 9px 11px; font: inherit; font-size: 13px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
textarea { min-height: 110px; resize: vertical; }
.form-actions { margin-top: 16px; display: flex; gap: 8px; align-items: center; }
.help { color: var(--muted); font-size: 11px; margin-top: 4px; }
.inline-form { display: inline; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-soft); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fbfcfd; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 2px 8px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-yellow { background: var(--warning-soft); color: var(--warning); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-gray { background: #f2f4f7; color: #475467; }
.badge-blue { background: #eff8ff; color: #175cd3; }

/* Flash */
.flash { border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.flash-success { background: var(--success-soft); border-color: #abefc6; color: #067647; }
.flash-error { background: var(--danger-soft); border-color: #fecdca; color: #b42318; }
.flash-info { background: #eff8ff; border-color: #b2ddff; color: #175cd3; }

/* Auth */
.auth-wrap { max-width: 420px; margin: 52px auto; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.auth-card .sub { color: var(--muted); margin-bottom: 22px; }
.auth-footer { text-align: center; margin-top: 16px; color: var(--muted); font-size: 13px; }

/* Dashboard */
.welcome { background: linear-gradient(135deg, #0f2b3c 0%, #123f4c 100%); color: #fff; border-radius: 12px; padding: 24px; margin-bottom: 16px; display: flex; justify-content: space-between; gap: 24px; align-items: center; }
.welcome h2 { font-size: 21px; margin-bottom: 5px; color: #fff; }
.welcome p { color: #b9ced8; margin-bottom: 0; font-size: 13px; }
.welcome .btn-secondary { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.welcome .btn-secondary:hover { background: rgba(255,255,255,.18); color: #fff; }
.plan-card { border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; }
.plan-card.featured { border-color: var(--primary); background: #fbfefd; }
.plan-card .name { font-size: 13px; color: var(--muted); }
.plan-card .price { font-size: 28px; font-weight: 700; letter-spacing: -.8px; margin: 4px 0 10px; }
.plan-card .price small { font-size: 12px; color: var(--muted); font-weight: 400; }
.plan-card ul { margin: 0 0 14px; padding-left: 16px; color: #4c5a69; font-size: 12px; }
.plan-card li { margin: 4px 0; }
.plan-card .btn { margin-top: auto; }

/* Knowledge */
.knowledge-layout { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.knowledge-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.knowledge-item:last-child { border-bottom: none; }
.knowledge-q { font-weight: 600; margin-bottom: 4px; }
.knowledge-a { color: #4c5a69; font-size: 13px; white-space: pre-wrap; }
.knowledge-meta { color: var(--muted); font-size: 11px; margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; }

/* Payment */
.pay-box { max-width: 560px; margin: 32px auto; text-align: center; }
.pay-amount { font-size: 40px; font-weight: 700; letter-spacing: -1.2px; margin: 10px 0; }
.qr-holder { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: inline-block; margin: 16px 0; }
.qr-holder img { display: block; width: 220px; height: 220px; }
.pay-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }

/* Admin */
.admin-table .mono { font-size: 12px; }
.metric-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }

/* Misc */
.divider { height: 1px; background: var(--line); margin: 18px 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.list-plain { margin: 0; padding: 0; list-style: none; }
.list-plain li { padding: 8px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 12px; }
.list-plain li:last-child { border-bottom: none; }
.code-box { background: #0f1d2b; color: #d7e2ec; border-radius: 8px; padding: 14px 16px; font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

@media (max-width: 980px) {
    .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 36px; }
    .hero h1 { font-size: 34px; }
    .feature-grid, .pricing-grid { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4, .metric-row, .knowledge-layout { grid-template-columns: 1fr; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; min-height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
    .sidebar .brand { padding: 4px 8px; }
    .side-nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-bottom { margin-left: auto; display: flex; align-items: center; gap: 10px; border-top: none; padding: 0; }
    .user-chip { margin-bottom: 0; }
    .topbar, .content { padding-left: 18px; padding-right: 18px; }
    .public-header { flex-wrap: wrap; }
    .public-header nav { gap: 12px; }
    .form-grid { grid-template-columns: 1fr; }
}
