:root {
  --ink: #1a2233; --muted: #6b7280; --line: #e2e5ec; --bg: #f4f5f8;
  --brand: #00a6ab; --brand-ink: #008d91; --danger: #c0392b; --ok: #1e7e34;
  --card: #ffffff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--brand-ink); }

/* ==================== 顶栏（高端深色版·固定两行） ===================== */
header {
  background: linear-gradient(118deg, #0a1d28 0%, #0d2c39 52%, #0d3d4c 100%);
  color: #fff; padding: 9px 28px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px;
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 3px 16px rgba(7,24,33,.28);
}
header::after { /* 底部香槟金细线 */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, rgba(217,185,140,0), rgba(217,185,140,.8) 16%, rgba(217,185,140,.8) 84%, rgba(217,185,140,0));
  pointer-events: none;
}
/* 行1：品牌（LOGO+菱形+名称）+ 右侧状态区
   LOGO 双层渐变：原图六边形在左（9%~27%），文字在右（33%+），28-32%是空白带。
   底层=原图原色+蒙版只留左侧；顶层=白剪影+反向蒙版只留右侧；过渡带落在空白区，左原色→右白自然渐变 */
header .logo { display: flex; align-items: center; gap: 15px; }
header .hdr-logo-wrap { position: relative; height: 76px; aspect-ratio: 3552 / 1184; flex: none; }
header .hdr-logo-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; }
header .hdr-logo-color {
  -webkit-mask-image: linear-gradient(90deg, #000 30%, transparent 36%);
  mask-image: linear-gradient(90deg, #000 30%, transparent 36%);
}
header .hdr-logo-white {
  filter: brightness(0) invert(1);
  -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000 36%);
  mask-image: linear-gradient(90deg, transparent 30%, #000 36%);
}
header .logo-mark { width: 13px; height: 13px; transform: rotate(45deg); border: 1.5px solid #d9b98c; border-radius: 2px;
  box-shadow: inset 0 0 0 3px rgba(217,185,140,.22); flex: none; }
header .logo-text { font-size: 17px; font-weight: 700; letter-spacing: 2.5px; line-height: 1.25; margin-left: 5px; }
header .logo-text small { display: block; font-size: 10px; font-weight: 400; letter-spacing: 2px; color: #93c3c0; margin-top: 2px; }
header .spacer { flex: 1; }
header .lockstate { font-size: 12px; color: #cfe0df; background: rgba(0,0,0,.22); border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px; padding: 4px 12px; letter-spacing: .5px; white-space: nowrap; }
/* 行2：导航（占满整行，溢出横向滚动，任何屏宽都不换行不错位） */
nav { display: flex; gap: 6px; width: 100%; overflow-x: auto; padding: 2px 0 9px; margin-left: 0; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }
nav button { position: relative; background: none; border: none; color: #b9c9cd; padding: 9px 15px; font-size: 14px;
  letter-spacing: 1px; cursor: pointer; border-radius: 8px; transition: color .15s, background .15s; white-space: nowrap; flex: none; }
nav button:hover { color: #fff; background: rgba(255,255,255,.07); }
nav button.on { color: #fff; background: rgba(255,255,255,.10); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); font-weight: 600; }
nav button.on::after { content: ""; position: absolute; left: 15px; right: 15px; bottom: 3px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, #e8cf9f, #d9b98c); }

main { max-width: 1180px; margin: 18px auto; padding: 0 16px 60px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(20,25,40,.04); }
.card h3 { font-size: 15px; margin-bottom: 12px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.card h3 .tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #eef0f5; color: var(--muted); font-weight: normal; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 900px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------- 移动端（≤640px）---------- */
@media (max-width: 640px) {
  header { padding: 8px 12px 0; gap: 6px 10px; }
  header .logo { width: 100%; }
  header .logo-text { font-size: 15px; letter-spacing: 2px; }
  header .hdr-logo-wrap { height: 44px; }
  nav { padding: 2px 0 7px; }
  nav button { padding: 8px 10px; font-size: 13px; letter-spacing: 0; }
  nav button.on::after { left: 10px; right: 10px; }
  header .spacer { display: none; }
  header .lockstate { font-size: 11px; }
  main { margin: 10px auto; padding: 0 8px 40px; }
  .card { padding: 12px; border-radius: 8px; }
  dialog { min-width: 0; width: 92vw; max-width: 420px; max-height: 88vh; overflow-y: auto; padding: 16px; }
  table.data { font-size: 12px; }
  table.data th, table.data td { padding: 5px 6px; }
  table.data input, table.data select { font-size: 12px; }
  .totals-box .grand { font-size: 20px; }
  .btn { padding: 9px 16px; } /* 触控目标加大 */
  .btn.small { padding: 6px 10px; }
  .chip { padding: 5px 12px; }
  .secblock { padding: 8px; }
  .secblock .sec-head input { max-width: 100% !important; width: 100%; }
}

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=number], input[type=date], input[type=password], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: 2px solid rgba(0,166,171,.35); border-color: #00a6ab; }
input[disabled] { background: #f2f3f6; color: var(--muted); }

.btn { display: inline-block; padding: 8px 18px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; background: var(--brand); color: #fff; }
.btn:hover { background: #008d91; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: #00a6ab; color: #008d91; background: #f2fbfb; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { border: 1px solid var(--line); padding: 7px 9px; vertical-align: top; }
table.data th { background: #f0f1f5; font-weight: bold; text-align: center; white-space: nowrap; }
table.data td.r { text-align: right; } table.data td.c { text-align: center; }
table.data tr:hover td { background: #f7fcfc; }
table.data input, table.data select { padding: 4px 6px; font-size: 13px; }

.layer { display: inline-block; padding: 1px 8px; border-radius: 9px; font-size: 11px; font-weight: bold; }
.layer.B { background: #e7f0ff; color: #1a56c4; }
.layer.C { background: #fff3e0; color: #b26a00; }
.layer.A { background: #e8f5e9; color: #1e7e34; }
a.delq { color: var(--danger); }
.badge-warn { background: #fdecea; color: var(--danger); padding: 1px 8px; border-radius: 9px; font-size: 11px; }

.calcbox { background: #f2fbfb; border: 1px dashed #b2e4e6; border-radius: 8px; padding: 12px 14px; margin-top: 12px; font-size: 13px; line-height: 1.9; }
.calcbox .amount { font-size: 22px; font-weight: bold; color: #008d91; }
.calcbox .warn { color: var(--danger); }
.calcbox .sub { color: var(--muted); font-size: 12px; }

.totals-box { text-align: right; font-size: 14px; line-height: 2; }
.totals-box .grand { font-size: 24px; font-weight: bold; color: var(--brand-ink); }
.totals-box .cn { color: var(--muted); font-size: 13px; }
.totals-box .warnline { color: var(--danger); font-size: 12px; line-height: 1.6; }
.totals-box .costline { color: var(--muted); font-size: 12px; line-height: 1.6; }
.totals-box .costline.low { color: var(--danger); font-weight: bold; }

/* 多分区明细 */
.secblock { margin-bottom: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fcfcfd; }
.secblock .sec-head { margin-bottom: 8px; }
.secblock .sec-head input { padding: 5px 9px; font-size: 13px; border: none; border-bottom: 1px dashed var(--line); background: transparent; }
.table-wrap { overflow-x: auto; }

/* 费用快捷按钮 */
.chip { display: inline-block; padding: 3px 10px; border: 1px dashed #00a6ab; border-radius: 14px; background: #f2fbfb; color: #008d91; font-size: 12px; cursor: pointer; }
.chip:hover { background: #e5f6f7; }

.layer.F { background: #eef0f5; color: #6b7280; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #2b2f3d; color: #fff; padding: 10px 22px; border-radius: 8px; font-size: 14px; display: none; z-index: 99; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.toast.err { background: var(--danger); }

.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input { max-width: 320px; }

.muted { color: var(--muted); font-size: 12px; }
.mt { margin-top: 12px; }
.right { text-align: right; }
.flex { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.flex > div { flex: 1; }

/* 宽表格横向滚动（手机上左右滑） */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table.data { min-width: 640px; }

/* 搜索栏小屏换行 */
.searchbar { flex-wrap: wrap; }
@media (max-width: 640px) { .searchbar input { max-width: 100%; } }

dialog { border: none; border-radius: 10px; padding: 22px; min-width: 380px; }
dialog::backdrop { background: rgba(20,25,40,.45); }
dialog h3 { margin-bottom: 14px; }
dialog .row { margin-bottom: 10px; }

/* ==================== 云端登录页（复刻 FEIYUNUO CRM PC 端版式）==================== */
#login-view { position: fixed; inset: 0; z-index: 50; display: flex; }
.login-page { position: relative; display: flex; width: 100%; height: 100%; background: #fff; }
.login-corner-logo { position: absolute; top: 26px; left: 34px; height: 68px; z-index: 2; }
.login-left { flex: 1.15; overflow: hidden; background: linear-gradient(160deg, #f2fbfb, #ccedee); }
.login-left img { width: 100%; height: 100%; object-fit: cover; display: block; }
.login-right { flex: 1; display: flex; align-items: center; justify-content: center; background: #fff; }
.login-box { width: 400px; max-width: 88%; }
.login-logo { display: block; width: 200px; max-width: 70%; margin: 0 auto 26px; }
.login-welcome { text-align: center; font-size: 22px; font-weight: 600; color: #1f2329; letter-spacing: 1px; }
.login-sub { text-align: center; font-size: 13px; color: #8f959e; margin: 10px 0 34px; }
.login-input { display: flex; align-items: center; gap: 10px; background: #f2fbfb; border: 1px solid #ccedee;
  border-radius: 8px; padding: 0 14px; margin-bottom: 18px; transition: border-color .15s, background .15s; }
.login-input svg { width: 18px; height: 18px; flex: none; }
.login-input input { flex: 1; border: none; background: transparent; padding: 12px 0; font-size: 14px; color: var(--ink); }
.login-input input:focus { outline: none; }
.login-input:focus-within { border-color: #00a6ab; background: #fff; box-shadow: 0 0 0 3px rgba(0,166,171,.12); }
.login-btn { width: 100%; padding: 12px; font-size: 15px; letter-spacing: 8px; border-radius: 8px;
  background: #00a6ab; margin-top: 6px; }
.login-btn:hover { background: #008d91; }
.login-err { color: var(--danger); font-size: 12px; min-height: 16px; margin: 2px 0 6px; text-align: center; }
.login-tip { text-align: center; margin-top: 26px; font-size: 12px; color: #aab2b8; }
@media (max-width: 900px) {
  #login-view { align-items: stretch; }
  .login-page { flex-direction: column; }
  .login-corner-logo { height: 44px; top: 16px; left: 16px; }
  .login-left { flex: none; height: 30vh; background: linear-gradient(160deg, #f2fbfb, #ccedee); }
  .login-left img { width: 100%; height: 30vh; object-fit: cover; }
  .login-right { flex: 1; padding: 10px 0 30px; align-items: flex-start; }
  .login-box { margin-top: 8px; }
  .login-welcome { font-size: 19px; }
}

/* 顶栏用户区（云端） */
.userchip { font-size: 12px; display: flex; align-items: center; gap: 8px; opacity: .95; }
.userchip .uname { color: #fff; }
.userchip .urole { background: rgba(255,255,255,.16); border-radius: 9px; padding: 1px 8px; }
.userchip a { color: #ffd57a; cursor: pointer; text-decoration: none; }
.userchip a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .userchip { font-size: 11px; width: auto; }
}

