/* 汉豪大学智慧校园 - 全局样式 */
:root {
  --bg: #f3f6fc;
  --card: #ffffff;
  --text: #1b2436;
  --muted: #6b7686;
  --line: #e6eaf3;
  --primary: #1a56db;
  --primary-dark: #1648b5;
  --primary-soft: #eaf0ff;
  --success: #12805c;
  --success-soft: #e6f6f0;
  --warn: #b45309;
  --warn-soft: #fdf3e3;
  --danger: #c22e2e;
  --danger-soft: #fdeceb;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(24, 45, 90, .06);
  --shadow-lg: 0 10px 30px rgba(24, 45, 90, .10);
  --header-h: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶部导航 ---------- */
.topbar {
  height: var(--header-h);
  background: linear-gradient(90deg, #123a94 0%, #1a56db 60%, #2f6fe4 100%);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 2px 12px rgba(18, 58, 148, .22);
}
.topbar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
  white-space: nowrap;
}
.topbar .logo:hover { text-decoration: none; }
.logo-badge {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .35);
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800;
}
.topbar nav { display: flex; gap: 4px; margin-left: 28px; }
.topbar nav a {
  color: rgba(255, 255, 255, .82);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 14px;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .13); color: #fff; text-decoration: none; }
.topbar nav a.active { background: rgba(255, 255, 255, .22); color: #fff; font-weight: 600; }
.topbar .spacer { flex: 1; }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
  padding: 4px 6px 4px 4px;
  border-radius: 30px;
  cursor: pointer;
  position: relative;
}
.user-chip:hover { background: rgba(255, 255, 255, .2); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff; color: var(--primary);
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.user-chip .uname { font-size: 13px; color: #fff; padding-right: 6px; }
.user-chip .urole {
  font-size: 11px; color: rgba(255,255,255,.8);
  display: block; line-height: 1; margin-top: 2px;
}
.dropdown {
  position: absolute; right: 0; top: 46px;
  background: #fff; color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 190px;
  overflow: hidden;
  display: none;
  z-index: 80;
}
.dropdown.show { display: block; }
.dropdown .dd-head { padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fafbfe; }
.dropdown .dd-head b { display: block; font-size: 14px; }
.dropdown .dd-head span { font-size: 12px; color: var(--muted); }
.dropdown a, .dropdown button {
  display: block; width: 100%; text-align: left;
  padding: 10px 14px; font-size: 13px;
  color: var(--text); background: none; border: none;
  cursor: pointer; font-family: inherit;
}
.dropdown a:hover, .dropdown button:hover { background: var(--primary-soft); text-decoration: none; }
.dropdown .dd-line { height: 1px; background: var(--line); }

/* ---------- 布局 ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.container.narrow { max-width: 980px; }
.page-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.page-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 18px; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff; color: var(--text);
  font-size: 13px; font-family: inherit; cursor: pointer;
  transition: all .15s;
}
.btn:hover { border-color: #c8d2e6; background: #f7f9fe; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: #f0c9c7; background: var(--danger-soft); }
.btn-danger:hover { background: #fbdedc; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d8dfec;
  border-radius: 9px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, .12);
}
textarea { resize: vertical; min-height: 76px; }
label.fld { display: block; margin-bottom: 13px; }
label.fld > span {
  display: block; font-size: 12.5px; color: var(--muted);
  margin-bottom: 5px; font-weight: 600;
}
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  background: #eef2f9;
  color: var(--muted);
  white-space: nowrap;
}
.tag-blue { background: var(--primary-soft); color: var(--primary); }
.tag-green { background: var(--success-soft); color: var(--success); }
.tag-orange { background: var(--warn-soft); color: var(--warn); }
.tag-red { background: var(--danger-soft); color: var(--danger); }

/* ---------- 表格 ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 10px 12px;
  background: #f7f9fd; color: var(--muted);
  font-weight: 600; font-size: 12.5px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: #fafbff; }

/* ---------- 应用卡片 ---------- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 13px;
}
.app-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
  cursor: pointer;
  transition: all .18s;
  display: flex; flex-direction: column; gap: 9px;
  position: relative;
  text-align: left;
}
.app-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: #c3d3f5;
}
.app-ico {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 22px;
  color: #fff;
  flex-shrink: 0;
}
.app-card .nm { font-weight: 700; font-size: 14px; }
.app-card .ds {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  min-height: 36px;
}
.app-card .meta { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  background:
    radial-gradient(1000px 520px at 12% 8%, #2f6fe4 0%, transparent 60%),
    radial-gradient(900px 500px at 88% 92%, #1a56db 0%, transparent 58%),
    #0f2f7a;
}
.login-left {
  flex: 1.1;
  color: #fff;
  padding: 60px 64px;
  display: flex; flex-direction: column; justify-content: center;
}
.login-left h1 { font-size: 36px; margin: 0 0 8px; letter-spacing: 1px; }
.login-left .slogan { font-size: 15px; color: rgba(255,255,255,.78); margin-bottom: 34px; }
.feat { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.feat .fi {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.24);
  display: grid; place-items: center; font-size: 17px; flex-shrink: 0;
}
.feat b { display: block; font-size: 14px; }
.feat p { margin: 2px 0 0; font-size: 12.5px; color: rgba(255,255,255,.7); }

.login-right {
  flex: .95;
  display: grid; place-items: center;
  padding: 40px;
}
.login-box {
  width: 100%; max-width: 400px;
  background: #fff;
  border-radius: 18px;
  padding: 34px 32px 28px;
  box-shadow: 0 24px 60px rgba(6, 20, 55, .35);
}
.login-box h2 { margin: 0 0 4px; font-size: 21px; }
.login-box .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.sso-banner {
  background: var(--primary-soft);
  border: 1px solid #cbdcff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--primary-dark);
  margin-bottom: 16px;
  display: flex; gap: 8px;
}
.quick-login { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.quick-login button {
  border: 1px dashed #cfd9ea; background: #fafcff;
  border-radius: 9px; padding: 7px 8px;
  font-size: 12px; cursor: pointer; color: var(--text);
  font-family: inherit; text-align: left;
}
.quick-login button:hover { border-color: var(--primary); background: var(--primary-soft); }
.quick-login b { display: block; font-size: 12.5px; }
.quick-login span { color: var(--muted); font-size: 11px; }

.alert {
  padding: 9px 12px; border-radius: 9px; font-size: 12.5px; margin-bottom: 14px;
  background: var(--danger-soft); color: var(--danger); border: 1px solid #f2cdcb;
}
.alert.ok { background: var(--success-soft); color: var(--success); border-color: #bfe6d7; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0;
  background: rgba(15, 26, 48, .45);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px;
  width: 100%; max-width: 560px;
  max-height: 88vh; overflow: auto;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
}
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; background: none; border: none; }
.modal-body { padding: 18px 20px; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 9px;
  background: #fbfcfe; border-radius: 0 0 16px 16px;
}

/* ---------- 角色多选 ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 13px; border-radius: 20px;
  border: 1px solid #d8dfec; background: #fff;
  font-size: 12.5px; cursor: pointer; user-select: none;
}
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 应用容器 ---------- */
.frame-page { display: flex; flex-direction: column; height: calc(100vh - var(--header-h)); }
.frame-bar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 9px 18px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.frame-bar .back { color: var(--muted); font-size: 13px; }
.frame-bar .t { font-weight: 700; font-size: 14px; }
.frame-bar .spacer { flex: 1; }
#appFrame { flex: 1; width: 100%; border: none; background: #fff; }
.frame-tip {
  padding: 8px 18px; background: var(--warn-soft);
  color: var(--warn); font-size: 12.5px;
  border-bottom: 1px solid #f3ddb8;
  display: none;
}

.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 13px; }

/* ---------- 内嵌应用页面 ---------- */
.embedded { background: #fff; min-height: 100vh; padding: 16px 18px 40px; }
.embedded .eb-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 12px; margin-bottom: 16px;
  border-bottom: 2px solid var(--primary);
}
.embedded .eb-head h2 { margin: 0; font-size: 18px; }
.tabs { display: flex; gap: 20px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  background: none; border: none; padding: 8px 2px 10px;
  font-size: 14px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; font-family: inherit;
  margin-bottom: -1px;
}
.tabs button.on { color: var(--primary); font-weight: 700; border-bottom-color: var(--primary); }

.kpi {
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px;
}
.kpi .v { font-size: 24px; font-weight: 800; line-height: 1.2; }
.kpi .l { font-size: 12px; color: var(--muted); }

/* 课表 */
.timetable { width: 100%; border-collapse: collapse; font-size: 12px; }
.timetable th { background: #f2f5fb; padding: 9px 4px; border: 1px solid var(--line); color: var(--muted); }
.timetable td { border: 1px solid var(--line); padding: 5px; text-align: center; height: 52px; vertical-align: middle; }
.tt-cell { border-radius: 7px; padding: 5px 3px; font-size: 11px; line-height: 1.35; }
.tt-cell b { display: block; font-size: 12px; }

.stat-bar {
  height: 7px; border-radius: 6px; background: #eef1f7; overflow: hidden;
}
.stat-bar > i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }

@media (max-width: 900px) {
  .login-left { display: none; }
  .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar nav { display: none; }
}

/* ---------- 全站页脚 ---------- */
.site-foot {
  margin-top: 30px; padding: 18px 20px 24px;
  border-top: 1px solid var(--line);
  text-align: center; color: var(--muted);
  font-size: 12px; line-height: 1.9;
}
.site-foot .sf-title { font-weight: 700; font-size: 12.5px; color: #4a5568; letter-spacing: .3px; }
.site-foot .sf-sub { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
@media (max-width: 560px) { .site-foot .sf-sub { gap: 6px; flex-direction: column; } }

/* ============================================================
 * 窄屏适配（手机端）
 * ============================================================ */
@media (max-width: 768px) {
  :root { --header-h: 52px; }
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 13.5px; }

  .topbar { padding: 0 12px; gap: 6px; }
  .topbar .logo { font-size: 13px; gap: 7px; letter-spacing: 0; }
  .logo-badge { width: 26px; height: 26px; font-size: 12px; border-radius: 7px; }
  .topbar nav { margin-left: 6px; gap: 2px; }
  .topbar nav a { padding: 6px 9px; font-size: 12.5px; }

  .container { padding: 14px 12px 40px; }
  .container.narrow { max-width: none; }
  .card { border-radius: 12px; }
  .card-head { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card-head .spacer { display: none; }
  .card-head h3 { font-size: 14.5px; }
  .card-body { padding: 14px; }
  .g2, .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  table.tbl {
    display: block; overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .tabs { overflow-x: auto; gap: 16px; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { flex: 0 0 auto; white-space: nowrap; }

  .mask { padding: 12px; align-items: flex-start; }
  .modal { max-width: none; max-height: calc(100vh - 24px); border-radius: 14px; }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; }
  .modal-foot .btn { flex: 1; }

  .site-foot { margin-top: 18px; padding: 14px 14px 20px; }
}

@media (max-width: 420px) {
  .topbar .logo .logo-txt { display: none; }
  .container { padding-left: 10px; padding-right: 10px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
}
