:root {
  --brand-primary: #0e7490;
  --brand-primary-dark: #0b4f63;
  --brand-sidebar: #0f2740;
  --brand-sidebar-2: #12324d;
  --brand-accent: #14b8a6;
  --brand-accent-soft: #e6faf7;
  --brand-bg: #f1f5f9;
  --brand-card: #ffffff;
  --brand-text: #0f172a;
  --brand-muted: #64748b;
  --brand-border: #e2e8f0;
  --brand-border-strong: #cbd5e1;
  --field-edit: #ffffff;
  --field-readonly: #f1f5f9;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
  --sidebar-width: 260px;
  --topbar-height: 60px;
  --radius: .65rem;
  --radius-sm: .45rem;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .08);
  --font: "Noto Sans TC", "Noto Sans SC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-family: var(--font);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--brand-bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 100% -20%, rgba(20, 184, 166, .07), transparent),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(14, 116, 144, .05), transparent);
  color: var(--brand-text);
  min-height: 100vh;
  font-size: .875rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-accent); }

/* ---------- Shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(175deg, var(--brand-sidebar) 0%, var(--brand-sidebar-2) 55%, #0c3d52 100%);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(15, 39, 64, .18);
  transform: translateX(0);
  transition: transform .22s ease, box-shadow .22s ease;
  will-change: transform;
}

html.sidebar-collapsed .sidebar {
  transform: translateX(-105%);
  box-shadow: none;
  pointer-events: none;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1.15rem 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
  min-height: var(--topbar-height);
}

.sidebar-collapse-btn {
  margin-left: auto;
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: .45rem;
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 255, 255, .78);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.sidebar-collapse-btn:hover {
  background: rgba(20, 184, 166, .22);
  border-color: rgba(125, 224, 219, .35);
  color: #fff;
}
.sidebar-collapse-btn i { font-size: .9rem; line-height: 1; }

.sidebar .brand .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: .55rem;
  background: linear-gradient(145deg, rgba(20, 184, 166, .35), rgba(14, 116, 144, .4));
  border: 1px solid rgba(125, 224, 219, .25);
  color: #99f6e4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.sidebar .brand .brand-text { min-width: 0; }

.sidebar .brand .brand-title {
  font-weight: 700;
  font-size: .98rem;
  letter-spacing: .01em;
  line-height: 1.25;
  white-space: nowrap;
}

.sidebar .brand small {
  display: block;
  font-weight: 400;
  opacity: .55;
  font-size: .7rem;
  margin-top: .15rem;
}

.sidebar .nav-section {
  padding: 1rem .85rem .35rem;
  font-size: .65rem;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .35);
}

.sidebar nav {
  padding: .35rem .75rem 1rem;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 224, 219, .35) transparent;
}

/* 侧栏滚动条：深色主题细条，避免系统灰条 */
.sidebar nav::-webkit-scrollbar {
  width: 6px;
}
.sidebar nav::-webkit-scrollbar-track {
  background: transparent;
  margin: .35rem 0;
}
.sidebar nav::-webkit-scrollbar-thumb {
  background: rgba(125, 224, 219, .28);
  border-radius: 999px;
}
.sidebar nav::-webkit-scrollbar-thumb:hover {
  background: rgba(125, 224, 219, .48);
}
.sidebar nav::-webkit-scrollbar-corner {
  background: transparent;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: rgba(255, 255, 255, .72);
  padding: .62rem .8rem;
  border-radius: .5rem;
  margin-bottom: .15rem;
  font-weight: 500;
  font-size: .875rem;
  line-height: 1.35;
  box-sizing: border-box;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}

.sidebar nav a .nav-ico,
.sidebar .nav-group-toggle .nav-ico {
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  opacity: .85;
  border-radius: .35rem;
  line-height: 1;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
}

.sidebar nav a.active {
  background: rgba(20, 184, 166, .22);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand-accent);
}

.sidebar nav a.active .nav-ico {
  background: rgba(20, 184, 166, .25);
  opacity: 1;
  color: #5eead4;
}

.sidebar .nav-group {
  margin-bottom: .15rem;
}

.sidebar .nav-group-toggle {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  margin: 0 0 .15rem;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .72);
  padding: .62rem .8rem;
  border-radius: .5rem;
  font-weight: 500;
  font-size: .875rem;
  font-family: inherit;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  transition: background .15s ease, color .15s ease;
}

.sidebar .nav-group-toggle > span {
  flex: 1 1 auto;
  min-width: 0;
}

.sidebar .nav-group-toggle:hover {
  background: rgba(255, 255, 255, .07);
  color: #fff;
}

.sidebar .nav-group.open > .nav-group-toggle {
  color: #fff;
}

.sidebar .nav-group-toggle .nav-chevron {
  margin-left: auto;
  font-size: .75rem;
  opacity: .55;
  transition: transform .2s ease;
}

.sidebar .nav-group.open > .nav-group-toggle .nav-chevron {
  transform: rotate(180deg);
}

.sidebar .nav-sub {
  display: none;
  padding: .15rem 0 .35rem 0;
  margin: .1rem 0 .2rem .55rem;
  border-left: 1px solid rgba(255, 255, 255, .12);
  padding-left: .55rem;
}

.sidebar .nav-group.open > .nav-sub {
  display: block;
}

.sidebar .nav-sub a {
  padding: .42rem .65rem .42rem .9rem;
  font-size: .8rem;
  margin-bottom: .05rem;
  color: rgba(255, 255, 255, .62);
}

.sidebar .nav-sub a .nav-ico {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 1.15rem;
  font-size: .92rem;
  opacity: .7;
}

.sidebar .nav-sub a:hover {
  color: #fff;
}

.sidebar .nav-sub a.active {
  color: #fff;
}

.sidebar .sidebar-foot {
  padding: .9rem 1.15rem 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: .68rem;
  color: rgba(255, 255, 255, .35);
  letter-spacing: .02em;
}

.main-wrap {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left .22s ease;
}

html.sidebar-collapsed .main-wrap {
  margin-left: 0;
}

.topbar {
  height: var(--topbar-height);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .65rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .65rem;
  margin-left: auto;
  min-width: 0;
}

.sidebar-toggle {
  width: 2.15rem;
  height: 2.15rem;
  flex-shrink: 0;
  border: 1px solid var(--brand-border);
  border-radius: .5rem;
  background: #fff;
  color: var(--brand-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.sidebar-toggle:hover {
  background: var(--brand-accent-soft);
  border-color: rgba(20, 184, 166, .35);
  color: var(--brand-primary-dark);
}
.sidebar-toggle:focus-visible {
  outline: 2px solid rgba(14, 116, 144, .35);
  outline-offset: 2px;
}
.sidebar-toggle i { font-size: 1.2rem; line-height: 1; }
html.sidebar-collapsed .sidebar-toggle {
  border-color: rgba(20, 184, 166, .4);
  background: var(--brand-accent-soft);
  color: var(--brand-primary-dark);
}

.topbar .topbar-divider {
  width: 1px;
  height: 22px;
  background: var(--brand-border);
  margin: 0 .15rem;
}

.topbar .user-chip {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--brand-text);
  font-size: .82rem;
  font-weight: 500;
  padding: .28rem .7rem .28rem .35rem;
  background: #fff;
  border: 1px solid var(--brand-border);
  border-radius: 2rem;
  box-shadow: var(--shadow-sm);
}

.topbar .user-chip .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, #0e7490, #14b8a6);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
}

