:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --side: #1f2d3d;
  --side-2: #17222e;
  --line: #e3e8ef;
  --text: #1f2937;
  --muted: #7b8794;
  --brand: #2f6fed;
  --brand-2: #1b56d3;
  --green: #12a06a;
  --orange: #e8890c;
  --red: #d9534f;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.side {
  width: 200px; flex: 0 0 200px; background: var(--side); color: #c7d2de;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side .logo {
  padding: 16px 18px; font-size: 15px; font-weight: 700; color: #fff;
  background: var(--side-2); letter-spacing: .5px; display: flex; align-items: center; gap: 8px;
}
.side .logo .dot { width: 8px; height: 8px; border-radius: 50%; background: #37c98b; }
.side nav { padding: 8px 0; overflow-y: auto; flex: 1; }
.side .group { padding: 12px 18px 6px; font-size: 12px; color: #6b7c8f; }
.side a.item {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 18px; color: #c7d2de; font-size: 13.5px; border-left: 3px solid transparent;
}
.side a.item:hover { background: #26374a; color: #fff; text-decoration: none; }
.side a.item.on { background: #26374a; color: #fff; border-left-color: var(--brand); font-weight: 600; }
.side .foot { padding: 12px 18px; font-size: 11.5px; color: #5c6b7d; border-top: 1px solid #26374a; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
  height: 52px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; position: sticky; top: 0; z-index: 20;
}
.top .crumb { font-size: 13.5px; color: var(--muted); }
.top .crumb b { color: var(--text); font-weight: 600; }
.top .user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px;
  background: #eef3fd; color: var(--brand); border: 1px solid #dbe6fb;
}

.content { padding: 16px 18px 40px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.card > .hd {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.card > .hd h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card > .bd { padding: 14px 16px; }
.card > .bd.tight { padding: 0; }

/* ---------- 统计块 ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.kpi .l { font-size: 12.5px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -.3px; }
.kpi .v small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }

/* ---------- 表单控件 ---------- */
input[type=text], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  height: 32px; padding: 0 9px; border: 1px solid #d5dbe3; border-radius: 6px;
  font-size: 13.5px; color: var(--text); background: #fff; outline: none; font-family: inherit;
}
textarea { height: auto; padding: 7px 9px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,111,237,.1); }
label.f { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.field input, .field select, .field textarea { width: 100%; }

.btn {
  height: 32px; padding: 0 13px; border-radius: 6px; border: 1px solid #d5dbe3;
  background: #fff; color: var(--text); font-size: 13.5px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px; font-family: inherit;
}
.btn:hover { border-color: #b9c3d0; background: #f8fafc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { background: #fff; border-color: #efc9c7; color: var(--red); }
.btn.danger:hover { background: #fdf3f3; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.sm { height: 27px; padding: 0 9px; font-size: 12.5px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .sp { flex: 1; }

/* ---------- 表格 ---------- */
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th, table.grid td {
  padding: 8px 10px; border-bottom: 1px solid #eef1f5; text-align: left; white-space: nowrap;
}
table.grid th {
  background: #f8fafc; color: #5b6672; font-weight: 600; font-size: 12.5px;
  position: sticky; top: 0; z-index: 2; border-bottom: 1px solid var(--line);
}
table.grid tbody tr:hover { background: #f7faff; }
table.grid td.wrap { white-space: normal; }
.table-scroll { overflow: auto; max-height: calc(100vh - 260px); }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 12px; border: 1px solid;
}
.tag.在用 { color: var(--green); border-color: #bfe6d5; background: #f2fbf7; }
.tag.闲置 { color: var(--muted); border-color: #e0e5eb; background: #f7f9fb; }
.tag.借用 { color: var(--orange); border-color: #f6ddb8; background: #fffaf1; }
.tag.维修 { color: #7b5cd6; border-color: #ddd4f7; background: #f8f5ff; }
.tag.报废 { color: var(--red); border-color: #efc9c7; background: #fdf3f3; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager .info { color: var(--muted); font-size: 12.5px; }
.pager .sp { flex: 1; }
.pager button {
  min-width: 30px; height: 28px; border: 1px solid #d5dbe3; background: #fff;
  border-radius: 5px; cursor: pointer; font-size: 12.5px;
}
.pager button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, #1f2d3d 0%, #24405f 55%, #2f6fed 140%); padding: 20px;
}
.login-box {
  width: 100%; max-width: 360px; background: #fff; border-radius: 12px;
  padding: 28px 26px 24px; box-shadow: 0 18px 50px rgba(9, 20, 38, .28);
}
.login-box h1 { margin: 0 0 4px; font-size: 19px; font-weight: 700; }
.login-box p.sub { margin: 0 0 20px; font-size: 12.5px; color: var(--muted); }
.login-box .field { margin-bottom: 14px; }
.login-box input { width: 100%; height: 38px; }
.login-box .btn.primary { width: 100%; height: 38px; justify-content: center; font-size: 14.5px; margin-top: 6px; }
.login-err { color: var(--red); font-size: 12.5px; min-height: 18px; margin-top: 8px; }
.login-note { background:#f4f8ff; border:1px solid #cfddf2; color:#334155; border-radius:8px; padding:10px 12px; font-size:12px; line-height:1.8; }
.login-note b { color:#1e40af; }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(17, 24, 39, .45); display: none;
  align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.mask.on { display: flex; }
.modal {
  background: #fff; border-radius: 10px; width: 100%; max-width: 560px;
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.modal .mh { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; justify-content: space-between; }
.modal .mb { padding: 16px 18px; overflow: auto; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 9px 16px; border-radius: 6px; font-size: 13.5px;
  opacity: 0; transition: .2s; pointer-events: none; z-index: 200; max-width: 80vw;
}
.toast.on { opacity: 1; bottom: 52px; }
.toast.err { background: #b93a37; }

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

/* ---------- 手机 ---------- */
@media (max-width: 820px) {
  .side { display: none; }
  .content { padding: 10px; }
  .grid2 { grid-template-columns: 1fr; }
  .table-scroll { max-height: none; }
  .top { padding: 0 10px; }
  .kpi .v { font-size: 18px; }
}
