:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --bg: #f6f9f8;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --ok: #16a34a;
  --bad: #dc2626;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--muted); font-size: 13px; }
.ok-text { color: var(--ok); font-weight: 600; }
.bad-text { color: var(--bad); font-weight: 600; }

.page-bg { min-height: 100vh; background: linear-gradient(180deg, #ecfdf5 0%, var(--bg) 30%); padding-bottom: 60px; }
.container { max-width: 860px; margin: 0 auto; padding: 32px 16px 0; }

.site-header { text-align: center; margin-bottom: 28px; }
.site-title { font-size: 30px; font-weight: 800; color: var(--primary-dark); letter-spacing: 1px; }
.site-sub { color: var(--muted); margin-top: 8px; font-size: 14px; }
.top-links { margin-top: 10px; }
.top-links a { color: var(--primary); text-decoration: none; margin: 0 10px; font-size: 13px; }

.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.feature-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; transition: all .2s; cursor: default; }
.feature-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(13,148,136,.08); }
.active-feat { border-color: var(--primary); box-shadow: 0 4px 14px rgba(13,148,136,.12); }
.feat-title { font-weight: 700; font-size: 14px; }
.feat-desc { color: var(--muted); font-size: 12px; margin-top: 4px; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn { flex: 1; padding: 12px; border: 1px solid var(--border); background: var(--card); border-radius: 12px; font-size: 15px; cursor: pointer; color: var(--muted); transition: all .2s; }
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.03); }
.card-title { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.card-hint { color: var(--muted); font-size: 13px; margin-bottom: 16px; }

.input-row { margin-bottom: 12px; }
.input-row input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; outline: none; transition: border .2s; }
.input-row input:focus { border-color: var(--primary); }
.flex-row { display: flex; gap: 10px; }
.flex-row input { flex: 1; }