.topbar .user-chip .role-tag {
  color: var(--brand-muted);
  font-weight: 400;
  font-size: .75rem;
}

.content {
  padding: 1.5rem 1.65rem 2.25rem;
  flex: 1;
  width: 100%;
  max-width: none;
}

/* ---------- Panels ---------- */
.card-panel {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.15rem;
}

.card-panel--flush {
  padding: 0;
  overflow: hidden;
}

.card-panel--flush .card-toolbar {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--brand-border);
  background: linear-gradient(180deg, #fafbfc, #f8fafc);
}

.card-panel--flush .table-responsive {
  margin: 0;
}

.card-panel > h5,
.card-panel .panel-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .95rem;
  font-weight: 650;
  color: var(--brand-primary-dark);
  margin: 0 0 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--brand-border);
}

.card-panel > h5 .bi,
.card-panel .panel-title .bi {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .4rem;
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  font-size: .95rem;
}

.panel-title--inline {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

.panel-head {
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--brand-border);
}

.panel-head-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .65rem;
  margin: 0 0 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--brand-border);
}
.card-toolbar.panel-head-bar {
  align-items: center;
}
.panel-head-bar > .panel-title,
.panel-head-bar > h5.panel-title {
  margin: 0;
  padding: 0;
  border: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.panel-fs-btn {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .45rem;
  line-height: 1;
}
.panel-fs-btn i { font-size: .95rem; }

.card-panel.is-panel-fs {
  position: fixed;
  inset: 0.85rem;
  z-index: 2000;
  margin: 0 !important;
  width: auto !important;
  max-width: none !important;
  max-height: calc(100vh - 1.7rem);
  overflow: auto;
  box-shadow: var(--shadow-md);
  background: var(--brand-card);
  border-radius: var(--radius);
}
.card-panel.is-panel-fs .chart-box--tall {
  height: min(52vh, 520px);
}
.card-panel.is-panel-fs .rpt-chart-data,
.card-panel.is-panel-fs .table-responsive {
  max-height: none;
}
body.panel-fs-open {
  overflow: hidden;
}
.panel-fs-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1990;
  background: rgba(15, 23, 42, .48);
  border: 0;
  padding: 0;
  cursor: pointer;
}

.dash-feed .list-group-item {
  background: transparent;
  border-color: #f1f5f9;
  padding-top: .7rem;
  padding-bottom: .7rem;
}

/* ---------- Dashboard reminder groups by WO ---------- */
.dash-reminder-groups {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.dash-rem-group {
  border: 1px solid var(--brand-border);
  border-radius: .55rem;
  background: #fff;
  overflow: hidden;
}

.dash-rem-group__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .45rem .7rem;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid transparent;
}

.dash-rem-group.is-open .dash-rem-group__head {
  border-bottom-color: var(--brand-border);
}

.dash-rem-group__wo {
  font-weight: 600;
  font-size: .82rem;
  word-break: break-all;
  min-width: 0;
}

