:root {
  --cream: #f4f3ea;
  --ink: #22301f;
  --muted: #8a8f80;
  --green: #33513c;
  --green-soft: #4a6b52;
  --lime: #dcf265;
  --orange: #f07a4b;
  --line: #e7e8da;
  --white: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }

/* ---------- 认证页 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 8%, rgba(220, 242, 101, 0.45), transparent 42%),
    radial-gradient(circle at 88% 92%, rgba(51, 81, 60, 0.16), transparent 46%),
    var(--cream);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: 28px;
  padding: 40px 36px 32px;
  box-shadow: 0 24px 60px rgba(34, 48, 31, 0.12);
}

.brand-row { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }

.brand-mark {
  width: 46px; height: 46px;
  border-radius: 15px;
  background: var(--lime);
  color: var(--ink);
  font-weight: 800;
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}

.brand-name { font-weight: 800; font-size: 16px; }
.brand-sub { color: var(--muted); font-size: 12px; }

.auth-card h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: 0.5px; }
.auth-hint { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.auth-hint b { color: var(--green); }

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: #4a5244; margin-bottom: 8px; }

.field input {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fafaf3;
  outline: none;
  transition: border-color .15s, background .15s;
}
.field input:focus { border-color: var(--green); background: #fff; }

.code-row { display: flex; gap: 10px; }
.code-row input { flex: 1; }
.code-row .btn { flex: none; padding: 0 16px; white-space: nowrap; }

.msg { min-height: 20px; font-size: 13px; margin-top: 12px; color: var(--orange); }
.msg.ok { color: var(--green); }

.link-btn {
  margin-top: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  padding: 0;
}

/* ---------- 按钮 ---------- */
.btn {
  border: none;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 700;
  transition: transform .12s, opacity .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-soft); }
