/* ───────────────────────────────────────────────
   NavolarTech 设计系统 — 与 NavolarOfficalWebsite 同源的设计变量
   浅色主题（token 取自官网 [data-theme="light"]）· Inter 字体
   ─────────────────────────────────────────────── */
:root {
  --ink: #f6f7f9;
  --ink-soft: #eceef2;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --line: rgba(15, 20, 30, 0.10);
  --line-strong: rgba(15, 20, 30, 0.18);

  --mist: #1b1f27;
  --mute: #565d6b;
  --faint: #878e9c;
  --fg: #0b0e14;

  --accent: #2f6fe6;
  --accent-2: #0f9f73;
  --gold: #b9831f;
  --danger: #be123c;

  --fill: rgba(15, 20, 30, 0.04);
  --fill-strong: rgba(15, 20, 30, 0.07);
  --btn-bg: #0b0e14;
  --btn-fg: #ffffff;

  --grid-line: rgba(15, 20, 30, 0.05);
  --glass-1: rgba(255, 255, 255, 0.78);
  --glass-2: rgba(255, 255, 255, 0.55);
  --card-1: rgba(15, 20, 30, 0.025);
  --card-2: rgba(15, 20, 30, 0.008);

  --radius: 14px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; border-color: var(--line); }

html { color-scheme: light; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--ink);
  color: var(--mist);
  font-size: 14px;
  overflow-x: hidden;
}

::selection { background: rgba(47, 111, 230, 0.18); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 2px solid var(--ink);
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* 浅灰色字标在浅色背景上加深（与官网 .logo-word 同款处理） */
img.word { filter: brightness(0.3) contrast(1.15); }

/* ---------- 按钮 ---------- */
button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  transition: opacity .15s, background .15s, border-color .15s;
}
button:hover { opacity: .85; }
button.ghost {
  background: var(--surface);
  color: var(--mist);
  border: 1px solid var(--line-strong);
  font-weight: 500;
}
button.ghost:hover { opacity: 1; background: var(--fill); border-color: var(--faint); }
button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
  padding: 5px 10px;
  font-weight: 500;
}
button.danger:hover { opacity: 1; background: rgba(190, 18, 60, 0.07); }
button.small { padding: 5px 12px; font-size: 13px; }

