/* 管理后台通用样式（平台后台 / 机构后台共用） */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --navy: #0B1B3A;
  --navy2: #122C5C;
  --primary: #2F6BFF;
  --primary-d: #1E4FD6;
  --primary-l: #EAF1FF;
  --bg: #F5F7FB;
  --card: #FFFFFF;
  --line: #E3E8F2;
  --text: #1B2437;
  --muted: #6B7A99;
  --ok: #00B42A;
  --warn: #FF9A2E;
  --danger: #F53F3F;
  --radius: 10px;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* ============ 登录页 ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0B1B3A 0%, #122C5C 55%, #1B3E7D 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 14px;
  padding: 40px 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .logo {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2F6BFF, #5B8CFF);
  color: #fff; font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.login-brand h1 { font-size: 20px; font-weight: 600; }
.login-brand p { font-size: 13px; color: var(--muted); margin-top: 6px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; color: var(--text); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}
.login-err {
  min-height: 20px; font-size: 13px; color: var(--danger); margin-bottom: 8px;
}
.login-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 20px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); font-size: 13px; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #C9D4E8; background: #FAFBFE; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn-danger { color: var(--danger); border-color: #FBC4C4; }
.btn-danger:hover { background: #FEF1F1; }
.btn-block { width: 100%; height: 44px; font-size: 15px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-link {
  border: none; background: none; color: var(--primary);
  padding: 0 6px; height: auto; cursor: pointer; font-size: 13px;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

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

.sidebar {
  width: 216px; flex: 0 0 216px;
  background: linear-gradient(180deg, #0B1B3A 0%, #122C5C 100%);
  color: #C9D8F5;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(159, 184, 232, .16);
}
.sidebar .brand strong { display: block; color: #fff; font-size: 15px; letter-spacing: .5px; }
.sidebar .brand span { font-size: 11px; color: #7E96C4; letter-spacing: 1px; }
.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px; margin-bottom: 4px;
  border-radius: 8px; font-size: 13.5px; color: #C9D8F5;
  cursor: pointer; transition: all .15s; user-select: none;
}
.nav-item:hover { background: rgba(47, 107, 255, .18); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 500; }
.nav-item .ico { width: 16px; text-align: center; font-size: 14px; opacity: .9; }
.sidebar .side-foot {
  padding: 14px 20px; font-size: 11px; color: #6B84B4;
  border-top: 1px solid rgba(159, 184, 232, .16);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; flex: 0 0 60px;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 16px; font-weight: 600; }
.topbar .who { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-l); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.content { padding: 20px 24px 40px; flex: 1; }
.view { display: none; }
.view.active { display: block; }

/* ============ 卡片 / 指标 ============ */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--muted); font-weight: 400; }

.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.metric-card .lb { font-size: 12.5px; color: var(--muted); }
.metric-card .val { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.5px; }
.metric-card .val.primary { color: var(--primary); }
.metric-card .val.ok { color: var(--ok); }
.metric-card .val.warn { color: var(--warn); }

/* ============ 工具条 ============ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar input, .toolbar select {
  height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; background: #fff; color: var(--text);
}
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; padding: 11px 12px;
  background: #F7F9FD; color: var(--muted); font-weight: 500;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td {
  padding: 11px 12px; border-bottom: 1px solid #EFF2F8; vertical-align: middle;
}
table.data tbody tr:hover { background: #FAFBFE; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .ops { white-space: nowrap; }
.empty { padding: 40px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ============ 徽标 ============ */
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 12px; line-height: 18px; white-space: nowrap;
}
.badge.ok { background: #E8F8EC; color: #0A8F2A; }
.badge.warn { background: #FFF4E5; color: #C46A00; }
.badge.danger { background: #FEECEC; color: #C62222; }
.badge.info { background: var(--primary-l); color: var(--primary-d); }
.badge.mute { background: #F0F2F7; color: var(--muted); }

/* ============ 分页 ============ */
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; padding-top: 14px; font-size: 13px; color: var(--muted); }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11, 27, 58, .45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-mask.hidden { display: none; }
.modal {
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  background: #fff; border-radius: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 15px; font-weight: 600; }
.modal-head .x {
  border: none; background: none; font-size: 20px; line-height: 1;
  color: var(--muted); cursor: pointer; padding: 0 4px;
}
.modal-body { padding: 18px 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ============ 提示条 ============ */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200; min-width: 220px; max-width: 90vw;
  padding: 11px 18px; border-radius: 8px;
  font-size: 13.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(4px); }
.toast.ok { background: #E8F8EC; color: #0A8F2A; border: 1px solid #B7E8C4; }
.toast.err { background: #FEECEC; color: #C62222; border: 1px solid #FBC4C4; }
.toast.info { background: var(--primary-l); color: var(--primary-d); border: 1px solid #C3D6FF; }

/* ============ 其他 ============ */
.kv { display: grid; grid-template-columns: 116px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--text); word-break: break-all; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.scroll-y { max-height: 360px; overflow-y: auto; }
.tip {
  font-size: 12.5px; color: var(--muted); background: #F7F9FD;
  border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; line-height: 1.7;
}
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week-col { background: #F7F9FD; border: 1px solid var(--line); border-radius: 8px; min-height: 160px; padding: 8px; }
.week-col h4 { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 8px; text-align: center; }
.week-col h4 b { display: block; font-size: 15px; color: var(--text); font-weight: 600; margin-top: 2px; }
.slot-item {
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--primary);
  border-radius: 6px; padding: 6px 8px; margin-bottom: 6px; font-size: 12px; line-height: 1.5;
}
.slot-item.slot { border-left-color: var(--warn); }
.slot-item .t { font-weight: 600; font-size: 12.5px; }
.slot-item .n { color: var(--muted); }
.drop {
  border: 2px dashed #C9D4E8; border-radius: 10px; padding: 28px 16px;
  text-align: center; color: var(--muted); font-size: 13px; cursor: pointer;
  transition: all .15s; background: #FAFBFE;
}
.drop:hover, .drop.over { border-color: var(--primary); background: var(--primary-l); color: var(--primary-d); }
.row-err { color: var(--danger); font-size: 12.5px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  padding: 8px 14px; font-size: 13.5px; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* 首登强制改密提示条（非阻塞，置于页面顶部） */
.pwd-banner {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 10px 16px;
  background: #FFF4E5; color: #C46A00;
  font-size: 13.5px; border-bottom: 1px solid #F5D9AE;
}
.pwd-banner.hidden { display: none !important; }
