/* 就选我厂 CMS 后台管理 · 独立站点样式 */
:root {
  --orange: #e9681b; --orange-dark: #c6530d; --orange-soft: #fff2e8;
  --ink: #1f2a30; --ink-2: #3b4a52; --muted: #77858d;
  --line: #e6e9ec; --bg: #f4f6f8; --white: #fff;
  --green: #2e9b65; --red: #d94b45;
  --radius: 10px; --shadow: 0 10px 34px rgba(31,42,48,.12);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.65; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: 14px; }
img { display: block; max-width: 100%; }

/* ---------- 登录 ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1000px 600px at 20% 0%, #fff4e9, transparent), #f2f4f6; padding: 24px; }
.login-card { width: 420px; max-width: 100%; background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 40px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand .mark { width: 44px; height: 44px; border-radius: 12px; background: var(--orange); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 800; }
.login-brand b { display: block; font-size: 20px; }
.login-brand span { display: block; font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.login-card h1 { font-size: 23px; margin: 0 0 6px; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 13px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--ink-2); }
.field label .req { color: var(--red); }
.field .hint { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; font-weight: 400; }
.input, .textarea, .select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; color: var(--ink); background: #fff; outline: none; transition: .2s; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(233,104,27,.12); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
.textarea--code { font-family: Consolas, "Courier New", monospace; font-size: 12.5px; min-height: 180px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; cursor: pointer; font-weight: 600; transition: .2s; background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--orange); color: #fff; border-color: var(--orange); }
.btn--primary:hover { background: var(--orange-dark); }
.btn--danger { color: var(--red); border-color: #f0c9c7; }
.btn--danger:hover { background: #fff2f1; }
.btn--sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn--block { width: 100%; padding: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.login-error { background: #fff1f0; color: #b5342f; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.login-foot { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; font-size: 12px; color: var(--muted); }
.login-foot summary { cursor: pointer; color: var(--orange); font-weight: 600; }
.login-foot table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 12px; }
.login-foot td { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.login-foot code { background: #f5f6f8; padding: 1px 5px; border-radius: 4px; }

/* ---------- 框架 ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0,1fr); min-height: 100vh; }
.sidebar { background: #1b262c; color: #c8d2d6; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { padding: 24px 20px 20px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid rgba(255,255,255,.09); }
.sidebar-brand .mark { width: 36px; height: 36px; border-radius: 9px; background: var(--orange); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.sidebar-brand b { color: #fff; font-size: 16px; display: block; }
.sidebar-brand span { font-size: 10px; letter-spacing: .08em; color: #8e9ba1; display: block; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px; }
.nav-group-title { font-size: 11px; letter-spacing: .12em; color: #71838a; padding: 12px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13.5px; transition: .15s; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.is-active { background: var(--orange); color: #fff; font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; opacity: .9; }
.sidebar-foot { padding: 16px; border-top: 1px solid rgba(255,255,255,.09); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #34444c; color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.sidebar-user b { display: block; color: #fff; font-size: 13px; }
.sidebar-user span { font-size: 11px; color: #94a3a9; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 66px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 28px; gap: 16px; position: sticky; top: 0; z-index: 20; }
.topbar h2 { font-size: 17px; margin: 0; }
.topbar .crumb { color: var(--muted); font-size: 12px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.role-pill { background: var(--orange-soft); color: var(--orange-dark); border-radius: 999px; padding: 4px 12px; font-size: 12px; font-weight: 600; }
.content { padding: 26px 28px 60px; }

/* ---------- 通用面板 ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.panel-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-head .desc { color: var(--muted); font-size: 12px; }
.panel-body { padding: 22px; }
.panel-head .right { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card b { display: block; font-size: 30px; line-height: 1.3; color: var(--orange); margin-top: 4px; }
.stat-card small { color: var(--muted); font-size: 11px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.quick { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; cursor: pointer; transition: .2s; background: #fff; }
.quick:hover { border-color: var(--orange); background: var(--orange-soft); }
.quick b { display: block; font-size: 14px; }
.quick span { font-size: 12px; color: var(--muted); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; background: #f8fafb; color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fcfcfd; }
table.data .title-cell { font-weight: 600; color: var(--ink); max-width: 320px; }
table.data .sub-cell { color: var(--muted); font-size: 12px; margin-top: 2px; }
table.data .thumb { width: 54px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge--on { background: #e9f7ef; color: var(--green); }
.badge--off { background: #f0f2f4; color: #8b969c; }
.badge--warn { background: var(--orange-soft); color: var(--orange-dark); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-row { text-align: center; color: var(--muted); padding: 42px 0; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.search { width: 210px; }

/* ---------- 表单 / 弹窗 ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.img-picker { display: flex; gap: 10px; align-items: flex-start; }
.img-picker .preview { width: 88px; height: 66px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; background: var(--bg); flex-shrink: 0; }
.img-picker .grow { flex: 1; min-width: 0; }
.modal-mask { position: fixed; inset: 0; background: rgba(20,28,33,.5); z-index: 100; display: grid; place-items: center; padding: 24px; }
.modal { background: #fff; border-radius: 14px; width: 760px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head .x { margin-left: auto; background: none; border: 0; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.toast-stack { position: fixed; top: 20px; right: 20px; z-index: 200; display: grid; gap: 10px; }
.toast { background: #fff; border-left: 4px solid var(--orange); box-shadow: var(--shadow); border-radius: 8px; padding: 12px 18px; font-size: 13px; min-width: 220px; animation: slidein .2s ease; }
.toast--ok { border-left-color: var(--green); }
.toast--err { border-left-color: var(--red); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 媒体库 ---------- */
.media-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.media-cell { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.media-cell .pic { aspect-ratio: 4/3; background: var(--bg); }
.media-cell .pic img { width: 100%; height: 100%; object-fit: cover; }
.media-cell .meta { padding: 10px 12px; font-size: 11px; color: var(--muted); }
.media-cell .meta b { display: block; color: var(--ink); font-size: 12px; word-break: break-all; }
.media-cell .meta .src { margin-top: 5px; color: var(--orange-dark); }

/* ---------- 权限矩阵 / 日志 ---------- */
.perm-group { border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.perm-group h4 { margin: 0 0 12px; font-size: 14px; }
.perm-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.perm-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.perm-check input { accent-color: var(--orange); width: 15px; height: 15px; }
.log-time { white-space: nowrap; color: var(--muted); font-size: 12px; }
.note-box { background: var(--orange-soft); border-left: 3px solid var(--orange); border-radius: 0 8px 8px 0; padding: 14px 18px; font-size: 13px; color: var(--ink-2); margin-bottom: 18px; }
.src-table { font-size: 12.5px; }
.src-table code { background: #f5f6f8; padding: 1px 6px; border-radius: 4px; font-size: 12px; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav-group-title { width: 100%; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .media-grid { grid-template-columns: repeat(3,1fr); }
  .quick-grid { grid-template-columns: repeat(2,1fr); }
  .perm-list { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 640px) {
  .content { padding: 18px 14px 40px; }
  .topbar { padding: 0 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .media-grid { grid-template-columns: repeat(2,1fr); }
  .perm-list { grid-template-columns: 1fr; }
  .search { width: 100%; }
}
