/* ============================================================
   灿臻不锈钢 · 内部平台门户 & 统一认证中心
   设计规范与「物料登记系统 / 项目进度管理系统」保持一致
   ============================================================ */
:root {
  --brand: #2f6fed;
  --brand-dark: #1f52c4;
  --brand-soft: #eaf1ff;
  --ok: #12a150;
  --ok-soft: #e6f7ee;
  --warn: #e08600;
  --warn-soft: #fdf3e2;
  --danger: #dc2626;
  --danger-soft: #fdeceb;
  --gray: #64748b;
  --gray-soft: #eef2f7;
  --purple: #7c4dff;

  --navy-1: #0e2547;
  --navy-2: #0a1a33;

  --bg: #f2f5fa;
  --card: #ffffff;
  --text: #0f1f3d;
  --text-2: #475569;
  --muted: #8094ad;
  --line: #e5eaf2;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 64, .05);
  --shadow: 0 2px 4px rgba(16, 32, 64, .04), 0 12px 28px -16px rgba(16, 32, 64, .18);
  --shadow-lg: 0 24px 60px -24px rgba(10, 30, 70, .34);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.2px; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select { font-family: inherit; }
svg.ic { width: 1em; height: 1em; flex: none; vertical-align: -.14em; }

/* ==================== 通用组件 ==================== */
.brand-logo-link { display: inline-flex; transition: transform .16s, opacity .16s; }
.brand-logo {
  display: block; height: 34px; width: auto; max-width: 200px;
  background: #fff; border-radius: 9px; padding: 6px 10px;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .35);
  object-fit: contain;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  background: #fff; color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .15s ease; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 18px -10px rgba(47, 111, 237, .9); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-2); }
.btn-ghost:hover { border-color: #cfdae9; color: var(--text); background: #fff; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fbdad8; }
.btn-sm { height: 31px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 10px;
  border: 1px solid var(--line); background: #fbfcfe; color: var(--text);
  font-size: 14.5px; outline: none; transition: .15s;
  appearance: none; -webkit-appearance: none;
}
.input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(47, 111, 237, .14); }
.input[disabled] { background: #f1f4f9; color: var(--muted); }
select.input { padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238094ad' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 2px 0 10px; }

/* ==================== 登录页 ==================== */
.login-screen { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; min-height: 100dvh; }
.login-visual {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 460px at 12% 8%, rgba(47, 111, 237, .42), transparent 60%),
    radial-gradient(700px 420px at 92% 92%, rgba(0, 196, 180, .24), transparent 62%),
    linear-gradient(150deg, var(--navy-1), var(--navy-2) 70%);
  color: #fff; display: flex; align-items: center; padding: 8vh 7vw;
}
.login-visual::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 30% 40%, #000 20%, transparent 78%);
}
.login-visual-inner { position: relative; z-index: 1; max-width: 520px; }
.login-visual .brand-logo-link { margin-bottom: 26px; }
.login-visual h1.login-title { font-size: 32px; line-height: 1.25; letter-spacing: -.5px; font-weight: 800; word-break: keep-all; }
.login-visual h1.login-title::after {
  content: ""; display: block; width: 56px; height: 4px; border-radius: 3px; margin-top: 18px;
  background: linear-gradient(90deg, var(--brand), #00c4b4);
}
.login-org { margin-top: 20px; font-size: 17px; font-weight: 700; color: rgba(255, 255, 255, .9); letter-spacing: .3px; }
.login-sub { margin-top: 8px; font-size: 14px; color: rgba(255, 255, 255, .7); }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 6vh 5vw; }
.login-card { width: 100%; max-width: 372px; }
.login-brand-m { display: none; }
.login-card h2 { font-size: 22px; }
.login-tip { margin: 6px 0 22px; font-size: 13.5px; color: var(--muted); }
.login-foot { margin-top: 22px; text-align: center; font-size: 12px; color: var(--muted); }

/* ==================== 应用外壳 ==================== */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(120deg, var(--navy-1), var(--navy-2) 85%);
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 18px 12px;
  box-shadow: 0 10px 26px -18px rgba(6, 20, 45, .9);
}
.topbar-inner { max-width: 1040px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.topbar .brand-logo { height: 30px; padding: 5px 8px; border-radius: 8px; }
.topbar-title { min-width: 0; flex: 1; }
.topbar-title strong { display: block; font-size: 15px; font-weight: 650; line-height: 1.3; }
.topbar-title em {
  margin-top: 3px; display: block; font-style: normal; font-size: 11.5px; color: rgba(255, 255, 255, .62);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px;
  background: rgba(255, 255, 255, .1); border-radius: 999px;
}
.user-chip .avatar {
  width: 27px; height: 27px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, #4f8bff, #2f6fed); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.user-chip .u-meta { line-height: 1.25; }
.user-chip .u-meta strong { display: block; font-size: 13px; font-weight: 600; }
.user-chip .u-meta em { display: block; font-style: normal; font-size: 10.5px; color: rgba(255, 255, 255, .66); }
.topbar .btn-ghost { border-color: rgba(255, 255, 255, .26); color: rgba(255, 255, 255, .92); }
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .4); }

.main { flex: 1; width: 100%; max-width: 1040px; margin: 0 auto; padding: 24px 18px calc(env(safe-area-inset-bottom, 0px) + 40px); }

.page-head { margin-bottom: 18px; }
.page-head h2 { font-size: 21px; }
.page-head p { margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.page-head .row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

/* ==================== 应用卡片 ==================== */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.app-card {
  display: flex; gap: 15px; align-items: flex-start; text-align: left; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; min-width: 0; cursor: pointer; font: inherit; color: inherit;
  box-shadow: var(--shadow-sm); transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.app-card:hover { border-color: #c8d9f5; box-shadow: 0 16px 34px -20px rgba(20, 50, 110, .42); transform: translateY(-3px); }
.app-card:active { transform: translateY(-1px); }
.app-ico {
  flex: none; width: 48px; height: 48px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand);
}
.app-ico svg { width: 24px; height: 24px; }
.app-ico.g-purple { background: #f1ecff; color: var(--purple); }
.app-ico.g-green { background: var(--ok-soft); color: var(--ok); }
.app-ico.g-amber { background: var(--warn-soft); color: var(--warn); }
.app-ico.g-teal { background: #e5f7f4; color: #0d9488; }
.app-body { flex: 1; min-width: 0; }
.app-name { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 6px; }
.app-name .arrow { color: var(--muted); font-weight: 400; transition: .15s; }
.app-card:hover .app-name .arrow { color: var(--brand); transform: translateX(3px); }
.app-desc { margin-top: 4px; font-size: 12.8px; color: var(--text-2); }
.app-tags { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 2px 8px; font-weight: 500; }

.empty {
  background: var(--card); border: 1px dashed #d5deeb; border-radius: var(--radius);
  padding: 46px 24px; text-align: center; color: var(--muted);
}
.empty svg { width: 40px; height: 40px; color: #c3cfdf; }
.empty p { margin-top: 12px; font-size: 14px; }
.empty span { display: block; margin-top: 5px; font-size: 12.5px; }

/* ==================== 卡片 / 表格 ==================== */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: 15.5px; }
.card-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.card-body { padding: 18px; }

.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--text-2); font-size: 12.5px;
  padding: 11px 14px; background: #f7f9fc; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid #eef2f8; vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #fafcff; }
.t-right { text-align: right; }
.t-nowrap { white-space: nowrap; }
.t-sub { color: var(--muted); font-size: 12.5px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.b-blue { background: var(--brand-soft); color: var(--brand); }
.b-green { background: var(--ok-soft); color: var(--ok); }
.b-gray { background: var(--gray-soft); color: var(--gray); }
.b-red { background: var(--danger-soft); color: var(--danger); }
.b-orange { background: var(--warn-soft); color: var(--warn); }
.b-purple { background: #f1ecff; color: var(--purple); }

.avatar-txt {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #4f8bff, #2f6fed); color: #fff; font-weight: 700; font-size: 13px;
}
.avatar-txt.is-admin { background: linear-gradient(135deg, #9b6bff, #7c4dff); }
.u-cell { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.u-cell strong { display: block; font-size: 13.5px; }
.u-cell em { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); }
/* 登录支持「账号或姓名」后：同名员工的姓名不能用于登录，列表中给出提示（20261014c） */
.u-cell em.dup-tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 5px;
  font-size: 10.5px; font-weight: 600; color: #b45309; background: #fef3c7;
}

.pwd { display: inline-flex; align-items: center; gap: 7px; }
.pwd code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; background: #f4f7fc; border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 8px; letter-spacing: .4px; color: var(--text-2);
}
.pwd .eye { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 2px; display: inline-flex; }
.pwd .eye:hover { color: var(--brand); }

.apps-pick { display: flex; flex-wrap: wrap; gap: 7px; }
.pick {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: #fbfcfe; border-radius: 9px;
  padding: 7px 11px; font-size: 13px; font-weight: 500; transition: .14s;
}
.pick:hover { border-color: #c8d9f5; }
.pick input { display: none; }
.pick .box {
  width: 16px; height: 16px; border-radius: 5px; border: 1.6px solid #c3cfdf;
  display: inline-flex; align-items: center; justify-content: center; transition: .14s;
}
.pick .box svg { width: 11px; height: 11px; opacity: 0; color: #fff; }
.pick.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.pick.on .box { background: var(--brand); border-color: var(--brand); }
.pick.on .box svg { opacity: 1; }
.pick.disabled { opacity: .55; cursor: not-allowed; }

/* ==================== 弹窗 / 提示 ==================== */
.modal-mask {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 90;
  background: rgba(9, 20, 40, .48); display: flex; align-items: center; justify-content: center;
  padding: 18px; backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 486px; max-height: 90vh; overflow: auto;
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-head { padding: 18px 20px 0; }
.modal-head h3 { font-size: 17px; }
.modal-head p { margin-top: 4px; font-size: 12.8px; color: var(--muted); }
.modal-body { padding: 18px 20px 4px; }
.modal-foot { padding: 14px 20px 20px; display: flex; gap: 10px; justify-content: flex-end; }

.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 120; display: grid; gap: 9px; }
.toast {
  background: #10203c; color: #fff; font-size: 13.5px; font-weight: 500;
  padding: 10px 16px; border-radius: 11px; box-shadow: var(--shadow);
  animation: pop .18s ease; max-width: 84vw;
}
.toast.ok { background: #0d7a3f; }
.toast.err { background: #b32020; }

.loading { display: flex; align-items: center; justify-content: center; padding: 60px 0; color: var(--muted); font-size: 13.5px; gap: 9px; }
.spinner {
  width: 17px; height: 17px; border-radius: 50%; border: 2px solid #d7e0ee; border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== 响应式 ==================== */
@media (max-width: 860px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { padding: 8vh 22px 6vh; }
  .login-brand-m { display: block; text-align: center; margin-bottom: 22px; }
  .login-brand-m .brand-logo { height: 40px; margin: 0 auto; }
  .login-brand-m .lbg-text { margin-top: 12px; }
  .login-brand-m .lbg-text strong { display: block; font-size: 17px; }
  .login-brand-m .lbg-text span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
  .login-card { margin: 0 auto; }
  .login-card .head-hide { display: none; }
  .apps { grid-template-columns: 1fr; }
  .main { padding: 18px 14px calc(env(safe-area-inset-bottom, 0px) + 34px); }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .topbar-title strong { font-size: 14px; }
  .user-chip .u-meta { display: none; }
  .user-chip { padding: 3px; background: rgba(255, 255, 255, .12); }
  .page-head h2 { font-size: 19px; }
}
@media (max-width: 420px) {
  .login-visual { padding: 7vh 7vw; }
  .login-visual h1.login-title { font-size: 24px; }
  .login-visual h1.login-title::after { margin-top: 14px; }
}
