* { box-sizing: border-box; }
:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #e8efff;
  --green: #16a34a;
  --green-dark: #15803d;
  --green-soft: #dcfce7;
  --ink: #14232a;
  --muted: #7d8f95;
  --bg: #e3ecf5;
  --line: #dfe8f5;
}
body {
  margin: 0; min-height: 100vh; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: .5px; }
h2 { font-size: 18px; margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.muted { color: var(--muted); font-size: 12px; }

label { display: block; font-size: 13px; color: #4b5b60; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%; padding: 10px 11px; border: 1px solid #d7e2f2; border-radius: 8px; font-size: 14px; outline: none; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
button {
  border: 0; border-radius: 8px; padding: 10px 18px; font-size: 14px; cursor: pointer;
  background: var(--blue); color: #fff; transition: background .15s, transform .05s;
}
button:hover { background: var(--blue-dark); }
button:active { transform: translateY(1px); }
button.ghost { background: var(--green-soft); color: var(--green-dark); }
button.ghost:hover { background: #c7f5d4; }
button.danger { background: #ff4d4f; }
button:disabled { opacity: .6; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.err { color: #cf1322; font-size: 13px; min-height: 18px; margin-top: 8px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ---------- 登录页：左侧产品图 + 右侧表单 ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.25fr 1fr; }
.login-hero {
  position: relative; display: flex; align-items: center; padding: 56px 56px;
  background:
    radial-gradient(860px 440px at 94% 0%, rgba(22,163,74,.34), transparent 62%),
    radial-gradient(720px 420px at 0% 100%, rgba(37,99,235,.34), transparent 64%),
    linear-gradient(150deg, #c6e0fd 0%, #d2e8ff 46%, #c6f2d8 100%);
  overflow: hidden;
}
.hero-inner { position: relative; z-index: 1; color: #12283a; width: 100%; max-width: 680px; }
.hero-inner h1 { font-size: 38px; margin: 0 0 12px; letter-spacing: 1px; color: #07304f; }
.hero-inner p { margin: 0; font-size: 15px; color: #3f5a68; line-height: 1.9; }
.hero-shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 36px; }
.hero-shot {
  background: linear-gradient(180deg, #ffffff, #f5f9ff);
  border-radius: 16px; padding: 14px 14px 12px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  box-shadow: 0 14px 34px rgba(20,50,110,.12), inset 0 0 0 1px rgba(37,99,235,.10);
  transition: transform .2s;
}
.hero-shot:hover { transform: translateY(-4px); }
.hero-shot img { width: 100%; height: 200px; object-fit: contain; }
.hero-shot span { font-size: 13.5px; color: #17356b; letter-spacing: .5px; }

.login-side { display: flex; align-items: center; justify-content: center; padding: 40px 28px; background: #fff; border-left: 1px solid #eef4fc; }
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 26px; margin-bottom: 4px; }
.login-card .actions button { width: 100%; letter-spacing: 6px; }

/* ---------- 系统选择页 ---------- */
.portal { max-width: 1200px; margin: 0 auto; padding: 44px 26px 60px; }
.portal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 30px; flex-wrap: wrap; }
.portal-head h1 { font-size: 28px; }
.portal-head h1::after {
  content: ''; display: block; width: 64px; height: 4px; margin-top: 10px; border-radius: 2px;
  background: linear-gradient(90deg, var(--blue), var(--green));
}
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.sys-tile {
  background: #fff; border: 1px solid #b9cfe8; border-radius: 18px; overflow: hidden; text-decoration: none; color: var(--ink);
  box-shadow: 0 10px 30px rgba(20,50,110,.07); transition: transform .2s, box-shadow .2s, border-color .2s;
  display: flex; flex-direction: column;
}
.sys-tile:hover { transform: translateY(-5px); box-shadow: 0 22px 46px rgba(20,50,110,.16); border-color: #93c5fd; }
.tile-img {
  height: 210px; background: linear-gradient(160deg, #f8fbff, #edf4ff);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.tile-img img { width: 100%; height: 100%; object-fit: contain; padding: 18px; transition: transform .25s; }
.sys-tile:hover .tile-img img { transform: scale(1.04); }
.tile-body { padding: 16px 20px 20px; border-top: 1px solid #eef4fc; }
.tile-body b { display: block; font-size: 18px; margin-bottom: 6px; color: #123a6b; }
.tile-body span { color: var(--muted); font-size: 12.5px; letter-spacing: .3px; }
.portal-foot { margin-top: 28px; color: var(--muted); font-size: 12.5px; }

/* ---------- 管理页（用户/主数据） ---------- */
.center { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 32px 24px; }
.card { background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(20,50,110,.08); padding: 28px; width: 100%; max-width: 420px; }
.card.wide { max-width: 1180px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 16px; }
.topbar .who { font-size: 13px; color: #5c6f73; }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button { background: var(--blue-soft); color: #1c3f7a; }
.tabs button.on { background: var(--blue); color: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border: 1px solid #e9f0f9; padding: 8px 9px; text-align: left; vertical-align: top; }
th { background: #f4f8ff; font-weight: 600; color: #1c3f7a; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; background: var(--green-soft); color: var(--green-dark); font-size: 12px; margin: 1px; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
.checks label { display: inline-flex; gap: 6px; align-items: center; margin: 0; font-size: 13px; }
.checks input { width: auto; }
.modal-mask { position: fixed; inset: 0; background: rgba(8,28,60,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.modal { background: #fff; border-radius: 14px; padding: 22px; width: 100%; max-width: 620px; max-height: 90vh; overflow: auto; }

/* ---------- 备案信息 ---------- */
.beian { margin-top: 22px; padding-top: 14px; border-top: 1px solid #eef4fc; text-align: center; font-size: 12px; color: #93a6a8; line-height: 2; }
.beian a { color: #93a6a8; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; margin: 0 4px; }
.beian a:hover { color: var(--blue); }
.beian img { width: 14px; height: 14px; }

@media (max-width: 1100px) {
  .hero-shot img { height: 160px; }
}
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 24px; }
  .hero-inner h1 { font-size: 26px; }
  .hero-shot img { height: 130px; }
  .login-side { padding: 28px 20px 40px; }
  .tile-img { height: 180px; }
}

/* 按系统分组的权限勾选 */
.sys-perms { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.sys-perm { border: 1px solid #e2ecf7; border-radius: 10px; padding: 10px 12px; background: #fafcff; }
.sys-perm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sys-perm-head label { margin: 0; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.perm-grid label { display: inline-flex; gap: 6px; align-items: flex-start; margin: 0; font-size: 12.5px; line-height: 1.5; color: #445; }
.perm-grid input { width: auto; margin-top: 2px; }
button.tiny { padding: 2px 8px; font-size: 12px; border-radius: 6px; }
@media (max-width: 640px) { .perm-grid { grid-template-columns: 1fr; } }

/* 权限分类块 */
.perm-group { margin-bottom: 8px; }
.perm-group-title { font-size: 12.5px; font-weight: 600; color: #2a4c7a; margin-bottom: 4px; }
.perm-umbrella { display: block; margin: 0 0 6px; font-size: 12.5px; color: #445; }
.perm-umbrella .muted { font-size: 12px; }

/* 用户列表：紧凑行高与操作按钮 */
.users-table td, .users-table th { padding: 4px 8px; }
.users-table td button { padding: 3px 9px; font-size: 12px; border-radius: 6px; line-height: 1.4; }
.users-table td button + button { margin-left: 6px; }

/* 主数据编辑弹窗 */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 14px; }
.form-grid label { margin-top: 2px; }
.comp-row { display: flex; gap: 8px; margin-bottom: 6px; }
.comp-row .comp-el { flex: 2; }
.comp-row .comp-ratio { flex: 1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr 1fr; } }

/* 主数据页：紧凑按钮与行高 */
.card.compact button { padding: 4px 11px; font-size: 12.5px; border-radius: 7px; line-height: 1.5; }
.card.compact .tabs button { padding: 4px 14px; }
.master-table td, .master-table th { padding: 4px 8px; }
.master-table td button { padding: 2px 8px; font-size: 12px; line-height: 1.4; }
.master-table td button + button { margin-left: 6px; }

/* 主料/辅料标签区分 */
.tag.main-tag { background: #e8f0ff; color: #1d4ed8; }
.tag.aux-tag { background: #fff4e6; color: #b45309; }

/* 自动计算的不含税价展示 */
.auto-val { padding: 10px 11px; border: 1px dashed #d7e2f2; border-radius: 8px; background: #f7faff; color: #4b5b60; }

/* 预演下发明细 */
.diff-list { max-height: 260px; overflow: auto; margin: 6px 0 0 18px; padding: 0; list-style: none; font-size: 12.5px; line-height: 1.9; }
.diff-list li { border-bottom: 1px dashed #eef2f8; padding: 1px 0; }

/* 分系统价 */
.sys-price-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.sys-price-row { display: grid; grid-template-columns: 70px 1fr 1fr 60px; gap: 8px; align-items: center; }
.sys-price-row .sys-name { font-size: 13px; color: #2a4c7a; font-weight: 600; }
.sys-price-row input { padding: 6px 8px; }

/* 金额大写 */
.amount-upper { font-size: 12px; color: #8a90a0; margin-top: 4px; letter-spacing: .5px; }

/* 主数据页加宽 */
.card.full { max-width: 1560px; }
