/* 恒锐装备 · 后台 */

:root {
  --paper: #F3F0EA;
  --paper-2: #EAE5DC;
  --card: #FCFAF6;
  --ink: #121517;
  --ink-2: #343A3E;
  --muted: #6E7674;
  --line: #D6D0C4;
  --line-strong: #B8B1A3;
  --accent: #D9481F;
  --accent-dark: #B23A16;
  --dark: #101315;
  --dark-2: #171C1F;
  --ok: #2D6A4F;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
  --display: "Bahnschrift", "DIN Alternate", "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei", sans-serif;
  --body: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 14px; line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
input, textarea, select, button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }

/* ------------------------------ 布局 ------------------------------ */

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

.sidebar {
  width: 232px; flex: none;
  background: var(--dark); color: #A9B1AC;
  position: fixed; top: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column;
  padding: 22px 0 18px;
  z-index: 30;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 24px; }
.sidebar .brand svg { width: 34px; height: 34px; }
.sidebar .brand strong { display: block; font-family: var(--display); font-size: 16px; color: #F0ECE2; line-height: 1.15; }
.sidebar .brand em { display: block; font-style: normal; font-family: var(--mono); font-size: 8px; letter-spacing: .18em; color: #6F7873; margin-top: 4px; }

.side-label { padding: 0 20px; font-family: var(--mono); font-size: 9px; letter-spacing: .18em; color: #5E6663; margin: 10px 0 8px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; font-size: 13.5px; color: #A9B1AC;
  border-left: 2px solid transparent;
  transition: .18s;
}
.side-nav a:hover { background: #191F22; color: #E7E2D6; }
.side-nav a.active { border-left-color: var(--accent); background: #171D20; color: #fff; }
.side-nav .dot { width: 5px; height: 5px; background: currentColor; opacity: .5; }
.side-nav a.active .dot { background: var(--accent); opacity: 1; }
.side-nav .pill { margin-left: auto; font-family: var(--mono); font-size: 10px; background: var(--accent); color: #fff; padding: 1px 6px; }

.side-foot { margin-top: auto; padding: 16px 20px 0; border-top: 1px solid #23292C; }
.side-foot form { margin: 0; }
.side-foot button { border: 0; background: transparent; color: #7C8580; font-size: 12.5px; padding: 6px 0; cursor: pointer; }
.side-foot button:hover { color: var(--accent); }
.side-foot .who { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: #5E6663; margin-bottom: 4px; }

.main { margin-left: 232px; flex: 1; min-width: 0; }
.topbar {
  height: 62px; background: rgba(252, 250, 246, .94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 28px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; }
.topbar .top-actions { display: flex; align-items: center; gap: 14px; }
.content { padding: 26px 28px 60px; max-width: 1240px; }

/* ------------------------------ 按钮 / 表单 ------------------------------ */

.a-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border: 1px solid transparent;
  font-size: 13px; cursor: pointer; transition: .18s;
}
.a-btn-primary { background: var(--ink); color: var(--paper); }
.a-btn-primary:hover { background: var(--accent); }
.a-btn-ghost { border-color: var(--line-strong); background: transparent; color: var(--ink); }
.a-btn-ghost:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.a-btn-danger { border: 1px solid #E3B5A7; color: #A33A1C; background: transparent; }
.a-btn-danger:hover { background: #A33A1C; border-color: #A33A1C; color: #fff; }
.a-btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field label b { color: var(--accent); font-weight: 400; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line-strong); background: #fff;
  padding: 9px 11px; font-size: 13.5px; outline: none; transition: border-color .18s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); }
.field textarea { resize: vertical; min-height: 90px; line-height: 1.7; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.6; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: 16px; height: 16px; }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 22px; }
.form-actions .spacer { flex: 1; }

/* ------------------------------ 卡片 / 表格 ------------------------------ */

.card { background: var(--card); border: 1px solid var(--line); padding: 22px; }
.card h2 { font-size: 17px; margin-bottom: 4px; }
.card .card-sub { font-size: 12px; color: var(--muted); margin-bottom: 18px; }

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--card); border: 1px solid var(--line); padding: 20px; position: relative; }
.stat-card .k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; color: var(--muted); text-transform: uppercase; }
.stat-card .v { font-family: var(--display); font-size: 34px; line-height: 1.1; margin-top: 8px; }
.stat-card .v small { font-size: 13px; color: var(--muted); font-family: var(--body); }
.stat-card .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.stat-card.accent { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.stat-card.accent .k, .stat-card.accent .hint { color: #9AA39E; }

.table-wrap { background: var(--card); border: 1px solid var(--line); overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
table.data th {
  text-align: left; font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 400; padding: 12px 14px; border-bottom: 1px solid var(--line-strong); 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 tr:hover td { background: rgba(18, 21, 23, .022); }
table.data .thumb { width: 54px; height: 42px; object-fit: cover; background: var(--dark); border: 1px solid var(--line); }
table.data .name { font-weight: 600; }
table.data .sub { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; letter-spacing: .04em; }
table.data .num { font-family: var(--mono); font-size: 12px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions a, .row-actions button { white-space: nowrap; }

.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border: 1px solid var(--line-strong); color: var(--muted); }
.badge-on { border-color: #B6CDBF; color: var(--ok); background: #F1F7F3; }
.badge-off { border-color: #DCC9C2; color: #9A4A30; background: #FBF1ED; }
.badge-new { border-color: #E8B6A6; color: #A33A1C; background: #FBEAE5; }
.badge-quoted { border-color: #C9C2A8; color: #6E5E1F; background: #FAF6E6; }
.badge-done { border-color: #B6CDBF; color: var(--ok); background: #F1F7F3; }

.toolbar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-row .search-inline { display: flex; border: 1px solid var(--line-strong); background: #fff; height: 38px; }
.toolbar-row .search-inline input { border: 0; padding: 0 12px; outline: none; width: 200px; background: transparent; }
.toolbar-row .search-inline button { border: 0; border-left: 1px solid var(--line); padding: 0 12px; background: transparent; font-size: 12px; cursor: pointer; }
.toolbar-row .spacer { flex: 1; }

.flash { background: #F1F7F3; border: 1px solid #B6CDBF; color: var(--ok); padding: 10px 14px; font-size: 12.5px; margin-bottom: 16px; }
.flash.warn { background: #FBF1ED; border-color: #E3B5A7; color: #A33A1C; }

/* ------------------------------ 产品编辑 ------------------------------ */

.edit-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.side-stack { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }
.img-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.img-preview img { aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--line); background: var(--dark); }

.more-link {
  display: inline-block; margin-top: 4px;
  font-size: 11px; color: var(--accent); border-bottom: 1px solid currentColor;
}
.more-link:hover { color: var(--ink); border-color: var(--ink); }

.gen-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 20px; margin: 18px 0;
}
.gen-grid label {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); background: #fff; font-size: 13px;
}
.gen-grid label span { margin-left: auto; color: var(--muted); font-size: 11.5px; }

.product-picker { position: relative; max-width: 760px; }
.pp-search input {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line-strong); background: #fff;
  font-size: 13px; color: var(--ink); outline: none;
}
.pp-search input:focus { border-color: var(--ink); }
.pp-results {
  position: absolute; left: 0; right: 0; top: 46px; z-index: 40;
  max-height: 280px; overflow: auto;
  background: #fff; border: 1px solid var(--line-strong);
  box-shadow: 0 14px 34px rgba(18, 21, 23, .14);
}
.pp-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.pp-result:last-child { border-bottom: 0; }
.pp-result:hover { background: #FAF8F3; }
.pp-info { min-width: 0; }
.pp-info b { display: block; font-size: 12.5px; font-weight: 600; }
.pp-info small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.pp-none { padding: 14px 12px; font-size: 12px; color: var(--muted); }
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pp-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 4px 6px 4px 10px; border: 1px solid var(--line-strong); background: #FAF8F3; font-size: 11.5px;
}
.pp-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-chip button { border: 0; background: transparent; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; padding: 0 2px; }
.pp-chip button:hover { color: var(--accent); }
.pp-empty { margin-top: 8px; font-size: 11.5px; color: var(--muted); }

.rte-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 7px 8px; border: 1px solid var(--line-strong); border-bottom: 0; background: #FAF8F3;
}
.rte-toolbar button {
  min-width: 34px; height: 30px; padding: 0 9px;
  border: 1px solid var(--line); background: #fff; font-size: 12px; color: var(--ink-2);
}
.rte-toolbar button:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.rte-toolbar .rte-hint { font-size: 10.5px; color: var(--muted); margin-left: auto; }
.rte {
  min-height: 340px; max-height: 70vh; overflow: auto;
  padding: 18px 20px; border: 1px solid var(--line-strong); background: #fff;
  font-size: 14px; line-height: 1.9; color: var(--ink); outline: none;
}
.rte:focus { border-color: var(--ink); }
.rte:empty:before { content: attr(data-placeholder); color: #A9A296; }
.rte h2 { font-size: 20px; margin: 18px 0 8px; }
.rte h3 { font-size: 17px; margin: 14px 0 6px; }
.rte p { margin: 0 0 12px; }
.rte ul, .rte ol { margin: 0 0 12px 22px; }
.rte img { max-width: 100%; height: auto; display: block; margin: 14px 0; border: 1px solid var(--line); }

.manual-item { display: block !important; padding: 12px 0; }
.manual-item .m-title { font-size: 13px; line-height: 1.5; word-break: break-word; }
.manual-item .m-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.manual-item .m-foot .model { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.manual-item .row-actions { flex: none; }

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

.login-wrap { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.login-visual { background: var(--dark); color: var(--paper); padding: 54px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-visual:before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(#1C2226 1px, transparent 1px), linear-gradient(90deg, #1C2226 1px, transparent 1px);
  background-size: 48px 48px; opacity: .6;
}
.login-visual > * { position: relative; }
.login-visual h1 { font-size: clamp(32px, 3.4vw, 46px); line-height: 1.12; margin-top: 40px; }
.login-visual h1 span { color: var(--accent); }
.login-visual .mono { color: #7C8580; }
.login-visual .foot { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: #5E6663; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--paper); }
.login-box { width: 100%; max-width: 360px; }
.login-box h2 { font-size: 26px; }
.login-box .sub { color: var(--muted); font-size: 13px; margin: 8px 0 26px; }
.login-error { background: #FBEAE5; border: 1px solid #E8B6A6; color: #8A2C12; padding: 10px 12px; font-size: 12.5px; margin-bottom: 14px; }
.login-tip { margin-top: 18px; font-size: 11.5px; color: var(--muted); line-height: 1.8; border-top: 1px solid var(--line); padding-top: 14px; }

/* ------------------------------ 详情 ------------------------------ */

.detail-grid-2 { display: grid; grid-template-columns: 1.4fr .6fr; gap: 20px; align-items: start; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv .k { color: var(--muted); font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; padding-top: 3px; }
.items-list li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.items-list .model { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

@media (max-width: 1000px) {
  .sidebar { width: 64px; padding-top: 16px; }
  .sidebar .brand { padding: 0 0 18px; justify-content: center; }
  .sidebar .brand-text, .side-label, .side-nav a span.txt, .side-foot .who { display: none; }
  .side-nav a { justify-content: center; padding: 13px 0; }
  .side-nav .pill { display: none; }
  .side-foot { padding: 10px 0; text-align: center; }
  .main { margin-left: 64px; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .edit-grid, .detail-grid-2 { grid-template-columns: 1fr; }
  .side-stack { position: static; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-visual { display: none; }
}

@media (max-width: 640px) {
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 0 16px; }
  .grid-2, .grid-3, .stat-cards { grid-template-columns: 1fr; }
}
