/* =====================================================
   APEX · 品牌展示网页 共享样式
   主题：深藏蓝 + 金色点缀 / 浅色背景
   ===================================================== */

:root {
  --brand: #14243d;      /* 深藏蓝 */
  --brand-dark: #0d1829;
  --brand-mid: #1e3a5f;
  --gold: #c9a86a;       /* 金色点缀 */
  --gold-dark: #a98a4e;
  --gold-soft: #f6f0e3;  /* 浅金底 */
  --bg: #f6f7f9;         /* 浅色页面背景 */
  --card-bg: #ffffff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e2e6ec;
  --danger: #d64541;
  --success: #2e9e5b;
  --radius: 10px;
  --shadow: 0 8px 32px rgba(13, 24, 41, 0.08);
  --shadow-soft: 0 2px 12px rgba(13, 24, 41, 0.05);
}

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

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

/* 装饰元素（光斑）绝对定位会溢出视口，双保险裁掉横向 */
html { overflow-x: hidden; }

/* ---------- 通用控件 ---------- */
button {
  font: inherit;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 7px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

button:hover { border-color: var(--brand); color: var(--brand); }

button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
button.primary:hover {
  background: var(--brand-mid);
  border-color: var(--brand-mid);
  color: #fff;
  box-shadow: 0 4px 14px rgba(20, 36, 61, 0.28);
}

button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); color: var(--danger); }

button:disabled { opacity: 0.5; cursor: not-allowed; }

input[type="text"], input[type="password"] {
  font: inherit;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  background: #fbfcfd;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input:focus {
  border-color: var(--gold);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(201, 168, 106, 0.18);
}

/* =====================================================
   登录页 —— 左右分栏（浅色背景 + 品牌区 + 表单卡片）
   ===================================================== */

.login-body {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 100%;
  background: var(--bg);
  overflow: hidden;
}

/* 背景装饰光斑 */
.login-body::before,
.login-body::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
}

.login-body::before {
  width: 560px;
  height: 560px;
  left: -140px;
  top: -160px;
  background: radial-gradient(circle, rgba(201, 168, 106, 0.20), transparent 65%);
  animation: floatBlob 14s ease-in-out infinite alternate;
}

.login-body::after {
  width: 640px;
  height: 640px;
  right: -180px;
  bottom: -200px;
  background: radial-gradient(circle, rgba(20, 36, 61, 0.14), transparent 65%);
  animation: floatBlob 18s ease-in-out infinite alternate-reverse;
}

@keyframes floatBlob {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(50px, 40px) scale(1.08); }
}

.login-shell {
  position: relative;
  z-index: 1;
  display: flex;
  width: min(1080px, 94vw);
  min-height: 620px;
  margin: auto;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(13, 24, 41, 0.12);
  overflow: hidden;
  animation: loginIn 0.6s ease-out both;
}

@keyframes loginIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 左侧品牌区 ---------- */
.brand-panel {
  position: relative;
  flex: 1.1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 40px;
  background:
    linear-gradient(160deg, rgba(20, 36, 61, 0.035) 0%, transparent 55%),
    var(--card-bg);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

/* 山脊装饰线条 */
.brand-panel::before {
  content: "";
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 168, 106, 0.45), transparent);
}

.brand-panel::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 11%;
  width: 78%;
  height: 120px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(
    110deg,
    transparent 0 46px,
    rgba(20, 36, 61, 0.045) 46px 48px
  );
  -webkit-mask-image: linear-gradient(to top, #000, transparent);
  mask-image: linear-gradient(to top, #000, transparent);
  pointer-events: none;
}

.brand-mark {
  width: 64px;
  height: 64px;
  margin-bottom: 30px;
  color: var(--gold);
  animation: markFloat 5s ease-in-out infinite;
}

@keyframes markFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

.brand-word {
  font-size: 52px;
  font-weight: 200;
  letter-spacing: 0.32em;
  padding-left: 0.32em; /* 平衡字距使视觉居中 */
  color: var(--brand);
  line-height: 1.1;
}

.brand-rule {
  width: 46px;
  height: 2px;
  margin: 22px auto;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
}

.brand-sub {
  font-size: 18px;
  color: var(--text);
  letter-spacing: 3px;
  margin-bottom: 8px;
}

.brand-sub-en {
  font-size: 12.5px;
  color: var(--text-light);
  letter-spacing: 1.6px;
  text-transform: uppercase;
  margin-bottom: 26px;
}

.brand-tagline {
  font-size: 13.5px;
  color: var(--text-light);
  letter-spacing: 1px;
}

.brand-tagline .en {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  letter-spacing: 2.2px;
  color: #9aa3af;
  text-transform: uppercase;
}

/* ---------- 右侧表单卡片 ---------- */
.login-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 48px;
}

.login-form-wrap { width: 100%; max-width: 360px; }

.login-heading {
  font-size: 24px;
  font-weight: 600;
  color: var(--brand);
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.login-heading-en {
  font-size: 13px;
  color: var(--text-light);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 34px;
}

.login-form-wrap label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
  margin: 18px 0 8px;
}

.login-form-wrap label .en {
  font-size: 11px;
  color: var(--text-light);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 400;
}

.login-form-wrap .submit-btn {
  width: 100%;
  margin-top: 28px;
  padding: 13px;
  font-size: 15px;
  letter-spacing: 4px;
  font-weight: 500;
}

.submit-btn .en { letter-spacing: 1.5px; font-size: 12px; margin-left: 8px; opacity: 0.85; }

.login-foot {
  margin-top: 26px;
  text-align: center;
  font-size: 11.5px;
  color: #9aa3af;
  letter-spacing: 0.5px;
}

