/* =========================================================
   食安智控 · 校园食品安全管理系统
   Design system & application styles
   ========================================================= */

:root {
  --bg: #f3f6f4;
  --bg-strong: #edf2ef;
  --surface: #ffffff;
  --surface-soft: #f8fbf9;
  --surface-tint: #eef7f3;
  --ink: #142a24;
  --ink-2: #344b44;
  --muted: #6b7d76;
  --muted-2: #93a39d;
  --line: #e1e9e4;
  --line-strong: #d2ded8;
  --brand: #0f766e;
  --brand-dark: #0b5f59;
  --brand-deep: #08211e;
  --brand-side: #0b2d28;
  --brand-soft: #e4f4ee;
  --brand-soft-2: #d3ede4;
  --mint: #a7f3d0;
  --lime: #8bc34a;
  --danger: #cb3d46;
  --danger-soft: #fcecee;
  --warn: #c47a0a;
  --warn-soft: #fdf3df;
  --ok: #16805d;
  --ok-soft: #e6f6ef;
  --blue: #3b6fca;
  --blue-soft: #edf3fd;
  --purple: #7b61c9;
  --purple-soft: #f2eefc;
  --risk-a: #c73b45;
  --risk-a-bg: #fcebed;
  --risk-b: #b97808;
  --risk-b-bg: #fdf3df;
  --risk-c: #0f766e;
  --risk-c-bg: #e6f5f0;
  --shadow-xs: 0 1px 2px rgba(15, 45, 36, .04);
  --shadow-sm: 0 2px 8px rgba(15, 45, 36, .05);
  --shadow-md: 0 12px 32px rgba(15, 45, 36, .08);
  --shadow-lg: 0 24px 60px rgba(9, 35, 28, .16);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --sidebar-w: 258px;
  --topbar-h: 74px;
  /* 全局字号倍率：所有 font-size 都乘以它，由「系统设置 → 显示与字号」调整 */
  --fs: 1.3;
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Consolas", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  font-family: var(--font);
  font-size: calc(14px * var(--fs));
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 78% -18%, rgba(15, 118, 110, .07), transparent 60%),
    radial-gradient(700px 450px at 18% 108%, rgba(139, 195, 74, .055), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll { overflow: hidden; }

button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
img { max-width: 100%; }
::selection { background: var(--brand-soft-2); color: var(--brand-deep); }

:focus-visible {
  outline: 2px solid rgba(15, 118, 110, .55);
  outline-offset: 2px;
}

/* =========================
   App shell
   ========================= */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  color: rgba(234, 247, 242, .78);
  background:
    radial-gradient(circle at 15% -5%, rgba(45, 212, 191, .18), transparent 36%),
    radial-gradient(circle at 100% 70%, rgba(139, 195, 74, .07), transparent 42%),
    linear-gradient(170deg, #103a33 0%, var(--brand-side) 46%, #071f1b 100%);
  border-right: 1px solid rgba(255, 255, 255, .06);
  overflow: hidden;
}

.sidebar::after {
  content: "";
  position: absolute;
  left: -80px;
  bottom: 80px;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(167, 243, 208, .08);
  border-radius: 50%;
  pointer-events: none;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 23px 22px 19px;
  color: #fff;
  z-index: 1;
}

.brand-mark {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  display: grid;
  place-items: center;
  color: #d9fff2;
  border: 1px solid rgba(167, 243, 208, .34);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(45, 212, 191, .23), rgba(45, 212, 191, .07));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 8px 24px rgba(0, 0, 0, .12);
}
.brand-mark svg { width: 28px; height: 28px; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong { font-size: calc(15px * var(--fs)); letter-spacing: .03em; font-weight: 700; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-copy small { margin-top: 3px; font-size: calc(8.5px * var(--fs)); letter-spacing: .04em; color: rgba(198, 235, 224, .62); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-body { flex: 1; overflow-y: auto; padding: 8px 14px 12px; scrollbar-width: none; }
.sidebar-body::-webkit-scrollbar { display: none; }

.nav-section-label {
  padding: 10px 12px 7px;
  font-size: calc(10px * var(--fs));
  font-weight: 600;
  letter-spacing: .16em;
  color: rgba(194, 229, 219, .42);
  text-transform: uppercase;
}
.nav-section-gap { margin-top: 20px; }

.side-nav { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 11px;
  color: rgba(223, 242, 236, .7);
  background: transparent;
  font-size: calc(13.5px * var(--fs));
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .18s, color .18s, transform .18s;
}
.nav-item svg { width: 19px; height: 19px; flex: 0 0 19px; opacity: .82; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(45, 212, 191, .19), rgba(45, 212, 191, .055));
  box-shadow: inset 0 0 0 1px rgba(167, 243, 208, .09);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 11px;
  bottom: 11px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #5eead4;
  box-shadow: 0 0 16px rgba(94, 234, 212, .55);
}
.nav-item.active svg { opacity: 1; color: #8ff5df; }
.nav-badge {
  margin-left: auto;
  min-width: 21px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(245, 158, 11, .18);
  color: #fcd34d;
  font-size: calc(10.5px * var(--fs));
  font-weight: 700;
}
.nav-badge.danger { background: rgba(248, 113, 113, .18); color: #fca5a5; }
.nav-badge:empty { display: none; }

.sidebar-foot { position: relative; z-index: 1; padding: 0 14px 16px; }

.sidebar-mini-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid rgba(167, 243, 208, .12);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .065), rgba(255, 255, 255, .025));
}
.mini-card-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  border-radius: 10px;
  background: rgba(94, 234, 212, .12);
  color: #8ff5df;
}
.mini-card-icon svg { width: 18px; height: 18px; }
.mini-card-copy { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.mini-card-copy strong { color: #f0fdf8; font-size: calc(12px * var(--fs)); font-weight: 600; white-space: nowrap; }
.mini-card-copy span { color: rgba(198, 235, 224, .48); font-size: calc(9.5px * var(--fs)); white-space: nowrap; }
.mini-card-link {
  width: 25px;
  height: 25px;
  margin-left: auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: rgba(198, 235, 224, .7);
  background: rgba(255, 255, 255, .07);
  cursor: pointer;
}
.mini-card-link:hover { background: rgba(255, 255, 255, .13); }
.mini-card-link svg { width: 14px; height: 14px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.sidebar-user .avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #073c32;
  background: linear-gradient(145deg, #a7f3d0, #6ee7b7);
  font-size: calc(12px * var(--fs));
  font-weight: 700;
}
.sidebar-user-info { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-info strong { font-size: calc(12px * var(--fs)); font-weight: 600; color: #f0fdf8; }
.sidebar-user-info span { font-size: calc(9.5px * var(--fs)); color: rgba(198, 235, 224, .5); }

.app-main { min-height: 100vh; margin-left: var(--sidebar-w); }

/* =========================
   Topbar
   ========================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 30px;
  border-bottom: 1px solid rgba(207, 221, 214, .72);
  background: rgba(250, 252, 251, .86);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}
.topbar-context { min-width: 0; }
.topbar-eyebrow { display: block; font-size: calc(9px * var(--fs)); font-weight: 700; letter-spacing: .18em; color: var(--muted-2); }
.topbar-line { display: flex; align-items: center; gap: 10px; margin-top: 2px; font-size: calc(12.5px * var(--fs)); color: var(--ink-2); white-space: nowrap; }
.topbar-line #topbarOrg { font-weight: 600; }
.topbar-sep { width: 3px; height: 3px; border-radius: 50%; background: #b2c1ba; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  font-size: calc(11px * var(--fs));
  color: var(--muted);
  white-space: nowrap;
}
.save-state i { width: 6px; height: 6px; border-radius: 50%; background: #34b27b; box-shadow: 0 0 0 3px rgba(52, 178, 123, .1); }

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 38px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink-2);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .16s, background .16s, color .16s, transform .16s;
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.icon-btn:active { transform: scale(.97); }
.icon-btn svg { width: 18px; height: 18px; }
.notification-dot {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fafcfb;
  border-radius: 999px;
  color: #fff;
  background: var(--danger);
  font-size: calc(9px * var(--fs));
  font-weight: 700;
  line-height: 1;
}
.notification-dot.zero { background: #a8b6b0; }

.avatar-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  margin-left: 2px;
  border: 2px solid #fff;
  border-radius: 12px;
  color: #075247;
  background: linear-gradient(145deg, #d1fae5, #86efac);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-xs);
  font-size: calc(12px * var(--fs));
  font-weight: 700;
  cursor: pointer;
}

.page {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 27px 30px 48px;
  outline: none;
}

/* =========================
   Typography / page head
   ========================= */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.page-title-wrap { min-width: 0; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  font-size: calc(9.5px * var(--fs));
  font-weight: 700;
  letter-spacing: .17em;
  color: var(--brand);
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 15px; height: 1.5px; border-radius: 2px; background: var(--brand); }
.page-head h1 { font-size: clamp(calc(23px * var(--fs)), calc(2vw * var(--fs)), calc(29px * var(--fs))); line-height: 1.18; font-weight: 700; letter-spacing: -.02em; color: var(--ink); }
.page-head p { margin-top: 7px; font-size: calc(12.5px * var(--fs)); color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }

/* =========================
   Buttons / chips
   ========================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: calc(12.5px * var(--fs));
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .16s, box-shadow .16s, background .16s, border-color .16s;
}
.btn svg { width: 16px; height: 16px; flex: 0 0 16px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { color: #fff; background: linear-gradient(145deg, #12897f, var(--brand)); box-shadow: 0 7px 18px rgba(15, 118, 110, .18); }
.btn-primary:hover { background: linear-gradient(145deg, #0f7e75, #0b655e); box-shadow: 0 9px 22px rgba(15, 118, 110, .23); }
.btn-dark { color: #fff; background: var(--brand-deep); }
.btn-soft { color: var(--brand-dark); background: var(--brand-soft); border-color: transparent; }
.btn-soft:hover { background: var(--brand-soft-2); }
.btn-outline { background: #fff; border-color: var(--line-strong); color: var(--ink-2); }
.btn-outline:hover { border-color: #b7c9c0; background: var(--surface-soft); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-soft); color: var(--ink); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b5313b; }
.btn-sm { min-height: 32px; padding: 6px 11px; font-size: calc(11.5px * var(--fs)); border-radius: 8px; }
.btn-sm svg { width: 14px; height: 14px; flex-basis: 14px; }
.btn-lg { min-height: 44px; padding: 12px 20px; font-size: calc(13.5px * var(--fs)); border-radius: 11px; }
.btn-block { width: 100%; }
.btn-icon-only { width: 34px; padding: 0; min-height: 34px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: calc(10.5px * var(--fs));
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.chip svg { width: 11px; height: 11px; }
.chip-a { color: var(--risk-a); background: var(--risk-a-bg); }
.chip-b { color: var(--risk-b); background: var(--risk-b-bg); }
.chip-c { color: var(--risk-c); background: var(--risk-c-bg); }
.chip-pending { color: #b45309; background: #fff4e5; }
.chip-processing { color: #2563a8; background: #eaf2fe; }
.chip-review { color: #6d4bc3; background: #f1ecfd; }
.chip-closed { color: #147a57; background: #e3f6ed; }
.chip-overdue { color: #b62f3a; background: #fdebed; }
.chip-neutral { color: var(--muted); background: #f0f4f2; }
.chip-demo { color: #7c5b0b; background: #fdf3d7; border-color: #f1dfaa; }
.chip-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-size: calc(10.5px * var(--fs));
  font-weight: 800;
  letter-spacing: -.02em;
}
.risk-badge.a { color: var(--risk-a); background: var(--risk-a-bg); }
.risk-badge.b { color: var(--risk-b); background: var(--risk-b-bg); }
.risk-badge.c { color: var(--risk-c); background: var(--risk-c-bg); }

.avatar {
  width: 29px;
  height: 29px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 29px;
  border-radius: 9px;
  color: var(--brand-dark);
  background: linear-gradient(145deg, #e0f5ed, #c6eadf);
  font-size: calc(10px * var(--fs));
  font-weight: 700;
}
.avatar.alt-1 { color: #79510a; background: linear-gradient(145deg, #fdf1d7, #f6e1b4); }
.avatar.alt-2 { color: #42528f; background: linear-gradient(145deg, #e9edfc, #d7def8); }
.avatar.alt-3 { color: #7b3d52; background: linear-gradient(145deg, #fbeaf0, #f4d8e2); }
.avatar.alt-4 { color: #2f6b62; background: linear-gradient(145deg, #e2f4ef, #ccebe3); }
.avatar-lg { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; font-size: calc(12px * var(--fs)); }

/* =========================
   Cards / common
   ========================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 19px 21px 0;
}
.card-head.compact { padding: 16px 18px 0; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: calc(14px * var(--fs)); font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.card-title .title-icon {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--brand);
  background: var(--brand-soft);
}
.card-title .title-icon svg { width: 15px; height: 15px; }
.card-sub { margin-top: 4px; font-size: calc(10.5px * var(--fs)); color: var(--muted); }
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 0;
  border: 0;
  color: var(--brand);
  background: none;
  font-size: calc(10.5px * var(--fs));
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.card-link svg { width: 12px; height: 12px; }
.card-link:hover { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 3px; }
.card-body { padding: 17px 21px 21px; }
.card-body.compact { padding: 14px 18px 18px; }

.grid { display: grid; gap: 16px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.section-divider { height: 1px; background: var(--line); margin: 18px 0; }
.muted { color: var(--muted); }
.small { font-size: calc(11px * var(--fs)); }
.mono { font-family: var(--mono); font-size: calc(10.5px * var(--fs)); letter-spacing: .01em; }
.text-danger { color: var(--danger); }
.text-brand { color: var(--brand); }
.nowrap { white-space: nowrap; }

/* =========================
   KPI cards
   ========================= */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-card {
  position: relative;
  min-height: 119px;
  padding: 16px 17px 14px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: var(--shadow-xs);
}
.kpi-card::after {
  content: "";
  position: absolute;
  right: -31px;
  bottom: -46px;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--kpi-wash, rgba(15, 118, 110, .055));
  pointer-events: none;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: calc(11.5px * var(--fs)); font-weight: 600; color: var(--muted); }
.kpi-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--kpi-color, var(--brand));
  background: var(--kpi-bg, var(--brand-soft));
}
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-value { display: flex; align-items: baseline; gap: 4px; margin-top: 6px; font-size: calc(30px * var(--fs)); font-weight: 700; line-height: 1.08; letter-spacing: -.045em; color: var(--kpi-color, var(--ink)); }
.kpi-value .unit { font-size: calc(13px * var(--fs)); font-weight: 600; letter-spacing: 0; color: var(--muted); }
.kpi-foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; font-size: calc(10px * var(--fs)); color: var(--muted); }
.kpi-foot .signal { display: inline-flex; align-items: center; gap: 3px; padding: 1px 5px; border-radius: 4px; background: var(--kpi-bg, var(--brand-soft)); color: var(--kpi-color, var(--brand)); font-weight: 650; }
.kpi-foot .signal svg { width: 9px; height: 9px; }
.kpi-card.danger { --kpi-color: var(--danger); --kpi-bg: var(--danger-soft); --kpi-wash: rgba(203, 61, 70, .06); }
.kpi-card.warn { --kpi-color: var(--warn); --kpi-bg: var(--warn-soft); --kpi-wash: rgba(196, 122, 10, .065); }
.kpi-card.ok { --kpi-color: var(--ok); --kpi-bg: var(--ok-soft); --kpi-wash: rgba(22, 128, 93, .06); }
.kpi-card.blue { --kpi-color: var(--blue); --kpi-bg: var(--blue-soft); --kpi-wash: rgba(59, 111, 202, .06); }

/* =========================
   Chart
   ========================= */
.chart-area { margin-top: 14px; }
.line-chart { width: 100%; height: auto; min-height: 190px; overflow: visible; }
.line-chart text { font-family: var(--font); }
.chart-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; font-size: calc(10px * var(--fs)); color: var(--muted); }
.legend-line { width: 15px; height: 3px; border-radius: 3px; background: var(--brand); }
.legend-line.alt { background: #9bc8b8; }
.legend-swatch { width: 7px; height: 7px; border-radius: 2px; }

.chart-summary { display: flex; align-items: flex-end; gap: 17px; margin-top: 2px; }
.chart-summary strong { font-size: calc(21px * var(--fs)); line-height: 1; letter-spacing: -.03em; }
.chart-summary span { font-size: calc(9.5px * var(--fs)); color: var(--muted); }
.chart-summary .trend-up { color: var(--ok); font-size: calc(10px * var(--fs)); font-weight: 600; }

/* Donut */
.donut-block { display: flex; align-items: center; gap: 19px; padding-top: 15px; }
.donut-wrap { position: relative; width: 126px; height: 126px; flex: 0 0 126px; }
.donut-wrap svg { width: 126px; height: 126px; transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center strong { font-size: calc(23px * var(--fs)); line-height: 1.05; letter-spacing: -.04em; }
.donut-center span { margin-top: 3px; font-size: calc(9px * var(--fs)); color: var(--muted); }
.donut-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.donut-row { display: flex; align-items: center; gap: 7px; font-size: calc(10.5px * var(--fs)); }
.donut-row .dot { width: 7px; height: 7px; border-radius: 2px; flex: 0 0 7px; }
.donut-row .label { color: var(--ink-2); flex: 1; }
.donut-row .value { font-weight: 700; color: var(--ink); }
.donut-row .pct { width: 32px; text-align: right; font-size: calc(9.5px * var(--fs)); color: var(--muted); }
.risk-summary-line { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 14px; padding-top: 13px; border-top: 1px dashed var(--line); }
.risk-summary-line .chip { font-weight: 600; }

/* =========================
   Urgent tasks
   ========================= */
.urgent-list { display: flex; flex-direction: column; }
.urgent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 3px;
  border-bottom: 1px solid #edf2ef;
  cursor: pointer;
  transition: background .15s;
}
.urgent-row:last-child { border-bottom: 0; }
.urgent-row:hover { background: #fbfdfc; }
.urgent-main { min-width: 0; flex: 1; }
.urgent-title { display: flex; align-items: center; gap: 6px; }
.urgent-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: calc(11.5px * var(--fs));
  font-weight: 600;
  color: var(--ink);
}
.urgent-meta { display: flex; align-items: center; gap: 7px; margin-top: 4px; font-size: calc(9.5px * var(--fs)); color: var(--muted); flex-wrap: wrap; }
.urgent-meta .dot { width: 2px; height: 2px; border-radius: 50%; background: #b5c3bd; }
.urgent-side { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }
.due-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 5px; background: #f3f7f5; font-size: calc(9px * var(--fs)); color: var(--muted); white-space: nowrap; }
.due-chip.overdue { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.due-chip.soon { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.chevron { width: 14px; height: 14px; color: #b6c4be; flex: 0 0 14px; }

/* =========================
   Areas & bars
   ========================= */
.area-list { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.area-row .area-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.area-name { display: flex; align-items: center; gap: 7px; font-size: calc(11px * var(--fs)); font-weight: 600; }
.area-name .area-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--brand); }
.area-name .area-dot.alt { background: #8bc34a; }
.area-numbers { font-size: calc(9.5px * var(--fs)); color: var(--muted); }
.area-numbers b { color: var(--ink); font-size: calc(10.5px * var(--fs)); }
.progress-track { height: 7px; border-radius: 999px; background: #eef3f0; overflow: hidden; }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #46b99b, var(--brand)); transition: width .5s ease; }
.progress-fill.warn { background: linear-gradient(90deg, #e9b45b, #c47a0a); }
.progress-fill.danger { background: linear-gradient(90deg, #e58991, #cb3d46); }
.area-foot { display: flex; justify-content: space-between; margin-top: 5px; font-size: calc(8.5px * var(--fs)); color: var(--muted-2); }

.bar-list { display: flex; flex-direction: column; gap: 12px; margin-top: 13px; }
.bar-row { display: grid; grid-template-columns: 68px 1fr 30px; align-items: center; gap: 9px; }
.bar-label { font-size: calc(10px * var(--fs)); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 7px; border-radius: 999px; background: #f0f4f2; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8bd6c3, #2aa38f); }
.bar-fill.alt { background: linear-gradient(90deg, #b7d98d, #8bc34a); }
.bar-value { text-align: right; font-size: calc(10px * var(--fs)); font-weight: 600; color: var(--muted); }

/* =========================
   Activity / tip
   ========================= */
.activity-list { position: relative; margin-top: 15px; }
.activity-list::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 10px; width: 1px; background: #e8efeb; }
.activity-item { position: relative; display: flex; gap: 10px; padding: 0 0 14px 0; }
.activity-item:last-child { padding-bottom: 0; }
.activity-dot { position: relative; z-index: 1; width: 13px; height: 13px; flex: 0 0 13px; display: grid; place-items: center; margin-top: 1px; border-radius: 50%; background: #fff; border: 1px solid #d5e4de; }
.activity-dot::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.activity-dot.a::after { background: var(--risk-a); }
.activity-dot.b::after { background: var(--risk-b); }
.activity-dot.c::after { background: var(--risk-c); }
.activity-dot.closed::after { background: var(--ok); }
.activity-copy { min-width: 0; flex: 1; }
.activity-copy p { font-size: calc(10.5px * var(--fs)); color: var(--ink-2); line-height: 1.45; }
.activity-copy p b { font-weight: 650; color: var(--ink); }
.activity-copy span { display: block; margin-top: 2px; font-size: calc(8.5px * var(--fs)); color: var(--muted-2); }
.activity-time { flex: 0 0 auto; font-size: calc(8.5px * var(--fs)); color: var(--muted-2); }

.tip-strip {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 16px;
  padding: 13px 17px;
  border: 1px solid #dceae3;
  border-radius: 14px;
  background:
    radial-gradient(500px 100px at 100% 0, rgba(139, 195, 74, .12), transparent),
    linear-gradient(100deg, #f5fbf8, #fbfdf9);
}
.tip-strip .tip-icon { width: 31px; height: 31px; flex: 0 0 31px; display: grid; place-items: center; border-radius: 9px; color: var(--brand); background: #e2f4ec; }
.tip-strip .tip-icon svg { width: 17px; height: 17px; }
.tip-strip strong { display: block; font-size: calc(11px * var(--fs)); color: var(--brand-dark); }
.tip-strip p { margin-top: 1px; font-size: calc(10px * var(--fs)); color: var(--muted); }
.tip-strip .tip-date { margin-left: auto; font-size: calc(9px * var(--fs)); color: var(--muted-2); white-space: nowrap; }

/* =========================
   Demo banner
   ========================= */
.demo-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid #efdfb5;
  border-radius: 12px;
  background: linear-gradient(100deg, #fffaf0, #fffdf7);
  font-size: calc(10.5px * var(--fs));
  color: #7c5b0b;
}
.demo-banner .demo-icon { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; border-radius: 7px; background: #fdf0cf; color: #b07a0a; }
.demo-banner .demo-icon svg { width: 14px; height: 14px; }
.demo-banner .demo-copy { flex: 1; min-width: 0; }
.demo-banner strong { font-weight: 700; }
.demo-banner .btn { min-height: 27px; padding: 3px 9px; font-size: calc(10px * var(--fs)); }
.demo-banner .banner-close { border: 0; background: none; color: #a98c4b; cursor: pointer; padding: 3px; }

/* =========================
   Inspection form
   ========================= */
.inspect-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .82fr); gap: 18px; align-items: start; }
.inspect-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.inspect-aside { position: sticky; top: calc(var(--topbar-h) + 18px); display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.form-card { padding: 20px 21px 22px; }
.form-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.form-card-head h2 { font-size: calc(15px * var(--fs)); font-weight: 700; letter-spacing: -.01em; }
.form-card-head p { margin-top: 3px; font-size: calc(10.5px * var(--fs)); color: var(--muted); }
.form-step { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; padding: 4px 8px; border-radius: 6px; color: var(--brand); background: var(--brand-soft); font-size: calc(9.5px * var(--fs)); font-weight: 600; white-space: nowrap; }
.form-section { padding-top: 17px; }
.form-section-title { display: flex; align-items: center; gap: 7px; margin-bottom: 13px; font-size: calc(10.5px * var(--fs)); font-weight: 700; color: var(--ink-2); letter-spacing: .02em; }
.form-section-title .num { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 5px; color: var(--brand); background: var(--brand-soft); font-size: calc(9px * var(--fs)); font-weight: 700; }
.form-section-title .line { height: 1px; flex: 1; background: var(--line); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.field { min-width: 0; }
.field > label, .field-label { display: flex; align-items: center; gap: 4px; margin-bottom: 5px; font-size: calc(10.5px * var(--fs)); font-weight: 600; color: var(--ink-2); }
.field > label .required, .field-label .required { color: var(--danger); }
.field-hint { margin-left: auto; font-size: calc(9px * var(--fs)); font-weight: 400; color: var(--muted-2); }
.input, .select, .textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: calc(12px * var(--fs));
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.select { appearance: none; 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='%236b7d76' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 29px; cursor: pointer; }
.textarea { min-height: 74px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: #a7b5af; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: #68b8a5; box-shadow: 0 0 0 3px rgba(15, 118, 110, .09); background: #fff; }
.input.error, .select.error, .textarea.error { border-color: #dc7b81; background: #fffafa; }
.field-error { display: none; margin-top: 4px; font-size: calc(9.5px * var(--fs)); color: var(--danger); }
.field-error.show { display: block; }
.input-with-suffix { position: relative; }
.input-with-suffix .input { padding-right: 35px; }
.input-suffix { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); font-size: calc(9.5px * var(--fs)); color: var(--muted); pointer-events: none; }

.risk-select { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.risk-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
}
.risk-option:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.risk-option .letter { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 7px; font-size: calc(11px * var(--fs)); font-weight: 800; }
.risk-option .risk-copy { display: flex; flex-direction: column; line-height: 1.2; }
.risk-option .risk-copy strong { font-size: calc(10.5px * var(--fs)); font-weight: 650; }
.risk-option .risk-copy span { margin-top: 1px; font-size: calc(8.5px * var(--fs)); color: var(--muted); }
.risk-option[data-risk="A"] .letter { color: var(--risk-a); background: var(--risk-a-bg); }
.risk-option[data-risk="B"] .letter { color: var(--risk-b); background: var(--risk-b-bg); }
.risk-option[data-risk="C"] .letter { color: var(--risk-c); background: var(--risk-c-bg); }
.risk-option.selected[data-risk="A"] { border-color: #dc8b91; background: #fffafb; box-shadow: 0 0 0 3px rgba(199, 59, 69, .06); }
.risk-option.selected[data-risk="B"] { border-color: #dfb86e; background: #fffcf5; box-shadow: 0 0 0 3px rgba(185, 120, 8, .06); }
.risk-option.selected[data-risk="C"] { border-color: #78bdac; background: #f8fdfb; box-shadow: 0 0 0 3px rgba(15, 118, 110, .06); }
.risk-option .check { position: absolute; top: 5px; right: 6px; width: 12px; height: 12px; display: none; color: var(--brand); }
.risk-option.selected .check { display: block; }
.risk-option .check svg { width: 12px; height: 12px; }

.owner-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.owner-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px 5px 5px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: calc(10.5px * var(--fs));
  cursor: pointer;
  transition: border-color .16s, background .16s;
}
.owner-pill .avatar { width: 23px; height: 23px; flex-basis: 23px; border-radius: 50%; font-size: calc(8px * var(--fs)); }
.owner-pill .owner-role { color: var(--muted-2); font-size: calc(8.5px * var(--fs)); }
.owner-pill:hover { border-color: var(--line-strong); }
.owner-pill.selected { border-color: var(--brand); background: var(--brand-soft); }
.owner-pill.selected .owner-role { color: var(--brand); }

.photo-drop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 83px;
  padding: 13px;
  border: 1.5px dashed #c7d8d1;
  border-radius: 12px;
  background: #fbfdfc;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}
.photo-drop:hover, .photo-drop.dragging { border-color: #7dbfae; background: #f5fbf8; }
.photo-drop .upload-icon { width: 43px; height: 43px; flex: 0 0 43px; display: grid; place-items: center; border-radius: 11px; color: var(--brand); background: var(--brand-soft); }
.photo-drop .upload-icon svg { width: 21px; height: 21px; }
.photo-drop .upload-copy strong { display: block; font-size: calc(11.5px * var(--fs)); font-weight: 600; color: var(--ink-2); }
.photo-drop .upload-copy span { display: block; margin-top: 2px; font-size: calc(9px * var(--fs)); color: var(--muted); }
.photo-drop .upload-action { margin-left: auto; font-size: calc(9.5px * var(--fs)); font-weight: 600; color: var(--brand); white-space: nowrap; }
.photo-preview { position: relative; width: 100%; display: flex; align-items: center; gap: 12px; }
.photo-preview img { width: 83px; height: 62px; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }
.photo-preview .preview-meta { flex: 1; min-width: 0; }
.photo-preview .preview-meta strong { display: block; font-size: calc(10.5px * var(--fs)); font-weight: 600; }
.photo-preview .preview-meta span { display: block; margin-top: 2px; font-size: calc(9px * var(--fs)); color: var(--muted); }
.photo-preview .photo-remove { width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--danger); cursor: pointer; }

.form-actions { display: flex; align-items: center; gap: 9px; padding-top: 19px; margin-top: 18px; border-top: 1px solid var(--line); }
.form-note { display: flex; align-items: center; gap: 5px; margin-right: auto; font-size: calc(9px * var(--fs)); color: var(--muted); }
.form-note svg { width: 12px; height: 12px; color: var(--brand); }

.guide-card { overflow: hidden; }
.guide-tabs { display: flex; gap: 5px; padding: 12px 16px 0; overflow-x: auto; scrollbar-width: none; }
.guide-tabs::-webkit-scrollbar { display: none; }
.guide-tab { padding: 5px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: calc(9.5px * var(--fs)); white-space: nowrap; cursor: pointer; }
.guide-tab.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.guide-list { padding: 10px 16px 12px; display: flex; flex-direction: column; }
.guide-item { padding: 9px 0; border-bottom: 1px solid #eef3f0; }
.guide-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.guide-item-top { display: flex; align-items: center; gap: 5px; }
.guide-item p { margin-top: 4px; font-size: calc(10px * var(--fs)); line-height: 1.5; color: var(--ink-2); }
.guide-item .guide-use { display: inline-flex; align-items: center; gap: 3px; margin-top: 5px; padding: 0; border: 0; background: none; color: var(--brand); font-size: calc(9px * var(--fs)); font-weight: 600; cursor: pointer; }
.guide-item .guide-use:hover { text-decoration: underline; text-underline-offset: 2px; }
.guide-item .guide-use svg { width: 10px; height: 10px; }
.risk-key { display: flex; flex-direction: column; gap: 8px; padding: 14px 17px 16px; }
.risk-key-row { display: flex; gap: 8px; align-items: flex-start; }
.risk-key-row .risk-badge { margin-top: 1px; flex: 0 0 22px; }
.risk-key-row p { font-size: calc(9.5px * var(--fs)); color: var(--muted); line-height: 1.5; }
.risk-key-row p b { color: var(--ink-2); font-weight: 650; }
.recent-mini { padding: 13px 17px 15px; }
.recent-mini-item { display: flex; align-items: flex-start; gap: 7px; padding: 7px 0; border-bottom: 1px solid #eef3f0; }
.recent-mini-item:last-child { border: 0; padding-bottom: 0; }
.recent-mini-item p { flex: 1; min-width: 0; font-size: calc(9.5px * var(--fs)); color: var(--ink-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recent-mini-item span { font-size: calc(8.5px * var(--fs)); color: var(--muted-2); white-space: nowrap; }

/* =========================
   Task board
   ========================= */
.task-stats { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 15px; }
.task-stat { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: calc(10px * var(--fs)); color: var(--muted); }
.task-stat b { color: var(--ink); font-size: calc(12px * var(--fs)); }
.task-stat svg { width: 14px; height: 14px; flex: 0 0 14px; color: var(--brand); }
.task-stat.danger b { color: var(--danger); }
.task-stat.review b { color: var(--purple); }
.task-toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 15px; }
.task-toolbar .select { width: auto; min-width: 110px; }
.task-toolbar .search-field { flex: 1; min-width: 190px; max-width: 340px; }
.toggle-check { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: calc(10px * var(--fs)); color: var(--muted); cursor: pointer; user-select: none; }
.toggle-check input { width: 13px; height: 13px; accent-color: var(--brand); }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.kanban-col { min-width: 0; border: 1px solid var(--line); border-radius: 15px; background: #f9fbfa; }
.kanban-head { display: flex; align-items: center; gap: 7px; padding: 12px 12px 9px; }
.kanban-head .col-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--col-color, var(--brand)); }
.kanban-head strong { font-size: calc(10.5px * var(--fs)); font-weight: 650; color: var(--ink-2); }
.kanban-head .count { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; background: #eef3f0; color: var(--muted); font-size: calc(9px * var(--fs)); font-weight: 700; }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; padding: 0 8px 9px; min-height: 90px; }
.task-card {
  position: relative;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 45, 36, .035);
  cursor: pointer;
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.task-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15, 45, 36, .075); border-color: #c8d9d1; }
.task-card.overdue { border-left: 3px solid var(--danger); }
.task-card-top { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; }
.task-code { font-family: var(--mono); font-size: calc(8px * var(--fs)); color: var(--muted-2); letter-spacing: -.02em; }
.task-card-top .risk-badge { margin-left: auto; width: 19px; height: 19px; font-size: calc(9px * var(--fs)); }
.task-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: calc(10.5px * var(--fs)); font-weight: 600; line-height: 1.5; color: var(--ink); min-height: 31px; }
.task-loc { display: flex; align-items: center; gap: 4px; margin-top: 5px; font-size: calc(8.5px * var(--fs)); color: var(--muted); }
.task-loc svg { width: 10px; height: 10px; flex: 0 0 10px; color: var(--muted-2); }
.task-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; padding-top: 8px; border-top: 1px solid #f0f4f2; }
.task-card-foot .avatar { width: 20px; height: 20px; flex-basis: 20px; border-radius: 6px; font-size: calc(7.5px * var(--fs)); }
.task-owner { font-size: calc(8.5px * var(--fs)); color: var(--muted); }
.task-due { margin-left: auto; font-size: calc(8px * var(--fs)); color: var(--muted-2); white-space: nowrap; }
.task-due.overdue { color: var(--danger); font-weight: 650; }
.task-actions { display: flex; gap: 5px; margin-top: 8px; }
.task-actions .btn { flex: 1; min-height: 26px; padding: 3px 6px; font-size: calc(9px * var(--fs)); border-radius: 6px; }
.kanban-empty { padding: 26px 8px; text-align: center; font-size: calc(9.5px * var(--fs)); color: var(--muted-2); }

/* =========================
   Records
   ========================= */
.filter-card { padding: 13px 15px; margin-bottom: 14px; }
.filter-row { display: flex; align-items: flex-end; gap: 9px; flex-wrap: wrap; }
.filter-row .field { flex: 0 0 auto; }
.filter-row .field.search { flex: 1; min-width: 195px; max-width: 330px; }
.filter-row .field .input, .filter-row .field .select { min-height: 35px; font-size: calc(11px * var(--fs)); }
.filter-row .field > label { font-size: calc(9.5px * var(--fs)); margin-bottom: 4px; }
.filter-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.table-card { overflow: hidden; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.table-toolbar .left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.table-toolbar .right { display: flex; align-items: center; gap: 6px; }
.table-toolbar h2 { font-size: calc(13px * var(--fs)); font-weight: 700; }
.table-toolbar .count-tag { padding: 2px 6px; border-radius: 5px; background: var(--brand-soft); color: var(--brand); font-size: calc(9px * var(--fs)); font-weight: 650; }
.selection-info { font-size: calc(10px * var(--fs)); color: var(--brand); font-weight: 600; }

.data-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 1030px; }
.data-table th {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  background: #f8faf9;
  color: var(--muted);
  font-size: calc(9px * var(--fs));
  font-weight: 650;
  text-align: left;
  white-space: nowrap;
  letter-spacing: .02em;
}
.data-table td { padding: 10px 11px; border-bottom: 1px solid #edf2ef; font-size: calc(10.5px * var(--fs)); vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background .14s; }
.data-table tbody tr:hover { background: #fbfdfc; }
.data-table tbody tr.selected { background: #f3faf7; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .check-cell { width: 34px; text-align: center; padding-right: 2px; }
.data-table input[type="checkbox"] { width: 13px; height: 13px; accent-color: var(--brand); cursor: pointer; }
.cell-code { font-family: var(--mono); font-size: calc(8.5px * var(--fs)); color: var(--muted); white-space: nowrap; }
.cell-main { min-width: 170px; max-width: 300px; }
.cell-main strong { display: block; font-size: calc(10.5px * var(--fs)); font-weight: 600; color: var(--ink); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-main span { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: calc(8.5px * var(--fs)); color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-loc { white-space: nowrap; font-size: calc(9.5px * var(--fs)); color: var(--ink-2); }
.cell-loc span { display: block; margin-top: 1px; color: var(--muted-2); font-size: calc(8.5px * var(--fs)); }
.cell-owner { display: flex; align-items: center; gap: 5px; white-space: nowrap; font-size: calc(9.5px * var(--fs)); }
.cell-owner .avatar { width: 22px; height: 22px; flex-basis: 22px; border-radius: 6px; font-size: calc(8px * var(--fs)); }
.cell-date { font-size: calc(9.5px * var(--fs)); color: var(--muted); white-space: nowrap; }
.cell-date b { display: block; color: var(--ink-2); font-weight: 500; font-size: calc(9.5px * var(--fs)); }
.cell-actions { white-space: nowrap; text-align: right; }
.row-action { width: 26px; height: 26px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.row-action:hover { background: var(--surface-soft); border-color: var(--line); color: var(--brand); }
.row-action svg { width: 14px; height: 14px; }

.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); background: #fcfdfd; }
.table-footer .page-info { font-size: calc(9.5px * var(--fs)); color: var(--muted); }
.pagination { display: flex; align-items: center; gap: 3px; }
.page-btn { min-width: 26px; height: 26px; padding: 0 6px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted); font-size: calc(9.5px * var(--fs)); cursor: pointer; }
.page-btn:hover { background: #f0f5f2; }
.page-btn.active { background: var(--brand); color: #fff; font-weight: 650; }
.page-btn:disabled { opacity: .35; cursor: not-allowed; }
.page-btn svg { width: 12px; height: 12px; }

.batch-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 11px 9px 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 13px;
  color: #fff;
  background: rgba(8, 33, 30, .94);
  box-shadow: 0 16px 40px rgba(8, 33, 30, .25);
  backdrop-filter: blur(10px);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
body.has-sidebar .batch-bar { left: calc(50% + var(--sidebar-w) / 2); }
.batch-bar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.batch-bar .batch-count { font-size: calc(10.5px * var(--fs)); color: rgba(240, 253, 248, .8); white-space: nowrap; }
.batch-bar .batch-count b { color: #fff; font-size: calc(12px * var(--fs)); }
.batch-bar .btn { min-height: 29px; padding: 4px 9px; font-size: calc(9.5px * var(--fs)); }
.batch-bar .btn-quiet { color: rgba(240, 253, 248, .75); background: rgba(255, 255, 255, .09); }
.batch-bar .btn-quiet:hover { background: rgba(255, 255, 255, .15); }
.batch-divider { width: 1px; height: 18px; background: rgba(255, 255, 255, .15); }

/* =========================
   Analytics
   ========================= */
.analytics-range { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.range-btn { padding: 5px 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: calc(10px * var(--fs)); font-weight: 600; cursor: pointer; }
.range-btn.active { color: var(--brand-dark); background: var(--brand-soft); }
.analytics-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.mini-kpi { padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.mini-kpi span { display: block; font-size: calc(9.5px * var(--fs)); color: var(--muted); }
.mini-kpi strong { display: block; margin-top: 4px; font-size: calc(23px * var(--fs)); line-height: 1.1; letter-spacing: -.03em; }
.mini-kpi strong small { font-size: calc(10px * var(--fs)); font-weight: 500; color: var(--muted); letter-spacing: 0; }
.mini-kpi em { display: block; margin-top: 3px; font-style: normal; font-size: calc(8.5px * var(--fs)); color: var(--muted-2); }
.analytics-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.analytics-insight { padding: 15px 17px; border: 1px solid #dbeae3; border-radius: 13px; background: linear-gradient(135deg, #f4fbf8, #fbfdf9); }
.analytics-insight h3 { display: flex; align-items: center; gap: 6px; font-size: calc(11px * var(--fs)); color: var(--brand-dark); }
.analytics-insight h3 svg { width: 14px; height: 14px; }
.analytics-insight p { margin-top: 6px; font-size: calc(10px * var(--fs)); line-height: 1.65; color: var(--muted); }
.analytics-insight p b { color: var(--ink-2); }
.rank-table { width: 100%; border-collapse: collapse; }
.rank-table th { padding: 7px 5px; border-bottom: 1px solid var(--line); font-size: calc(8.5px * var(--fs)); font-weight: 600; color: var(--muted); text-align: left; white-space: nowrap; }
.rank-table td { padding: 9px 5px; border-bottom: 1px solid #eff3f1; font-size: calc(9.5px * var(--fs)); color: var(--ink-2); }
.rank-table tr:last-child td { border-bottom: 0; }
.rank-table .person { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.rank-table .person .avatar { width: 22px; height: 22px; flex-basis: 22px; border-radius: 6px; font-size: calc(8px * var(--fs)); }
.rate-cell { display: flex; align-items: center; gap: 7px; }
.rate-mini-track { width: 44px; height: 4px; border-radius: 4px; background: #edf2ef; overflow: hidden; }
.rate-mini-fill { height: 100%; background: var(--brand); border-radius: inherit; }
.rank-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* =========================
   Standards
   ========================= */
.standards-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.category-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-chip { padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--muted); font-size: calc(9.5px * var(--fs)); cursor: pointer; }
.cat-chip:hover { border-color: var(--line-strong); }
.cat-chip.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); font-weight: 650; }
.standards-toolbar .search-field { flex: 1; min-width: 190px; max-width: 290px; margin-left: auto; }
.standards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.standard-card { display: flex; flex-direction: column; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: transform .16s, box-shadow .16s, border-color .16s; }
.standard-card:hover { transform: translateY(-2px); border-color: #cbdbd4; box-shadow: var(--shadow-sm); }
.standard-top { display: flex; align-items: center; gap: 6px; }
.std-cat { font-size: calc(8.5px * var(--fs)); color: var(--muted); background: #f2f6f4; padding: 2px 6px; border-radius: 4px; }
.standard-top .risk-badge { margin-left: auto; }
.standard-card h3 { margin-top: 8px; font-size: calc(11px * var(--fs)); line-height: 1.55; font-weight: 650; color: var(--ink); }
.standard-card p { margin-top: 7px; font-size: calc(9.5px * var(--fs)); line-height: 1.6; color: var(--muted); flex: 1; }
.std-basis { display: flex; align-items: flex-start; gap: 4px; margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: calc(8.5px * var(--fs)); line-height: 1.5; color: var(--muted-2); }
.std-basis svg { width: 10px; height: 10px; flex: 0 0 10px; margin-top: 1px; }
.std-use { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.std-use .btn { min-height: 28px; padding: 3px 8px; font-size: calc(9px * var(--fs)); }
.standards-empty { grid-column: 1 / -1; }

/* =========================
   Settings
   ========================= */
.settings-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 16px; align-items: start; }
.settings-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.settings-card { padding: 18px 19px; }
.settings-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.settings-card-head h2 { font-size: calc(13px * var(--fs)); font-weight: 700; }
.settings-card-head p { margin-top: 3px; font-size: calc(9.5px * var(--fs)); color: var(--muted); }
.settings-form .field { margin-bottom: 11px; }
.settings-form .field:last-child { margin-bottom: 0; }
.owner-list { display: flex; flex-direction: column; gap: 7px; }
.owner-row { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; }
.owner-row .avatar { width: 29px; height: 29px; flex-basis: 29px; border-radius: 8px; }
.owner-row-copy { flex: 1; min-width: 0; }
.owner-row-copy strong { display: block; font-size: calc(10.5px * var(--fs)); font-weight: 600; }
/* 只作用于直接子级：否则标题里的角色标签会被 display:block 拉成整行色条 */
.owner-row-copy > span { display: block; margin-top: 1px; font-size: calc(8.5px * var(--fs)); color: var(--muted); }
.owner-row-copy strong .role-tag { display: inline-flex; width: auto; margin-left: 4px; vertical-align: middle; }
.owner-row .row-action:hover { color: var(--danger); }
.inline-add { display: flex; gap: 6px; margin-top: 9px; }
.inline-add .input { min-width: 0; min-height: 33px; font-size: calc(10.5px * var(--fs)); }
.inline-add .input:first-child { max-width: 88px; }
.location-block { padding: 10px 0; border-bottom: 1px solid #eff3f1; }
.location-block:first-child { padding-top: 0; }
.location-block:last-child { border: 0; padding-bottom: 0; }
.location-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.location-head strong { font-size: calc(10.5px * var(--fs)); }
.location-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.location-tag { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; background: #fafcfb; font-size: calc(8.5px * var(--fs)); color: var(--muted); }
.location-tag button { border: 0; padding: 0; background: none; color: #a9b7b1; cursor: pointer; font-size: calc(11px * var(--fs)); line-height: 1; }
.location-tag button:hover { color: var(--danger); }
.location-add { display: flex; gap: 5px; margin-top: 7px; }
.location-add .input { min-height: 29px; font-size: calc(9.5px * var(--fs)); padding: 5px 8px; }
.data-actions { display: flex; flex-direction: column; gap: 7px; }
.data-action { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; text-align: left; }
.data-action:hover { background: #fbfdfc; border-color: var(--line-strong); }
.data-action .da-icon { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 8px; color: var(--brand); background: var(--brand-soft); }
.data-action .da-icon svg { width: 15px; height: 15px; }
.data-action .da-copy { flex: 1; min-width: 0; }
.data-action .da-copy strong { display: block; font-size: calc(10px * var(--fs)); font-weight: 600; }
.data-action .da-copy span { display: block; margin-top: 1px; font-size: calc(8.5px * var(--fs)); color: var(--muted); }
.data-action.danger .da-icon { color: var(--danger); background: var(--danger-soft); }
.data-action.danger .da-copy strong { color: var(--danger); }
.storage-bar { margin-top: 11px; padding: 9px 10px; border-radius: 8px; background: #f7faf8; }
.storage-line { display: flex; justify-content: space-between; font-size: calc(8.5px * var(--fs)); color: var(--muted); }
.storage-track { height: 4px; margin-top: 5px; border-radius: 3px; background: #e5ede9; overflow: hidden; }
.storage-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #69c3aa, var(--brand)); }
.about-box { padding: 13px 14px; border-radius: 10px; background: linear-gradient(140deg, #0d352f, #08211e); color: rgba(240, 253, 248, .78); }
.about-box .about-brand { display: flex; align-items: center; gap: 8px; color: #fff; font-size: calc(12px * var(--fs)); font-weight: 700; letter-spacing: .06em; }
.about-box .about-brand svg { width: 21px; height: 21px; color: #a7f3d0; }
.about-box p { margin-top: 7px; font-size: calc(8.5px * var(--fs)); line-height: 1.6; color: rgba(198, 235, 224, .62); }
.about-meta { display: flex; gap: 9px; margin-top: 9px; flex-wrap: wrap; }
.about-meta span { font-size: calc(8px * var(--fs)); color: rgba(198, 235, 224, .45); }
.sla-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sla-item { padding: 8px; border: 1px solid var(--line); border-radius: 9px; text-align: center; }
.sla-item .risk-badge { margin: 0 auto 4px; }
.sla-item .input { min-height: 31px; text-align: center; padding: 4px; font-size: calc(12px * var(--fs)); font-weight: 600; }
.sla-item span { display: block; margin-top: 3px; font-size: calc(8px * var(--fs)); color: var(--muted); }

/* =========================
   Empty state
   ========================= */
.empty-state { padding: 40px 20px; text-align: center; }
.empty-illustration { width: 62px; height: 62px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 18px; color: var(--brand); background: linear-gradient(145deg, #e7f7f1, #f5fbf8); border: 1px solid #dcece5; }
.empty-illustration svg { width: 28px; height: 28px; opacity: .75; }
.empty-state h3 { font-size: calc(12px * var(--fs)); font-weight: 650; color: var(--ink-2); }
.empty-state p { margin-top: 4px; font-size: calc(9.5px * var(--fs)); color: var(--muted); }
.empty-state .btn { margin-top: 12px; }

/* =========================
   Drawer
   ========================= */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(6, 28, 23, .38);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s;
}
.drawer-scrim.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  width: min(480px, 94vw);
  background: #fbfdfc;
  box-shadow: -24px 0 60px rgba(7, 31, 24, .18);
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.22, .75, .25, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.drawer.open { transform: translateX(0); }
.drawer-content { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.drawer-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 253, 252, .94);
  backdrop-filter: blur(12px);
}
.drawer-head .drawer-title { font-size: calc(12px * var(--fs)); font-weight: 700; }
.drawer-head .drawer-code { margin-left: 2px; font-family: var(--mono); font-size: calc(8px * var(--fs)); color: var(--muted-2); }
.drawer-head .icon-btn { margin-left: auto; width: 31px; height: 31px; flex-basis: 31px; border-radius: 8px; }
.drawer-body { padding: 17px; }
.drawer-issue-head { display: flex; align-items: flex-start; gap: 10px; }
.drawer-issue-head .risk-badge { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 9px; font-size: calc(13px * var(--fs)); }
.drawer-issue-head h2 { font-size: calc(15px * var(--fs)); line-height: 1.5; font-weight: 700; letter-spacing: -.01em; }
.drawer-issue-head .issue-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.drawer-photo { width: 100%; max-height: 255px; margin-top: 13px; object-fit: cover; border-radius: 13px; border: 1px solid var(--line); cursor: zoom-in; }
.drawer-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; margin-top: 15px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.fact { min-width: 0; }
.fact span { display: block; font-size: calc(8.5px * var(--fs)); color: var(--muted-2); }
.fact strong { display: block; margin-top: 2px; font-size: calc(10px * var(--fs)); font-weight: 600; color: var(--ink-2); line-height: 1.4; }
.drawer-section { margin-top: 17px; }
.drawer-section h3 { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; font-size: calc(9.5px * var(--fs)); font-weight: 700; color: var(--ink-2); letter-spacing: .02em; }
.drawer-section h3 svg { width: 12px; height: 12px; color: var(--brand); }
.drawer-section p { padding: 10px 11px; border-radius: 9px; background: #fff; border: 1px solid var(--line); font-size: calc(10px * var(--fs)); line-height: 1.65; color: var(--ink-2); }
.drawer-section .done-note { background: #f4fbf8; border-color: #dcece5; }
.drawer-timeline { position: relative; padding-left: 17px; margin-top: 4px; }
.drawer-timeline::before { content: ""; position: absolute; left: 4px; top: 5px; bottom: 8px; width: 1px; background: #e0ebe6; }
.timeline-item { position: relative; padding-bottom: 11px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: -17px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: #fff; border: 2px solid #b9d3c9; }
.timeline-item.active::before { border-color: var(--brand); background: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .1); }
.timeline-item strong { display: block; font-size: calc(9.5px * var(--fs)); font-weight: 600; color: var(--ink-2); }
.timeline-item span { display: block; margin-top: 1px; font-size: calc(8.5px * var(--fs)); color: var(--muted); line-height: 1.5; }
.drawer-actions { position: sticky; bottom: 0; margin-top: auto; padding: 12px 17px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(251, 253, 252, .96); backdrop-filter: blur(12px); display: flex; gap: 7px; flex-wrap: wrap; }
.drawer-actions .btn { flex: 1; min-width: 92px; }
.drawer-actions .btn-icon { flex: 0 0 36px; min-width: 36px; padding: 0; }

/* =========================
   Modal
   ========================= */
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(6, 28, 23, .42);
  backdrop-filter: blur(3px);
  opacity: 1;
  pointer-events: auto;
  transition: opacity .18s;
}
.modal-scrim.show { opacity: 1; pointer-events: auto; }
.modal {
  width: min(470px, 100%);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(.985);
  transition: transform .2s;
}
.modal-scrim.show .modal { transform: translateY(0) scale(1); }
.modal.modal-wide { width: min(620px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 18px 12px; }
.modal-head-icon { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 9px; color: var(--brand); background: var(--brand-soft); }
.modal-head-icon svg { width: 17px; height: 17px; }
.modal-head-copy { flex: 1; min-width: 0; }
.modal-head h2 { font-size: calc(14px * var(--fs)); font-weight: 700; }
.modal-head p { margin-top: 3px; font-size: calc(9.5px * var(--fs)); color: var(--muted); line-height: 1.5; }
.modal-head .icon-btn { width: 28px; height: 28px; flex-basis: 28px; border: 0; background: #f5f8f6; border-radius: 7px; }
.modal-head .icon-btn svg { width: 14px; height: 14px; }
.modal-body { padding: 2px 18px 14px; overflow-y: auto; }
.modal-body .field { margin-bottom: 10px; }
.modal-body .field:last-child { margin-bottom: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 7px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fcfdfd; }
.modal-foot .btn { min-height: 34px; padding: 6px 13px; font-size: calc(11px * var(--fs)); }
.modal-confirm-copy { padding: 2px 1px 4px; font-size: calc(10.5px * var(--fs)); line-height: 1.7; color: var(--muted); }
.modal-confirm-copy b { color: var(--ink-2); }
.modal-warning { display: flex; gap: 7px; padding: 9px 10px; margin-top: 9px; border-radius: 8px; background: var(--danger-soft); color: #9f3038; font-size: calc(9.5px * var(--fs)); line-height: 1.5; }
.modal-warning svg { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 1px; }
.complete-upload { min-height: 62px; padding: 9px; }
.complete-upload .upload-icon { width: 32px; height: 32px; flex-basis: 32px; border-radius: 8px; }
.complete-upload .upload-icon svg { width: 16px; height: 16px; }

/* =========================
   Toast
   ========================= */
.toast-host { position: fixed; top: 86px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 7px; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  max-width: 360px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: rgba(8, 33, 30, .95);
  color: #f0fdf8;
  box-shadow: 0 12px 30px rgba(8, 33, 30, .2);
  transform: translateY(-6px);
  opacity: 0;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast .toast-icon { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; border-radius: 6px; background: rgba(94, 234, 212, .15); color: #5eead4; }
.toast .toast-icon svg { width: 12px; height: 12px; }
.toast.error .toast-icon { background: rgba(248, 113, 113, .17); color: #fca5a5; }
.toast.warn .toast-icon { background: rgba(251, 191, 36, .17); color: #fcd34d; }
.toast span { font-size: calc(10.5px * var(--fs)); line-height: 1.4; }
.toast .toast-action { margin-left: auto; border: 0; padding: 2px 0 2px 8px; background: none; color: #5eead4; font-size: calc(9.5px * var(--fs)); font-weight: 600; cursor: pointer; pointer-events: auto; white-space: nowrap; }

/* =========================
   Mobile nav / more sheet
   ========================= */
.mobile-nav { display: none; }
.more-sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 105;
  background: rgba(6, 28, 23, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.more-sheet-scrim.show { opacity: 1; pointer-events: auto; }
.more-sheet {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 110;
  padding: 7px 18px calc(22px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: #fff;
  box-shadow: 0 -20px 50px rgba(6, 28, 23, .16);
  transform: translateY(105%);
  transition: transform .25s cubic-bezier(.22, .75, .25, 1);
}
.more-sheet.show { transform: translateY(0); }
.more-sheet-handle { width: 36px; height: 4px; margin: 0 auto 11px; border-radius: 3px; background: #e1e9e4; }
.more-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.more-sheet-head strong { font-size: calc(13px * var(--fs)); }
.more-sheet-head .icon-btn { width: 30px; height: 30px; flex-basis: 30px; border: 0; background: #f4f7f5; }
.more-sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.more-link { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 13px 6px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfc; font-size: calc(10px * var(--fs)); font-weight: 600; color: var(--ink-2); cursor: pointer; }
.more-link svg { width: 20px; height: 20px; color: var(--brand); }

/* =========================
   Lightbox
   ========================= */
.lightbox { position: fixed; inset: 0; z-index: 150; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(4, 16, 13, .9); }
.lightbox.show { display: flex; }
.lightbox img { max-width: 100%; max-height: 88vh; border-radius: 10px; box-shadow: 0 24px 60px rgba(0, 0, 0, .4); }
.lightbox-close { position: absolute; top: 15px; right: 18px; width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .18); border-radius: 9px; background: rgba(255, 255, 255, .08); color: #fff; font-size: calc(20px * var(--fs)); cursor: pointer; }

/* =========================
   Print
   ========================= */
.print-root { display: none; }

/* =========================
   Motion
   ========================= */
.page-enter { animation: pageIn .28s ease both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 1280px) {
  .page { padding: 24px 24px 44px; }
  .topbar { padding: 0 24px; }
  .kpi-grid { gap: 12px; }
  .kpi-value { font-size: calc(27px * var(--fs)); }
  .kanban { gap: 9px; }
  .task-card { padding: 10px; }
}

@media (max-width: 1120px) {
  :root { --sidebar-w: 232px; }
  .brand { padding-left: 18px; padding-right: 18px; }
  .brand-copy strong { font-size: calc(14px * var(--fs)); }
  .brand-copy small { font-size: calc(8.5px * var(--fs)); }
  .sidebar-body { padding-left: 11px; padding-right: 11px; }
  .nav-item { padding-left: 10px; padding-right: 10px; }
  .span-7, .span-8 { grid-column: span 8; }
  .span-5, .span-4 { grid-column: span 4; }
  .dashboard-grid .span-7 { grid-column: span 8; }
  .dashboard-grid .span-5 { grid-column: span 4; }
  .inspect-layout { grid-template-columns: minmax(0, 1.45fr) minmax(255px, .75fr); }
  .standards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .sidebar { display: none; }
  .app-main { margin-left: 0; }
  .topbar { height: 64px; padding: 0 18px; }
  .topbar-eyebrow { display: none; }
  .topbar-line { margin-top: 0; font-size: calc(11px * var(--fs)); }
  .save-state { display: none; }
  .page { padding: 20px 18px calc(88px + env(safe-area-inset-bottom)); }
  body { padding-bottom: 0; }
  .mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(9px + env(safe-area-inset-bottom));
    z-index: 80;
    height: 61px;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    padding: 6px;
    border: 1px solid rgba(218, 229, 224, .9);
    border-radius: 17px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 14px 36px rgba(12, 47, 38, .15);
    backdrop-filter: blur(16px);
  }
  .mobile-nav-item {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #8a9b94;
    font-size: calc(8.5px * var(--fs));
    font-weight: 500;
    cursor: pointer;
  }
  .mobile-nav-item svg { width: 19px; height: 19px; }
  .mobile-nav-item.active { color: var(--brand); background: var(--brand-soft); font-weight: 650; }
  .mobile-nav-item .nav-badge { position: absolute; transform: translate(13px, -11px); min-width: 15px; height: 15px; font-size: calc(8px * var(--fs)); padding: 0 3px; border: 1.5px solid #fff; }
  .more-sheet { display: block; }
  .more-sheet-grid { display: grid; }
  .batch-bar { bottom: calc(78px + env(safe-area-inset-bottom)); }
  body.has-sidebar .batch-bar { left: 50%; }
  .page-head { align-items: flex-start; }
  .inspect-layout { grid-template-columns: 1fr; }
  .inspect-aside { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px) {
  .topbar-line #topbarOrg { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .topbar-date { display: none; }
  .topbar-sep { display: none; }
  .topbar-add span { display: none; }
  .topbar-add { width: 38px; padding: 0; min-height: 38px; }
  .topbar-add svg { width: 18px; height: 18px; }
  .page { padding-left: 14px; padding-right: 14px; }
  .page-head { gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
  .page-head h1 { font-size: calc(22px * var(--fs)); }
  .page-head p { font-size: calc(10.5px * var(--fs)); line-height: 1.5; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .kpi-card { min-height: 105px; padding: 13px; }
  .kpi-label { font-size: calc(10px * var(--fs)); }
  .kpi-value { font-size: calc(25px * var(--fs)); }
  .kpi-icon { width: 28px; height: 28px; }
  .kpi-icon svg { width: 14px; height: 14px; }
  .kpi-foot { font-size: calc(9px * var(--fs)); }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 12px; }
  .dashboard-grid > *,
  .dashboard-grid .span-4,
  .dashboard-grid .span-5,
  .dashboard-grid .span-6,
  .dashboard-grid .span-7,
  .dashboard-grid .span-8,
  .dashboard-grid .span-12 { grid-column: 1 / -1; }
  .card-head { padding: 15px 15px 0; }
  .card-body { padding: 13px 15px 16px; }
  .card-body.compact { padding: 12px 15px 15px; }
  .chart-area { margin-top: 10px; }
  .line-chart { min-height: 160px; }
  .donut-block { gap: 13px; }
  .donut-wrap { width: 110px; height: 110px; flex-basis: 110px; }
  .donut-wrap svg { width: 110px; height: 110px; }
  .donut-center strong { font-size: calc(20px * var(--fs)); }
  .urgent-row { padding: 9px 2px; }
  .urgent-title strong { font-size: calc(10.5px * var(--fs)); }
  .due-chip { display: none; }
  .tip-strip { align-items: flex-start; }
  .tip-strip .tip-date { display: none; }
  .demo-banner { align-items: flex-start; flex-wrap: wrap; }
  .demo-banner .btn { margin-left: 36px; }
  .inspect-aside { grid-template-columns: 1fr; }
  .form-card { padding: 15px; }
  .form-card-head { flex-direction: column; gap: 6px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; gap: 11px; }
  .form-grid .span-2 { grid-column: span 1; }
  .risk-select { grid-template-columns: 1fr; gap: 6px; }
  .risk-option { padding: 7px 9px; }
  .risk-option .risk-copy { flex-direction: row; align-items: baseline; gap: 6px; }
  .risk-option .risk-copy span { margin-top: 0; }
  .photo-drop { min-height: 74px; }
  .photo-drop .upload-action { display: none; }
  .form-actions { flex-wrap: wrap; }
  .form-note { order: 3; width: 100%; margin-top: 2px; }
  .filter-row { align-items: stretch; }
  .filter-row .field { flex: 1 1 130px; }
  .filter-row .field.search { flex-basis: 100%; max-width: none; }
  .filter-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .table-toolbar { padding: 11px 12px; flex-wrap: wrap; }
  .table-toolbar .left { width: 100%; }
  .table-toolbar .right { width: 100%; justify-content: flex-end; }
  .data-table { min-width: 900px; }
  .table-footer { flex-wrap: wrap; gap: 8px; }
  .batch-bar { left: 14px; right: 14px; bottom: calc(78px + env(safe-area-inset-bottom)); transform: translateY(20px); justify-content: space-between; }
  body.has-sidebar .batch-bar { left: 14px; }
  .batch-bar.show { transform: translateY(0); }
  .batch-bar .batch-count { font-size: calc(9px * var(--fs)); }
  .kanban { display: flex; overflow-x: auto; gap: 10px; padding-bottom: 5px; scroll-snap-type: x mandatory; }
  .kanban-col { flex: 0 0 78%; scroll-snap-align: start; }
  .analytics-kpis { gap: 8px; }
  .mini-kpi { padding: 11px 12px; }
  .mini-kpi strong { font-size: calc(20px * var(--fs)); }
  .analytics-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .analytics-grid > *,
  .analytics-grid .span-4,
  .analytics-grid .span-5,
  .analytics-grid .span-7,
  .analytics-grid .span-8 { grid-column: 1 / -1; }
  .standards-grid { grid-template-columns: 1fr; }
  .standards-toolbar .search-field { order: 5; flex-basis: 100%; max-width: none; }
  .settings-layout { gap: 12px; }
  .settings-card { padding: 15px; }
  .sla-grid { gap: 6px; }
  .drawer { width: 100%; }
  .drawer-head { padding: 12px 14px; }
  .drawer-body { padding: 14px; }
  .drawer-actions { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .drawer-actions .btn { font-size: calc(10px * var(--fs)); min-height: 36px; }
  .toast-host { top: auto; bottom: calc(82px + env(safe-area-inset-bottom)); left: 14px; right: 14px; align-items: stretch; }
  .toast { min-width: 0; max-width: none; width: 100%; }
  .modal-scrim { padding: 10px; align-items: end; }
  .modal { width: 100%; max-height: calc(100vh - 20px); border-radius: 18px 18px 12px 12px; }
  .modal-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .kpi-grid { gap: 8px; }
  .kpi-card { padding: 11px; min-height: 98px; }
  .kpi-value { font-size: calc(23px * var(--fs)); }
  .kpi-foot .signal { display: none; }
  .page-head h1 { font-size: calc(21px * var(--fs)); }
  .topbar { padding: 0 13px; }
  .page { padding-left: 12px; padding-right: 12px; }
  .card-head { padding-left: 13px; padding-right: 13px; }
  .card-body { padding-left: 13px; padding-right: 13px; }
  .form-card { padding: 13px; }
  .risk-option .risk-copy span { display: none; }
  .owner-pill .owner-role { display: none; }
  .kanban-col { flex-basis: 86%; }
  .topbar-line #topbarOrg { max-width: 115px; }
  .avatar-btn { display: none; }
}

/* =========================
   Print styles
   ========================= */
@media print {
  @page { size: A4; margin: 14mm 13mm; }
  html, body { background: #fff !important; }
  body.printing .app-shell,
  body.printing .mobile-nav,
  body.printing .drawer,
  body.printing .drawer-scrim,
  body.printing .modal-scrim,
  body.printing .toast-host,
  body.printing .more-sheet,
  body.printing .more-sheet-scrim,
  body.printing .batch-bar,
  body.printing .lightbox { display: none !important; }
  .print-root { display: none; }
  body.printing .print-root { display: block !important; }
  .print-doc { font-family: var(--font); color: #111; font-size: 9pt; line-height: 1.5; }
  .print-letterhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 9mm; border-bottom: 2px solid #0f766e; }
  .print-brand { display: flex; align-items: center; gap: 9px; }
  .print-logo { height: 13mm; width: auto; display: block; }
  .print-brand-copy strong { display: block; font-size: 15pt; letter-spacing: .1em; color: #0b4f49; }
  .print-brand-copy span { display: block; font-size: 7.5pt; color: #667; letter-spacing: .12em; }
  .print-letterhead-right { max-width: 58%; text-align: right; font-size: 7.5pt; color: #667; line-height: 1.6; overflow-wrap: anywhere; }
  .print-doc h1 { margin: 6mm 0 2mm; text-align: center; font-size: 17pt; letter-spacing: .12em; }
  .print-subtitle { text-align: center; font-size: 8pt; color: #667; margin-bottom: 5mm; }
  .print-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2mm 5mm; margin-bottom: 3mm; font-size: 8pt; color: #444; }
  .print-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .print-table th, .print-table td { border: .6pt solid #aab8b2; padding: 1.7mm 1.6mm; font-size: 7.6pt; vertical-align: top; word-break: break-word; }
  .print-table th { background: #eef7f3; font-weight: 700; text-align: left; color: #174b40; }
  .print-table .c { text-align: center; }
  .print-table .risk-a { color: #b32631; font-weight: 700; }
  .print-table .risk-b { color: #9b6408; font-weight: 700; }
  .print-table .risk-c { color: #0f766e; font-weight: 700; }
  .print-summary { margin-top: 4mm; padding: 3mm 4mm; border: .6pt solid #aab8b2; background: #f8fbf9; font-size: 8pt; line-height: 1.7; }
  .print-sign { display: flex; justify-content: space-between; gap: 14mm; margin-top: 10mm; font-size: 8pt; color: #333; }
  .print-sign div { flex: 1; border-top: .6pt solid #888; padding-top: 2mm; }
  .print-foot { margin-top: 7mm; padding-top: 3mm; border-top: .6pt solid #d5dfda; display: flex; justify-content: space-between; font-size: 6.8pt; color: #888; }
  .print-notice-title { margin: 5mm 0 3mm; padding: 2mm 3mm; background: #0f766e; color: #fff; font-size: 10pt; font-weight: 700; letter-spacing: .1em; }
  .print-info-grid { display: grid; grid-template-columns: 1fr 1fr; border: .6pt solid #aab8b2; }
  .print-info-item { display: flex; min-height: 8mm; border-bottom: .6pt solid #c9d4cf; }
  .print-info-item:nth-child(odd) { border-right: .6pt solid #c9d4cf; }
  .print-info-item .k { width: 27mm; flex: 0 0 27mm; padding: 1.6mm 2mm; background: #f3f8f6; color: #556; font-size: 7.5pt; }
  .print-info-item .v { flex: 1; padding: 1.6mm 2mm; font-size: 8pt; }
  .print-info-item.full { grid-column: 1 / -1; }
  .print-text-block { margin-top: 3mm; }
  .print-text-block .label { padding: 1.6mm 2mm; background: #f3f8f6; border: .6pt solid #aab8b2; border-bottom: 0; font-size: 7.5pt; color: #556; }
  .print-text-block .content { min-height: 16mm; padding: 2mm; border: .6pt solid #aab8b2; font-size: 8.5pt; line-height: 1.7; white-space: pre-wrap; }
  .print-photo { max-width: 70mm; max-height: 50mm; margin-top: 3mm; border: .6pt solid #aab8b2; object-fit: cover; }
  .print-issue-title { font-size: 15pt; text-align: center; letter-spacing: .08em; margin: 6mm 0 1mm; }
  .print-issue-sub { text-align: center; font-size: 7.5pt; color: #667; margin-bottom: 5mm; }
  .print-legal { margin-top: 4mm; font-size: 7.5pt; line-height: 1.7; color: #444; }
}

/* =========================================================
   Authentication / role management / login
   ========================================================= */
body.logged-out { background: #eef3f0; }
body.logged-out .app-shell,
body.logged-out .mobile-nav { display: none !important; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  min-height: 100vh;
  background: #eef3f0;
}
body.logged-out .login-screen { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); }
.login-screen.hidden { display: none !important; }

.login-visual {
  position: relative;
  overflow: hidden;
  color: #f0fdf8;
  background:
    radial-gradient(circle at 15% 8%, rgba(45, 212, 191, .24), transparent 34%),
    radial-gradient(circle at 90% 90%, rgba(139, 195, 74, .11), transparent 40%),
    linear-gradient(145deg, #103a33 0%, #08211e 62%, #061814 100%);
}
.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(167, 243, 208, .12);
  border-radius: 50%;
  pointer-events: none;
}
.login-visual::before { width: 520px; height: 520px; right: -220px; top: -180px; }
.login-visual::after { width: 360px; height: 360px; left: -160px; bottom: -150px; }
.login-visual-inner { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; padding: 34px clamp(28px, 5vw, 68px); }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid rgba(167, 243, 208, .35); border-radius: 14px; background: rgba(45, 212, 191, .12); color: #d9fff2; }
.login-brand-mark svg { width: 30px; height: 30px; }
.login-brand div { display: flex; flex-direction: column; }
.login-brand strong { font-size: calc(21px * var(--fs)); letter-spacing: .1em; }
.login-brand span { font-size: calc(9px * var(--fs)); letter-spacing: .18em; color: rgba(198, 235, 224, .58); margin-top: 2px; }
.login-hero { margin: auto 0; max-width: 670px; padding: 55px 0; }
.login-kicker { font-size: calc(10px * var(--fs)); letter-spacing: .2em; color: #5eead4; font-weight: 700; }
.login-hero h1 { margin-top: 15px; font-size: clamp(calc(38px * var(--fs)), calc(5vw * var(--fs)), calc(66px * var(--fs))); line-height: 1.14; letter-spacing: -.04em; font-weight: 700; color: #fff; }
.login-hero p { max-width: 520px; margin-top: 17px; font-size: calc(13px * var(--fs)); line-height: 1.85; color: rgba(218, 240, 232, .62); }
.login-role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 31px; max-width: 540px; }
.login-role-card { padding: 15px 16px; border: 1px solid rgba(167, 243, 208, .14); border-radius: 14px; background: rgba(255, 255, 255, .045); backdrop-filter: blur(5px); }
.login-role-card span { display: block; font-size: calc(9px * var(--fs)); color: #5eead4; letter-spacing: .12em; }
.login-role-card strong { display: block; margin-top: 5px; font-size: calc(15px * var(--fs)); color: #fff; }
.login-role-card small { display: block; margin-top: 4px; font-size: calc(9.5px * var(--fs)); line-height: 1.6; color: rgba(218, 240, 232, .52); }
.login-visual-foot { display: flex; justify-content: space-between; gap: 20px; font-size: calc(9px * var(--fs)); color: rgba(198, 235, 224, .36); }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 32px clamp(20px, 5vw, 65px); overflow-y: auto; }
.login-card { width: min(420px, 100%); }
.login-mobile-brand { display: none; }
.login-card > h2 { margin-top: 4px; font-size: calc(27px * var(--fs)); line-height: 1.2; letter-spacing: -.03em; }
.login-lead { margin-top: 7px; margin-bottom: 21px; font-size: calc(11.5px * var(--fs)); line-height: 1.65; color: var(--muted); }
.login-field { margin-bottom: 12px; }
.login-field > label { font-size: calc(10.5px * var(--fs)); }
.login-input-wrap { position: relative; }
.login-input-wrap > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #98aaa2; pointer-events: none; }
.login-input-wrap .input { min-height: 43px; padding-left: 37px; font-size: calc(12.5px * var(--fs)); border-radius: 10px; }
.login-input-wrap .input:focus { border-color: #5fb5a2; box-shadow: 0 0 0 4px rgba(15, 118, 110, .08); }
.login-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; border-radius: 6px; padding: 5px 7px; background: transparent; color: var(--brand); font-size: calc(9px * var(--fs)); font-weight: 600; cursor: pointer; }
.login-eye:hover { background: var(--brand-soft); }
.login-options { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin: 2px 0 13px; font-size: calc(9.5px * var(--fs)); color: var(--muted-2); }
.login-remember { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; }
.login-remember input { width: 13px; height: 13px; accent-color: var(--brand); }
.login-error { display: none; margin-bottom: 10px; padding: 8px 10px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); font-size: calc(10px * var(--fs)); line-height: 1.5; }
.login-error.show { display: block; }
.login-submit { width: 100%; min-height: 44px; font-size: calc(13px * var(--fs)); letter-spacing: .18em; border-radius: 10px; }
.login-quick { margin-top: 21px; padding-top: 15px; border-top: 1px solid var(--line); }
.login-quick-title { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: calc(9px * var(--fs)); color: var(--muted-2); }
.login-quick-title span:first-child { font-weight: 650; color: var(--muted); }
.login-quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.login-quick-grid button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.login-quick-grid button:hover { border-color: #8fc7b8; background: #f7fcfa; }
.login-quick-grid strong { font-size: calc(9.5px * var(--fs)); color: var(--ink-2); }
.login-quick-grid span { font-size: calc(8.5px * var(--fs)); color: var(--muted-2); }
.login-owner { margin-top: 17px; padding-top: 13px; border-top: 1px solid var(--line); font-size: calc(8.5px * var(--fs)); color: var(--muted-2); text-align: center; }

/* Role and account surfaces */
.role-tag { display: inline-flex; align-items: center; padding: 2px 6px; border-radius: 5px; font-size: calc(8px * var(--fs)); font-weight: 650; white-space: nowrap; }
.role-owner { color: #7c3aed; background: #f1ebfe; }
.role-leader { color: #2563a8; background: #eaf2fe; }
.role-inspector { color: #0f766e; background: #e3f6ef; }
.role-contractor { color: #a16207; background: #fdf4df; }
.role-operator { color: #4b5563; background: #f0f4f2; }
.sidebar-user-action { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 24px; border: 0; border-radius: 6px; background: rgba(255,255,255,.06); color: rgba(218,240,232,.55); cursor: pointer; }
.sidebar-user-action:hover { background: rgba(255,255,255,.13); color: #fff; }
.sidebar-user-action svg { width: 12px; height: 12px; }
.sidebar-user .sidebar-user-info { margin-right: auto; overflow: hidden; }
.sidebar-user .sidebar-user-info strong,
.sidebar-user .sidebar-user-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.system-owner-strip { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 11px 14px; border: 1px solid #dbe9e2; border-radius: 12px; background: linear-gradient(100deg, #f6fbf8, #fbfdfb); }
.owner-seal { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
.owner-seal svg { width: 15px; height: 15px; }
.system-owner-strip > div { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.system-owner-strip strong { font-size: calc(10.5px * var(--fs)); color: var(--ink-2); }
.system-owner-strip span { font-size: calc(9.5px * var(--fs)); color: var(--muted); }
.system-owner-strip .owner-extra { margin-left: auto; color: var(--muted-2); font-size: calc(8.5px * var(--fs)); white-space: nowrap; }

.account-card { display: flex; align-items: center; gap: 10px; margin: 12px 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfc; }
.account-card-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 1px; }
.account-card-copy strong { font-size: calc(12px * var(--fs)); }
.account-card-copy span { font-size: calc(9px * var(--fs)); color: var(--muted); }
.account-card-copy small { font-size: calc(8.5px * var(--fs)); color: var(--muted-2); }
.settings-inline-note { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: calc(9px * var(--fs)); color: var(--muted); }
.settings-inline-note svg { width: 12px; height: 12px; color: var(--brand); }

.user-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; margin-bottom: 14px; }
.user-cell { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.user-cell > span { display: flex; flex-direction: column; gap: 1px; }
.user-cell strong { font-size: calc(10.5px * var(--fs)); font-weight: 650; color: var(--ink); }
.user-cell small { font-size: calc(8px * var(--fs)); color: var(--muted-2); }
.users-table { min-width: 1050px; }
.user-role-full { display: block; margin-top: 3px; font-size: calc(8px * var(--fs)); color: var(--muted-2); }
.user-contact { display: block; font-size: calc(8.5px * var(--fs)); color: var(--muted); word-break: break-all; }
.user-email { display: block; margin-top: 2px; font-size: calc(8px * var(--fs)); color: var(--muted-2); word-break: break-all; }
.user-email.missing { color: var(--danger); }

/* 角色单元格 · 点击直接改角色 */
.role-cell-top { display: flex; align-items: center; gap: 4px; }
.role-cell-btn { display: block; width: 100%; margin: -4px -6px; padding: 4px 6px; border: 1px dashed transparent; border-radius: 8px; background: none; font: inherit; text-align: left; cursor: pointer; transition: border-color .14s, background .14s; }
.role-cell-btn:hover,
.role-cell-btn-active { border-color: var(--line-strong); background: #f7fcfa; }
.role-cell-btn:focus-visible { outline: none; border-color: var(--brand); background: #f7fcfa; }
.role-cell-pencil { display: inline-flex; color: var(--brand); opacity: 0; transition: opacity .14s; }
.role-cell-pencil svg { width: 10px; height: 10px; }
.role-cell-btn:hover .role-cell-pencil,
.role-cell-btn:focus-visible .role-cell-pencil,
.role-cell-btn-active .role-cell-pencil { opacity: 1; }

.role-menu { position: fixed; z-index: 100; width: 246px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-md); animation: roleMenuIn .13s ease-out; }
@keyframes roleMenuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.role-menu-head { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px 8px; border-bottom: 1px solid var(--line); }
.role-menu-head strong { font-size: calc(10px * var(--fs)); color: var(--ink); }
.role-menu-head span { font-size: calc(8.5px * var(--fs)); color: var(--muted-2); }
.role-menu-group { padding: 7px 8px 2px; font-size: calc(8px * var(--fs)); font-weight: 650; letter-spacing: .06em; color: var(--muted-2); }
.role-menu-item { display: flex; align-items: center; gap: 7px; width: 100%; padding: 6px 8px; border: 0; border-radius: 8px; background: none; font: inherit; text-align: left; cursor: pointer; }
.role-menu-item:hover,
.role-menu-item:focus-visible { background: var(--surface-tint); outline: none; }
.role-menu-item.active { background: var(--brand-soft); }
.role-menu-label { flex: 1; font-size: calc(9.5px * var(--fs)); color: var(--ink-2); }
.role-menu-check { display: inline-flex; width: 12px; height: 12px; color: var(--brand); }
.role-menu-check svg { width: 12px; height: 12px; }
.role-menu-foot { margin-top: 4px; padding: 7px 8px 3px; border-top: 1px solid var(--line); font-size: calc(8px * var(--fs)); line-height: 1.5; color: var(--muted-2); }
.row-action:disabled { opacity: .32; cursor: not-allowed; }

.profile-card { display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdfc; }
.profile-card > div { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.profile-card strong { font-size: calc(14px * var(--fs)); }
.profile-card span { font-size: calc(9.5px * var(--fs)); color: var(--muted); }
.profile-card small { font-size: calc(8.5px * var(--fs)); color: var(--muted-2); }
.profile-divider { height: 1px; margin: 14px 0; background: var(--line); }
.profile-admin-link { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.profile-admin-link span { font-size: calc(8.5px * var(--fs)); color: var(--muted-2); }

.std-edit-actions { display: inline-flex; gap: 2px; margin-left: auto; }
.std-edit-actions .row-action { width: 22px; height: 22px; border-radius: 5px; }
.std-edit-actions .row-action svg { width: 11px; height: 11px; }
.standard-top > .risk-badge { margin-left: 0; }
.standard-top .std-edit-actions + .risk-badge { margin-left: 0; }
.standard-top { flex-wrap: wrap; }

@media (max-width: 980px) {
  body.logged-out .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 28px 18px; background: linear-gradient(180deg, #f8fbf9, #eef4f1); }
  .login-mobile-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 22px; }
  .login-mobile-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--brand-soft); color: var(--brand); }
  .login-mobile-mark svg { width: 24px; height: 24px; }
  .login-mobile-brand div { display: flex; flex-direction: column; }
  .login-mobile-brand strong { font-size: calc(16px * var(--fs)); letter-spacing: .08em; }
  .login-mobile-brand span { font-size: calc(8px * var(--fs)); color: var(--muted-2); }
  .user-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .system-owner-strip { flex-wrap: wrap; }
  .system-owner-strip .owner-extra { margin-left: 38px; }
}
@media (max-width: 420px) {
  .login-card > h2 { font-size: calc(24px * var(--fs)); }
  .login-panel { padding: 22px 16px; }
  .login-quick-grid { grid-template-columns: 1fr 1fr; }
  .account-card { flex-wrap: wrap; }
  .account-card .btn { width: 100%; }
}

.login-recovery { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.login-recovery button { padding: 0; border: 0; background: none; color: var(--brand); font-size: calc(8.5px * var(--fs)); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.login-recovery span { font-size: calc(8px * var(--fs)); color: var(--muted-2); }
.toast-host { z-index: 600; }

/* 显示与字号 */
.ui-scale-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.ui-scale-btn { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfc; font: inherit; text-align: left; cursor: pointer; transition: border-color .14s, background .14s; }
.ui-scale-btn strong { font-size: calc(11px * var(--fs)); color: var(--ink-2); }
.ui-scale-btn span { font-size: calc(8.5px * var(--fs)); color: var(--muted-2); line-height: 1.4; }
.ui-scale-btn em { position: absolute; top: 7px; right: 10px; font-style: normal; font-weight: 700; font-size: calc(11px * var(--fs)); color: var(--muted-2); opacity: .55; }
.ui-scale-btn:hover { border-color: #b7c9c0; background: var(--surface-soft); }
.ui-scale-btn.active { border-color: var(--brand); background: var(--brand-soft); }
.ui-scale-btn.active strong,
.ui-scale-btn.active em { color: var(--brand-dark); }
.ui-scale-btn.active em { opacity: 1; }
.ui-scale-btn:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }

/* 登录页：忘记密码与服务器状态提示 */
.login-forgot { padding: 0; border: 0; background: none; color: var(--brand); font-size: calc(8.5px * var(--fs)); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.login-server-hint { margin-top: 9px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); font-size: calc(8px * var(--fs)); color: var(--muted); text-align: center; }

/* 多人整改负责人 */
.owner-stack { display: inline-flex; align-items: center; vertical-align: middle; margin-right: 4px; }
/* 抽屉的 .fact span 会把所有 span 变成 block，这里必须压回去 */
.drawer-facts .fact .owner-stack,
.cell-owner .owner-stack,
.task-card-foot .owner-stack { display: inline-flex; align-items: center; }
.owner-stack > .avatar { display: inline-grid !important; margin-left: -6px; box-shadow: 0 0 0 1.5px #fff; }
.owner-stack > .avatar:first-child { margin-left: 0; }
.owner-stack .owner-more { display: inline; margin-left: 3px; font-size: calc(8px * var(--fs)); font-weight: 650; color: var(--muted-2); }
.owner-pill[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.owner-multi-note { display: block; margin-top: 2px; font-style: normal; font-weight: 500; font-size: calc(8px * var(--fs)); color: var(--brand); }

/* 详情里的照片：点击看大图 */
.drawer-photo-wrap { position: relative; display: inline-block; width: 100%; }
.drawer-photo-wrap .drawer-photo { display: block; width: 100%; cursor: zoom-in; }
.drawer-photo-hint { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; background: rgba(4, 16, 13, .62); color: #fff; font-size: calc(8px * var(--fs)); pointer-events: none; }
.drawer-photo-hint svg { width: 11px; height: 11px; }
.photo-empty { display: flex; align-items: center; gap: 7px; padding: 12px 13px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-soft); color: var(--muted-2); font-size: calc(9.5px * var(--fs)); }
.photo-empty svg { width: 15px; height: 15px; }

/* 未绑定邮箱提示条 */
.email-banner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; padding: 10px 13px; border: 1px solid #f0d7a8; border-radius: 10px; background: #fdf7e9; color: #8a5a08; font-size: calc(9.5px * var(--fs)); }
.email-banner svg { width: 14px; height: 14px; flex: 0 0 14px; }
.email-banner .card-link { margin-left: auto; }
.profile-email-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fbfdfc; }
.profile-email-row > span { font-size: calc(9px * var(--fs)); color: var(--muted); }
.profile-email-row > strong { flex: 1; font-size: calc(9.5px * var(--fs)); color: var(--ink-2); word-break: break-all; }
.profile-email-row em { font-style: normal; }

/* 编辑弹窗：现场照片 */
.edit-photo { align-items: center; }
.edit-photo .edit-photo-thumb { width: 100%; max-height: 210px; object-fit: cover; border-radius: 9px; cursor: zoom-in; display: block; }
.edit-photo .edit-photo-hint { display: block; margin-top: 6px; font-size: calc(8.5px * var(--fs)); color: var(--muted-2); }
.edit-photo:has(.edit-photo-thumb) { display: block; padding: 8px; }

/* 整改任务：勾选与图片导出 */
.task-export-group { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.task-check { position: absolute; top: 8px; right: 9px; display: inline-flex; padding: 2px; border-radius: 5px; background: rgba(255,255,255,.9); cursor: pointer; }
.task-check input { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }
.task-card { position: relative; }
.task-card.picked { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.task-card-top { padding-right: 26px; }

/* 现场照片缩略图：任务卡与台账 */
.task-photo { position: relative; margin: 8px 0 1px; border-radius: 9px; overflow: hidden; background: #eef2ef; }
.task-photo img { display: block; width: 100%; height: 104px; object-fit: cover; cursor: zoom-in; }
.task-photo-tag { position: absolute; left: 7px; bottom: 6px; padding: 1px 6px; border-radius: 4px; background: rgba(4,16,13,.62); color: #fff; font-size: calc(7.5px * var(--fs)); font-weight: 600; }
.cell-main-wrap { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cell-main-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cell-thumb { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 6px; object-fit: cover; cursor: zoom-in; border: 1px solid var(--line); }

/* 整改任务：卡片 / 列表 视图切换 */
.view-switch { display: inline-flex; align-items: center; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.view-switch button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: inherit; font-size: calc(9px * var(--fs)); font-weight: 600; cursor: pointer; transition: background .14s, color .14s; }
.view-switch button svg { width: 13px; height: 13px; }
.view-switch button:hover { color: var(--ink-2); }
.view-switch button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-xs); }
.view-switch button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--brand-soft-2); }

/* 整改任务：列表视图 */
.task-list { overflow: hidden; }
.task-list-head, .task-row { display: grid; grid-template-columns: 26px 44px 118px minmax(0, 1fr) 62px 108px 96px 72px 96px; align-items: center; gap: 10px; padding: 9px 14px; }
.task-list-head { background: var(--surface-soft); border-bottom: 1px solid var(--line); font-size: calc(8.5px * var(--fs)); font-weight: 650; color: var(--muted); }
.task-row { border-bottom: 1px solid #edf2ef; cursor: pointer; transition: background .14s; }
.task-row:hover { background: #fbfdfc; }
.task-row.picked { background: #f3faf7; }
.task-row.overdue { box-shadow: inset 3px 0 0 var(--danger); }
.task-row:last-child { border-bottom: 0; }
.task-row input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }
.tl-thumb img, .tl-thumb-empty { display: block; width: 44px; height: 34px; border-radius: 6px; object-fit: cover; border: 1px solid var(--line); cursor: zoom-in; background: var(--surface-soft); }
.tl-thumb-empty { cursor: default; }
.tl-code b { display: block; font-family: var(--mono); font-size: calc(8.5px * var(--fs)); color: var(--ink-2); }
.tl-code em, .tl-main em, .tl-owner em, .tl-due em { display: block; font-style: normal; margin-top: 2px; font-size: calc(8px * var(--fs)); color: var(--muted-2); }
.tl-main { min-width: 0; }
.tl-main b { display: block; font-size: calc(10px * var(--fs)); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-owner, .tl-due { min-width: 0; font-size: calc(9px * var(--fs)); color: var(--ink-2); }
.tl-owner em, .tl-main em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-owner .owner-stack { margin-right: 3px; }
.tl-action { display: flex; justify-content: flex-end; }
@media (max-width: 1180px) {
  .task-list-head, .task-row { grid-template-columns: 24px 40px 100px minmax(0, 1fr) 56px 92px 84px 68px 84px; gap: 8px; padding: 8px 11px; }
}

/* 品牌：两枚校徽（白底容器保证在深色侧栏/登录页也清晰） */
.brand-logo-chip { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; padding: 3px; border-radius: 10px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.16); }
.brand-logo-chip img { width: 100%; height: 100%; object-fit: contain; }
.login-brand-logos { display: inline-flex; align-items: center; gap: 6px; padding: 5px 7px; border-radius: 12px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.login-brand-logos img { height: 38px; width: auto; display: block; }
.login-mobile-logos { display: inline-flex; align-items: center; gap: 5px; }
.login-mobile-logos img { height: 30px; width: auto; display: block; }

/* ===== 移动端横向溢出修复（v1.13） ===== */
@media (max-width: 980px) {
  /* 批量操作条：改为贴边全宽 + 可横向滚动，避免 4 个按钮把页面撑宽 */
  .batch-bar,
  body.has-sidebar .batch-bar {
    left: 8px;
    right: 8px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    max-width: none;
    gap: 8px;
    padding: 8px 10px;
    overflow-x: auto;
    transform: translateY(12px);
  }
  .batch-bar.show { transform: translateY(0); }
  .batch-bar .btn { flex: 0 0 auto; }

  /* 底部导航：允许文字收缩，5 个入口在 390px 也能排下 */
  .mobile-nav { width: auto; max-width: calc(100% - 20px); }
  .mobile-nav-item { min-width: 0; }
  .mobile-nav-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* 顶栏：双校徽 + 集团抬头 */
.topbar-logos { display: inline-flex; align-items: center; gap: 5px; margin-right: 11px; padding-right: 11px; border-right: 1px solid var(--line); }
.topbar-logos img { height: 26px; width: auto; max-height: 26px; display: block; }
.topbar-copy { display: flex; flex-direction: column; min-width: 0; }
.topbar .topbar-context { display: flex; align-items: center; }
@media (max-width: 980px) {
  .topbar-logos { display: none; }
}
@media (max-width: 1180px) {
  .topbar-logos img { height: 23px; max-height: 23px; }
}

/* 风险分级说明：任务页与台账页共用 */
.risk-key-card { overflow: hidden; }
.risk-key-card .risk-key { padding: 14px 17px 16px; }
.risk-key-card .card-head.compact { padding-bottom: 0; border-bottom: 0; }
@media (max-width: 700px) {
  .risk-key-card .risk-key { padding: 12px 14px 14px; gap: 9px; }
}

/* 详情页整改照片操作行 */
.drawer-photo-ops { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.drawer-photo-ops .small { font-size: calc(9.5px * var(--fs)); }

/* 图片说明 */
.photo-caption { display: flex; align-items: flex-start; gap: 6px; margin-top: 8px; padding: 8px 11px; border-radius: 9px; background: var(--brand-soft); color: var(--ink-2); font-size: calc(10px * var(--fs)); line-height: 1.6; }
.photo-caption svg { width: 13px; height: 13px; flex: 0 0 13px; margin-top: 2px; color: var(--brand); }
.drawer-photo-note { margin-top: 9px; font-size: calc(10.5px * var(--fs)); }

/* 整改任务表头排序 */
.task-list-head .tl-sort { cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 3px; }
.task-list-head .tl-sort:hover { color: var(--brand); }
.task-list-head .tl-sort.active { color: var(--brand); font-weight: 650; }
.tl-sort-arrow { font-size: calc(8px * var(--fs)); opacity: .45; font-style: normal; }
.task-list-head .tl-sort.active .tl-sort-arrow { opacity: 1; }
.task-list-head .tl-sort-reset { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 2px; }
.task-list-head .tl-sort-reset:hover { color: var(--brand); }

/* ===== 督促与处罚（v1.24） ===== */
.chip-penalty { color: #8a1f2b; background: #fbdde1; font-weight: 650; }
.chip-penalty-pending { color: #b62f3a; background: #fdebed; font-weight: 650; border: 1px dashed #e9a8b0; }
.urge-badge { display: inline-block; margin-left: 5px; padding: 1px 5px; border-radius: 5px; background: #fdf3df; color: #b45309; font-size: calc(8.5px * var(--fs)); font-weight: 650; font-style: normal; white-space: nowrap; }
.urge-badge.late { background: #fdebed; color: #b62f3a; }
.urge-list { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #f8fbf9; list-style: none; max-height: 168px; overflow: auto; }
.urge-list li { display: flex; align-items: center; gap: 7px; padding: 4px 0; font-size: calc(10px * var(--fs)); color: var(--ink-2); border-bottom: 1px dashed #e6eee9; }
.urge-list li:last-child { border: 0; }
.penalty-list { display: flex; flex-direction: column; gap: 10px; }
.penalty-row { display: flex; gap: 9px; align-items: flex-start; }
.penalty-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 8px; }
.penalty-dot.warn { background: #e0a02a; }
.penalty-dot.danger { background: #c8323d; }
.penalty-row strong { display: block; font-size: calc(10.5px * var(--fs)); color: var(--ink); }
.penalty-row span { display: block; font-size: calc(9.5px * var(--fs)); color: var(--muted); line-height: 1.6; }
.penalty-row em { display: block; margin-top: 3px; padding: 5px 8px; border-radius: 7px; background: #f8fbf9; font-style: normal; font-size: calc(9.5px * var(--fs)); color: var(--ink-2); }
.penalty-ops { margin-top: 11px; display: flex; gap: 8px; }
@media (max-width: 700px) { .penalty-ops { flex-direction: column; } }

/* 邮件发送规则 */
.mail-rule { margin: 14px 0 4px; padding: 13px 15px; border-radius: var(--radius); background: var(--brand-mist); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.mail-rule-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.mail-rule-chip .chip { font-size: calc(9.5px * var(--fs)); }
.mail-rule-edit { display: flex; gap: 8px; }

/* ===== 手机端详情页操作栏：图标 + 文字，全部可见（v1.26） ===== */
@media (max-width: 980px) {
  .drawer-actions {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
    gap: 6px; align-items: stretch;
  }
  .drawer-actions .btn {
    flex: none; min-width: 0; min-height: 50px; padding: 6px 4px;
    flex-direction: column; gap: 3px; line-height: 1.2;
    font-size: calc(9.5px * var(--fs));
  }
  .drawer-actions .btn-icon { flex: none; width: auto; min-width: 0; padding: 6px 4px; }
  .drawer-actions .btn-icon::after { content: attr(data-label); font-size: calc(9px * var(--fs)); font-weight: 600; }
  .drawer-actions .btn-icon svg { width: 17px; height: 17px; }
  .drawer-actions .chip { grid-column: 1 / -1; justify-self: center; }
}

/* 手机端图片保存浮层 */
.image-save-mask {
  position: fixed; inset: 0; z-index: 4000; display: flex; flex-direction: column;
  background: rgba(8, 20, 17, .94); backdrop-filter: blur(6px);
}
.image-save-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px; color: #eaf4ee;
}
.image-save-copy strong { display: block; font-size: calc(12.5px * var(--fs)); font-weight: 650; }
.image-save-copy span { display: block; margin-top: 2px; font-size: calc(10px * var(--fs)); color: #9dbcb2; }
.image-save-bar .btn { color: #eaf4ee; border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.1); }
.image-save-scroll { flex: 1; overflow: auto; padding: 0 14px 14px; -webkit-overflow-scrolling: touch; }
.image-save-scroll img { display: block; width: 100%; height: auto; border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.5); }
.image-save-foot { padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); display: flex; justify-content: center; }
.image-save-foot .btn { width: 100%; justify-content: center; }

/* ===== 转发（系统内 / 微信） ===== */
.forward-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 12px; background: var(--brand-mist); border: 1px solid var(--line); }
.forward-tab { flex: 1; padding: 8px 0; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-family: inherit; font-size: calc(10.5px * var(--fs)); font-weight: 650; color: var(--muted); }
.forward-tab.active { background: #fff; color: var(--brand-dark); box-shadow: var(--shadow-sm); }
.wx-share { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 16px; align-items: start; }
.wx-share-img { width: 100%; border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.wx-share-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.wx-link { display: flex; gap: 6px; }
.wx-link .input { flex: 1; min-width: 0; font-size: calc(9.5px * var(--fs)); }
.wx-share-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 700px) {
  .wx-share { grid-template-columns: 1fr; }
  .wx-share-img { max-height: 46vh; object-fit: contain; background: #f2f6f4; }
}

/* 演示模式 */
.login-demo-btn { width: 100%; justify-content: center; margin-top: 8px; }
.demo-picker { display: flex; flex-direction: column; gap: 14px; }
.demo-group strong { display: block; margin-bottom: 6px; font-size: calc(10px * var(--fs)); letter-spacing: .08em; color: var(--muted); }
.demo-users { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.demo-user { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; font-family: inherit; transition: border-color .16s, box-shadow .16s, transform .12s; }
.demo-user:hover { border-color: #bcd8ce; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.demo-user b { display: block; font-size: calc(10.5px * var(--fs)); color: var(--ink); }
.demo-user i { display: block; font-style: normal; font-size: calc(9px * var(--fs)); color: var(--muted-2); }
.demo-banner-mode { background: var(--brand-soft); border-color: #cfe9e0; }

/* 登录页品牌标识（食安智控盾牌） */
.login-brand-mark {
  display: inline-grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 13px; background: rgba(255,255,255,.14); color: #d8f3e8;
  border: 1px solid rgba(255,255,255,.22);
}
.login-brand-mark svg { width: 27px; height: 27px; }
.login-brand-mark-sm { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; }
.login-brand-mark-sm svg { width: 22px; height: 22px; }
.login-brand em, .login-mobile-brand em {
  display: block; font-style: normal; font-size: calc(8.5px * var(--fs)); letter-spacing: .16em;
  color: rgba(216,243,232,.62); margin-top: 2px;
}

/* 审批开关 */
.approval-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.approval-row:last-child { border-bottom: 0; }
.approval-row strong { display: block; font-size: calc(11px * var(--fs)); color: var(--ink); }
.approval-row span { display: block; font-size: calc(9.5px * var(--fs)); color: var(--muted); margin-top: 2px; }
.switch { position: relative; flex: 0 0 44px; width: 44px; height: 26px; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #d9e4de; transition: background .18s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .18s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(18px); }

/* 审批待办 */
.approval-pending { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--brand-mist); border: 1px solid var(--line); }
.approval-pending > strong { display: block; margin-bottom: 8px; font-size: calc(10.5px * var(--fs)); color: var(--brand-dark); }
.approval-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.approval-item b { font-size: calc(10px * var(--fs)); color: var(--ink); }
.approval-item span { display: block; font-size: calc(9px * var(--fs)); color: var(--muted); margin-top: 2px; }
.approval-ops { display: flex; gap: 6px; }

.demo-avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); font-size: calc(11px * var(--fs)); font-weight: 700; }

/* 登录页底部信息：强制独占一行，避免变成右侧栏 */
.login-owner { grid-column: 1 / -1; width: 100%; }
.login-panel, .login-form-col { align-items: stretch; }

/* 登录页排版修正 */
.login-owner { grid-column: 1 / -1 !important; width: 100%; text-align: center; position: static !important; margin-top: 16px; }
.login-options { flex-wrap: nowrap !important; gap: 10px; align-items: center; }
.login-options > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.login-remember, .login-forgot { white-space: nowrap; }
.login-form-col, .login-panel { min-width: 0; }
@media (min-width: 980px) { .login-form-col { min-width: 380px; } }

/* 登录页：右栏改为纵向排列（修复「系统所有人」被排到右侧） */
.login-panel { flex-direction: column; align-items: center; justify-content: center; }
.login-panel > form, .login-owner, .login-recovery, .login-server-hint { width: 100%; max-width: 460px; }
.login-owner { margin-top: 18px; }

/* 弹窗层级兜底：确保登录页上的「忘记密码」弹窗不被登录层遮挡 */
#modalRoot { position: relative; z-index: 9000; }
.modal-scrim { z-index: 9001 !important; }
.login-screen { z-index: 10; }

/* 工作台 KPI 卡可点击 */
.kpi-card.kpi-link { cursor: pointer; transition: transform .14s, box-shadow .18s; }
.kpi-card.kpi-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card.kpi-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* 批量导入弹窗 */
.bulk-import { display: flex; flex-direction: column; gap: 10px; }
.bulk-option { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; font-family: inherit; transition: border-color .16s, box-shadow .16s, transform .12s; }
.bulk-option:hover { border-color: #bcd8ce; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.bulk-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-dark); }
.bulk-icon svg { width: 18px; height: 18px; }
.bulk-option strong { display: block; font-size: calc(11px * var(--fs)); color: var(--ink); }
.bulk-option span span { display: block; margin-top: 2px; font-size: calc(9.5px * var(--fs)); color: var(--muted); }

/* 现场检查简化：风险等级 ABC 内联小按钮 */
.risk-label { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.risk-select-sm { display: inline-flex; gap: 6px; }
.risk-select-sm .risk-option { padding: 4px 10px; min-height: 30px; border-radius: 8px; gap: 6px; }
.risk-select-sm .risk-option .letter { width: 20px; height: 20px; line-height: 20px; font-size: calc(10px * var(--fs)); }
.risk-select-sm .risk-option .risk-copy { display: inline-flex; align-items: center; }
.risk-select-sm .risk-option .risk-copy strong { font-size: calc(9.5px * var(--fs)); font-weight: 600; }
.risk-select-sm .risk-option .risk-copy span { display: none; }
.risk-select-sm .risk-option .check { display: none; }
/* 检查要点可折叠 */
.guide-head { cursor: pointer; user-select: none; }
.guide-toggle { margin-left: auto; display: inline-flex; color: var(--muted); transition: transform .2s; }
.guide-card.collapsed .guide-tabs, .guide-card.collapsed .guide-list { display: none; }
.guide-card.collapsed .guide-toggle { transform: rotate(0deg); }
.guide-card:not(.collapsed) .guide-toggle { transform: rotate(90deg); }
.guide-card.collapsed .card-sub { display: none; }

/* 风险等级行内：ABC + 整改期限 */
.risk-select-sm .risk-option { padding: 5px 12px; }
.risk-select-sm .risk-option .risk-copy { display: none; }
.risk-label-gap { width: 14px; }
.risk-inline-label { font-size: calc(10px * var(--fs)); font-weight: 600; color: var(--muted); white-space: nowrap; }
.risk-deadline { width: 150px; }
.risk-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 风险等级行：ABC 与整改期限同一水平线 */
.risk-row { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; overflow-x: auto; }
.risk-row .risk-select-sm { flex: 0 0 auto; }
.risk-deadline-inline { display: inline-flex; align-items: center; gap: 6px; margin-left: 22px; flex: 0 0 auto; }
.risk-deadline { width: 148px; }
@media (max-width: 700px) {
  .risk-row { flex-wrap: wrap; overflow: visible; }
  .risk-deadline-inline { margin-left: 0; }
}

/* 风险等级 + 整改期限 同一行 */
.risk-inline-row { display: flex; align-items: center; gap: 9px; flex-wrap: nowrap; }
.risk-inline-title { font-size: calc(10px * var(--fs)); font-weight: 600; color: var(--muted); white-space: nowrap; }
.risk-inline-row .risk-select-sm { flex: 0 0 auto; }
.risk-inline-row .risk-deadline-inline { display: inline-flex; align-items: center; gap: 6px; margin-left: 18px; flex: 0 0 auto; }
.risk-inline-row .risk-deadline { width: 150px; }
@media (max-width: 700px) { .risk-inline-row { flex-wrap: wrap; } .risk-inline-row .risk-deadline-inline { margin-left: 0; } }

/* 现场检查：只读校区显示 */
.area-static { display: flex; align-items: center; min-height: 38px; padding: 0 12px; border-radius: 10px; background: var(--brand-mist); border: 1px solid var(--line); font-size: calc(10.5px * var(--fs)); font-weight: 600; color: var(--brand-dark); }

/* 现场检查单栏布局 */
.inspect-layout.single { grid-template-columns: minmax(0, 1fr); }
.inspect-layout.single .inspect-main { max-width: 880px; margin: 0 auto; width: 100%; }

/* 台账表头排序 */
.data-table th.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.data-table th.th-sort:hover { color: var(--brand); }
.th-arrow { margin-left: 4px; font-size: calc(8px * var(--fs)); font-style: normal; opacity: .45; }
.th-arrow.active { opacity: 1; color: var(--brand); }
/* 手机端底部菜单文字更清晰 */
@media (max-width: 980px) {
  .mobile-nav-item { color: #3f514a; font-weight: 650; }
  .mobile-nav-item span { font-size: calc(9.5px * var(--fs)); }
  .mobile-nav-item svg { color: #4c615a; }
  .mobile-nav-item.active { color: var(--brand-dark); }
}

/* 消息中心 */
.notify-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow: auto; }
.notify-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; font-family: inherit; }
.notify-item:hover { border-color: #bcd8ce; background: #fbfdfc; }
.notify-item.unread { background: var(--brand-mist); border-color: #cfe4da; }
.notify-dot { width: 7px; height: 7px; border-radius: 50%; background: #cfd8d4; flex: 0 0 7px; }
.notify-item.unread .notify-dot { background: var(--brand); }
.notify-item.tone-amber.unread .notify-dot { background: #d79a26; }
.notify-item.tone-danger.unread .notify-dot { background: #c8452f; }
.notify-item.tone-ok.unread .notify-dot { background: var(--ok); }
.notify-copy { flex: 1; min-width: 0; }
.notify-copy strong { display: block; font-size: calc(10.5px * var(--fs)); color: var(--ink); }
.notify-copy span { display: block; margin-top: 2px; font-size: calc(9px * var(--fs)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notify-time { font-size: calc(9px * var(--fs)); color: var(--muted); white-space: nowrap; }

/* 任务列表：编号前的小全选框 */
.tl-check { display: flex; align-items: center; justify-content: center; }
.tl-check input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--brand); cursor: pointer; }

/* 数据分析：自定义时间区间 */
.range-custom { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 6px; border-radius: 10px; border: 1px dashed var(--line); }
.range-custom.active { border-style: solid; border-color: var(--brand); background: var(--brand-mist); }
.range-date { width: 128px; height: 30px; padding: 0 6px; font-size: calc(9px * var(--fs)); }
.range-sep { font-size: calc(9px * var(--fs)); color: var(--muted); }

/* 侧栏：折叠按钮 + 收藏星标 */
.sidebar-tools { display: flex; justify-content: flex-end; padding: 0 10px 6px; }
.sidebar-tool-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border-radius: 8px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06); color: #cfe3da; font-size: calc(9px * var(--fs)); cursor: pointer; font-family: inherit; }
.sidebar-tool-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.sidebar-tool-btn svg { width: 14px; height: 14px; }
.nav-star { margin-left: auto; font-style: normal; font-size: calc(11px * var(--fs)); color: rgba(255,255,255,.25); opacity: 0; transition: opacity .15s, color .15s; }
.nav-item:hover .nav-star { opacity: 1; }
.nav-star.on { opacity: 1; color: #f5c451; }
.nav-fav-sep { height: 1px; margin: 8px 10px; background: rgba(255,255,255,.1); }
body.sidebar-collapsed .sidebar { width: 76px; }
body.sidebar-collapsed .sidebar .brand-text, body.sidebar-collapsed .sidebar .nav-section-label,
body.sidebar-collapsed .sidebar .nav-item span, body.sidebar-collapsed .sidebar .nav-badge,
body.sidebar-collapsed .sidebar .sidebar-user-info, body.sidebar-collapsed .sidebar .sidebar-mini-card,
body.sidebar-collapsed .sidebar .sidebar-tool-btn span, body.sidebar-collapsed .sidebar .brand-sub { display: none; }
body.sidebar-collapsed .sidebar .nav-item { justify-content: center; padding: 9px 0; }
body.sidebar-collapsed .sidebar .sidebar-tools { justify-content: center; }
body.sidebar-collapsed .app-main { margin-left: 76px; }

/* 详情抽屉关闭按钮：红色醒目 */
.drawer-close {
  margin-left: auto;
  flex: 0 0 auto;
  align-self: flex-start;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid #f0b6b0;
  background: #fdecea;
  color: #c8302a;
  cursor: pointer;
  transition: background .16s, color .16s, transform .12s, box-shadow .16s;
}
.drawer-close svg { width: 16px; height: 16px; stroke-width: 2.4; }
.drawer-close:hover { background: #c8302a; color: #fff; border-color: #c8302a; box-shadow: 0 4px 12px rgba(200,48,42,.28); }
.drawer-close:active { transform: scale(.94); }

/* 今日食安提示轮播 */
.tip-body { transition: opacity .22s ease, transform .22s ease; }
.tip-body.fading { opacity: 0; transform: translateY(-3px); }
.tip-side { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 0 0 auto; }
.tip-dots { display: flex; gap: 4px; }
.tip-dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,.3); transition: background .2s, width .2s; }
.tip-dots i.on { width: 12px; border-radius: 3px; background: rgba(255,255,255,.85); }
