:root {
  --brand: #c2703d;
  --brand-dark: #9a5527;
  --brand-light: #e0a87e;
  --brand-50: #fbf0e8;
  --ink: #1f2329;
  --ink-2: #5a626b;
  --line: #ecec;
  --bg: #f5f6f8;
  --card: #fff;
  --shadow: 0 8px 30px rgba(31, 35, 41, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }

/* 关键修复：display:flex 类会覆盖 hidden 属性，必须强制 hidden 优先 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* ===== 登录页 ===== */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fbf0e8 0%, #f5f6f8 60%, #eef1f4 100%);
}
.login-card {
  width: 380px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 36px 28px;
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand-logo {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 20px; font-weight: 700; }
.brand-sub { font-size: 12px; color: var(--ink-2); letter-spacing: 0.5px; }
.login-title { font-size: 22px; margin: 6px 0 4px; }
.login-hint { font-size: 13px; color: var(--ink-2); margin: 0 0 22px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid #e3e6ea; border-radius: 10px;
  font-size: 14px; outline: none; transition: border-color .2s;
}
.field input:focus { border-color: var(--brand); }
.login-msg { color: #d4380d; font-size: 13px; margin: 0 0 12px; }
.btn-primary {
  width: 100%; height: 46px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
  transition: opacity .2s;
}
.btn-primary:hover { opacity: .92; }
.btn-primary:disabled { opacity: .6; cursor: default; }
.login-foot { text-align: center; font-size: 12px; color: #b3b8bf; margin: 22px 0 0; }

/* 测试账号一键填入 */
.demo-accounts {
  margin-top: 18px; padding: 12px 14px;
  background: var(--brand-50); border-radius: 10px;
}
.demo-title { font-size: 12px; color: var(--brand-dark); margin: 0 0 8px; }
.demo-btns { display: flex; gap: 8px; }
.demo-btn {
  flex: 1; height: 32px; border: 1px solid var(--brand-light);
  background: #fff; color: var(--brand-dark); font-size: 12px;
  border-radius: 8px; cursor: pointer; transition: background .15s;
  font-family: inherit;
}
.demo-btn:hover { background: #fff; border-color: var(--brand); }
.demo-btn.demo-on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ===== 门户主框架 ===== */
.portal-view { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  background: #fff; border-bottom: 1px solid #eef0f3;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.logo-dot {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.topbar-title { font-weight: 600; font-size: 15px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-label { font-size: 13px; color: var(--ink-2); }
.btn-ghost {
  border: 1px solid #e0e3e8; background: #fff; color: var(--ink-2);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.dashboard { flex: 1; overflow: auto; padding: 40px 32px; }
.dash-head { max-width: 1080px; margin: 0 auto 28px; }
.dash-head h2 { font-size: 22px; margin: 0 0 8px; }
.dash-head p { font-size: 14px; color: var(--ink-2); margin: 0; }

.module-grid {
  max-width: 1080px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
}
.module-card {
  text-align: left; background: var(--card); border: 1px solid #eef0f3;
  border-radius: var(--radius); padding: 26px 24px; cursor: pointer;
  transition: transform .18s, box-shadow .18s, border-color .18s;
  font-family: inherit;
}
.module-card:hover {
  transform: translateY(-4px); box-shadow: var(--shadow);
  border-color: var(--brand-light);
}
.card-icon { font-size: 34px; margin-bottom: 14px; }
.card-name { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.card-desc { font-size: 13px; color: var(--ink-2); line-height: 1.6; min-height: 42px; }
.card-mode {
  display: inline-block; margin-top: 14px; font-size: 12px;
  padding: 4px 10px; border-radius: 20px;
}
.mode-in { background: #eaf6ee; color: #1a7f37; }
.mode-tab { background: #fff4e6; color: var(--brand-dark); }

/* ===== 子系统容器 ===== */
.subsystem { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.sub-bar {
  height: 48px; flex: 0 0 48px; display: flex; align-items: center; gap: 14px;
  padding: 0 16px; background: #fafbfc; border-bottom: 1px solid #eef0f3;
}
.current-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.sub-frame { flex: 1; width: 100%; border: none; background: #fff; }

@media (max-width: 640px) {
  .dashboard { padding: 24px 16px; }
  .module-grid { grid-template-columns: 1fr; }
}