.login-error {
  display: none;
  margin-top: 18px;
  background: #fdecea;
  border: 1px solid #f5c6c4;
  color: #a93226;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  text-align: center;
}

.login-error.show { display: block; }

.login-form-wrap .loading {
  text-align: center;
  color: var(--text-light);
  font-size: 13px;
  margin-top: 16px;
  display: none;
}

/* 窄屏：分栏变堆叠 */
@media (max-width: 900px) {
  .login-shell {
    flex-direction: column;
    width: min(480px, 94vw);
    min-height: 0;
    margin: 24px auto;
    border-radius: 16px;
  }

  .brand-panel {
    flex: none;
    padding: 44px 24px 48px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .brand-word { font-size: 40px; }
  .brand-mark { width: 52px; height: 52px; margin-bottom: 22px; }

  .login-panel { flex: none; padding: 40px 32px 44px; }
}

/* =====================================================
   仪表盘（报表页）布局
   ===================================================== */

.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 58px;
  padding: 0 20px;
  background: linear-gradient(90deg, var(--brand-dark), var(--brand));
  color: #fff;
  box-shadow: 0 2px 10px rgba(13, 24, 41, 0.25);
  z-index: 5;
}

.topbar .brand-block { display: flex; align-items: baseline; gap: 12px; min-width: 0; }

.topbar .site-title {
  font-size: 20px;
  font-weight: 200;
  letter-spacing: 0.28em;
  padding-left: 0.28em;
  color: var(--gold);
  white-space: nowrap;
}

.topbar .site-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar .spacer { flex: 1; }

.topbar .user-chip {
  font-size: 13px;
  opacity: 0.88;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar a {
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 106, 0.55);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.topbar a.link-btn:hover { background: rgba(201, 168, 106, 0.16); border-color: var(--gold); }

.topbar button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  padding: 6px 14px;
}
.topbar button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: rgba(255,255,255,0.7); }

/* ---------- 主区域：侧边栏 + 报表 ---------- */
.app-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.sidebar {
  flex: none;
  width: 220px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  overflow-y: auto;
}

.sidebar-title {
  font-size: 12px;
  color: var(--text-light);
  letter-spacing: 2px;
  padding: 0 10px 12px;
}

.sidebar-title .en {
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 10.5px;
  color: #a7aeb8;
  margin-left: 6px;
}

.brand-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  padding: 13px 14px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.6px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.brand-btn:hover { background: var(--gold-soft); }

.brand-btn.active {
  background: linear-gradient(90deg, var(--gold-soft), #fbf7ee);
  border-color: var(--gold);
  color: var(--brand);
  box-shadow: var(--shadow-soft);
}

.brand-btn .dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.15s, box-shadow 0.15s;
}

.brand-btn.active .dot {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(201, 168, 106, 0.22);
}

/* ---------- 报表区 ---------- */
.report-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 报表裁剪容器：iframe 底部多出的 48px（Power BI 底部品牌条约 37px）被裁掉，
   使 iframe 内不显示任何 Power BI 界面元素 */
.report-clip {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.report-frame {
  width: 100%;
  height: calc(100% + 48px);
  border: 0;
  display: block;
}

/* 切换报表时的加载遮罩 */
.report-loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(246, 247, 249, 0.94);
  font-size: 14px;
  color: var(--text-light);
  letter-spacing: 1px;
}

.report-loading.show { display: flex; }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 窄屏：侧边栏收成顶下一行横向品牌按钮 */
@media (max-width: 720px) {
  .app-body { flex-direction: column; }

  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    overflow: visible;
  }

  .sidebar-title { display: none; }

  .brand-nav { flex-direction: row; gap: 6px; }

  .brand-btn { padding: 8px 12px; font-size: 13px; }

  .topbar .site-subtitle { display: none; }
}

/* =====================================================
   管理页
   ===================================================== */

.admin-body { height: 100%; overflow: auto; }

.admin-wrap {
  max-width: 1000px;
  margin: 28px auto 60px;
  padding: 0 20px;
}

.admin-wrap h1 {
  font-size: 20px;
  color: var(--brand);
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.card {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}

.card h2 { font-size: 15px; color: var(--brand); letter-spacing: 0.5px; margin-bottom: 16px; }

.add-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.add-form input[type="text"], .add-form input[type="password"] { width: 180px; }

.add-form .checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
}

.status-bar {
  margin: 16px 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  display: none;
}

.status-bar.error { display: block; background: #fdecea; border: 1px solid #f5c6c4; color: #a93226; }
.status-bar.ok { display: block; background: #e6f4ec; border: 1px solid #b7dfc9; color: var(--success); }

table.users {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

table.users th, table.users td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.users th {
  color: var(--text-light);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.5px;
  background: #fafbfc;
}

table.users tr:hover td { background: #fbfcfe; }
table.users tr.disabled-row td { opacity: 0.55; }

.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.badge.admin { background: var(--gold-soft); color: var(--gold-dark); }
.badge.user { background: #eef0f3; color: var(--text-light); }
.badge.disabled { background: #fdecea; color: #a93226; }
.badge.enabled { background: #e6f4ec; color: var(--success); }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions button { font-size: 12px; padding: 4px 10px; }

.time-col { color: var(--text-light); font-size: 12px; white-space: nowrap; }

.empty-tip { color: var(--text-light); text-align: center; padding: 18px 0; }

@media (max-width: 640px) {
  .topbar .user-chip { display: none; }
  .add-form input[type="text"], .add-form input[type="password"] { width: 100%; }
}
