/* ==========================================================================
   Topsmill · 管理后台样式（与前台共用配色方案 B 的设计 Token）
   ========================================================================== */
:root {
  --brand: #14507a;
  --brand-700: #0c3555;
  --brand-600: #0f4266;
  --brand-050: #e9f0f5;
  --brand-100: #cfe0ec;
  --accent: #e09331;
  --accent-hover: #c9801f;
  --on-accent: #22160a;
  --ink: #14212e;
  --ink-2: #2c3e4e;
  --muted: #5d6b78;
  --line: #dfe5e9;
  --line-soft: #eef2f5;
  --bg: #f5f7f8;
  --white: #ffffff;
  --surface: #fbfcfd;
  --hover-soft: #f0f4f7;
  --unread-bg: #eef5fa;
  --ok: #1b7a4b;
  --err: #c0341f;
  --err-line: #eecdc6;
  --err-bg: #fdf3f1;
  --badge: #b5442f;
  --brand-rgb: 20, 80, 122;
  --ink-rgb: 20, 33, 46;
  --white-rgb: 255, 255, 255;
  --shadow: 0 8px 24px -14px rgba(var(--ink-rgb), .22);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink-2);
  font-family: var(--font); font-size: 15px; line-height: 1.7;
}
h1, h2, h3, h4 { color: var(--ink); margin: 0 0 .5em; line-height: 1.3; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
.hide { display: none !important; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--white); border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1100px; margin: 0 auto; padding: 0 24px; height: 62px;
  display: flex; align-items: center; gap: 14px;
}
.topbar__brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--ink); }
.topbar__mark {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--brand), var(--brand-700));
}
.topbar__mark svg { width: 15px; height: 15px; }
.topbar__sep { color: var(--line); }
.topbar__label { font-size: .86rem; color: var(--muted); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font-family: inherit; font-size: .88rem; font-weight: 600;
  padding: 9px 16px; border-radius: 7px; border: 1px solid transparent;
  cursor: pointer; transition: all .16s ease; white-space: nowrap;
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: var(--white); color: var(--ink-2); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand-600); }
.btn--danger { background: var(--white); color: var(--err); border-color: var(--err-line); }
.btn--danger:hover { background: var(--err-bg); }
.btn--sm { padding: 6px 11px; font-size: .8rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* 登录 */
.login-wrap { min-height: calc(100vh - 62px); display: grid; place-items: center; padding: 40px 20px; }
.login-card {
  width: 100%; max-width: 392px; background: var(--white); border: 1px solid var(--line);
  border-radius: 12px; padding: 34px; box-shadow: var(--shadow);
}
.login-card h1 { font-size: 1.24rem; }
.login-card p { color: var(--muted); font-size: .88rem; margin-bottom: 22px; }
.login-hint { font-size: .78rem; color: var(--muted); margin-top: 14px; line-height: 1.6; }

/* 表单元素 */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=password], input[type=email], input[type=tel], textarea, select {
  font-family: inherit; font-size: .92rem; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--white); width: 100%; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .16);
}
textarea { min-height: 84px; resize: vertical; line-height: 1.65; }

/* 布局 */
.shell { max-width: 1100px; margin: 0 auto; padding: 26px 24px 120px; display: grid; grid-template-columns: 190px 1fr; gap: 26px; align-items: start; }
.side { position: sticky; top: 86px; }
.side__nav { display: grid; gap: 3px; }
.side__nav button {
  font-family: inherit; font-size: .9rem; text-align: left; cursor: pointer;
  border: 0; background: transparent; color: var(--ink-2);
  padding: 9px 12px; border-radius: 7px; display: flex; align-items: center; gap: 8px;
}
.side__nav button:hover { background: var(--white); }
.side__nav button.is-active { background: var(--white); color: var(--brand-600); font-weight: 600; box-shadow: var(--shadow); }
.badge {
  margin-left: auto; font-size: .72rem; font-weight: 700; color: var(--white); background: var(--badge);
  border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center;
}

.panel { display: grid; gap: 22px; }
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: 10px;
  padding: 24px;
}
.card__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.card__head h2 { font-size: 1.02rem; margin: 0; }
.card__head span { font-size: .8rem; color: var(--muted); }
.card__hint { font-size: .8rem; color: var(--muted); margin: -8px 0 16px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* 重复项编辑器 */
.repeater { display: grid; gap: 12px; }
.rep-item {
  border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px 6px;
  background: var(--surface); position: relative;
}
.rep-item__bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.rep-item__no {
  font-family: ui-monospace, Consolas, monospace; font-size: .74rem;
  color: var(--brand-600); background: var(--brand-050); border: 1px solid var(--brand-100);
  padding: 1px 8px; border-radius: 999px;
}
.rep-item__del { margin-left: auto; }
.rep-item .field:last-child { margin-bottom: 8px; }
.rep-add { margin-top: 4px; }

/* 相册/标签编辑 */
.tags-edit { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
.tags-edit span {
  font-size: .8rem; background: var(--brand-050); border: 1px solid var(--brand-100);
  color: var(--ink-2); padding: 3px 10px; border-radius: 999px;
}
.tags-edit span button {
  border: 0; background: none; color: var(--muted); cursor: pointer; margin-left: 5px; font-size: .8rem;
}

/* 询盘表 */
.inq { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.inq + .inq { margin-top: 10px; }
.inq__head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--white); cursor: pointer; font-size: .9rem;
}
.inq__head:hover { background: var(--hover-soft); }
.inq.is-unread .inq__head { background: var(--unread-bg); }
.inq__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex: none; }
.inq.is-unread .inq__dot { background: var(--brand); }
.inq__who { font-weight: 600; color: var(--ink); }
.inq__meta { color: var(--muted); font-size: .8rem; margin-left: auto; }
.inq__body { padding: 0 16px 16px; display: none; border-top: 1px solid var(--line-soft); }
.inq.is-open .inq__body { display: block; }
.inq__body p { white-space: pre-wrap; font-size: .9rem; margin: 12px 0; }
.inq__acts { display: flex; gap: 8px; flex-wrap: wrap; }
.kv { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); padding-top: 12px; }

.empty { text-align: center; color: var(--muted); font-size: .9rem; padding: 40px 0; }

/* 底部保存条 */
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(var(--white-rgb), .96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 12px 24px;
  display: flex; align-items: center; gap: 12px; justify-content: flex-end;
}
.savebar__status { margin-right: auto; font-size: .85rem; color: var(--muted); }
.savebar__status.ok { color: var(--ok); }
.savebar__status.err { color: var(--err); }

.status { font-size: .84rem; margin-top: 10px; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

.adv textarea { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; min-height: 320px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; padding-bottom: 130px; }
  .side { position: static; }
  .side__nav { display: flex; overflow-x: auto; gap: 6px; }
  .side__nav button { white-space: nowrap; background: var(--white); box-shadow: var(--shadow); }
  .row { grid-template-columns: 1fr; }
  .login-card { padding: 26px; }
}
