/* ===== 镜湖石油 后台管理 样式 ===== */
:root {
  --red: #c8161c;
  --red-700: #a10f14;
  --navy: #14457e;
  --navy-deep: #0e3461;
  --gold: #e6a015;
  --ink: #1f2733;
  --muted: #6b7480;
  --line: #e5e9f0;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --ok: #1f9d55;
  --f: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --f-num: "Oswald", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--f); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
input, textarea, select, button { font-family: inherit; font-size: 14px; }
h1, h2, h3 { margin: 0; }

.mark { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(to bottom, var(--navy) 0 50%, var(--red) 50% 100%); display: grid; place-items: center; flex: none; }
.mark svg { width: 21px; height: 21px; color: #fff; }
.bn { font-weight: 900; font-size: 18px; letter-spacing: 0.05em; }
.be { font-size: 10.5px; letter-spacing: 0.12em; color: var(--muted); margin-top: 2px; }

/* ===== 按钮 ===== */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 16px; border-radius: 8px; cursor: pointer; font-weight: 700; transition: all 0.15s; }
.btn:hover { border-color: #c8d0dc; }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-700); border-color: var(--red-700); }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-deep); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: #f0c9cb; background: #fdf2f2; }
.btn-danger:hover { background: #f9e2e3; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; padding: 12px; font-size: 15px; }

/* ===== 登录 ===== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(120% 90% at 80% 0%, rgba(230, 160, 21, 0.18), transparent 50%),
    linear-gradient(135deg, #0e3461, #7a0a0e); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 34px 30px; box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.5); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.fld { display: block; margin-bottom: 16px; }
.fld > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 7px; }
.fld input, .fld textarea, .fld select { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe; transition: border 0.15s, box-shadow 0.15s; }
.fld input:focus, .fld textarea:focus, .fld select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(20, 69, 126, 0.12); background: #fff; }
.login-err { color: var(--red); font-size: 13px; margin: 12px 0 0; min-height: 18px; text-align: center; }
.login-tip { color: var(--muted); font-size: 12px; margin: 14px 0 0; text-align: center; line-height: 1.5; }

/* ===== 布局 ===== */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: #18212e; color: #c4ccd8; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 22px 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.side-brand .be { color: #8c97a6; }
.menu { display: flex; flex-direction: column; padding: 14px 12px; gap: 4px; flex: 1; }
.menu button { text-align: left; background: transparent; border: none; color: #c4ccd8; padding: 11px 14px; border-radius: 9px; cursor: pointer; font-size: 14.5px; font-weight: 500; transition: all 0.15s; }
.menu button:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.menu button.active { background: var(--red); color: #fff; font-weight: 700; }
.side-foot { padding: 16px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; flex-direction: column; gap: 10px; }
.view-site { color: #c4ccd8; font-size: 13.5px; text-decoration: none; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); text-align: center; }
.view-site:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.logout { background: transparent; border: 1px solid rgba(255, 255, 255, 0.18); color: #c4ccd8; padding: 8px; border-radius: 8px; cursor: pointer; }
.logout:hover { color: #fff; border-color: rgba(255, 255, 255, 0.4); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 64px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 19px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.saved-at { color: var(--ok); font-size: 13px; }
.who { color: var(--muted); font-size: 13px; }
.content { padding: 28px; max-width: 920px; }

/* ===== 面板 / 卡片 ===== */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head h2 { font-size: 17px; }
.panel-head p { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 16px; line-height: 1.6; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }

.fld textarea { resize: vertical; min-height: 78px; line-height: 1.6; }
.fld .suffix { display: flex; align-items: center; gap: 8px; }
.fld .suffix input { flex: 1; }
.fld .suffix .u { color: var(--muted); font-size: 13px; white-space: nowrap; }

.actions-bar { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

/* 重复条目（门店 / 公告 / 岗位 / 油品 / 轮播） */
.item { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: #fcfdff; }
.item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.item-head .idx { width: 26px; height: 26px; border-radius: 7px; background: var(--navy); color: #fff; display: grid; place-items: center; font-family: var(--f-num); font-weight: 700; font-size: 14px; flex: none; }
.item-head .t { font-weight: 700; font-size: 14.5px; flex: 1; }
.item .tools { display: flex; gap: 6px; }
.iconbtn { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 7px; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.iconbtn:hover { color: var(--ink); border-color: #c8d0dc; }
.iconbtn.danger:hover { color: var(--red); border-color: #f0c9cb; }

.add-row { margin-top: 6px; }

.badge { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.badge.on { background: #e5f6ec; color: var(--ok); }
.badge.off { background: #f1f3f6; color: var(--muted); }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13.5px; color: var(--muted); }
.switch input { display: none; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: #cdd4de; position: relative; transition: background 0.18s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.18s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ===== 提示 toast ===== */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px); background: #18212e; color: #fff; padding: 12px 22px; border-radius: 10px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 999; box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.5); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }

/* ===== LOGO 管理 ===== */
.logo-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.logo-preview { width: 120px; height: 120px; flex: none; border: 1px dashed #cdd4de; border-radius: 12px; display: grid; place-items: center; background: #fcfdff; overflow: hidden; padding: 10px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview .mark { width: 64px; height: 64px; }
.logo-preview .mark svg { width: 34px; height: 34px; }
.logo-ctrls { flex: 1; min-width: 240px; }
.logo-ctrls .row { margin-bottom: 4px; }
.side-brand .mark.has-img { background: none; width: auto; height: 34px; }
.side-brand .mark.has-img img { height: 34px; width: auto; max-width: 122px; object-fit: contain; display: block; background: #fff; border-radius: 6px; padding: 2px; }

/* ===== 行内图片字段（门店图片等）===== */
.img-field { display: flex; gap: 14px; align-items: flex-start; margin-top: 4px; }
.img-field .thumb { width: 132px; height: 92px; flex: none; border: 1px dashed #cdd4de; border-radius: 10px; overflow: hidden; background: #f7f9fc; display: grid; place-items: center; }
.img-field .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-field .thumb .ph { color: #9aa3ad; font-size: 12.5px; }
.img-field .img-ctrls { flex: 1; min-width: 200px; }
.img-field .img-ctrls .row { margin-bottom: 4px; }
.img-field .img-ctrls .fld { margin-bottom: 0; }

/* ===== 公告滚动速度 ===== */
.speed-row { display: flex; align-items: center; gap: 12px; }
.speed-row input[type="range"] { flex: 1; accent-color: var(--red); }
.speed-row .speed-cap { font-size: 13px; color: var(--muted); flex: none; }
.speed-row .speed-val { font-family: var(--f-num); font-weight: 700; color: var(--navy); min-width: 70px; text-align: right; flex: none; }
.notice-preview { margin-top: 16px; display: flex; align-items: center; background: var(--gold); color: #3a2a00; border-radius: 8px; overflow: hidden; padding: 8px 0; }
.notice-preview .np-tag { flex: none; background: var(--red); color: #fff; font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 6px; margin: 0 12px; }
.notice-preview .np-track { flex: 1; overflow: hidden; white-space: nowrap; }
.np-move { display: inline-block; padding-left: 100%; white-space: nowrap; font-weight: 700; font-size: 13px; animation: np-scroll 28s linear infinite; }
@keyframes np-scroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ===== 固定公告实时预览 ===== */
.fn-preview { background: #fbf4e6; border: 1px solid #ebdfc4; border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.fn-preview .fnp-tag { flex: none; background: var(--red); color: #fff; font-weight: 700; font-size: 12.5px; padding: 5px 14px; border-radius: 999px; }
.fn-preview .fnp-title { color: var(--navy-deep); font-weight: 700; line-height: 1.45; }
.fn-preview .fnp-text { color: #6b6259; line-height: 1.75; text-align: left; white-space: pre-line; max-width: 560px; width: 100%; }
.fn-preview .fnp-source { color: #8a8178; font-size: 12.5px; line-height: 1.6; text-align: right; max-width: 560px; width: 100%; }
.fn-preview .fnp-source:empty { display: none; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .menu { flex-direction: row; flex-wrap: wrap; }
  .side-foot { flex-direction: row; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