.dash-rem-group__count {
  flex: 0 0 auto;
  cursor: pointer;
  border: 1px solid var(--brand-border);
  display: inline-flex;
  align-items: center;
  gap: .1rem;
  padding: .25rem .55rem;
  font-size: .78rem;
  line-height: 1.2;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.dash-rem-group__count:hover,
.dash-rem-group.is-open .dash-rem-group__count {
  background: var(--brand-accent-soft);
  border-color: #99e6d8;
  color: var(--brand-primary);
}

.dash-rem-group__count .bi {
  font-size: .7rem;
}

.dash-rem-group__list {
  padding: .25rem .35rem .4rem;
  max-height: 16rem;
  overflow: auto;
}

.dash-rem-item {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  padding: .4rem .4rem;
  border-radius: .4rem;
}

.dash-rem-item + .dash-rem-item {
  margin-top: .1rem;
}

.dash-rem-ico {
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: .4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  margin-top: .05rem;
}

.dash-rem-ico--inline {
  width: 1.45rem;
  height: 1.45rem;
  font-size: .85rem;
  margin-right: .35rem;
  vertical-align: -0.2rem;
  display: inline-flex;
}

.dash-rem-body {
  min-width: 0;
  flex: 1;
}

.dash-rem-msg {
  font-size: .875rem;
  color: #334155;
  line-height: 1.35;
}

.dash-rem-due {
  font-size: .72rem;
  color: #94a3b8;
  margin-top: .1rem;
}

/* tones */
.dash-rem-item--deadline .dash-rem-ico,
.rem-tone--deadline {
  background: #fef2f2;
  color: #dc2626;
}
.dash-rem-item--deadline {
  background: #fff7f7;
}

.dash-rem-item--doc .dash-rem-ico,
.rem-tone--doc {
  background: #eff6ff;
  color: #2563eb;
}
.dash-rem-item--doc {
  background: #f8fbff;
}

.dash-rem-item--amount .dash-rem-ico,
.rem-tone--amount {
  background: #fff7ed;
  color: #c2410c;
}
.dash-rem-item--amount {
  background: #fffaf5;
}

.dash-rem-item--ric .dash-rem-ico,
.rem-tone--ric {
  background: #ecfdf5;
  color: #0d9488;
}
.dash-rem-item--ric {
  background: #f6fffb;
}

.dash-rem-item--admin .dash-rem-ico,
.rem-tone--admin {
  background: #f5f3ff;
  color: #7c3aed;
}
.dash-rem-item--admin {
  background: #faf8ff;
}

.dash-rem-item--approval .dash-rem-ico,
.rem-tone--approval {
  background: #fdf4ff;
  color: #a21caf;
}
.dash-rem-item--approval {
  background: #fef9ff;
}

.dash-rem-item--default .dash-rem-ico,
.rem-tone--default {
  background: #fffbeb;
  color: #d97706;
}

.reminder-detail-table .reminder-row--deadline td:nth-child(2) { border-left: 3px solid #dc2626; }
.reminder-detail-table .reminder-row--doc td:nth-child(2) { border-left: 3px solid #2563eb; }
.reminder-detail-table .reminder-row--amount td:nth-child(2) { border-left: 3px solid #c2410c; }
.reminder-detail-table .reminder-row--ric td:nth-child(2) { border-left: 3px solid #0d9488; }
.reminder-detail-table .reminder-row--admin td:nth-child(2) { border-left: 3px solid #7c3aed; }
.reminder-detail-table .reminder-row--approval td:nth-child(2) { border-left: 3px solid #a21caf; }
.reminder-detail-table .reminder-row--default td:nth-child(2) { border-left: 3px solid #d97706; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

/* Stick below topbar while scrolling long lists (e.g. workers) */
.page-header--sticky {
  position: sticky;
  top: var(--topbar-height);
  z-index: 40;
  margin-left: -1.65rem;
  margin-right: -1.65rem;
  margin-top: -0.35rem;
  padding: .7rem 1.65rem .75rem;
  background: rgba(241, 245, 249, .94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--brand-border);
  box-shadow: 0 6px 16px rgba(15, 23, 42, .06);
}

@media (max-width: 991.98px) {
  .page-header--sticky {
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Workers list: sticky thead under sticky page-header (needs no overflow clip ancestors) */
.card-panel--sticky-table {
  overflow: visible;
}
.table-responsive--sticky-head {
  overflow: visible;
}
#workers-table thead.workers-thead-sticky th {
  position: sticky;
  top: var(--workers-thead-top, calc(var(--topbar-height) + 4.75rem));
  z-index: 35;
  background: #f1f5f9;
  box-shadow: inset 0 -1px 0 var(--brand-border);
}

.page-header--create .page-header-main {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.btn-import-pdf {
  --import-pdf-bg: #c45c26;
  --import-pdf-bg-hover: #a84d1f;
  color: #fff;
  background: var(--import-pdf-bg);
  border: 1px solid var(--import-pdf-bg);
  font-weight: 550;
  padding: .35rem .85rem;
  font-size: .875rem;
  border-radius: .45rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
}

.btn-import-pdf:hover,
.btn-import-pdf:focus {
  color: #fff;
  background: var(--import-pdf-bg-hover);
  border-color: var(--import-pdf-bg-hover);
}

.btn-import-pdf:disabled {
  opacity: .75;
  cursor: wait;
}

.wo-pdf-loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  background: rgba(255, 255, 255, .82);
  border-radius: inherit;
  font-size: .95rem;
  font-weight: 550;
  color: var(--brand-text);
}

.wo-pdf-env {
  padding: .55rem .75rem;
  border-radius: .4rem;
  border: 1px solid #e2e6ea;
  background: #f8f9fa;
  color: #495057;
  line-height: 1.45;
}
.wo-pdf-env--ok {
  border-color: #c3e6cb;
  background: #f0faf2;
  color: #1e5a2c;
}
.wo-pdf-env--warn {
  border-color: #f0d9a8;
  background: #fff8eb;
  color: #6b4e00;
}
.wo-pdf-env__title {
  font-weight: 600;
}
.wo-pdf-env__flags {
  opacity: .9;
}
.wo-pdf-env__issues {
  padding-left: 1.1rem;
  margin: 0;
}

.card-panel--wo-create {
  position: relative;
}


.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  color: var(--brand-text);
  display: flex;
  align-items: center;
  gap: .55rem;
  line-height: 1.3;
  letter-spacing: -.01em;
}

.page-title .bi {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .5rem;
  background: #fff;
  border: 1px solid var(--brand-border);
  color: var(--brand-primary);
  font-size: 1.05rem;
  box-shadow: var(--shadow-sm);
}

.page-subtitle {
  color: var(--brand-muted);
  font-size: .82rem;
  margin-top: .3rem;
  margin-left: 2.7rem;
}

/* ---------- Buttons ---------- */
.btn {
  font-weight: 550;
  border-radius: var(--radius-sm);
  letter-spacing: .01em;
}

.btn-brand {
  background: linear-gradient(180deg, #1289a7, var(--brand-primary));
  border-color: var(--brand-primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(14, 116, 144, .25);
}

.btn-brand:hover,
.btn-brand:focus {
  background: linear-gradient(180deg, #14b8a6, #0e7490);
  border-color: var(--brand-accent);
  color: #fff;
}

.btn-accent {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: #fff;
}

.btn-accent:hover,
.btn-accent:focus {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}

.btn-outline-secondary {
  border-color: var(--brand-border-strong);
  color: #475569;
  background: #fff;
}

.btn-outline-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: var(--brand-text);
}

.btn-outline-primary {
  border-color: #99d5e3;
  color: var(--brand-primary);
  background: #fff;
}

.btn-outline-primary:hover {
  background: var(--brand-accent-soft);
  border-color: var(--brand-accent);
  color: var(--brand-primary-dark);
}

.btn .bi {
  margin-right: .35rem;
  vertical-align: -.1em;
}

.btn-sm {
  font-size: .78rem;
  padding: .3rem .6rem;
}

.btn-sm .bi { margin-right: .25rem; }

.btn-icon-action {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}

/* ---------- Forms ---------- */
.form-label {
  font-size: .78rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: .35rem;
}

.form-control,
.form-select {
  background-color: var(--field-edit);
  border-color: var(--brand-border-strong);
  color: var(--brand-text);
  border-radius: var(--radius-sm);
  box-shadow: none;
  font-size: .875rem;
  min-height: 2.35rem;
}

.form-control:focus,
.form-select:focus {
  background-color: var(--field-edit);
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 .2rem rgba(20, 184, 166, .15);
}

.field-manual,
.form-control.field-manual,
.form-select.field-manual {
  background-color: var(--field-edit) !important;
}

.field-auto,
.form-control.field-auto,
.form-select.field-auto,
.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
  background-color: var(--field-readonly) !important;
  color: #475569;
  cursor: default;
}

.form-control[readonly]:focus,
.form-control:disabled:focus,
.form-select:disabled:focus {
  box-shadow: none;
  border-color: var(--brand-border-strong);
}

/* ---------- Tables ---------- */
.badge-soft {
  background: var(--brand-accent-soft);
  color: #0f766e;
  border: 1px solid #99e6d8;
  font-weight: 600;
  font-size: .72rem;
  padding: .3em .55em;
  border-radius: .35rem;
}

.badge-state {
  font-weight: 650;
  font-size: .72rem;
  padding: .32em .55em;
  border-radius: .35rem;
  border: 1px solid transparent;
  max-width: 100%;
  white-space: nowrap;
}

.badge-state--open {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.badge-state--ip {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

.badge-state--fb {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}

.badge-state--other {
  background: var(--brand-accent-soft);
  color: #0f766e;
  border-color: #99e6d8;
}

.table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
  --bs-table-border-color: #eef2f6;
}

.table thead th {
  background: #f8fafc;
  color: #64748b;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--brand-border) !important;
  vertical-align: middle;
  padding-top: .85rem !important;
  padding-bottom: .85rem !important;
}

.table > :not(caption) > * > * {
  padding: .85rem 1rem;
  vertical-align: middle;
}

.table-hover > tbody > tr {
  transition: background .12s ease;
}

.table-hover > tbody > tr:hover > * {
  background-color: #f0fdfa !important;
}

.table-data tbody td {
  font-size: .84rem;
  color: #334155;
}

.table-data tbody td:first-child {
  font-weight: 600;
  color: var(--brand-text);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: .8rem;
}

/* 描述列适度宽度，过长截断 */
.table-data .col-desc {
  width: 18%;
  min-width: 0;
  max-width: none;
}
.table-data .col-desc .text-truncate {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-data .col-actions {
  width: 1%;
  white-space: nowrap;
}

/* 工作单列表：固定布局，避免横向滚动；子单明显缩进 */
.table-wo-list-wrap {
  overflow-x: hidden;
}
.table-wo-list {
  table-layout: fixed;
  width: 100%;
}
.table-wo-list th,
.table-wo-list td {
  vertical-align: middle;
  overflow: hidden;
}
.table-wo-list .col-select {
  width: 1.55rem;
  min-width: 1.55rem;
  max-width: 1.55rem;
  text-align: center;
  vertical-align: middle;
  padding-left: .3rem;
  padding-right: .2rem;
}
.table-wo-list .col-select .form-check-input {
  margin: 0;
  float: none;
  width: .9em;
  height: .9em;
}
.table-wo-list .th-sort {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.table-wo-list .th-sort .bi {
  font-size: .85em;
  color: #94a3b8;
  opacity: .85;
}
.table-wo-list .th-sort:hover {
  color: var(--brand-primary, #0e7490);
}
.table-wo-list .th-sort:hover .bi {
  color: var(--brand-primary, #0e7490);
  opacity: 1;
}
.table-wo-list .th-sort.is-active,
.table-wo-list .th-sort.is-active .bi {
  color: var(--brand-primary, #0e7490);
  opacity: 1;
  font-weight: 600;
}
.table-wo-list .col-wo-no { width: 17%; }
.table-wo-list .col-relation { width: 9%; }
.table-wo-list .col-ha { width: 10%; }
.table-wo-list .col-loc { width: 7%; min-width: 3.2rem; }
.table-wo-list .col-owner { width: 7%; }
.table-wo-list .col-desc { width: 14%; }
.table-wo-list .col-type { width: 8%; }
.table-wo-list .col-state { width: 9%; }
.table-wo-list .col-progress { width: 8%; }
.table-wo-list .col-var { width: 6%; }
.table-wo-list .col-actions { width: 7%; min-width: 0; }
.table-wo-list .col-wo-no.mono-cell,
.table-wo-list .col-ha,
.table-wo-list .col-owner {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-wo-list .wo-no-text {
  display: inline;
}
.table-wo-list .col-actions .action-group {
  flex-wrap: nowrap;
  gap: .25rem;
}
.table-wo-list .col-actions .btn {
  padding: .25rem .4rem;
}
.table-wo-list .col-actions .btn .bi {
  margin: 0;
}

.wo-row--parent > td {
  background: rgba(13, 110, 108, 0.04);
}
.wo-row--child > td {
  background: rgba(148, 163, 184, 0.06);
}
.wo-row--child > td.col-wo-no {
  padding-left: 1.75rem;
}
.wo-tree-indent {
  display: inline-block;
  width: 1.15rem;
  height: .9rem;
  margin-right: .45rem;
  border-left: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  vertical-align: middle;
  opacity: .75;
  flex-shrink: 0;
}
.badge-wo-parent {
  background: #ccfbf1;
  color: #0f766e;
  border: 1px solid #99f6e4;
  font-weight: 600;
  font-size: .72rem;
}
.badge-wo-child {
  background: #e2e8f0;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-weight: 600;
  font-size: .72rem;
}

/* Work order detail — basic info form */
.wo-basic-form .form-label {
  margin-bottom: .35rem;
  font-size: .8125rem;
}
.wo-basic-form textarea.form-control {
  min-height: 5.5rem;
  resize: vertical;
}
.wo-basic-form .wo-basic-form__text-pair textarea.form-control {
  height: 5.5rem;
}

.wo-parent-select {
  position: relative;
}
.wo-parent-select__toggle {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.wo-parent-select__toggle:focus {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25);
}
.wo-parent-select__label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 1rem;
}
.wo-parent-select__label.is-placeholder {
  color: #6c757d;
}
.wo-parent-select__panel {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 1050;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: .375rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  overflow: hidden;
}
.wo-parent-select__search {
  padding: .45rem .5rem;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}
.wo-parent-select__list {
  max-height: 22rem;
  overflow-y: auto;
}
.wo-parent-select__option {
  display: block;
  width: 100%;
  padding: .5rem .65rem;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: transparent;
  text-align: left;
  font-size: .8125rem;
  color: #0f172a;
}
.wo-parent-select__option:last-child {
  border-bottom: 0;
}
.wo-parent-select__option:hover,
.wo-parent-select__option:focus {
  background: #e9ecef;
  outline: none;
}
.wo-parent-select__option.is-active {
  background: #0d6efd;
  color: #fff;
}
.wo-parent-select__option.is-active .wo-parent-select__desc {
  color: rgba(255, 255, 255, .85);
}
.wo-parent-select__option.is-none {
  font-weight: 500;
  color: #6c757d;
}
.wo-parent-select__option.is-none.is-active {
  color: #fff;
}
.wo-parent-select__no {
  display: block;
  font-weight: 600;
}
.wo-parent-select__desc {
  display: block;
  margin-top: .15rem;
  color: #64748b;
  font-size: .75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wo-parent-select__hint,
.wo-parent-select__empty {
  padding: .65rem;
  color: #94a3b8;
  font-size: .8125rem;
  text-align: center;
}

.table-sm > :not(caption) > * > * {
  padding: .55rem .75rem;
}

.mono-cell {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: .8rem;
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--brand-muted);
}

.empty-state .bi {
  font-size: 2.25rem;
  display: block;
  margin-bottom: .65rem;
  opacity: .4;
  color: var(--brand-primary);
}

/* ---------- Lang / reminder ---------- */
.lang-switch .btn {
  border-color: var(--brand-border-strong);
  min-width: 3.2rem;
  font-size: .75rem;
  font-weight: 600;
  background: #fff;
}

.lang-switch .btn.active {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

.reminder-bell {
  position: relative;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .5rem;
  border: 1px solid var(--brand-border);
  background: #fff;
  color: #475569;
  padding: 0;
  transition: all .15s ease;
}

.reminder-bell:hover {
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  border-color: #99e6d8;
}

.reminder-bell .badge {
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: .62rem;
  min-width: 1.1rem;
}

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 18% 22%, rgba(20, 184, 166, .22), transparent 42%),
    radial-gradient(circle at 82% 8%, rgba(14, 116, 144, .32), transparent 38%),
    linear-gradient(145deg, #0f2740, #0e7490 48%, #14b8a6);
}

.login-shell {
  width: 100%;
  max-width: 420px;
}

.login-copyright {
  margin: 1rem 0 0;
  text-align: center;
  font-size: .72rem;
  color: rgba(255, 255, 255, .62);
  letter-spacing: .02em;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 1rem;
  padding: 2.1rem 2.15rem 1.85rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .28);
  border: 1px solid rgba(255, 255, 255, .2);
}

.login-card .login-icon {
  width: 52px;
  height: 52px;
  border-radius: .75rem;
  background: linear-gradient(145deg, var(--brand-accent-soft), #d1fae5);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid #99e6d8;
}

.login-card h1 {
  font-size: 1.4rem;
  color: var(--brand-text);
  margin-bottom: .25rem;
  font-weight: 700;
  text-align: center;
}

.login-card .login-subtitle {
  text-align: center;
  margin-bottom: 0;
}

.login-card .login-lang-switch {
  display: flex;
  justify-content: center;
  margin: .65rem 0 1.2rem;
}

.login-card .login-lang-btn {
  min-width: 3.1rem;
  font-size: .75rem;
  font-weight: 500;
  padding: .32rem .85rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  box-shadow: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.login-card .login-lang-btn:hover {
  background: #f1f5f9;
  color: #475569;
  border-color: #cbd5e1;
}

.login-card .login-lang-btn.active,
.login-card .login-lang-btn.active:hover {
  background: #ecfdf5;
  color: #0f766e;
  border-color: #a7f3d0;
  font-weight: 600;
}

.login-card .alert {
  margin-bottom: 1rem;
}

.login-card form {
  margin-top: 0;
}

.login-card .form-control {
  background: var(--field-edit);
  min-height: 2.6rem;
}

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap .bi {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand-muted);
  pointer-events: none;
}

.input-icon-wrap .form-control {
  padding-left: 2.45rem;
}

/* ---------- Tabs / stats ---------- */
.nav-tabs {
  border-bottom: 1px solid var(--brand-border);
  gap: .15rem;
}

.nav-tabs .nav-link {
  color: var(--brand-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: .4rem .4rem 0 0;
  padding: .75rem 1.05rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-weight: 500;
  font-size: .85rem;
}

.nav-tabs .nav-link:hover {
  color: var(--brand-primary);
  background: #f8fafc;
  border-color: transparent;
}

.nav-tabs .nav-link.active {
  color: var(--brand-primary);
  background: transparent;
  border-color: transparent transparent var(--brand-accent);
  font-weight: 650;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--brand-card);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: flex-start;
  gap: .95rem;
  transition: transform .15s ease, box-shadow .15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-ico {
  width: 44px;
  height: 44px;
  border-radius: .6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  border: 1px solid #b2f0e6;
}

.stat-card .stat-ico.tone-warn {
  background: #fff7ed;
  color: var(--warning);
  border-color: #fed7aa;
}

.stat-card .stat-ico.tone-info {
  background: #e0f2fe;
  color: var(--brand-primary);
  border-color: #bae6fd;
}

.stat-card .label {
  color: var(--brand-muted);
  font-size: .78rem;
  font-weight: 500;
  margin-bottom: .2rem;
}

.stat-card .value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--brand-text);
  line-height: 1.15;
  letter-spacing: -.02em;
}

.filter-bar {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 0;
}

.card-toolbar .filter-bar {
  margin: 0;
}

.wo-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  width: 100%;
}

@media (min-width: 1200px) {
  .wo-filter-row {
    flex-wrap: nowrap;
  }
}

.wo-filter-field {
  min-width: 0;
}

.wo-filter-q {
  flex: 1 1 7.5rem;
  min-width: 6.5rem;
}

.wo-filter-type {
  flex: 1.1 1 8rem;
  min-width: 7rem;
}

.wo-filter-owner {
  flex: 1 1 7.5rem;
  min-width: 6.5rem;
}

.wo-filter-relation {
  flex: 0.9 1 6.5rem;
  min-width: 5.5rem;
}

.wo-filter-submit {
  flex: 0 0 auto;
  min-width: 4.75rem;
}

.wo-filter-field .form-select,
.wo-filter-field .form-control {
  width: 100%;
}

.filter-form .campus-filter {
  margin-bottom: .85rem;
}

.filter-form .wo-filter-row {
  width: 100%;
}

.campus-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: .4rem;
}

.campus-filter__list {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  flex: 1 1 auto;
}

.campus-filter__item {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  margin: 0;
  padding: .28rem .65rem;
  border: 1px solid var(--brand-border, #e2e8f0);
  border-radius: .45rem;
  background: #fff;
  color: #475569;
  font-size: .8rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.campus-filter__item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.campus-filter__item .bi {
  font-size: .85rem;
  opacity: .75;
}

.campus-filter__item:hover {
  border-color: #cbd5e1;
  color: var(--brand-primary, #1e3a5f);
  background: #f8fafc;
}

.campus-filter__item.is-active {
  border-color: var(--brand-primary, #1e3a5f);
  background: var(--brand-primary, #1e3a5f);
  color: #fff;
  box-shadow: 0 1px 2px rgba(30, 58, 95, .18);
}

.campus-filter__item.is-active .bi {
  opacity: 1;
}

/* Work order discipline amount / split grids — 7 equal columns (MVAC…BS) */
.wo-disc-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: .45rem .6rem;
  align-items: end;
}

.wo-disc-grid__cell {
  min-width: 0;
}

.wo-disc-grid__cell .form-label {
  display: block;
  margin-bottom: .2rem;
  font-size: .75rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wo-disc-grid__cell .form-control {
  width: 100%;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.wo-disc-grid__cell input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.wo-disc-grid__cell input[type=number]::-webkit-outer-spin-button,
.wo-disc-grid__cell input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.wo-disc-grid__cell--spacer {
  visibility: hidden;
  pointer-events: none;
}

.wo-disc-grid--amount .form-control {
  background-color: #f8fafc;
}

@media (max-width: 991.98px) {
  .wo-disc-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .wo-disc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Inline ? hint tooltips */
.hint-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
  transition: color .15s ease;
}

.hint-icon:hover,
.hint-icon:focus-visible {
  color: var(--brand-primary, #1e3a5f);
  outline: none;
}

.hint-icon .bi {
  font-size: 1rem;
  pointer-events: none;
}

.hint-icon--sm .bi {
  font-size: .9rem;
}

.wo-section-title {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}

.nav-item--with-hint .nav-item-hint-wrap {
  display: inline-flex;
  align-items: center;
  gap: .1rem;
}

.nav-item--with-hint .nav-item-hint-wrap .nav-link {
  padding-right: .25rem;
}

.nav-item--with-hint .hint-icon {
  margin-right: .35rem;
  margin-bottom: .1rem;
}

.tooltip.hint-tooltip .tooltip-inner {
  max-width: min(34rem, 92vw);
  text-align: left;
  line-height: 1.5;
  padding: .45rem .7rem;
}

.tooltip.hint-tooltip--single .tooltip-inner {
  max-width: none;
  white-space: nowrap;
}

.toolbar-actions {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar-actions .dropdown-menu {
  font-size: .78rem;
  min-width: 9.5rem;
  padding: .28rem 0;
  border-color: var(--brand-border-strong);
  box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
}

.toolbar-actions .dropdown-item {
  font-size: inherit;
  padding: .38rem .75rem;
  color: var(--brand-text);
  display: flex;
  align-items: center;
  gap: .35rem;
}

.toolbar-actions .dropdown-item .bi {
  font-size: .92em;
  opacity: .75;
  flex-shrink: 0;
}

.toolbar-actions .dropdown-item:hover,
.toolbar-actions .dropdown-item:focus {
  background: var(--brand-accent-soft);
  color: var(--brand-primary-dark);
}

.toolbar-actions .dropdown-item:disabled,
.toolbar-actions .dropdown-item.disabled {
  color: var(--brand-muted, #94a3b8);
}

.toolbar-actions .dropdown-divider {
  margin: .28rem 0;
  border-color: var(--brand-border);
}

.section-block {
  margin-bottom: 1.35rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--brand-border);
}

.section-block:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-block h6,
.section-block-title {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 650;
  color: var(--brand-primary-dark);
  font-size: .9rem;
  margin: 0 0 .75rem;
}

.list-group-item {
  border-color: #eef2f5;
}

.progress-mini {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  width: auto;
  max-width: 100%;
}

.progress-mini .bar {
  flex: 1;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  min-width: 56px;
  max-width: 80px;
}

.progress-mini .bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
  border-radius: 3px;
}

.action-group {
  display: inline-flex;
  gap: .35rem;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  white-space: nowrap;
}

.table-data .col-actions .action-group .btn {
  flex-shrink: 0;
}

#toast-area {
  position: fixed;
  top: calc(var(--topbar-height) + 0.65rem);
  right: 1rem;
  z-index: 1090;
  width: min(30rem, calc(100vw - 1.25rem));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  pointer-events: none;
}

#toast-area .alert {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 1rem 2.85rem 1rem 1rem;
  border-radius: 0.65rem;
  border: 2px solid transparent;
  box-shadow:
    0 18px 48px rgba(15, 23, 42, 0.32),
    0 4px 12px rgba(15, 23, 42, 0.12);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: #fff;
  animation: wo-toast-in 0.42s cubic-bezier(0.34, 1.45, 0.64, 1);
}

#toast-area .alert .toast-icon-wrap {
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

#toast-area .alert .toast-icon {
  font-size: 1.25rem;
  line-height: 1;
  color: #fff;
}

#toast-area .alert .toast-msg {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

#toast-area .alert-success {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border-color: #34d399;
}

#toast-area .alert-danger {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border-color: #f87171;
}

#toast-area .alert-warning {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  border-color: #fbbf24;
}

#toast-area .alert-info {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: #60a5fa;
}

#toast-area .alert .btn-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  padding: 0.4rem;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

#toast-area .alert .btn-close:hover {
  opacity: 1;
}

@keyframes wo-toast-in {
  0% {
    opacity: 0;
    transform: translateX(2rem) scale(0.92);
  }
  70% {
    opacity: 1;
    transform: translateX(-0.15rem) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* 长时间任务提示：高对比，避免被当成普通 info 条忽略 */
#toast-area .alert-loading {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  color: #fff;
  border: 2px solid #fb923c;
  box-shadow: 0 18px 48px rgba(194, 65, 12, .4);
  font-weight: 700;
  font-size: 1.02rem;
  padding: 1rem 2.85rem 1rem 1rem;
}

#toast-area .alert-loading .toast-loading-icon {
  flex-shrink: 0;
  margin-top: .1rem;
}

#toast-area .alert-loading .spinner-border {
  width: 1.1rem;
  height: 1.1rem;
  border-width: .15em;
  color: #fff;
  border-right-color: transparent;
}

#toast-area .alert-loading .toast-msg {
  flex: 1;
  line-height: 1.45;
}

#toast-area .alert-loading .btn-close {
  filter: invert(1) grayscale(100%);
  opacity: .85;
}

/* ---------- Busy overlay (block UI during long import) ---------- */
.wo-busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, .62);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  cursor: wait;
  user-select: none;
}

.wo-busy-overlay.is-visible {
  display: flex;
}

.wo-busy-overlay__panel {
  width: min(420px, 100%);
  background: #059669;
  color: #fff;
  border-radius: 12px;
  padding: 1.5rem 1.35rem;
  text-align: center;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .35);
  border: 1px solid #047857;
}

.wo-busy-overlay__spinner {
  width: 2.25rem;
  height: 2.25rem;
  border-width: .22em;
  color: #fff;
  border-right-color: transparent;
  margin-bottom: .9rem;
}

.wo-busy-overlay__title {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.45;
  margin-bottom: .45rem;
}

.wo-busy-overlay__hint {
  font-size: .85rem;
  opacity: .92;
  line-height: 1.4;
}

html.wo-busy-lock,
body.wo-busy-lock {
  overflow: hidden !important;
}

/* ---------- List pagination ---------- */
.list-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1rem;
  padding: .85rem 1rem;
  border-top: 1px solid rgba(15, 23, 42, .08);
  background: #f8fafc;
}

.list-pagination__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1rem;
}

.list-pagination .pagination .page-link {
  min-width: 2rem;
  text-align: center;
}

/* ---------- Work order / worker preview modal ---------- */
.wo-preview-modal__dialog {
  --bs-modal-width: min(1440px, 96vw);
  max-width: min(1440px, 96vw);
  width: 96vw;
  margin: .6rem auto;
}

.wo-preview-modal__dialog .modal-content {
  max-height: calc(100vh - 1.2rem);
}

.wo-preview-iframe {
  width: 100%;
  min-height: 420px;
  height: min(68vh, calc(100vh - 5.5rem));
  max-height: calc(100vh - 5.5rem);
  border: 0;
  display: block;
  background: #fff;
}

.wo-embed {
  background: #fff;
}

.wo-embed__content {
  padding: .75rem 1rem 1rem;
  max-width: 100%;
}

.reminder-preview-col {
  white-space: normal;
  word-break: break-word;
  line-height: 1.45;
}

.reminder-preview-item + .reminder-preview-item {
  margin-top: .4rem;
  padding-top: .4rem;
  border-top: 1px dashed rgba(15, 23, 42, .08);
}

/* ---------- Excel import sheet picker ---------- */
.wo-import-sheet-list {
  max-height: 280px;
  overflow: auto;
  padding: .35rem;
  background: #fff;
}

.wo-import-sheet-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .65rem;
  margin: 0;
  border-radius: 8px;
  cursor: pointer;
}

.wo-import-sheet-item:hover {
  background: #f1f5f9;
}

.wo-import-sheet-name {
  font-weight: 600;
  font-size: .9rem;
}

.wo-import-log {
  max-height: 120px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Certificate thumbs / lightbox ---------- */
.cert-thumb {
  width: 56px;
  height: 56px;
  border-radius: .4rem;
  border: 1px solid var(--brand-border);
  background: #f8fafc;
  overflow: hidden;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .1rem;
  cursor: zoom-in;
  padding: 0;
  flex-shrink: 0;
  transition: box-shadow .15s ease, border-color .15s ease;
  text-decoration: none;
  color: inherit;
}

.cert-thumb:hover {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .18);
}

.cert-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cert-thumb--pdf {
  color: #dc2626;
  font-size: 1.25rem;
}

.cert-thumb--pdf span {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: #b91c1c;
}

.cert-thumb--file {
  color: var(--brand-muted);
  font-size: 1.25rem;
  cursor: pointer;
}

.cert-thumb--empty {
  color: #cbd5e1;
  cursor: default;
  pointer-events: none;
}

.cert-thumb--broken,
.cert-thumb--missing {
  color: #94a3b8;
  cursor: default;
  pointer-events: none;
}

.cert-alert-stack {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.cert-alert {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-weight: 600;
}

.cert-alert .bi {
  font-size: 1rem;
  flex-shrink: 0;
}

.cert-alert--expired {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.cert-alert--soon {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.cert-table tbody tr.cert-row--expired > *,
.table-data tbody tr.cert-row--expired > * {
  background: #fef2f2 !important;
}

.cert-table tbody tr.cert-row--soon > *,
.table-data tbody tr.cert-row--soon > * {
  background: #fffbeb !important;
}

.cert-table tbody tr.cert-row--expired,
.table-data tbody tr.cert-row--expired {
  box-shadow: inset 3px 0 0 #dc2626;
}

.cert-table tbody tr.cert-row--soon,
.table-data tbody tr.cert-row--soon {
  box-shadow: inset 3px 0 0 #d97706;
}

.cert-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .7rem;
  font-weight: 700;
  padding: .18rem .45rem;
  border-radius: .3rem;
  line-height: 1.2;
  white-space: nowrap;
}

.cert-badge--expired {
  background: #dc2626;
  color: #fff;
}

.cert-badge--soon {
  background: #f59e0b;
  color: #78350f;
}

.cert-date {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cert-date--expired {
  color: #b91c1c;
}

.cert-date--soon {
  color: #b45309;
}

.cert-lightbox[hidden] {
  display: none !important;
}

.cert-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

body.cert-lightbox-open {
  overflow: hidden;
}

.cert-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .8);
  backdrop-filter: blur(2px);
  cursor: zoom-out;
}

.cert-lightbox__dialog {
  position: relative;
  z-index: 1;
  width: min(96vw, 1100px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  border-radius: .65rem;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

.cert-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .65rem .85rem;
  background: rgba(255, 255, 255, .06);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.cert-lightbox__title {
  color: #f8fafc;
  font-weight: 600;
  font-size: .9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cert-lightbox__actions {
  display: flex;
  gap: .4rem;
  flex-shrink: 0;
}

.cert-lightbox__body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .85rem;
  background: #020617;
}

.cert-lightbox__body img {
  max-width: 100%;
  max-height: calc(92vh - 64px);
  object-fit: contain;
  border-radius: .35rem;
}

.cert-lightbox__body iframe {
  width: 100%;
  height: calc(92vh - 64px);
  min-height: 420px;
  border: 0;
  border-radius: .35rem;
  background: #fff;
}

/* ---------- Confirm dialog ---------- */
.wo-confirm[hidden] {
  display: none !important;
}

.wo-confirm {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

body.wo-confirm-open {
  overflow: hidden;
}

.wo-confirm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
}

.wo-confirm__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  background: #fff;
  border-radius: .85rem;
  padding: 1.5rem 1.4rem 1.25rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  text-align: center;
  animation: wo-confirm-in .18s ease-out;
}

@keyframes wo-confirm-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}

.wo-confirm__icon {
  width: 52px;
  height: 52px;
  margin: 0 auto .9rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.wo-confirm--danger .wo-confirm__icon {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.wo-confirm--warn .wo-confirm__icon {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.wo-confirm--primary .wo-confirm__icon {
  background: var(--brand-accent-soft);
  color: var(--brand-primary);
  border: 1px solid #99e6d8;
}

.wo-confirm__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 .45rem;
  color: var(--brand-text);
}

.wo-confirm__message {
  margin: 0;
  color: #475569;
  font-size: .9rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.wo-confirm__detail {
  margin: .65rem 0 0;
  padding: .55rem .7rem;
  background: #f8fafc;
  border: 1px solid var(--brand-border);
  border-radius: .45rem;
  color: var(--brand-primary-dark);
  font-size: .82rem;
  font-weight: 600;
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-all;
  white-space: pre-wrap;
  text-align: left;
}

.wo-confirm__actions {
  display: flex;
  gap: .55rem;
  justify-content: center;
  margin-top: 1.2rem;
}

.wo-confirm__actions .btn {
  min-width: 96px;
}

/* ---------- Date / NA / Pending picker ---------- */
.dsp {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.dsp-seg {
  display: inline-flex;
  width: 100%;
  background: #f1f5f9;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.dsp-opt {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--brand-muted);
  font-size: .75rem;
  font-weight: 600;
  padding: .35rem .25rem;
  border-radius: .35rem;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}

.dsp-opt:hover:not(:disabled) {
  color: var(--brand-text);
  background: rgba(255, 255, 255, .7);
}

.dsp-opt.is-active {
  background: #fff;
  color: var(--brand-primary-dark);
  box-shadow: var(--shadow-sm);
}

.dsp-opt[data-dsp-mode="NA"].is-active {
  color: #64748b;
}

.dsp-opt[data-dsp-mode="Pending"].is-active {
  color: #b45309;
}

.dsp-date-wrap .form-control {
  min-height: 2.1rem;
}

.dsp--disabled {
  opacity: .75;
  pointer-events: none;
}

.dsp--disabled .dsp-opt {
  cursor: default;
}

/* ---------- Work order documents tab panels ---------- */
.wo-docs-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wo-docs-panel {
  border: 1px solid var(--brand-border, #e2e8f0);
  border-radius: .55rem;
  background: #fff;
  overflow: hidden;
}

.wo-docs-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--brand-border, #e2e8f0);
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
}

.wo-docs-panel__title {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  font-size: .92rem;
  font-weight: 650;
  color: var(--brand-primary-dark, #1e3a5f);
}

.wo-docs-panel__title .bi {
  font-size: 1rem;
  opacity: .85;
}

.wo-docs-panel__badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: #475569;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
}

.wo-docs-panel__body {
  padding: 1rem 1rem .85rem;
  margin: 0;
}

.wo-docs-panel--prep {
  border-left: 3px solid #94a3b8;
  background: #fafbfc;
}

.wo-docs-panel--prep .wo-docs-panel__head {
  background: linear-gradient(180deg, #f1f5f9, #e8edf3);
}

.wo-docs-panel--files {
  border-left: 3px solid var(--brand-primary, #1e3a5f);
  box-shadow: 0 1px 2px rgba(30, 58, 95, .06);
}

.wo-docs-panel--files .wo-docs-panel__head {
  background: linear-gradient(180deg, #eef6f8, #e6f2f5);
}

.wo-docs-panel--cert {
  border-left: 3px solid #0d9488;
}

.wo-docs-panel--cert .wo-docs-panel__head {
  background: linear-gradient(180deg, #ecfdf5, #e6f7f1);
}

.wo-docs-form__actions {
  padding-top: .25rem;
}

/* ---------- Work order section panels (amounts / split tabs) ---------- */
.wo-section-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wo-section-panel {
  border: 1px solid var(--brand-border, #e2e8f0);
  border-radius: .55rem;
  background: #fff;
  overflow: hidden;
}

.wo-section-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--brand-border, #e2e8f0);
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
}

.wo-section-panel__title {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  font-size: .92rem;
  font-weight: 650;
  color: var(--brand-primary-dark, #1e3a5f);
}

.wo-section-panel__title .bi {
  font-size: 1rem;
  opacity: .85;
}

.wo-section-panel__body {
  padding: 1rem;
}

.wo-section-panel__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .55rem 1rem .7rem;
  border-top: 1px solid var(--brand-border, #e2e8f0);
  background: #f8fafc;
}

.wo-section-panel__foot-hint {
  margin-right: auto;
  font-size: .75rem;
  color: var(--brand-muted, #64748b);
}

.wo-section-panel--split-tqs {
  border-left: 3px solid var(--brand-primary, #1e3a5f);
}

.wo-section-panel--split-tqs .wo-section-panel__head {
  background: linear-gradient(180deg, #eef6f8, #e6f2f5);
}

.wo-section-panel--split-layer {
  border-left: 3px solid #94a3b8;
}

.wo-section-panel--amount {
  border-left: 3px solid #cbd5e1;
}

@media (max-width: 992px) {
  .sidebar {
    position: relative;
    width: 100%;
    box-shadow: none;
    transform: none;
  }
  .main-wrap { margin-left: 0; }
  .app-shell { flex-direction: column; }
  html.sidebar-collapsed .sidebar {
    display: none;
    transform: none;
    pointer-events: none;
  }
  .sidebar nav {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    padding: .65rem;
  }
  .sidebar nav a {
    margin-bottom: 0;
    flex: 1 1 auto;
  }
  .sidebar nav a.active {
    box-shadow: none;
  }
  .page-subtitle {
    margin-left: 0;
  }
  .content {
    padding: 1.1rem 1rem 1.75rem;
  }
  .topbar {
    padding: 0 1rem;
  }
}

.chart-box {
  position: relative;
  height: 260px;
  width: 100%;
}
.chart-box--wide {
  height: 300px;
}
.chart-box--tall {
  height: 360px;
}
/* Sticky on the column (flex item) so it can track while left charts scroll */
.stage-filter-col {
  position: sticky;
  top: calc(var(--topbar-height, 60px) + 0.5rem);
  align-self: flex-start;
  z-index: 2;
  max-height: calc(100vh - var(--topbar-height, 60px) - 1rem);
  overflow-y: auto;
}
.stage-filter-panel {
  width: 100%;
  margin-bottom: 0;
}
.stage-filter-grid > [class*="col-"] {
  margin-bottom: 0.35rem;
}
.stage-date-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
}
.stage-date-presets .stage-date-preset {
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.28rem 0.2rem;
  border-radius: 0.35rem;
}
.stage-date-presets .stage-date-preset.active {
  background: var(--brand-primary, #0e7490);
  border-color: var(--brand-primary, #0e7490);
  color: #fff;
}
.stage-filter-col-stretch {
  display: flex;
  flex-direction: column;
}
.stage-check-list {
  max-height: 8.5rem;
  overflow: auto;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.375rem;
  padding: 0.35rem 0.5rem;
}
.stage-check-list--fill {
  /* Location list under search: fixed height */
  flex: 0 0 auto;
  height: 8.5rem;
  max-height: 8.5rem;
}
/* Tray: stretch to match Location search+list (tops/bottoms align with left) */
.stage-check-list--tall {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: none;
}
.stage-check-list .form-check {
  margin-bottom: 0.15rem;
}
.rpt-chart-data__table {
  font-size: 0.8rem;
}
/* 面版：表上方 Order/WO/… 数量·金额汇总条 */
.stage-kpi-sheet {
  font-size: 0.8rem;
  border: 1px solid var(--brand-border, #e2e8f0);
  border-radius: var(--radius-sm, .45rem);
  background: #f8fafc;
  padding: 0.45rem 0.65rem;
}
.stage-kpi-sheet__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 1.25rem;
}
.stage-kpi-sheet__pair {
  display: grid;
  grid-template-columns: minmax(5.5rem, auto) minmax(3.5rem, 1fr) minmax(5.5rem, auto) minmax(5rem, 1.2fr);
  gap: 0.15rem 0.45rem;
  align-items: baseline;
  padding: 0.12rem 0;
  border-bottom: 1px dashed rgba(148, 163, 184, .35);
}
.stage-kpi-sheet__pair:last-child {
  border-bottom: 0;
}
.stage-kpi-sheet__label {
  color: var(--brand-muted, #64748b);
  white-space: nowrap;
}
.stage-kpi-sheet__value {
  font-weight: 600;
  color: var(--brand-text, #0f172a);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.stage-kpi-sheet__value.is-money {
  color: var(--brand-primary-dark, #0b4f63);
}
@media (max-width: 992px) {
  .stage-kpi-sheet__cols {
    grid-template-columns: 1fr;
  }
}

.rpt-stage-wo-table thead th {
  vertical-align: bottom;
  line-height: 1.25;
  white-space: normal;
  min-width: 5.5rem;
}
.rpt-stage-wo-table th.col-wo-no,
.rpt-stage-wo-table td.col-wo-no {
  width: 7.5rem;
  max-width: 8.5rem;
  min-width: 6.5rem;
  white-space: normal;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.rpt-stage-wo-table td.col-wo-no a {
  display: inline;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.rpt-stage-wo-table .th-bi {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
}
.rpt-stage-wo-table .th-bi__zh {
  font-weight: 600;
  color: var(--brand-text, #0f172a);
}
.rpt-stage-wo-table .th-bi__en {
  font-weight: 500;
  font-size: 0.72em;
  color: var(--brand-muted, #64748b);
  letter-spacing: 0.01em;
}
.wo-disc-grid__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
}
.wo-disc-grid__label-row .form-label {
  margin-bottom: 0;
}
.wo-disc-enable {
  flex-shrink: 0;
}
.reports-filters .form-label {
  color: var(--brand-muted, #6c757d);
}

/* Permit workers roster: trade columns aligned under EN+(中文) headers */
.table-permit-workers thead th {
  vertical-align: bottom;
  line-height: 1.25;
  white-space: nowrap;
}
.table-permit-workers thead th.col-trade,
.table-permit-workers tbody td.col-trade {
  text-align: center;
  vertical-align: middle;
  min-width: 4.2rem;
  padding-left: .35rem;
  padding-right: .35rem;
}
.table-permit-workers tbody td.col-trade input[type="checkbox"] {
  margin: 0;
  vertical-align: middle;
  position: relative;
  top: 0;
}

/* Work order list — date range filter (day / week / month / custom) */
.wo-filter-row .wo-date-range-filter {
  flex: 2.2 1 14rem;
  min-width: 0;
  max-width: none;
}
.wo-date-range-filter .wo-date-range-bar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: .25rem;
  min-width: 0;
  width: 100%;
}
.wo-date-range-filter .wo-date-field {
  width: 5.25rem;
  flex: 0 0 auto;
  padding-left: .35rem;
  padding-right: 1.25rem;
  font-size: .8125rem;
}
.wo-date-range-filter .wo-date-presets {
  flex: 0 0 auto;
}
.wo-date-range-filter .wo-date-presets .btn,
.wo-date-range-filter .wo-date-custom-toggle {
  padding-left: .4rem;
  padding-right: .4rem;
  font-size: .75rem;
}
.wo-date-range-filter .wo-date-presets .btn.active,
.wo-date-range-filter .wo-date-custom-toggle.active {
  color: var(--bs-primary, #0d6efd);
  border-color: var(--bs-primary, #0d6efd);
  background: rgba(13, 110, 253, .08);
  font-weight: 600;
}
.wo-date-range-filter .wo-date-custom-panel {
  min-width: 15rem;
}
.wo-date-range-filter .wo-date-label {
  flex: 1 1 5rem;
  min-width: 4.5rem;
  max-width: none;
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: .35rem;
  padding-right: .35rem;
}
.wo-date-range-filter .wo-date-nav,
.wo-date-range-filter .wo-date-clear {
  flex: 0 0 auto;
  padding-left: .3rem;
  padding-right: .3rem;
}
@media (max-width: 1199.98px) {
  .wo-filter-row .wo-date-range-filter {
    flex: 1 1 100%;
    width: 100%;
  }
  .wo-date-range-filter .wo-date-range-bar {
    flex-wrap: wrap;
  }
}

/* Reports: wide drill modal + data grids */
.reports-drill-dialog {
  --bs-modal-width: min(96vw, 1400px);
  max-width: min(96vw, 1400px);
  width: 96vw;
  margin: 1rem auto;
}
.reports-drill-dialog .modal-body {
  max-height: calc(100vh - 8rem);
  overflow: auto;
}
.rpt-grid__scroll {
  max-height: 420px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.rpt-grid__scroll table {
  min-width: 100%;
  white-space: nowrap;
}
.rpt-grid__th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.rpt-grid__th-sort:hover {
  color: var(--brand-primary, #0e7490);
}
#reportsDrillGrid .rpt-grid__scroll {
  max-height: calc(100vh - 14rem);
}