input[type=text], input[type=password] {
  font: inherit;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  width: 100%;
  outline: none;
  background: var(--surface);
  color: var(--fg);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--faint); }
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 230, 0.14);
}

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 26px;
  position: relative;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
}
.login-wrap::before {
  content: "";
  position: absolute;
  width: 480px;
  height: 480px;
  border-radius: 9999px;
  background: radial-gradient(circle, rgba(47,111,230,.18), rgba(15,159,115,.07) 60%, transparent 75%);
  filter: blur(80px);
  opacity: .8;
  pointer-events: none;
}
.login-card {
  position: relative;
  background: linear-gradient(180deg, var(--glass-1), var(--glass-2));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 40px 36px;
  width: 380px;
  box-shadow: 0 18px 60px -18px rgba(15, 20, 30, 0.18), 0 0 80px -30px rgba(47, 111, 230, 0.35);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.login-logo img.mark { height: 34px; }
.login-logo img.word { height: 20px; }
.login-card h1 {
  font-size: 20px;
  margin-bottom: 4px;
  background: linear-gradient(120deg, #0b0e14 0%, #1b2a4a 45%, var(--accent) 110%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-card .sub { color: var(--mute); margin-bottom: 26px; font-size: 13px; }
.login-card .field { margin-bottom: 14px; }
.login-card button { width: 100%; padding: 11px; margin-top: 8px; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }
.login-hint { color: var(--faint); font-size: 12px; position: relative; }
.login-alt { margin-top: 16px; font-size: 13px; color: var(--mute); text-align: center; }
.login-alt a { color: var(--accent); text-decoration: none; }
.login-alt a:hover { text-decoration: underline; }

/* ---------- 应用布局 ---------- */
.shell { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  height: 58px;
  background: linear-gradient(180deg, var(--glass-1), var(--glass-2));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 12px;
  flex-shrink: 0;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand img.mark { height: 26px; }
.topbar .brand img.word { height: 15px; }
.topbar .brand .app-name {
  font-size: 13px;
  color: var(--mute);
  border-left: 1px solid var(--line-strong);
  padding-left: 12px;
  margin-left: 2px;
}
.topbar .spacer { flex: 1; }
.badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(47, 111, 230, 0.08);
  color: var(--accent);
  border: 1px solid rgba(47, 111, 230, 0.28);
}
.badge.member {
  background: rgba(15, 159, 115, 0.07);
  color: var(--accent-2);
  border-color: rgba(15, 159, 115, 0.28);
}
.badge.super {
  background: rgba(185, 131, 31, 0.09);
  color: var(--gold);
  border-color: rgba(185, 131, 31, 0.32);
}

.main { display: flex; flex: 1; overflow: hidden; }
.sidebar {
  width: 250px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar h3 {
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 18px 10px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--mute);
  margin-bottom: 2px;
  word-break: break-all;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item:hover { background: var(--fill); color: var(--mist); }
.nav-item.active {
  background: rgba(47, 111, 230, 0.08);
  border-color: rgba(47, 111, 230, 0.24);
  color: var(--accent);
  font-weight: 500;
}
.nav-item .icon { flex-shrink: 0; }

.content { flex: 1; overflow-y: auto; padding: 26px 30px; }
.content h2 { font-size: 19px; margin-bottom: 4px; color: var(--fg); display: flex; align-items: center; gap: 8px; }
.content .desc { color: var(--mute); margin-bottom: 22px; font-size: 13px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 18px; align-items: center; flex-wrap: wrap; }

/* ---------- 卡片与表格 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 22px;
  box-shadow: 0 1px 3px rgba(15, 20, 30, 0.04);
  transition: border-color .4s ease;
}
.card:hover { border-color: var(--line-strong); }
.card .card-head {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card .card-head .spacer { flex: 1; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 18px; border-bottom: 1px solid var(--line); }
th {
  color: var(--faint);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--surface-2);
}
td { color: var(--mist); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--fill); }
td .file-name { display: flex; align-items: center; gap: 8px; word-break: break-all; }
.empty { padding: 36px; text-align: center; color: var(--faint); }

/* ---------- 上传区 ---------- */
.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  color: var(--mute);
  margin-bottom: 22px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--accent);
  background: rgba(47, 111, 230, 0.04);
  box-shadow: 0 0 50px -20px rgba(47, 111, 230, 0.35);
}
.dropzone .big { font-size: 15px; color: var(--fg); margin-bottom: 4px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 20, 30, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px;
  width: 430px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 24px 70px -20px rgba(15, 20, 30, 0.35);
}
.modal h3 { margin-bottom: 16px; font-size: 16px; color: var(--fg); }
.modal .field { margin-bottom: 12px; }
.modal .field label { display: block; margin-bottom: 6px; color: var(--mute); font-size: 13px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal .modal-text { color: var(--mist); line-height: 1.7; margin-bottom: 4px; }
.modal .form-msg { font-size: 13px; min-height: 18px; color: var(--mute); }
.modal .form-msg.err { color: var(--danger); }
.modal .form-msg.ok { color: var(--accent-2); }

/* 轻提示（替代 alert） */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(16px);
  background: var(--fg);
  color: var(--btn-fg);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  max-width: min(560px, 88vw);
  box-shadow: 0 8px 30px rgba(15, 20, 30, 0.25);
  opacity: 0;
  transition: opacity .25s, transform .25s;
  z-index: 300;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.cred-box {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 14px;
  font-family: Consolas, monospace;
  margin: 10px 0;
  line-height: 1.8;
  color: var(--accent-2);
}

/* ---------- 权限行 ---------- */
.perm-row { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.perm-row:last-child { border-bottom: none; }
.perm-row .uname { flex: 1; color: var(--mist); }
.perm-row label { display: flex; align-items: center; gap: 6px; color: var(--mute); font-size: 13px; cursor: pointer; white-space: nowrap; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------- SVG 图标 ---------- */
.ic { display: inline-block; vertical-align: -3px; flex-shrink: 0; }
.ic-img { color: var(--accent-2); }
.ic-pdf { color: #e11d48; }
.ic-doc { color: var(--accent); }
.ic-xls { color: var(--accent-2); }
.ic-file { color: var(--mute); }
.ic-folder { color: var(--gold); }
.nav-item .icon { display: inline-flex; }
.dropzone .up-ic { color: var(--accent); margin-bottom: 8px; }
.preview-fallback .ic { opacity: .9; }
.dev-toggle .ic, .dev-title .ic { vertical-align: -2px; }

.tag { font-size: 12px; color: var(--faint); }
.notice {
  background: rgba(185, 131, 31, 0.07);
  border: 1px solid rgba(185, 131, 31, 0.3);
  color: var(--gold);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

/* ---------- 文件预览（右侧抽屉，占 50% 屏宽） ---------- */
.preview-mask {
  justify-content: flex-end;
  align-items: stretch;
}
.preview-box {
  background: var(--surface);
  border-left: 1px solid var(--line);
  width: 50vw;
  min-width: 360px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -20px 0 60px rgba(15, 20, 30, 0.16);
  animation: drawer-in .22s ease;
}
.preview-box.closing { animation: drawer-out .2s ease forwards; }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes drawer-out { from { transform: none; } to { transform: translateX(100%); } }
.preview-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.preview-head .preview-title { font-weight: 600; word-break: break-all; color: var(--fg); }
.preview-head .spacer { flex: 1; }
.preview-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-soft);
}
.preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-body iframe { width: 100%; height: 100%; border: none; }
.preview-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--mute);
  padding: 20px;
  text-align: center;
}

/* Excel 预览 */
.preview-body.excel {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: var(--surface);
}
.sheet-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  overflow-x: auto;
  flex-shrink: 0;
}
.sheet-tab {
  background: transparent;
  color: var(--mute);
  border: 1px solid transparent;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.sheet-tab:hover { opacity: 1; background: var(--fill); }
.sheet-tab.active {
  background: rgba(47, 111, 230, 0.08);
  color: var(--accent);
  border-color: rgba(47, 111, 230, 0.28);
}
.sheet-wrap { flex: 1; overflow: auto; padding: 14px; }
.sheet-wrap table { border-collapse: collapse; width: auto; }
.sheet-wrap td {
  border: 1px solid var(--line);
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
  min-width: 60px;
  color: var(--mist);
}
.sheet-wrap tr:first-child td { background: var(--surface-2); color: var(--fg); font-weight: 600; }

/* ---------- 仅本地开发用：快捷切换账号 ---------- */
.dev-switcher {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.dev-toggle {
  background: var(--surface);
  color: var(--gold);
  border: 1px solid var(--line-strong);
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(15, 20, 30, 0.12);
}
.dev-panel {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(15, 20, 30, 0.18);
  width: 340px;
  max-width: calc(100vw - 32px);
  overflow: hidden;
}
.dev-title {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.dev-account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  color: var(--mist);
}
.dev-account .badge { flex-shrink: 0; }
.dev-account .acc-name { flex-shrink: 0; white-space: nowrap; }
.dev-account .acc-email {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dev-account .acc-current { flex-shrink: 0; white-space: nowrap; }
.dev-account:last-child { border-bottom: none; }
.dev-account:hover { background: var(--fill); }
.dev-account.active { cursor: default; background: rgba(47, 111, 230, 0.06); }

/* ---------- 表格横向滚动容器 ---------- */
.table-wrap { overflow-x: auto; }
.table-wrap table { min-width: 560px; }

/* ---------- 移动端适配 ---------- */
@media (max-width: 768px) {
  /* 布局：侧栏变为顶部横向滚动条 */
  .main { flex-direction: column; }
  .sidebar {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 10px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
  }
  .sidebar h3 { display: none; }
  .nav-item {
    white-space: nowrap;
    word-break: normal;
    margin-bottom: 0;
    padding: 7px 12px;
    flex-shrink: 0;
  }
  .sidebar .tag { white-space: nowrap; flex-shrink: 0; }
  .sidebar button { white-space: nowrap; flex-shrink: 0; margin: 0 4px !important; }

  .content { padding: 16px 14px; }
  .content h2 { font-size: 17px; }

  /* 顶栏：收起品牌文字，用户名截断 */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .brand .app-name { display: none; }
  .topbar .brand img.word { display: none; }
  .topbar .tag {
    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 上传区更紧凑 */
  .dropzone { padding: 20px 14px; }

  /* 权限行可换行 */
  .perm-row { flex-wrap: wrap; row-gap: 6px; }
  .perm-row .uname { flex-basis: 100%; }

  /* 弹窗与登录卡自适应宽度 */
  .modal { width: min(430px, 92vw); padding: 20px; }
  .login-card { width: min(380px, 92vw); padding: 30px 24px; }

  /* 预览抽屉全屏 */
  .preview-box { width: 100vw; min-width: 0; }

  /* 操作按钮更紧凑 */
  button.small { padding: 4px 9px; font-size: 12px; }
  th, td { padding: 9px 12px; }
}
