/* ==========================================================================
   admin.code-moe.top — 设计系统
   原则：中性暖白底 / 1px 细边框 / 紧字距 / 等宽数字 / 单一低饱和强调色
   刻意避免：渐变、紫色、玻璃拟态、发光阴影、emoji
   ========================================================================== */

:root {
  color-scheme: only light;
  --bg:        #fbf8f9;
  --surface:   #ffffff;
  --surface-2: #fcfafb;
  --surface-3: #f7f1f4;

  --line:        #ece5e8;
  --line-strong: #dcd0d5;

  --ink:    #1a1a1c;
  --ink-2:  #45454a;
  --muted:  #74736f;
  --muted-2:#9a9992;

  /* 主色：樱花粉（偏深的玫瑰粉，保证白字可读） */
  --accent:      #c9557a;
  --accent-2:    #b04a6c;
  --accent-soft: #fdeef3;

  /* 次色：天空蓝 */
  --sky:      #2e86c1;
  --sky-2:    #25719f;
  --sky-soft: #eaf4fb;

  --ok:      #2f6f4f;
  --ok-soft: #e6f0ea;
  --warn:    #8a6a1f;
  --warn-soft:#f6efdc;
  --danger:  #9c3b34;
  --danger-soft:#f7e9e7;

  --radius:   10px;
  --radius-sm: 7px;

  --sidebar-w: 236px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --shadow: 0 1px 2px rgba(22, 22, 22, .04);
  --shadow-md: 0 4px 16px rgba(22, 22, 22, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -.006em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.018em; }
h1 { font-size: 19px; }
h2 { font-size: 15px; }
h3 { font-size: 13.5px; }

p { margin: 0 0 10px; }

code, .mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 骨架 */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 17px 18px 15px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  flex: 0 0 24px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-title { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.brand-sub { font-size: 10.5px; color: var(--muted-2); font-family: var(--mono); letter-spacing: .01em; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px 20px; }
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

.nav-group { margin-bottom: 16px; }
.nav-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted-2);
  padding: 0 9px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 450;
  text-decoration: none;
  transition: background .12s ease, color .12s ease;
  position: relative;
}
.nav-link:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav-link.is-active { background: var(--surface); color: var(--ink); font-weight: 550; box-shadow: var(--shadow); }
.nav-link.is-active::before {
  content: "";
  position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 2px; height: 16px; border-radius: 2px; background: var(--accent);
}
.nav-link svg { width: 15px; height: 15px; flex: 0 0 15px; stroke-width: 1.7; opacity: .72; }
.nav-link.is-active svg { opacity: 1; }
.nav-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  background: var(--danger);
  color: #fff;
  border-radius: 9px;
  padding: 0 5px;
  min-width: 16px;
  text-align: center;
  line-height: 15px;
}

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.avatar {
  width: 27px; height: 27px; flex: 0 0 27px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-2);
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 600;
  text-transform: uppercase;
}
.who { min-width: 0; flex: 1; }
.who-name { font-size: 12.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-role { font-size: 10.5px; color: var(--muted-2); }
.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  width: 26px; height: 26px;
  border-radius: 6px;
  display: grid; place-items: center;
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); text-decoration: none; }

/* --------------------------------------------------------------- 主区 */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 54px;
  border-bottom: 1px solid var(--line);
  background: rgba(252, 251, 249, .86);
  backdrop-filter: saturate(180%) blur(6px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-title { font-size: 14.5px; font-weight: 600; letter-spacing: -.012em; }
.topbar-sub { font-size: 12px; color: var(--muted); margin-left: 2px; }
.topbar-spacer { flex: 1; }
.menu-btn { display: none; }

.content { padding: 22px; max-width: 1500px; width: 100%; }
.content-narrow { max-width: 860px; }

.page-head { margin-bottom: 18px; }
.page-head h1 { margin-bottom: 3px; }
.page-desc { color: var(--muted); font-size: 12.5px; }

/* --------------------------------------------------------------- 卡片 */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-head h2 { flex: 1; }
.card-head .hint { font-size: 11.5px; color: var(--muted-2); }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }

