/* ============================================================
   激光打标管理系统 · 样式
   视觉规范对齐公司 CITOTEST CRM 数据驾驶舱：
     - 浅蓝灰画布 + 白色顶栏 + 左侧分组导航
     - 主色 #2f66e8，细边框、小圆角、几乎无重投影
     - 表格紧凑、表头浅底、字号 12–13px
   字体与图标全部本地化，内网/车间无 CDN 也能用。
   ============================================================ */

:root {
  --op-canvas: #f4f6f8;
  --op-sidebar: #ffffff;
  --op-panel: #ffffff;
  --op-border: #e1e6ec;
  --op-ink: #243247;
  --op-muted: #627085;
  --op-primary: #245fbd;
  --op-primary-soft: #e9efff;
  --op-success: #12805c;
  --op-warn: #b3730c;
  --op-danger: #c0392b;
  --op-header-height: 72px;
  --op-sidebar-width: 216px;
  --op-radius: 6px;
  --op-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --op-mono: "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }

html { background: var(--op-canvas); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--op-ink);
  background: var(--op-canvas);
  font-family: var(--op-sans);
  font-size: 13px;
  line-height: 1.5;
}

a { color: var(--op-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 顶栏 ----------------
   对齐 CRM：浅色底 + 品牌图 + 大写小字模块名 + 页面标题，
   右侧一排浅底描边按钮，最后是纯文字用户名。 */
.topbar {
  position: sticky; top: 0; z-index: 110;
  height: var(--op-header-height);
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px;
  background: var(--op-canvas);
  border-bottom: 1px solid #d7e1ef;
}
.topbar__brand {
  min-width: 0; flex: 0 1 auto;
  display: flex; align-items: center; gap: 14px;
  color: var(--op-ink); text-decoration: none;
}
.topbar__brand:hover { text-decoration: none; }
.topbar__brandlogo {
  display: block; width: 108px; height: 28px; flex: 0 0 108px;
  object-fit: contain; object-position: left center;
}
.topbar__heading { min-width: 0; display: grid; gap: 3px; }
.topbar__heading small {
  overflow: hidden; color: #6f81a0; font-size: 11px; font-weight: 800;
  line-height: 1; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__heading strong {
  overflow: hidden; color: #172c49; font-size: 21px; font-weight: 800;
  line-height: 1.15; text-overflow: ellipsis; white-space: nowrap;
}
.topbar__utility {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px; margin-left: auto;
}
.topbar__time {
  display: inline-flex; align-items: center; gap: 5px;
  color: #627492; font-size: 13px; white-space: nowrap;
}
.topbar__action {
  min-height: 34px; display: inline-flex; align-items: center; justify-content: center;
  gap: 5px; padding: 0 13px;
  border: 1px solid #d5deed; border-radius: 6px;
  color: #355073; background: #f5f8fd;
  font-size: 13px; font-weight: 600; line-height: 1;
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.topbar__action:hover {
  border-color: #bfcce0; color: var(--op-primary); background: #fff;
  text-decoration: none;
}
.topbar__logout:hover { border-color: #eec9c4; color: var(--op-danger); background: #fff5f6; }
.topbar__muted { cursor: default; }
.topbar__muted:hover { border-color: #d5deed; color: #355073; background: #f5f8fd; }
.topbar__username {
  min-width: 42px; color: #627492; font-size: 13px;
  text-align: center; white-space: nowrap;
}
.topbar__menu { display: none; }

/* ---------------- 左侧导航 ---------------- */
.side-nav {
  position: fixed; top: var(--op-header-height); bottom: 0; left: 0;
  width: var(--op-sidebar-width); overflow-y: auto;
  padding: 14px 12px 20px;
  background: var(--op-sidebar);
  border-right: 1px solid #d7e1ef;
}
.side-nav__switch { display: flex; gap: 4px; padding: 0 5px 14px; border-bottom: 1px solid #d6e0ee; }
.side-nav__switch button {
  flex: 1; min-height: 30px; border: 0; border-radius: 4px;
  background: transparent; color: #71819a; font: inherit; font-size: 12px; cursor: pointer;
}
.side-nav__switch button.is-active { color: var(--op-ink); background: #d7e0f1; font-weight: 700; }
.side-nav__group { margin-top: 13px; }
.side-nav__group:first-child { margin-top: 0; }
.side-nav__label {
  padding: 0 10px 6px; color: #8997aa;
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
}
.side-nav__link {
  display: flex; align-items: center; gap: 10px;
  min-height: 38px; margin: 2px 0; padding: 0 10px;
  border-radius: 5px; color: #53647d;
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.side-nav__link i { width: 15px; color: #6f83a1; text-align: center; font-size: 13px; }
.side-nav__link:hover { color: var(--op-primary); background: rgba(255, 255, 255, .55); text-decoration: none; }
.side-nav__link.is-active { color: #244eaa; background: #fff; box-shadow: 0 1px 3px rgba(56, 78, 112, .08); }
.side-nav__link.is-active i { color: var(--op-primary); }

/* ---------------- 面包屑 ---------------- */
.crumb {
  height: 42px; margin-left: var(--op-sidebar-width);
  padding: 0 24px; display: flex; align-items: center; gap: 9px;
  color: var(--op-muted); background: #fff;
  border-bottom: 1px solid #e4eaf3; font-size: 12px;
}
.crumb i { color: #aeb9c9; font-size: 10px; }
.crumb strong { color: var(--op-primary); font-weight: 700; }

/* ---------------- 主内容 ---------------- */
.main {
  margin-left: var(--op-sidebar-width);
  min-height: calc(100vh - var(--op-header-height) - 42px);
  padding: 22px 24px 34px;
}

/* 页面标题区（对齐 CRM 数据驾驶舱的问候语层级） */
.page-greeting {
  margin: 0 0 4px;
  color: #172c49;
  font-size: 25px; font-weight: 650; line-height: 1.15; letter-spacing: -.025em;
}
.page-sub {
  margin: 0 0 18px;
  color: var(--op-muted); font-size: 13.5px;
}
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 18px;
}
.page-head .page-greeting, .page-head .page-sub { margin-bottom: 0; }
.page-head__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--op-panel);
  border: 1px solid var(--op-border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(38, 57, 85, .04);
  margin-bottom: 16px;
  overflow: hidden;
}
.card__head {
  min-height: 50px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid #e8eef7;
  background: #fff;
  flex-wrap: wrap;
}
.card__head h2 {
  margin: 0; color: #172c49; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.card__head h2 i { color: var(--op-primary); font-size: 13px; }
.card__body { padding: 16px; }
.card__body--flush { padding: 0; }

/* ---------------- KPI ---------------- */
.kpi-bar {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 16px;
}
.kpi {
  position: relative; overflow: hidden;
  padding: 14px 16px 14px 20px;
  background: #fff;
  border: 1px solid var(--op-border);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(38, 57, 85, .04);
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 100%;
  background: var(--op-primary);
}
.kpi:nth-child(2)::before { background: #4a8ef0; }
.kpi:nth-child(3)::before { background: #12a3a3; }
.kpi:nth-child(4)::before { background: #8a6ee0; }
.kpi__label { color: var(--op-muted); font-size: 12px; font-weight: 600; }
.kpi__value {
  margin-top: 5px; color: #172c49; font-size: 25px; font-weight: 650;
  font-family: var(--op-mono); font-variant-numeric: tabular-nums; line-height: 1.15;
}
.kpi__unit { margin-left: 4px; color: var(--op-muted); font-size: 13px; font-weight: 600; }
.kpi__hint { margin-top: 3px; color: var(--op-muted); font-size: 11px; }
.kpi--live .kpi__value { color: #0f8a7a; }
.kpi--live.is-stale .kpi__value { color: var(--op-danger); }
/* 还没有数据时不要摆一个 26px 的彩色破折号，像坏了 */
.kpi__value.is-empty { color: #bcc8d6; font-weight: 700; }
.kpi--live .kpi__value.is-empty { color: #bcc8d6; }

/* 固定四列：混排时 auto-fit 会排成 5+3 两行不等宽，很散 */
.kpi-bar--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------------- 工艺值面板（一组相关指标） ---------------- */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { padding: 2px 20px; border-left: 1px solid #eef3f9; min-width: 0; }
.metric:first-child { border-left: 0; padding-left: 0; }
.metric__label {
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
  color: var(--op-muted); font-size: 12px; font-weight: 600;
}
.metric__addr {
  font-family: var(--op-mono); font-size: 10.5px; font-weight: 600;
  color: #9fb0c4; letter-spacing: .02em;
}
.metric__value {
  margin-top: 7px; display: flex; align-items: baseline; gap: 4px;
  line-height: 1.1; min-height: 26px;
}
.metric__num {
  font-family: var(--op-mono); font-variant-numeric: tabular-nums;
  font-size: 23px; font-weight: 800; color: #0f8a7a;
}
.metric__num.is-empty { color: #bcc8d6; font-weight: 700; }
.metric__unit { color: var(--op-muted); font-size: 12px; font-weight: 600; }
.card__note { color: var(--op-muted); font-size: 11.5px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow: auto; max-height: 72vh; }
table.data-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 12px;
}
table.data-table th {
  position: sticky; top: 0; z-index: 3;
  padding: 8px 10px;
  background: #eaf2f8; color: #35536e;
  border-bottom: 1px solid var(--op-border);
  font-weight: 700; letter-spacing: .015em; text-align: left; white-space: nowrap;
}
table.data-table td {
  padding: 6px 10px;
  line-height: 1.5;
  border-bottom: 1px solid #eef3f9;
  color: #334d63; white-space: nowrap;
}
table.data-table tbody tr:nth-child(even) td { background: #fbfdff; }
table.data-table tbody tr:hover td { background: #f2f7fd; }
table.data-table th:first-child, table.data-table td:first-child {
  position: sticky; left: 0; z-index: 2; background: #fff;
  box-shadow: inset -1px 0 0 #e8eef6;
}
table.data-table th:first-child { z-index: 4; background: #e4eef6; }
.num, td.num, .mono { font-family: var(--op-mono); font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.empty { padding: 36px 20px; text-align: center; color: var(--op-muted); font-size: 13px; }

/* ---------------- 标签 ---------------- */
.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 3px; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge--ok { color: var(--op-success); background: #e6f5ef; }
.badge--calib { color: #244eaa; background: var(--op-primary-soft); }
.badge--measured { color: var(--op-warn); background: #fdf3e2; }
.badge--void { color: var(--op-danger); background: #fdecea; }
.badge--type { color: #35536e; background: #eaf2f8; }

/* ---------------- 表单 ---------------- */
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { color: #48627a; font-size: 12px; font-weight: 600; }
.field .req { color: var(--op-danger); }
.field--wide { grid-column: 1 / -1; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  font: inherit; font-size: 13px; width: 100%;
  padding: 7px 10px; min-height: 34px;
  color: var(--op-ink); background: #fff;
  border: 1px solid var(--op-border); border-radius: var(--op-radius);
}
textarea { min-height: 68px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--op-primary);
  box-shadow: 0 0 0 3px rgba(47, 102, 232, .12);
}
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 15px;
  border: 1px solid var(--op-primary); border-radius: var(--op-radius);
  background: var(--op-primary); color: #fff;
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn--ghost { background: #f6f8fc; color: #42536b; border-color: var(--op-border); }
.btn--ghost:hover { background: #fff; border-color: #bfcce0; color: var(--op-primary); }
.btn--danger { background: #fff; color: var(--op-danger); border-color: #eec9c4; }
.btn--danger:hover { background: #fdecea; }
.btn--sm { min-height: 28px; padding: 0 10px; font-size: 12px; }

.toolbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.toolbar .field { min-width: 190px; }

/* ---------------- 提示 ---------------- */
.flash { padding: 10px 15px; border-radius: var(--op-radius); margin-bottom: 14px; font-size: 13px; border: 1px solid; }
.flash--ok { color: #0d5c45; background: #e9f7f2; border-color: #c9e9de; }
.flash--error { color: #8a3226; background: #fdecea; border-color: #f2d2cd; }

.notice {
  padding: 12px 16px; margin-bottom: 16px;
  border-radius: var(--op-radius); border: 1px solid #f0e0bd;
  background: #fdf8ec; color: #7c5a12;
  font-size: 12.5px; line-height: 1.7;
}
.notice strong { color: #6b4d0d; }
.notice ul { margin: 7px 0 0; padding-left: 20px; }

/* dl 默认有 1em 上下外边距，会在卡片里撑出一大块空白 */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; margin: 0; font-size: 13px; }
.kv + .hint { margin-top: 14px; }
.kv dt { color: var(--op-muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--op-ink); }
.kv dd.mono { font-family: var(--op-mono); }

.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2 > .card { margin-bottom: 0; }
/* 强制两列：两块等高的状态卡片并排，避免 auto-fit 在宽屏下排成三列 */
.grid-2--tight { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1080px) { .grid-2--tight { grid-template-columns: 1fr; } }

/* ---------------- 证书打印 ---------------- */
.cert-sheet {
  max-width: 900px; margin: 0 auto 16px; padding: 32px 36px;
  background: #fff; border: 1px solid var(--op-border); border-radius: 8px;
  box-shadow: 0 1px 3px rgba(38, 57, 85, .06);
  color: #16324b;
}
.cert-sheet__formno { color: var(--op-muted); font-family: var(--op-mono); font-size: 11px; }
.cert-sheet__title {
  margin: 8px 0 22px; text-align: center;
  color: #172c49; font-size: 21px; font-weight: 800; letter-spacing: .09em;
}
.cert-sheet table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 12.5px; }
.cert-sheet th, .cert-sheet td { padding: 7px 10px; border: 1px solid #cfdce8; color: #23415c; text-align: left; }
.cert-sheet th { background: #f2f7fb; font-weight: 700; width: 22%; }
.cert-sheet .section-title { background: #e8f1f7; color: #172c49; font-weight: 700; letter-spacing: .03em; }
.cert-sheet .terms { color: #3c5a75; font-size: 11.5px; line-height: 1.75; }
.cert-sheet .sign-row { display: flex; gap: 20px; margin-top: 34px; font-size: 12px; flex-wrap: wrap; }
.cert-sheet .sign-row > div { flex: 1 1 180px; }
.cert-sheet .sign-row .line { margin-top: 30px; padding-top: 5px; border-top: 1px solid #8fa9bd; color: var(--op-muted); }
.cert-void { position: relative; }
.cert-void::after {
  content: "VOID"; position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(192, 57, 43, .15); font-size: 72px; font-weight: 900;
  letter-spacing: .12em; transform: rotate(-20deg); pointer-events: none;
}

/* ---------------- 公开查询 ---------------- */
.query-hero { max-width: 620px; margin: 44px auto 22px; text-align: center; }
.query-hero h1 { margin: 0 0 8px; color: #172c49; font-size: 25px; font-weight: 650; letter-spacing: -.02em; }
.query-hero p { margin: 0 0 20px; color: var(--op-muted); font-size: 13.5px; }
.query-form { display: flex; gap: 10px; }
.query-form input {
  flex: 1 1 auto; min-height: 44px; text-align: center;
  font-family: var(--op-mono); font-size: 15px; letter-spacing: .08em;
}

.footer { padding: 20px 24px; color: var(--op-muted); font-size: 11.5px; text-align: center; }
.page-public .footer { text-align: center; }

/* ---------------- 顶栏用户菜单 ---------------- */
.user-menu { position: relative; }
.user-menu__pop {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 200;
  min-width: 210px; padding: 6px;
  background: #fff; border: 1px solid var(--op-border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(38, 57, 85, .14);
}
.user-menu.is-open .user-menu__pop { display: block; }
.user-menu__head {
  padding: 8px 10px 10px; margin-bottom: 4px;
  border-bottom: 1px solid #eef3f9; display: grid; gap: 3px;
}
.user-menu__head strong { color: #172c49; font-size: 13px; }
.user-menu__head span { color: var(--op-muted); font-size: 11px; }
.user-menu__pop a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 5px;
  color: #42536b; font-size: 13px; font-weight: 600;
}
.user-menu__pop a:hover { background: #f2f7fd; color: var(--op-primary); text-decoration: none; }
.user-menu__pop a i { width: 14px; color: #7b8ba3; text-align: center; }
.user-menu__pop a.user-menu__out:hover { background: #fdecea; color: var(--op-danger); }

/* ---------------- 登录页 ---------------- */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 3fr) minmax(390px, 1fr); }
.login-visual {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, #dbe8f8 0%, #cfe0f5 45%, #c3d8f2 100%);
}
.login-visual::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(226, 237, 250, .06) 45%, rgba(226, 237, 250, .55) 100%);
}
.visual-brand {
  position: absolute; z-index: 1; top: 30px; left: 34px;
  display: flex; align-items: center; gap: 12px;
  color: #24405f; font-size: 15px; font-weight: 700;
}
.visual-brand .topbar__logo { width: 34px; height: 34px; flex: 0 0 34px; }
.visual-caption { position: absolute; z-index: 1; left: 38px; bottom: 40px; max-width: 470px; color: #38557e; }
.visual-caption strong { display: block; font-size: 17px; font-weight: 700; }
.visual-caption p { margin: 8px 0 0; color: #6b84a6; font-size: 13px; line-height: 1.7; }
.login-side {
  min-height: 100vh; padding: 26px clamp(30px, 4vw, 68px) 22px;
  display: flex; flex-direction: column; background: #fff;
}
.side-meta {
  display: flex; justify-content: flex-end; min-height: 22px;
  color: #8290a4; font-size: 12px; font-family: var(--op-mono);
}
.login-main { width: min(100%, 396px); margin: auto; padding: 28px 0 40px; }
.login-kicker {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 18px; color: #7588a5; font-size: 14px;
}
.login-kicker i { color: var(--op-primary); }
.login-main h1 { margin: 0; color: #24344d; font-size: 27px; font-weight: 800; }
.login-main > p { margin: 10px 0 34px; color: var(--op-muted); font-size: 14px; }
.login-main .field { margin-bottom: 18px; }
.login-main .field label { display: block; margin-bottom: 7px; color: #52637b; font-size: 13px; font-weight: 600; }
.input-wrap { position: relative; }
.input-wrap > i {
  position: absolute; top: 50%; left: 13px; transform: translateY(-50%);
  color: #8a9ab1; font-size: 13px; pointer-events: none;
}
.login-main .input-wrap input {
  height: 46px; padding-left: 40px;
  background: #f7f9fc; border-color: var(--op-border);
}
.login-main .input-wrap input:focus { background: #fff; }
.login-btn {
  width: 100%; height: 46px; margin-top: 6px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--op-primary); border-radius: var(--op-radius);
  background: var(--op-primary); color: #fff;
  font: 600 15px var(--op-sans); cursor: pointer;
}
.login-btn:hover { background: #2458d3; box-shadow: 0 5px 12px rgba(47, 102, 232, .2); }
.login-alt { margin-top: 20px; padding-top: 18px; border-top: 1px solid #eef3f9; text-align: center; }
.login-alt a { color: var(--op-muted); font-size: 13px; }
.login-alt a:hover { color: var(--op-primary); text-decoration: none; }
.login-footer { margin-top: auto; padding-top: 18px; color: #9aa7b8; font-size: 11px; text-align: center; }

/* ---------------- 权限勾选 ---------------- */
/* 权限勾选网格在下面「弹窗式编辑器」一节统一定义 */
.perm-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px; cursor: pointer;
  border: 1px solid var(--op-border); border-radius: var(--op-radius);
  background: #fbfdff;
}
.perm-item:hover { border-color: #bfcce0; background: #fff; }
.perm-item input { margin: 3px 0 0; width: 15px; height: 15px; flex: 0 0 15px; cursor: pointer; }
.perm-item span { display: grid; gap: 3px; }
.perm-item strong { color: #24344d; font-size: 13px; }
.perm-item em { color: var(--op-muted); font-size: 11.5px; font-style: normal; line-height: 1.5; }
.perm-item--danger { border-color: #eec9c4; background: #fffafa; }
.perm-item--danger strong { color: var(--op-danger); }
.perm-item input:checked ~ span strong { color: var(--op-primary); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1000px) {
  .side-nav { transform: translateX(-100%); }
  .crumb, .main { margin-left: 0; }
  .side-nav.is-open { transform: none; box-shadow: 4px 0 16px rgba(38, 57, 85, .14); }
  .topbar__menu { display: inline-flex !important; }
}
@media (max-width: 700px) {
  .topbar { height: auto; min-height: 58px; padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .topbar__heading strong { font-size: 17px; }
  .topbar__time { display: none; }
  .main { padding: 14px 12px 28px; }
  .kpi-bar, .kpi-bar--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .metric:nth-child(odd) { border-left: 0; padding-left: 0; }
  .kpi__value { font-size: 21px; }
  table.data-table { font-size: 11px; }
  .cert-sheet { padding: 20px 16px; }
}
.topbar__menu { display: none; }

@media print {
  .topbar, .side-nav, .crumb, .footer, .no-print { display: none !important; }
  body { background: #fff; }
  .main { margin-left: 0; padding: 0; }
  .cert-sheet { border: 0; box-shadow: none; padding: 0; max-width: none; }
}

/* ============================================================
   弹窗式编辑器（用户管理）
   布局对齐 CRM 用户管理：遮罩 + 居中面板，
   基本信息两列，权限按分组每行三列勾选。
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 6000;
  display: none; align-items: center; justify-content: center; padding: 20px;
  background: rgba(25, 42, 66, .38);
}
.overlay.open { display: flex; }

.editor {
  width: min(1000px, 100%); max-height: 90vh;
  display: flex; flex-direction: column;
  background: #fff; border-radius: 6px;
  box-shadow: 0 24px 70px rgba(28, 45, 70, .24);
}
.editor-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; border-bottom: 1px solid #e4eaf2;
}
.editor-head strong { font-size: 16px; color: #172c49; }
.editor-head span { color: #7b8ba0; font-size: 12px; }
.editor-head .btn:first-of-type { margin-left: auto; }
.editor-body { overflow: auto; padding: 20px; }

/* 基本信息：两列 */
.editor-body .form-grid { grid-template-columns: 1fr 1fr; }
.editor-body .field { margin-bottom: 0; }
.editor-body .field label {
  display: block; margin-bottom: 7px;
  color: #536780; font-size: 12px; font-weight: 700;
}
.editor-body .field input,
.editor-body .field select { width: 100%; }

/* 分区 */
.section { margin-top: 24px; padding-top: 18px; border-top: 1px solid #e5ebf3; }
.section h3 { margin: 0 0 8px; font-size: 14px; color: #172c49; }
.hint { margin: 0 0 12px; color: #7b8ba0; font-size: 12px; line-height: 1.7; }
.hint b { color: #3c5a75; font-weight: 700; }

/* 权限勾选：每行三列 */
/* 固定三列，与 CRM 一致；项目少的分组也占满三列宽度，视觉整齐 */
.perm-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.choice {
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 8px 11px;
  border: 1px solid #dce5ef; border-radius: 4px; background: #fbfcfe;
  cursor: pointer; font-size: 13px; color: #24344d;
}
.choice:hover { border-color: #bfcce0; background: #fff; }
.choice input {
  width: auto; height: auto; min-height: auto; flex: 0 0 auto;
  margin: 0; cursor: pointer;
}
.choice:has(input:checked) { border-color: #9dbdf5; background: #f3f7fe; color: var(--op-primary); }
.choice--danger:has(input:checked) { border-color: #eec9c4; background: #fff5f6; color: var(--op-danger); }

.row-actions { display: flex; gap: 6px; }

@media (max-width: 900px) {
  .editor-body .form-grid { grid-template-columns: 1fr; }
  .perm-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .editor { max-height: 95vh; }
  .editor-body { padding: 14px; }
}

/* Production workspace: shared layout, controls and responsive behavior. */
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #3974d0; outline-offset: 3px; }
.main:focus { outline: none; }
button, input, select, textarea { font-family: inherit; }
button:disabled, .btn:disabled { opacity: .55; cursor: wait; }
input, select, textarea { min-width: 0; }
input::placeholder, textarea::placeholder { color: #8290a0; }
input:disabled, select:disabled { background: #f2f4f7; color: #657080; }
.skip-link { position: fixed; left: 16px; top: -100px; z-index: 9999; padding: 12px 20px; background: #fff; border: 2px solid var(--op-primary); }
.skip-link:focus { top: 12px; }
.topbar { background: #fff; padding: 0 26px; gap: 20px; border-bottom-color: var(--op-border); }
.topbar__brand { gap: 22px; }
.topbar__heading { padding-left: 22px; border-left: 1px solid var(--op-border); gap: 5px; }
.topbar__heading strong { font-size: 17px; font-weight: 650; }
.topbar__heading small { font-size: 11px; font-weight: 400; color: var(--op-muted); }
.topbar__time { margin-right: 12px; font-size: 12px; }
.topbar__action { background: #fff; font-weight: 500; min-height: 36px; }
.account-menu { position: relative; margin-left: 8px; }
.account-menu summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 9px; padding: 4px; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu summary > i { font-size: 10px; color: #68778c; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #eaf0f7; display: grid; place-items: center; font-weight: 600; color: #426184; }
.account-menu__panel { position: absolute; right: 0; top: 44px; min-width: 190px; padding: 10px; border: 1px solid var(--op-border); border-radius: 8px; background: #fff; box-shadow: 0 8px 24px #1d304418; }
.account-menu__panel a { display: block; padding: 10px; color: var(--op-ink); border-radius: 4px; }
.account-menu__panel a:hover { background: #f1f5fa; text-decoration: none; }
.account-menu__panel .section-note { display: block; padding: 4px 10px 10px; border-bottom: 1px solid var(--op-border); }
.side-nav { padding: 22px 12px 110px; z-index: 120; border-right-color: var(--op-border); }
.side-nav__group { margin: 0 0 26px; }
.side-nav__label { color: #7d8998; font-size: 11px; letter-spacing: 0; font-weight: 500; padding: 0 14px 8px; }
.side-nav__link { min-height: 42px; padding: 0 14px; margin: 3px 0; font-size: 13px; font-weight: 500; color: #526174; }
.side-nav__link i { color: #778498; font-size: 14px; width: 18px; }
.side-nav__link:hover { background: #f4f6f9; }
.side-nav__link.is-active { background: #eaf1fc; color: #2158a9; box-shadow: none; font-weight: 600; }
.side-nav__foot { position: absolute; bottom: 22px; left: 24px; right: 24px; padding-top: 18px; border-top: 1px solid var(--op-border); color: #5e6d80; font-size: 12px; }
.side-nav__foot small { display: block; margin: 6px 0 0 12px; font-size: 11px; color: #7c8999; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #72839b; margin-right: 4px; vertical-align: middle; }
.crumb { background: transparent; border: 0; height: 44px; padding: 0 30px; font-size: 12px; }
.crumb strong { font-weight: 500; color: #556476; }
.crumb i { font-size: 8px; }
.main { padding: 8px 30px 36px; min-height: calc(100vh - 160px); }
.page-head, .page-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .page-sub { margin-top: 8px; }
.page-sub, .section-note { color: var(--op-muted); font-size: 13px; line-height: 1.7; }
.page-greeting { font-size: 25px; font-weight: 650; letter-spacing: 0; line-height: 1.35; }
.card { border-radius: 8px; box-shadow: 0 1px 2px #24324703; margin-bottom: 20px; min-width: 0; }
.card__head { min-height: 58px; padding: 12px 20px; border-color: #e9edf1; }
.card__head h2 { font-size: 14px; font-weight: 600; }
.card__head h2 i { color: #738399; }
.card__body { padding: 20px; }
.card__body--flush { padding: 0; }
.kpi-bar { gap: 16px; margin-bottom: 20px; }
.kpi { padding: 20px; border-radius: 8px; box-shadow: none; }
.kpi::before { display: none; }
.kpi__label { font-size: 13px; font-weight: 400; color: #617084; }
.kpi__value { margin-top: 12px; font-size: 30px; font-weight: 600; font-family: var(--op-sans); }
.kpi__hint { margin-top: 10px; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.kpi--live .kpi__value { color: #244e7a; }
.kpi--live.is-stale .kpi__value { color: #7a8593; }
.metric { padding: 4px 24px; }
.metric__num { color: #283c55; font-size: 26px; font-weight: 600; }
.metric__addr { display: none; }
.metric__label { font-weight: 400; font-size: 13px; }
.metric__value { margin-top: 12px; }
.grid-2 { gap: 20px; margin-bottom: 20px; }
.grid-2 > * { min-width: 0; }
.btn { min-height: 38px; padding: 0 16px; justify-content: center; font-weight: 500; transition: background .15s, border-color .15s; }
.btn:hover { filter: none; background: #1d50a2; border-color: #1d50a2; }
.btn--ghost { background: #fff; }
.btn--ghost:hover { background: #f3f6fa; border-color: #b5c4d7; }
.btn--danger:hover { background: #fff1ef; border-color: #ce837b; }
.btn--sm { min-height: 30px; padding: 0 10px; font-size: 12px; }
.btn--text { border: 0; color: var(--op-primary); background: transparent; }
.btn--text:hover { background: #eef3fa; }
.toolbar .field { flex: 1; min-width: 180px; max-width: 360px; }
.toolbar .field label { font-size: 12px; }
.field label { font-size: 13px; color: #46576a; font-weight: 500; }
.field input:not([type=checkbox]):not([type=radio]), .field select { min-height: 40px; }
.field__hint { color: #68778b; font-size: 12px; line-height: 1.6; }
.form-grid { gap: 20px; }
.form-actions { padding-top: 18px; border-top: 1px solid #edf0f4; margin-top: 24px; }
.table-wrap { overscroll-behavior: contain; }
table.data-table { font-size: 13px; }
table.data-table th { padding: 12px 16px; background: #f7f9fb; color: #5c6a7d; font-weight: 500; letter-spacing: 0; }
table.data-table td { padding: 12px 16px; border-bottom-color: #edf0f4; color: #344358; }
table.data-table th:first-child { background: #f7f9fb; box-shadow: none; }
table.data-table td:first-child { box-shadow: none; }
table.data-table tbody tr:nth-child(even) td { background: #fff; }
table.data-table tbody tr:hover td { background: #f5f8fc; }
table.data-table .right { text-align: right; }
table.data-table tbody tr:last-child td { border-bottom: 0; }
.cell-secondary { display: block; margin-top: 3px; font-size: 11px; color: #7c8898; }
.table-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--op-border); color: var(--op-muted); font-size: 12px; }
.table-pages { display: flex; align-items: center; gap: 12px; }
.badge { font-size: 12px; font-weight: 500; border-radius: 4px; padding: 3px 8px; }
.empty, .empty-state { padding: 48px 24px; text-align: center; color: #66768a; }
.empty strong, .empty-state strong { display: block; margin-bottom: 8px; color: #3c4e65; font-size: 14px; font-weight: 500; }
.empty p, .empty-state p { margin: 8px 0 18px; }
.kv { grid-template-columns: minmax(100px, auto) minmax(0, 1fr); gap: 14px 22px; }
.kv dt { font-weight: 400; }
.kv dd { overflow-wrap: anywhere; }
.footer { margin-left: var(--op-sidebar-width); padding: 14px 30px 22px; text-align: left; color: #7b8796; }
.page-public .footer { margin-left: 0; text-align: center; }
.live-status { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 20px; border: 1px solid #dfe6ed; border-radius: 6px; background: #fff; color: #5c6b7d; }
.live-status strong { font-weight: 600; color: #354a63; }
.live-status.is-offline { border-color: #e4d6b8; background: #fffcf4; }
.live-status.is-offline strong { color: #886019; }
.live-status.is-online .status-dot { background: #278568; }
.live-status__action { margin-left: auto; }
.live-status__message { flex: 1; min-width: 160px; }
[data-live-error] { font-size: 12px; }
.details-card > summary { cursor: pointer; padding: 18px 20px; font-weight: 500; color: #41566f; }
.details-card[open] > summary { border-bottom: 1px solid var(--op-border); }
.nav-scrim { position: fixed; inset: var(--op-header-height) 0 0; z-index: 115; border: 0; background: #17283a55; }
@media(min-width:1600px) { .main { padding-left: 40px; padding-right: 40px; } .crumb { padding-left: 40px; } }
@media(max-width:1200px) { .topbar__time { display: none; } .main { padding-left: 22px; padding-right: 22px; } }
@media(max-width:1000px) { .footer { margin-left: 0; } .side-nav { width: 240px; } .nav-open { overflow: hidden; } .topbar__menu { display: inline-flex; } }
@media(max-width:760px) {
  :root { --op-header-height: 64px; }
  .topbar { height: 64px; min-height: 64px; padding: 0 14px; flex-wrap: nowrap; gap: 10px; }
  .topbar__brand { gap: 0; }
  .topbar__brandlogo { width: 90px; height: 24px; flex-basis: 90px; }
  .topbar__heading { display: none; }
  .topbar__utility { gap: 4px; }
  .account-name { display: none; }
  .account-menu { margin-left: 2px; }
  .topbar__action { padding: 0 10px; font-size: 12px; }
  .crumb { padding: 0 16px; height: 40px; }
  .main { padding: 8px 16px 28px; }
  .page-greeting { font-size: 22px; }
  .page-head, .page-header { margin-bottom: 20px; align-items: flex-start; }
  .page-head__actions { width: 100%; }
  .grid-2, .grid-2--tight { grid-template-columns: minmax(0, 1fr); }
  .kpi-bar, .kpi-bar--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 16px; }
  .kpi__value { font-size: 25px; }
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 22px 0; }
  .metric { padding: 0 16px; }
  .metric:nth-child(odd) { padding-left: 0; border-left: 0; }
  .metric__num { font-size: 23px; }
  .card__head { padding: 14px 16px; }
  .card__body { padding: 16px; }
  .card__body--flush { padding: 0; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .toolbar .field { max-width: none; min-width: min(100%, 220px); }
  table.data-table { font-size: 12px; }
  table.data-table td, table.data-table th { padding: 11px 12px; }
  .kv { gap: 12px; grid-template-columns: 105px minmax(0,1fr); font-size: 12px; }
  .editor-head { flex-wrap: wrap; }
  .overlay { padding: 10px; }
  .live-status { align-items: flex-start; }
  .live-status__message { flex-basis: 65%; }
  .live-status__action { margin-left: 18px; }
  .footer { padding-left: 16px; }
}
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { .skip-link, .nav-scrim, .account-menu, .live-status { display:none !important; } .main { margin:0; padding:0; } .card { box-shadow:none; } }

/* Small-screen navigation and forms retain a predictable reading order. */
.side-nav { display: flex; flex-direction: column; padding-bottom: 22px; }
.side-nav__foot { position: static; margin: auto 12px 0; }
@media(max-width:1000px) { .side-nav { visibility: hidden; } .side-nav.is-open { visibility: visible; } }
@media(max-width:760px) { .toolbar .field { flex-basis: 100%; width: 100%; } }
