/* 映善青年管理后台 · 青瓷浅色 */
:root {
  --bg: #F6FBF8;
  --surface: #FFFFFF;
  --surface-2: #FAFDFB;
  --ink: #202B26;
  --ink-2: #33423A;
  --muted: #5F7069;
  --muted-2: #64756E;
  --border: #DCEBE3;
  --border-strong: #C6DED2;
  --primary: #3F7A61;
  --primary-mid: #4A8A6D;
  --primary-soft: #ECF5F0;
  --primary-softer: #F2F9F5;
  --butter: #E3BE63;
  --danger: #C0392B;
  --danger-soft: #FCEAE8;
  --warning: #8F5A00;
  --warning-soft: #FFF4DC;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px -22px rgba(32, 43, 38, .45);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 12.5px; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 82% -10%, #E7F2EC 0%, rgba(246,251,248,0) 62%),
    radial-gradient(600px 400px at 8% 110%, #F6EFD9 0%, rgba(246,251,248,0) 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 30px 28px 26px;
  box-shadow: 0 24px 60px -40px rgba(32, 43, 38, .55);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-mark {
  width: 46px; height: 46px; border-radius: 15px; flex: none;
  background: linear-gradient(145deg, var(--primary), var(--primary-mid));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
}
.login-name { font-size: 16px; font-weight: 700; }
.login-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.login-error {
  margin: 4px 0 14px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger); font-size: 12.5px;
}
.login-note { margin-top: 16px; text-align: center; font-size: 11.5px; color: var(--muted); }

/* ---------- 表单 ---------- */
.fld { display: block; margin-bottom: 16px; }
.fld > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.fld input, .fld select {
  width: 100%; height: 42px; padding: 0 13px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fld input:focus, .fld select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(63, 122, 97, .14);
}
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.fld-inline { margin-bottom: 0; min-width: 160px; }
.fld-inline.grow { flex: 1; min-width: 200px; }
.hint { margin-top: 12px; font-size: 12px; color: var(--muted); }

/* ---------- 按钮 ---------- */
.btn {
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform .12s ease, background .15s ease, opacity .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-mid)); color: #fff; box-shadow: 0 8px 20px -14px rgba(63,122,97,.9); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #3A7159, #447F65); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--ink-2); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--primary-softer); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #A93226; }
.btn-sm { height: 32px; padding: 0 13px; font-size: 12.5px; }
.btn-block { width: 100%; height: 44px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 226px; flex: none; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 18px; }
.side-name { font-size: 14.5px; font-weight: 700; }
.side-sub { font-size: 11.5px; color: var(--muted); }
.nav { padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer; text-align: left; transition: background .14s ease, color .14s ease;
}
.nav-item:hover { background: var(--primary-softer); }
.nav-item.is-on { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav-ico { width: 16px; text-align: center; opacity: .8; font-size: 13px; }
.side-foot { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid var(--border); }
.who { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }

.main { flex: 1; min-width: 0; padding: 0 30px 48px; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 0 16px; margin-bottom: 6px;
  background: linear-gradient(var(--bg) 76%, rgba(246,251,248,0));
}
.topbar h1 { font-size: 21px; font-weight: 800; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ---------- 卡片 ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px 20px;
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { font-size: 14.5px; font-weight: 700; }
.panel-actions { margin-top: 14px; display: flex; justify-content: flex-end; gap: 10px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.stat-num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
td.mono, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 13px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap;
}
.tag-warn { background: var(--warning-soft); color: var(--warning); }
.tag-muted { background: #EEF2F8; color: var(--muted); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- 总览 ---------- */
.quota-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.quota {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 14px; background: var(--surface-2);
}
.quota-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.quota-name { font-weight: 700; font-size: 13.5px; }
.quota-meta { margin-top: 6px; font-size: 12px; color: var(--muted); }
.quota-sessions { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 11.5px; padding: 3px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.chip-0 { color: var(--danger); border-color: #F3CFC9; background: var(--danger-soft); }

.timeline { display: flex; flex-direction: column; gap: 2px; }
.tl-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.tl-row:last-child { border-bottom: 0; }
.tl-time { color: var(--muted); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; padding-top: 1px; }
.tl-body { flex: 1; min-width: 0; }
.tl-action { font-weight: 600; }
.tl-detail { color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.phone-list { display: flex; flex-wrap: wrap; gap: 8px; }
.phone-chip {
  border: 1px solid var(--border); background: var(--surface-2);
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; cursor: pointer;
  transition: border-color .14s ease, color .14s ease;
}
.phone-chip:hover { border-color: var(--primary); color: var(--primary); }
.phone-chip b { font-family: var(--mono); font-weight: 600; }

/* ---------- 配置 ---------- */
.config-list { display: flex; flex-direction: column; gap: 12px; }
.config-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.config-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.config-name { font-weight: 700; }
.config-row { display: flex; gap: 10px; align-items: center; }
.config-row textarea {
  flex: 1; min-height: 62px; padding: 9px 11px; resize: vertical;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); outline: none;
  font: inherit; font-size: 12.5px;
}
.config-row textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(63,122,97,.12); }
.switch {
  position: relative; width: 42px; height: 24px; border-radius: 999px;
  background: var(--border-strong); border: 0; cursor: pointer; flex: none;
  transition: background .16s ease;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .18s cubic-bezier(.32,.72,0,1);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch.is-on { background: var(--primary); }
.switch.is-on::after { transform: translateX(18px); }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.cert-result { margin-top: 14px; display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.cert-result img { width: 240px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #202B26; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 100; box-shadow: 0 12px 30px -18px rgba(0,0,0,.6);
  animation: toast-in .18s ease;
}
.toast.is-error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.modal {
  position: fixed; inset: 0; background: rgba(20, 32, 27, .42);
  display: flex; align-items: center; justify-content: center; z-index: 90; padding: 20px;
}
.modal-card {
  background: var(--surface); border-radius: 16px; padding: 22px 24px;
  width: 100%; max-width: 420px; box-shadow: 0 30px 80px -40px rgba(0,0,0,.6);
}
.modal-card h3 { font-size: 16px; margin-bottom: 8px; }
.modal-card p { margin: 0 0 18px; font-size: 13px; color: var(--ink-2); line-height: 1.65; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  .main { padding: 0 16px 40px; }
  .form-row { flex-direction: column; align-items: stretch; }
  .fld-inline { min-width: 0; }
}