.btn-row { margin-top: 14px; display: flex; gap: 10px; align-items: center; }
.btn-primary { background: var(--primary); color: #fff; border: none; border-radius: 10px; padding: 12px 28px; font-size: 15px; font-weight: 700; cursor: pointer; transition: background .2s; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { color: var(--primary); text-decoration: none; font-size: 14px; font-weight: 600; }
.btn-copy { background: #f1f5f9; border: 1px solid var(--border); border-radius: 8px; padding: 8px 16px; cursor: pointer; font-size: 13px; }

.msg { margin-top: 10px; font-size: 14px; min-height: 20px; }
.msg.ok { color: var(--ok); }
.msg.bad { color: var(--bad); }

.result-box { margin-top: 18px; border: 1.5px dashed var(--primary); border-radius: 12px; padding: 18px; background: #f0fdfa; }
.result-head { margin-bottom: 12px; }
.result-head-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.key-display { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.key-display code { flex: 1; word-break: break-all; font-size: 14px; }
.warn-text { color: #b45309; font-size: 13px; margin-top: 10px; }
.result-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }

.status-badge { font-size: 12px; padding: 4px 12px; border-radius: 999px; font-weight: 700; }
.status-badge.ok { background: #dcfce7; color: var(--ok); }
.status-badge.bad { background: #fee2e2; color: var(--bad); }

.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.info-cell { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.info-label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.info-value { font-weight: 700; font-size: 15px; word-break: break-all; }
.info-value.bad { color: var(--bad); }

.progress-wrap { background: #e2e8f0; border-radius: 999px; height: 10px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #14b8a6, #0d9488); border-radius: 999px; transition: width .5s; }
.progress-bar.over { background: var(--bad); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
.data-table .empty { text-align: center; color: var(--muted); padding: 24px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.pager button { padding: 6px 16px; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; font-size: 13px; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager span { font-size: 13px; color: var(--muted); }

@media (max-width: 640px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .info-grid { grid-template-columns: 1fr 1fr; }
}

/* ============ 用户面板（panel） ============ */
.p-container { max-width: 640px; margin: 0 auto; padding: 24px 16px 60px; }
.p-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.p-title { font-size: 22px; font-weight: 800; }
.p-link { color: #64748b; font-size: 13px; text-decoration: none; }
.p-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.pc-head { display: flex; justify-content: space-between; align-items: center; }
.pc-title { font-size: 14px; font-weight: 700; color: #334155; }
.mb12 { margin-bottom: 12px; } .mb8 { margin-bottom: 8px; } .mt8 { margin-top: 8px; }
.pc-sub { font-size: 12px; color: #64748b; margin-bottom: 8px; }
.pc-hint { font-size: 12px; color: #94a3b8; margin-top: 6px; }
.pc-key-row { display: flex; gap: 8px; align-items: center; }
.pc-key { flex: 1; min-width: 0; background: #f8fafc; padding: 10px 12px; border-radius: 9px; font-size: 13px; word-break: break-all; color: #1e293b; }
.pc-btn { flex-shrink: 0; padding: 9px 14px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 9px; cursor: pointer; font-size: 12px; color: #475569; }

.usage-card { background: linear-gradient(135deg, #1e293b, #0f172a); border-radius: 18px; padding: 22px; color: #fff; margin-bottom: 16px; }
.uc-label { font-size: 13px; opacity: .7; margin-bottom: 8px; }
.uc-big { font-size: 28px; font-weight: 800; margin-bottom: 14px; word-break: break-all; }
.uc-progress { background: rgba(255,255,255,.12); border-radius: 999px; height: 8px; overflow: hidden; margin-bottom: 10px; }
.uc-bar { height: 100%; width: 0; background: #34d399; border-radius: 999px; transition: width .5s; }
.uc-bar.over { background: #ef4444; }
.uc-row { display: flex; justify-content: space-between; font-size: 13px; opacity: .75; }
.uc-expires { font-size: 13px; opacity: .6; margin-top: 10px; }
.uc-expires.bad { color: #fca5a5; opacity: 1; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { padding: 6px 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 9px; font-size: 12px; font-family: ui-monospace, monospace; cursor: pointer; color: #334155; }
.chip:hover { background: #f1f5f9; }
.chip-free { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.chip-no { opacity: .45; }

.p-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.p-table th { text-align: left; color: #94a3b8; font-weight: 500; padding: 7px 8px; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
.p-table td { padding: 8px; border-bottom: 1px solid #f8fafc; white-space: nowrap; }
.p-table .empty { text-align: center; color: #94a3b8; padding: 20px; }
.mut { color: #94a3b8; }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; }
.pager button { padding: 5px 14px; border: 1px solid #e2e8f0; background: #fff; border-radius: 8px; cursor: pointer; font-size: 12px; color: #475569; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager span { font-size: 12px; color: #94a3b8; }

.view-toggle { background: #f1f5f9; border-radius: 9px; padding: 3px; display: inline-flex; gap: 2px; }
.view-toggle button { border: none; background: transparent; padding: 5px 12px; border-radius: 7px; font-size: 12px; cursor: pointer; color: #64748b; }
.view-toggle button.on { background: #fff; color: #1e293b; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.chart-tip { position: absolute; z-index: 20; pointer-events: none; background: #0f172a; color: #fff; font-size: 12px; border-radius: 10px; padding: 10px 12px; max-width: 240px; box-shadow: 0 8px 20px rgba(0,0,0,.25); }
.tip-day { color: #cbd5e1; margin-bottom: 6px; }
.tip-row { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.tip-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.tip-val { margin-left: auto; padding-left: 12px; }
.tip-total { margin-top: 6px; padding-top: 6px; border-top: 1px solid #334155; color: #e2e8f0; }

/* ============ 后台 ============ */
.admin-layout { display: flex; min-height: 100vh; background: #f1f5f9; }
.admin-side { width: 210px; background: #0f172a; color: #cbd5e1; padding: 20px 0; flex-shrink: 0; }
.admin-logo { font-size: 18px; font-weight: 800; color: #fff; padding: 0 20px 18px; border-bottom: 1px solid #1e293b; margin-bottom: 12px; }
.admin-menu a { display: block; padding: 11px 22px; color: #94a3b8; text-decoration: none; font-size: 14px; transition: all .15s; }
.admin-menu a:hover { color: #fff; background: #1e293b; }
.admin-menu a.on { color: #fff; background: #0d9488; font-weight: 600; }
.admin-main { flex: 1; padding: 24px; min-width: 0; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.admin-topbar h1 { font-size: 20px; font-weight: 700; }
.admin-actions { display: flex; gap: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px 18px; }
.stat-label { font-size: 12px; color: #64748b; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 800; }
.stat-sub { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.a-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
.a-table th { text-align: left; padding: 10px 12px; color: #64748b; font-weight: 600; border-bottom: 2px solid #e2e8f0; white-space: nowrap; }
.a-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
.a-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.a-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.a-toolbar input, .a-toolbar select { padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 9px; font-size: 13px; outline: none; }
.a-btn { padding: 8px 18px; border: none; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600; }
.a-btn-primary { background: #0d9488; color: #fff; }
.a-btn-primary:hover { background: #0f766e; }
.a-btn-ghost { background: #f1f5f9; color: #475569; }
.a-btn-danger { background: #fee2e2; color: #b91c1c; }
.a-btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.tag-green { background: #dcfce7; color: #16a34a; }
.tag-gray { background: #f1f5f9; color: #64748b; }
.tag-red { background: #fee2e2; color: #dc2626; }
.tag-blue { background: #dbeafe; color: #2563eb; }
.modal-mask { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 16px; padding: 24px; width: min(520px, 92vw); max-height: 86vh; overflow-y: auto; }
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; color: #64748b; margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; padding: 9px 12px; border: 1px solid #e2e8f0; border-radius: 9px; font-size: 13px; outline: none; }
.form-row input:focus, .form-row select:focus { border-color: #0d9488; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #ecfdf5, #f1f5f9); }
.login-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 18px; padding: 36px; width: min(380px, 92vw); }
.login-card h2 { text-align: center; margin-bottom: 22px; color: #0f766e; }

@media (max-width: 768px) {
  .admin-layout { flex-direction: column; }
  .admin-side { width: 100%; padding: 10px 0; }
  .admin-menu { display: flex; flex-wrap: wrap; }
  .admin-menu a { padding: 8px 12px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

.code-block { background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 16px; font-size: 13px; overflow-x: auto; line-height: 1.7; font-family: ui-monospace, Consolas, monospace; }