.btn-lime { background: var(--lime); color: var(--ink); }
.btn-lime:hover { background: #d2ea55; }
.btn-ghost { background: #fff; color: var(--green); border: 2px solid var(--green); }
.btn-ghost:hover { background: #f3f6e7; }
.btn-danger { background: #fdeee2; color: #c05621; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; padding: 14px; font-size: 15px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex: none;
  background: var(--green);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 26px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.side-brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.side-brand-text b { font-size: 15px; }
.side-brand-text span { font-size: 11px; color: rgba(255, 255, 255, 0.6); }

.side-nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}
.nav-item i { font-style: normal; font-size: 16px; }
.nav-item:hover { background: rgba(255, 255, 255, 0.08); }
.nav-item.active { background: var(--lime); color: var(--ink); }

.side-foot { margin-top: auto; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.side-user { font-size: 12px; color: rgba(255, 255, 255, 0.72); word-break: break-all; margin-bottom: 10px; }
.side-logout {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  border-radius: 999px;
  padding: 9px;
  font-size: 13px;
}
.side-logout:hover { background: rgba(255, 255, 255, 0.18); }
.side-logout + .side-logout { margin-top: 8px; }

.main { flex: 1; min-width: 0; padding: 26px 34px 60px; }

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.topbar-greet { color: var(--muted); font-size: 13px; }
.topbar h1 { margin: 2px 0 0; font-size: 34px; letter-spacing: 1px; }

/* ---------- 概览 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: 22px;
  padding: 22px 24px;
  box-shadow: 0 8px 24px rgba(34, 48, 31, 0.05);
}
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value { font-size: 34px; font-weight: 800; margin-top: 6px; letter-spacing: 0.5px; }
.stat-card .unit { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.stat-card.accent { background: var(--green); color: #fff; }
.stat-card.accent .label { color: rgba(255, 255, 255, 0.7); }
.stat-card.accent .value { color: var(--lime); }
.stat-card.warn .value { color: var(--orange); }

.panel {
  background: var(--white);
  border-radius: 24px;
  padding: 24px 26px;
  box-shadow: 0 8px 24px rgba(34, 48, 31, 0.05);
  margin-bottom: 20px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.panel-head h2 { font-size: 18px; margin: 0; }
.panel-head .sub { color: var(--muted); font-size: 12px; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}
td {
  padding: 14px 12px;
  border-bottom: 1px solid #f0f1e6;
  vertical-align: middle;
  font-size: 14px;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfbf4; }
.t-main { font-weight: 700; }
.t-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.t-nowrap { white-space: nowrap; }
.t-right { text-align: right; }
.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #eef0e2;
  color: var(--green);
  white-space: nowrap;
}
.chip-lime { background: var(--lime); color: var(--ink); }
.chip-warn { background: #fdeee2; color: #c05621; }
.chip-ok { background: #e4f4d9; color: #3c6e2f; }
.chip-mute { background: #f1f1ea; color: var(--muted); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar select, .toolbar input {
  border: 2px solid var(--line);
  background: #fafaf3;
  border-radius: 12px;
  padding: 9px 12px;
  outline: none;
}
.toolbar select:focus, .toolbar input:focus { border-color: var(--green); background: #fff; }
.toolbar input { min-width: 220px; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  color: #4a5244;
}
.tab.active { background: var(--green); border-color: var(--green); color: #fff; }

.empty { text-align: center; color: var(--muted); padding: 48px 0; font-size: 14px; }
.empty .emoji { display: block; font-size: 40px; margin-bottom: 10px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(20, 30, 18, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 20px;
  overflow-y: auto;
  z-index: 50;
  animation: fade .15s ease-out;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal {
  width: 100%;
  max-width: 620px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px 14px;
}
.modal-head h3 { margin: 0; font-size: 19px; }
.icon-btn {
  border: none; background: #f4f3ea; color: var(--muted);
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 14px;
}
.icon-btn:hover { background: #e9e9dd; color: var(--ink); }

.modal-body { padding: 8px 26px 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-row { display: flex; flex-direction: column; }
.form-row label { font-size: 12px; font-weight: 700; color: #4a5244; margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea {
  border: 2px solid var(--line);
  background: #fafaf3;
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
  width: 100%;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--green); background: #fff; }
.form-row textarea { min-height: 88px; resize: vertical; }
.form-row .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.check-row { display: flex; align-items: center; gap: 8px; padding-top: 26px; }
.check-row input { width: auto; }
.check-row label { margin: 0; font-size: 13px; }

.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 20px; margin-top: 6px; border-top: 1px solid var(--line);
}

/* ---------- 提示 ---------- */
.toast-root {
  position: fixed; top: 20px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 100;
}
.toast {
  background: var(--green);
  color: #fff;
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(34, 48, 31, 0.25);
  animation: slide .18s ease-out;
  max-width: 340px;
}
.toast.err { background: #b1442a; }
.toast.ok { background: var(--green); }
@keyframes slide { from { opacity: 0; transform: translateX(16px) } to { opacity: 1; transform: none } }

.loading { color: var(--muted); padding: 40px 0; text-align: center; }

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 10px;
    padding: 14px 16px; overflow-x: auto;
  }
  .side-brand { padding: 0 8px 0 0; }
  .side-brand-text span { display: none; }
  .side-nav { flex-direction: row; }
  .nav-item { white-space: nowrap; padding: 9px 12px; font-size: 13px; }
  .side-foot { margin: 0 0 0 auto; border: none; padding: 0; display: flex; align-items: center; gap: 8px; }
  .side-user { display: none; }
  .side-logout { width: auto; padding: 8px 14px; }
  .main { padding: 20px 16px 48px; }
  .topbar h1 { font-size: 26px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* 环境/域名不对时的提示条 */
.env-tip {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fdecec;
  border: 1px solid #f2c7c7;
  color: #9b2c2c;
  font-size: 13px;
  line-height: 1.6;
}
.env-tip b { display: block; font-size: 14px; margin-bottom: 6px; }
.env-tip p { margin: 0 0 10px; color: #8a3a3a; }
.env-tip code {
  background: rgba(0, 0, 0, .06);
  padding: 1px 6px;
  border-radius: 6px;
  word-break: break-all;
  font-size: 12px;
}
.env-tip .btn { margin: 0; text-decoration: none; }

/* ===== 关键修复 =====
   .auth-wrap{display:flex} 和 .app{display:flex} 的优先级高于浏览器默认的
   [hidden]{display:none}，导致 hidden 属性失效：登录成功后登录卡仍盖在页面上。
   这里强制 hidden 属性真正生效。 */
[hidden] { display: none !important; }
