/* 优数智租 · 智租有数  全局样式 */

:root {
  --ink: #10203a;
  --ink-2: #41556e;
  --ink-3: #7a8aa0;
  --line: #e3e9f2;
  --bg: #f4f6fa;
  --card: #ffffff;
  --brand: #1f4e79;
  --brand-2: #2b6cb0;
  --green: #0f9d76;
  --amber: #d97706;
  --red: #d64545;
  --purple: #7a5af8;
  --shadow: 0 6px 20px rgba(16, 32, 58, 0.06);
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------- 登录页 ---------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #16324f 0%, #1f4e79 45%, #2b6cb0 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 34px 26px;
  box-shadow: 0 24px 60px rgba(6, 20, 38, 0.35);
}
.login-brand {
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--ink-3);
}
.login-title {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 6px;
}
.login-title em { font-style: normal; color: var(--brand-2); }
.login-sub {
  color: var(--ink-2);
  font-size: 13px;
  margin-top: 8px;
}
.login-divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0 18px;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 13px;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
  font-family: inherit;
}
.field textarea { height: 84px; padding: 10px 13px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.12);
}
.login-btn {
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 15px;
  letter-spacing: 4px;
  cursor: pointer;
}
.login-btn:hover { background: var(--brand-2); }
.login-err { color: var(--red); font-size: 13px; min-height: 18px; margin: 4px 0 6px; }
.login-row { display: flex; gap: 16px; align-items: center; margin-bottom: 14px; }
.login-row label { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; cursor: pointer; }
.login-tip {
  margin-top: 16px;
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.9;
  background: #f8fafd;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

/* ---------------- 布局 ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 208px;
  flex: 0 0 208px;
  background: linear-gradient(180deg, #13293f, #17395a);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.side-brand { font-size: 12px; letter-spacing: 2px; color: rgba(255,255,255,.55); }
.side-title { font-size: 19px; font-weight: 700; margin: 6px 0 3px; }
.side-slogan { font-size: 11.5px; color: rgba(255,255,255,.6); line-height: 1.6; }
.nav { margin-top: 22px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: rgba(255,255,255,.72);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.on { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; font-size: 11.5px; color: rgba(255,255,255,.45); line-height: 1.7; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
}
.topbar-left { font-size: 16px; font-weight: 600; }
.topbar-left small { font-weight: 400; color: var(--ink-3); font-size: 12px; margin-left: 8px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.who { font-size: 13px; color: var(--ink-2); }
.role-pill {
  display: inline-block;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--line);
  margin-left: 6px;
}
.role-admin { background: #efeaff; color: var(--purple); border-color: #ded4ff; }
.role-manager { background: #fff5e6; color: var(--amber); border-color: #ffe3b8; }
.role-sales { background: #eaf7f0; color: var(--green); border-color: #c9ebdb; }
.role-finance { background: #eaf1fb; color: var(--brand-2); border-color: #cfe0f6; }

.content { flex: 1; padding: 20px 22px 40px; overflow: auto; }

/* ---------------- 卡片 / 表格 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand-2);
}
.hint { font-size: 12.5px; color: var(--ink-3); }
.sub { font-size: 13px; color: var(--ink-2); line-height: 1.9; }

.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.kpi .k-label { font-size: 12.5px; color: var(--ink-3); }
.kpi .k-value { font-size: 26px; font-weight: 700; margin-top: 8px; letter-spacing: -0.5px; }
.kpi .k-value span { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.kpi .k-foot { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.kpi.blue { border-top: 3px solid var(--brand-2); }
.kpi.green { border-top: 3px solid var(--green); }
.kpi.amber { border-top: 3px solid var(--amber); }
.kpi.red { border-top: 3px solid var(--red); }
.kpi.purple { border-top: 3px solid var(--purple); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.toolbar .grow { flex: 1; min-width: 140px; }

.btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { border-color: #c8d6e8; background: #fafcff; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: #f3d0d0; background: #fff7f7; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }

.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-2);
  background: #f7f9fd;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 12.5px;
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid #f0f3f9;
  color: var(--ink);
  vertical-align: middle;
}
td small { color: var(--ink-3); display: block; font-size: 11.5px; margin-top: 2px; }
tr:hover td { background: #fafcff; }
.empty { text-align: center; color: var(--ink-3); padding: 34px 0; font-size: 13px; }

.pill {
  display: inline-block;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.p-green { background: #e9f7f0; color: var(--green); }
.p-amber { background: #fff5e6; color: var(--amber); }
.p-red { background: #fdeeee; color: var(--red); }
.p-blue { background: #eaf1fb; color: var(--brand-2); }
.p-gray { background: #f0f2f6; color: var(--ink-3); }
.p-purple { background: #efeaff; color: var(--purple); }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- 图表 ---------------- */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-stack { width: 100%; display: flex; flex-direction: column-reverse; gap: 2px; }
.bar-seg { border-radius: 4px; min-height: 2px; }
.bar-label { font-size: 11.5px; color: var(--ink-3); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }

.progress { height: 7px; background: #eef2f8; border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand-2); border-radius: 99px; }

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(13, 26, 44, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 24px;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  padding: 22px 24px;
  box-shadow: 0 24px 60px rgba(6, 20, 38, 0.3);
}
.modal.wide { max-width: 820px; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.modal-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 14px);
  background: #10203a;
  color: #fff;
  font-size: 13.5px;
  padding: 11px 20px;
  border-radius: 10px;
  opacity: 0;
  transition: 0.25s;
  pointer-events: none;
  z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px; }
  .nav { flex-direction: row; margin-top: 0; flex-wrap: wrap; }
  .side-brand, .side-title, .side-slogan, .side-foot { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .modal-grid { grid-template-columns: 1fr; }
  .content { padding: 14px; }
}