/* 指标网格 */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 15px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
.stat-value { font-size: 23px; font-weight: 600; letter-spacing: -.03em; font-family: var(--mono); font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-value small { font-size: 12px; font-weight: 500; color: var(--muted-2); margin-left: 3px; letter-spacing: 0; }
.stat-foot { font-size: 11.5px; color: var(--muted-2); margin-top: 6px; }
.stat-foot .up { color: var(--ok); }
.stat-foot .down { color: var(--danger); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }

/* --------------------------------------------------------------- 表格 */

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th {
  text-align: left;
  font-weight: 550;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted-2);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
}
table.tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink-2);
}
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl td.num, table.tbl th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.tbl .cell-main { color: var(--ink); font-weight: 500; }
table.tbl .cell-sub { color: var(--muted-2); font-size: 11px; }
.tbl-empty { padding: 40px 16px; text-align: center; color: var(--muted-2); font-size: 12.5px; }

/* --------------------------------------------------------------- 徽标 */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 20px;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 18px;
}
.badge-neutral { background: var(--surface-3); color: var(--ink-2); border-color: var(--line); }
.badge-ok      { background: var(--ok-soft); color: var(--ok); }
.badge-warn    { background: var(--warn-soft); color: var(--warn); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-accent  { background: var(--accent-soft); color: var(--accent-2); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* --------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, border-color .12s;
  line-height: 1.5;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-danger { background: var(--surface); border-color: #e3c3c0; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sky { background: var(--sky); border-color: var(--sky); color: #fff; }
.btn-sky:hover { background: var(--sky-2); border-color: var(--sky-2); }
.btn-sm { padding: 3px 8px; font-size: 11.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row form { display: inline; }

/* --------------------------------------------------------------- 表单 */

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
.input, .select, .textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
.select { appearance: none; background-image: none; }
.field-hint { font-size: 11.5px; color: var(--muted-2); margin-top: 4px; }

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.filter-bar .input, .filter-bar .select { width: auto; min-width: 130px; }

/* --------------------------------------------------------------- 提示 */

.flash-stack { margin-bottom: 16px; display: grid; gap: 8px; }
.flash {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  border: 1px solid;
}
.flash-info    { background: var(--sky-soft); border-color: #cfe4f2; color: var(--sky-2); }
.flash-success { background: var(--ok-soft);     border-color: #c9e0d2; color: var(--ok); }
.flash-warn    { background: var(--warn-soft);   border-color: #e8dcbb; color: var(--warn); }
.flash-danger  { background: var(--danger-soft); border-color: #e8ccc9; color: var(--danger); }

.note {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--muted-2);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 12px;
  color: var(--muted);
}

/* --------------------------------------------------------------- 分页 */

.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.pager a { color: var(--ink-2); border: 1px solid var(--line-strong); padding: 3px 10px; border-radius: var(--radius-sm); text-decoration: none; }
.pager a:hover { background: var(--surface-3); text-decoration: none; }
.pager-info { color: var(--muted-2); font-family: var(--mono); font-size: 11.5px; }

/* --------------------------------------------------------------- 空态 */

.empty { padding: 46px 20px; text-align: center; }
.empty-title { font-size: 13.5px; font-weight: 550; color: var(--ink-2); margin-bottom: 4px; }
.empty-desc { font-size: 12px; color: var(--muted-2); max-width: 420px; margin: 0 auto 14px; }

/* --------------------------------------------------------------- 进度 */

.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.warn > i { background: var(--warn); }
.bar.danger > i { background: var(--danger); }
.bar.sky > i { background: var(--sky); }

.kv { display: grid; grid-template-columns: 132px 1fr; gap: 7px 14px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); font-family: var(--mono); font-variant-numeric: tabular-nums; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* --------------------------------------------------------------- 登录 */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-card {
  width: 100%;
  max-width: 372px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  padding: 28px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-title { font-size: 17px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 4px; }
.auth-desc { font-size: 12.5px; color: var(--muted); margin-bottom: 20px; }
.auth-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted-2); }

/* --------------------------------------------------------------- 遮罩 */

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(22, 22, 22, .3);
  z-index: 35;
}

/* ============================================================ 响应式 */

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

@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .2s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-md);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-overlay { display: block; }
  .menu-btn {
    display: grid; place-items: center;
    width: 30px; height: 30px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 6px;
    cursor: pointer;
  }
  .content { padding: 16px; }
  .topbar { padding: 0 14px; height: 50px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 108px 1fr; }
}

@media (max-width: 620px) {
  .stats { grid-template-columns: 1fr; }
  .stat-value { font-size: 20px; }
  .page-head h1 { font-size: 17px; }
  .topbar-sub { display: none; }
  table.tbl { font-size: 12px; }
  table.tbl th, table.tbl td { padding: 8px 9px; }
  .auth-card { padding: 22px; }
  .filter-bar .input, .filter-bar .select { width: 100%; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
