:root {
  --control-h: 36px;
  --focus-ring: #0f766e;
}

.ledger-commandbar {
  margin: 12px 0;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
}
.command-row,
.quick-view-row,
.active-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}
.command-row { justify-content: space-between; border-bottom: 1px solid var(--line); }
.command-actions { display: flex; align-items: center; gap: 8px; }
.quick-view-row { flex-wrap: wrap; background: #f7f9f9; border-bottom: 1px solid var(--line); }
.quick-view-row > span:first-child,
.active-filter-row > span:first-child { color: var(--muted); font-size: 12px; font-weight: 700; }
.quick-view-row button,
.active-filter-row button,
.table-pager button {
  border: 1px solid #d5dddc;
  background: #fff;
  color: #314542;
  min-height: 30px;
  border-radius: 5px;
  padding: 5px 9px;
  cursor: pointer;
}
.quick-view-row button:hover,
.active-filter-row button:hover { border-color: var(--accent); color: var(--accent); }
.quick-view-row input,
.quick-view-row select { height: 32px; min-width: 120px; max-width: 170px; }
.quick-separator { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.active-filter-row { min-height: 42px; flex-wrap: wrap; }
.active-filter-row button { background: #eef7f5; border-color: #c5ddd9; }
.active-filter-row button span { margin-left: 6px; font-size: 16px; line-height: 1; }
.ledger-tabs { display: flex; gap: 2px; }
.ledger-tabs .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.column-menu { position: relative; }
.column-menu summary { list-style: none; cursor: pointer; }
.column-menu summary::-webkit-details-marker { display: none; }
.column-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: 240px;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(31, 48, 46, .15);
}
.column-popover strong { display: block; margin-bottom: 8px; }
.column-popover label { display: flex; align-items: center; gap: 8px; min-height: 31px; font-size: 13px; }
.column-popover input { width: 15px; height: 15px; }

.primary-filters { gap: 8px !important; }
.primary-filters .search { min-width: 260px; flex: 1; }
.primary-filters select { width: 150px; }

.filter-drawer {
  position: fixed;
  inset: 0;
  z-index: 100;
  visibility: hidden;
  pointer-events: none;
}
.filter-drawer.show { visibility: visible; pointer-events: auto; }
.filter-drawer-backdrop { position: absolute; inset: 0; border: 0; background: rgba(14, 25, 24, .36); opacity: 0; transition: opacity .18s ease; }
.filter-drawer.show .filter-drawer-backdrop { opacity: 1; }
.filter-drawer aside {
  position: absolute;
  top: 0;
  right: 0;
  width: min(390px, 92vw);
  height: 100%;
  background: #fff;
  display: grid;
  grid-template-rows: auto 1fr auto;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.16, 1, .3, 1);
  box-shadow: -12px 0 34px rgba(18, 35, 33, .15);
}
.filter-drawer.show aside { transform: translateX(0); }
.drawer-head,
.drawer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px; border-bottom: 1px solid var(--line); }
.drawer-foot { border-top: 1px solid var(--line); border-bottom: 0; }
.drawer-head h2 { margin: 2px 0 0; font-size: 19px; }
.drawer-body { overflow: auto; padding: 18px; }
.drawer-body > label { display: grid; gap: 7px; margin-bottom: 16px; color: #425452; font-size: 12px; font-weight: 700; }
.drawer-body select { width: 100%; height: 38px; }

#regTable { min-width: 1080px; }
#regTable th:nth-child(1) { min-width: 190px; }
#regTable th:nth-child(7) { min-width: 220px; }
.wrap-cell { white-space: normal !important; min-width: 220px; line-height: 1.45; }

#projectTable[data-ledger-view="financial"] { min-width: 1450px; }
#projectTable[data-ledger-view="progress"] { min-width: 1500px; }
#projectTable[data-ledger-view="archive"] { min-width: 1320px; }
#projectTable[data-ledger-view="full"] { min-width: 4120px; }
#projectTable td[hidden], #projectTable th[hidden], #reviewTable td[hidden], #reviewTable th[hidden] { display: none; }

.table-pager {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: min(100%, 720px);
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #fafcfc;
  color: var(--muted);
  font-size: 12px;
}
.table-pager label,
.table-pager > div { display: flex; align-items: center; gap: 8px; }
.table-pager select { height: 30px; }
.page-hidden { display: none !important; }

.density-compact table th,
.density-compact table td { padding-top: 8px; padding-bottom: 8px; }
.density-compact .project-name span,
.density-compact td .sub { margin-top: 2px; }

.primary-metrics,
.secondary-metrics { display: grid; width: 100%; }
.primary-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.secondary-metrics { grid-template-columns: repeat(7, minmax(0, 1fr)); margin-top: 10px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.primary-metrics.flow-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.secondary-metrics.stock-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 0; }
#dashCards { display: block; }
.primary-metrics .card,
.secondary-metrics .card { border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.primary-metrics .card:last-child,
.secondary-metrics .card:last-child { border-right: 0; }
.secondary-metrics .card { padding: 13px 14px; min-height: 96px; }
.secondary-metrics .card .num { font-size: 21px; }
.risk-more { width: calc(100% - 20px); margin: 8px 10px 12px; }

.billing-subview-tabs { margin: 12px 0 8px; }
.billing-status-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.billing-status-strip button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #40514f;
  cursor: pointer;
}
.billing-status-strip button:hover { border-color: var(--accent); }
.billing-status-strip strong { font-size: 20px; color: #172522; }
#billingSummaryTable { min-width: 1240px; }

.project-workflow-modal { width: min(1180px, 96vw) !important; }
.project-workflow-modal .modal-body { padding: 0; }
.project-modal-summary {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1.5fr repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.project-modal-summary > div { min-width: 0; padding: 10px 14px; background: #f7faf9; }
.project-modal-summary span { display: block; color: var(--muted); font-size: 11px; }
.project-modal-summary strong { display: block; overflow: hidden; margin-top: 3px; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.project-workflow { display: grid; grid-template-columns: 190px minmax(0, 1fr); min-height: 570px; }
.project-step-nav { padding: 18px 12px; border-right: 1px solid var(--line); background: #f6f8f8; }
.project-step-nav button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  margin-bottom: 5px;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #465653;
  text-align: left;
  cursor: pointer;
}
.project-step-nav button span { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid #cbd6d4; border-radius: 50%; font-size: 11px; }
.project-step-nav button.active { background: #e6f1ef; color: var(--accent); font-weight: 700; }
.project-step-nav button.active span { border-color: var(--accent); background: var(--accent); color: #fff; }
.project-step-content { min-width: 0; padding: 20px 22px 32px; }
.project-step-panel > h3:first-child { margin-top: 0; }
.project-workflow-modal .modal-foot { position: sticky; bottom: 0; z-index: 8; background: #fff; }
.field-error { display: block; min-height: 16px; margin-top: 4px; color: #b5473f; font-size: 11px; font-weight: 500; }
[aria-invalid="true"] { border-color: #c95d55 !important; }

.toast-region { position: fixed; z-index: 300; top: 18px; right: 18px; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); pointer-events: none; }
.app-toast { transform: translateY(-10px); opacity: 0; display: grid; gap: 3px; padding: 12px 14px; border: 1px solid #c9ddda; border-left: 4px solid var(--accent); border-radius: 6px; background: #fff; box-shadow: 0 12px 30px rgba(20, 38, 36, .14); transition: .2s ease; }
.app-toast.show { transform: translateY(0); opacity: 1; }
.app-toast.error { border-left-color: var(--danger); }
.app-toast strong { font-size: 12px; }
.app-toast span { color: #4f5f5d; font-size: 13px; white-space: pre-line; }
.confirm-dialog { width: min(440px, 92vw) !important; }
.confirm-dialog .modal-body { min-height: auto; }
.confirm-dialog p { margin: 0; white-space: pre-line; color: #435452; line-height: 1.6; }
.password-field { display: grid; gap: 7px; color: #425452; font-size: 12px; font-weight: 700; }
.password-field input { height: 42px; font-size: 16px; }
.password-field small { min-height: 18px; color: var(--danger); font-weight: 500; }

.expandable-cell { cursor: pointer; }
.expandable-cell b::before { content: "+"; display: inline-grid; place-items: center; width: 17px; height: 17px; margin-right: 7px; border: 1px solid #bdccca; border-radius: 3px; color: var(--accent); font-size: 12px; }
.cost-inline-detail td { padding: 0 !important; background: #f7faf9; }
.cost-inline-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 16px 20px; }
.cost-inline-grid section > strong { display: block; margin-bottom: 8px; }
.cost-inline-grid section > div { display: grid; grid-template-columns: 100px 100px 1fr; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.cost-inline-grid small { color: var(--muted); }

#reviewTable { min-width: 1020px; }
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: #f0f7f6; }
.review-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.review-detail-grid > div { padding: 11px 12px; background: #fff; }
.review-detail-grid span { display: block; color: var(--muted); font-size: 11px; }
.review-detail-grid strong { display: block; margin-top: 4px; font-size: 13px; }

.attendance-entry-panel { align-self: start; min-height: auto !important; }
.attendance-entry-layout { grid-template-columns: minmax(370px, .72fr) minmax(520px, 1.28fr) !important; align-items: start; }
.attendance-project-panel { min-height: 0 !important; }
.project-results { max-height: 280px !important; overflow: auto; }
.weekly-reminder { padding: 12px 14px !important; }
.monthly-panel,
.monthly-data,
.monthly-chart-scroll,
.monthly-table-scroll { min-width: 0; max-width: 100%; }

.icon-action { white-space: nowrap; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Desktop professional workspace */
.app-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  pointer-events: none;
}
.tabs button { gap: 10px; }
.tabs button .app-icon { color: #8fa0af; }
.tabs button:hover .app-icon,
.tabs button.active .app-icon { color: #69c0b7; }
.sidebar-lock { gap: 6px; justify-content: center; }
.workspace-actions .btn,
.workspace-actions summary,
.command-actions .btn,
.billing-heading-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.duplicate-page-action,
.duplicate-page-export { display: none !important; }

.workspace-header { box-shadow: 0 1px 0 rgba(23, 37, 52, .03); }
.container { padding-top: 18px; }
.panel { margin-bottom: 14px; }
.panel h2,
.section-heading h2 { font-size: 16px; }
.card .label { font-size: 12px; }
.card .sub { font-size: 11px; }
.card .num { font-variant-numeric: tabular-nums; }
#view-billing .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }

table { font-size: 13px; }
th { height: 38px; color: #536575; background: #eef3f6; font-size: 11px; }
td { height: 44px; }
.density-compact table td { height: 36px; padding-top: 6px; padding-bottom: 6px; }
tbody tr:hover td { background: #eef5f4; }
.num { font-family: inherit; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "zero" 0; letter-spacing: 0; }
.seq-col { width: 48px !important; min-width: 48px !important; text-align: center !important; font-family: inherit; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "zero" 0; }
th:first-child, td:first-child { box-shadow: 6px 0 10px -10px rgba(23, 37, 52, .6), 1px 0 0 var(--line); }
th:last-child, td:last-child { box-shadow: -6px 0 10px -10px rgba(23, 37, 52, .6), -1px 0 0 var(--line); }
#billingTable th:last-child, #billingTable td:last-child,
#costTable th:last-child, #costTable td:last-child { position: sticky; right: 0; z-index: 5; box-shadow: -6px 0 10px -10px rgba(23, 37, 52, .6), -1px 0 0 var(--line); }
#billingTable th:last-child, #costTable th:last-child { z-index: 10; }
.project-name b, .project-name span, .project-name small { display: block; }
.project-name span, .project-name small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 500; }

#view-reg > .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 430px); align-items: center; gap: 16px; }
#view-reg > .toolbar .hint { color: var(--muted); font-size: 12px; }
#regTable { min-width: 100%; table-layout: fixed; }
#regTable th:nth-child(3), #regTable td:nth-child(3) { display: none; }
#regTable th:nth-child(2) { width: 18%; min-width: 0; }
#regTable th:nth-child(4) { width: 8%; }
#regTable th:nth-child(5) { width: 12%; }
#regTable th:nth-child(6), #regTable th:nth-child(7), #regTable th:nth-child(8) { width: 8%; }
#regTable th:nth-child(9) { width: 11%; }
#regTable th:nth-child(10) { width: 15%; min-width: 0; }
#regTable th:nth-child(11) { width: 9%; }
#regTable th:nth-child(12) { width: 5%; }
.archive-deadline { display: block; margin-bottom: 4px; }
.issue-count-button { min-height: 28px; padding: 4px 8px; border: 1px solid #dcc99f; border-radius: 999px; background: #fff7e6; color: var(--warn); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.issue-count-button:hover { border-color: var(--warn); background: #fdf0d5; }
.responsibility-note, .source-notice { margin: 0 0 10px; padding: 9px 12px; border-left: 3px solid var(--accent); border-radius: 0 5px 5px 0; background: #eef6f5; color: #52615f; font-size: 12px; }
.source-notice { display: grid; gap: 3px; margin: 0 0 14px; }
.source-notice[hidden] { display: none; }

.row-icon-action {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}
.row-icon-action span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.row-icon-action:hover { color: var(--accent); border-color: #b9d2cf; background: var(--accent-soft); }
.row-icon-action.danger:hover { color: var(--danger); border-color: #e0bbb7; background: var(--danger-soft); }
.clickable-project-row { cursor: pointer; }

.ledger-commandbar { margin: 12px 0 10px; }
.command-row { border-bottom: 0; }
.active-filter-row { border-top: 1px solid var(--line); background: #f8fafb; }
.active-filter-row[hidden] { display: none; }
.view-menu { position: relative; }
.view-menu summary { list-style: none; cursor: pointer; }
.view-menu summary::-webkit-details-marker { display: none; }
.view-menu-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 35;
  width: 310px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 16px 36px rgba(23, 37, 52, .16);
}
.view-menu-popover > strong { grid-column: 1 / -1; padding: 4px 5px; color: var(--muted); font-size: 11px; }
.view-menu-popover > button { min-height: 32px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--text); cursor: pointer; text-align: left; }
.view-menu-popover > button:hover { color: var(--accent); border-color: #9dc6c2; background: var(--accent-soft); }
.preset-editor { grid-column: 1 / -1; margin-top: 6px; padding-top: 10px; display: grid; grid-template-columns: 1fr auto; gap: 7px; border-top: 1px solid var(--line); }
.preset-editor input, .preset-editor select { min-width: 0; height: 34px; }
.preset-editor select { grid-column: 1 / -1; }
.preset-editor button { border: 1px solid var(--line-strong); border-radius: 5px; background: #fff; cursor: pointer; }
.primary-filters { min-height: 54px; flex-wrap: nowrap !important; }
.primary-filters .search { min-width: 280px; }
.primary-filters select { width: 170px; }
.inline-filter-menu { position: relative; flex: 0 0 auto; }
.inline-filter-menu summary { list-style: none; display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.inline-filter-menu summary::-webkit-details-marker { display: none; }
.inline-filter-popover { position: absolute; top: calc(100% + 8px); right: 0; z-index: 32; width: 280px; padding: 12px; display: grid; gap: 11px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; box-shadow: 0 16px 36px rgba(23, 37, 52, .16); }
.inline-filter-popover label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 700; }
.inline-filter-popover input, .inline-filter-popover select { width: 100%; height: 36px; }
.billing-filters, .cost-filters { flex-wrap: nowrap !important; }
.billing-filters .search, .cost-filters .search { min-width: 280px; flex: 1; }
.cost-filters select { width: 180px; }

#projectTable:not([data-ledger-view="full"]) { min-width: 100%; table-layout: fixed; }
#projectTable[data-ledger-view="financial"] { min-width: 100%; }
#projectTable[data-ledger-view="progress"] { min-width: 100%; }
#projectTable[data-ledger-view="archive"] { min-width: 100%; }
#projectTable[data-ledger-view="full"] { min-width: 4120px; table-layout: auto; }
#projectTable:not([data-ledger-view="full"]) th,
#projectTable:not([data-ledger-view="full"]) td { overflow: hidden; text-overflow: ellipsis; }
#projectTable:not([data-ledger-view="full"]) td { padding-left: 6px; padding-right: 6px; font-size: 12px; }
#projectTable:not([data-ledger-view="full"]) .project-name { font-size: 13px; }
#projectTable[data-ledger-view="financial"] th:nth-child(2) { width: 18%; }
#projectTable[data-ledger-view="financial"] th:nth-child(12) { width: 8%; }
#projectTable[data-ledger-view="financial"] th:nth-child(14),
#projectTable[data-ledger-view="financial"] th:nth-child(19),
#projectTable[data-ledger-view="financial"] th:nth-child(21) { width: 9%; }
#projectTable[data-ledger-view="financial"] th:nth-child(22) { width: 7%; }
#projectTable[data-ledger-view="financial"] th:nth-child(23),
#projectTable[data-ledger-view="financial"] th:nth-child(24),
#projectTable[data-ledger-view="financial"] th:nth-child(25) { width: 8%; }
#projectTable[data-ledger-view="financial"] th:nth-child(37) { width: 9%; }
#projectTable[data-ledger-view="financial"] th:last-child { width: 5%; }
#projectTable[data-ledger-view="progress"] th:nth-child(2) { width: 17%; }
#projectTable[data-ledger-view="progress"] th:nth-child(12) { width: 8%; }
#projectTable[data-ledger-view="progress"] th:nth-child(4),
#projectTable[data-ledger-view="progress"] th:nth-child(5),
#projectTable[data-ledger-view="progress"] th:nth-child(6) { width: 9%; }
#projectTable[data-ledger-view="progress"] th:nth-child(28),
#projectTable[data-ledger-view="progress"] th:nth-child(30),
#projectTable[data-ledger-view="progress"] th:nth-child(32) { width: 11%; }
#projectTable[data-ledger-view="progress"] th:nth-child(7) { width: 18%; }
#projectTable[data-ledger-view="progress"] th:last-child { width: 5%; }
.timeline-date { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11px; }
.timeline-date + .timeline-date { margin-top: 3px; }
.timeline-date small { color: var(--muted); font-size: 10px; }
.timeline-date.actual { color: var(--text-strong); font-weight: 700; }

.summary-project-link,
.summary-amount-link { margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.summary-project-link { display: block; width: 100%; text-align: left; }
.summary-project-link:hover b,
.summary-amount-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.summary-amount-link { font-variant-numeric: tabular-nums; font-weight: 700; }
.billing-focus-row { display: flex; align-items: center; margin: -2px 0 10px; }
.billing-focus-row[hidden] { display: none; }
.billing-focus-row > span { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 5px 8px 5px 10px; border: 1px solid #b9d2cf; border-right: 0; border-radius: 5px 0 0 5px; background: var(--accent-soft); color: #49615f; font-size: 12px; }
.billing-focus-row small { color: var(--muted); }
.billing-focus-row button { width: 30px; height: 30px; border: 1px solid #b9d2cf; border-radius: 0 5px 5px 0; background: var(--accent-soft); color: var(--accent); cursor: pointer; font-size: 18px; }
.billing-focus-row button:hover { background: #d7ebe8; }
.billing-record-actions,
.receipt-row-actions { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 88px; white-space: nowrap; }
.receipt-row-actions .row-icon-action { width: 32px; height: 32px; border-color: #c9d5dc; background: #fff; }
.receipt-row-actions .row-icon-action:hover { border-color: #8ebbb6; background: var(--accent-soft); color: var(--accent); }
.receipt-row-actions .row-icon-action.danger { border-color: #e6bbb7; color: var(--danger); }
.receipt-row-actions .row-icon-action.danger:hover { border-color: #d88e87; background: #fbefee; }
.billing-form-section { padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.billing-form-section + .billing-form-section { margin-top: 14px; }
.billing-project-summary { margin-bottom: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.issue-detail-modal { width: min(720px, 90vw); }
.issue-detail-list { display: grid; gap: 8px; }
.issue-detail-list article, .review-issue-section article { padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: #f8fafb; }
.issue-detail-list article > div { display: flex; align-items: center; gap: 8px; }
.issue-detail-list p, .review-issue-section p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.review-issue-section { margin-top: 16px; }
.review-issue-section h3 { margin: 0 0 8px; }
.billing-status-strip button.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
#costTable td:last-child .btn { min-width: 64px; white-space: nowrap; }
.cost-inline-detail td { position: static !important; display: table-cell !important; box-shadow: none !important; }

.risk-tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.risk-tabs button { min-height: 38px; padding: 7px 12px; display: inline-flex; align-items: center; gap: 8px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.risk-tabs button:hover { color: var(--accent); background: #f6faf9; }
.risk-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 750; }
.risk-tabs b { min-width: 20px; padding: 1px 6px; border-radius: 10px; background: #edf1f3; color: var(--muted); font-size: 11px; text-align: center; }
.risk-tabs button.active b { background: var(--accent-soft); color: var(--accent); }
.risk-tab-panel { border: 1px solid var(--line); border-top: 0; }
.risk-tab-panel .risk-head { padding: 11px 14px; }
.risk-tab-panel .risk-list { display: block; }
.risk-tab-panel .risk-item { min-height: 70px; padding: 11px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.risk-item-main { min-width: 0; }
.risk-context { margin-top: 5px; display: flex; gap: 18px; color: var(--muted); font-size: 11px; }
.risk-context span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.risk-item-actions { display: flex; align-items: center; gap: 8px; }
.risk-more { width: auto; margin: 10px 14px 14px; }

.overlay { align-items: center; justify-content: center; padding: 16px; }
#confirmModal, #passwordModal, #issueDetailModal { z-index: 420; }
.modal { height: min(860px, calc(100dvh - 32px)); border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.confirm-dialog { height: auto; max-height: calc(100dvh - 64px); }
.project-workflow-modal { width: min(1180px, calc(100vw - 48px)) !important; height: min(680px, calc(100dvh - 32px)); }
.project-workflow-modal .modal-body { flex: 1; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.project-workflow { min-height: 0; height: 100%; }
.project-step-nav { overflow: auto; }
.project-step-content { overflow: auto; }
.project-modal-summary > div { background: #f2f6f7; }
.project-step-nav { background: #f3f6f8; }
.project-step-nav button.active { background: var(--accent-soft); }
.step-error-count { min-width: 20px; margin-left: auto; padding: 1px 5px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 10px; font-style: normal; text-align: center; }
.field-error:empty { display: none; }
.source-note { background: #f3f7f8; }
input[readonly], textarea[readonly], select:disabled { color: #5f6c76; background: #eef2f4; }

#billingModal .modal-body > h3 { margin-top: 22px; }

#costTable thead th small {
  display: block;
  margin-top: 3px;
  color: #7a8792;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.25;
  white-space: normal;
}

.monthly-table .per-capita-value { color: #18756f; font-weight: 700; background: #eef7f5; }
.dashboard-insights { align-items: start; margin-bottom: 12px; }
.dashboard-side { align-self: start; grid-template-rows: auto; }
.dashboard-side .compact-panel { height: auto; }
#view-dash .cards { margin-bottom: 12px; }
#view-dash > .panel:last-child { margin-top: 0; }

#view-people { min-height: 0; }
#view-people .panel { min-height: 0; height: auto; }
#view-people .table-wrap {
  min-height: 0;
  height: auto;
  max-height: calc(100dvh - 270px);
  overflow: auto;
}
#peopleTable thead th { position: sticky; top: 0; z-index: 9; background: #eef3f6; }
#peopleTable thead .seq-col { left: 0; z-index: 10; }

#view-data { overflow-x: hidden; }
#view-data .panel { min-width: 0; }
#view-data .data-top-grid { grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); align-items: start; }
#view-data .data-top-grid .status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#view-data .data-top-grid .status-cell:nth-child(2n) { border-right: 1px solid var(--line); }
#view-data .data-top-grid .status-cell:nth-child(4n) { border-right: 0; }
#view-data .data-top-grid .status-cell strong { overflow-wrap: anywhere; }
#view-data .data-action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
#view-data .data-action-grid > .panel { display: flex; flex-direction: column; }
#view-data .data-button-grid { margin-top: auto; display: grid; gap: 8px; }
#view-data .backup-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#view-data .maintenance-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#view-data .data-button-grid .btn { width: 100%; min-width: 0; justify-content: center; white-space: normal; line-height: 1.25; }

.review-score-section { margin-top: 20px; }
.review-score-list { display: grid; gap: 8px; margin-top: 10px; }
.review-score-list article { padding: 10px 12px; border: 1px solid #d9e0e5; border-radius: 6px; background: #f7f9fa; }
.review-score-list article > div { display: flex; justify-content: space-between; gap: 12px; }
.review-score-list article p { margin: 5px 0 0; color: #65727e; font-size: 12px; }

#billingInvoicePane .table-wrap,
#billingReceiptPane .table-wrap { min-height: 260px; }
#billingCalcStrip { position: sticky; bottom: -28px; z-index: 3; box-shadow: 0 -1px 0 var(--line); }
.cost-entry-section { border-color: var(--line-strong); box-shadow: none; }
.service-entry-section { background: #fbfcfc; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media (max-width: 1180px) {
  .secondary-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .secondary-metrics .card:nth-child(4) { border-right: 0; }
  .attendance-entry-layout { grid-template-columns: 1fr !important; }
  .attendance-project-panel { min-height: auto !important; }
}

@media (max-width: 820px) {
  .container { padding-left: 12px !important; padding-right: 12px !important; }
  .app-sidebar .sidebar-foot { display: flex; min-height: 44px; padding: 6px 10px; border-top: 1px solid rgba(255,255,255,.08); }
  .app-sidebar .sidebar-lock { margin-left: auto; }
  .command-row { align-items: stretch; flex-direction: column; }
  .command-actions { flex-wrap: wrap; }
  .ledger-tabs { overflow-x: auto; }
  .ledger-tabs .btn { flex: 0 0 auto; }
  .quick-view-row input, .quick-view-row select { max-width: none; flex: 1 1 150px; }
  .primary-filters { display: grid !important; grid-template-columns: 1fr 1fr; }
  .primary-filters .search { grid-column: 1 / -1; min-width: 0; width: 100%; }
  .primary-filters select { width: 100%; }
  .primary-metrics { grid-template-columns: 1fr 1fr; }
  .secondary-metrics { grid-template-columns: 1fr 1fr; }
  .billing-status-strip { grid-template-columns: 1fr 1fr; }
  .periodbar { flex-wrap: wrap; overflow: hidden; }
  .periodbar .period-label { width: 100%; margin-left: 0; text-align: right; }
  .project-modal-summary { grid-template-columns: 1fr 1fr; }
  .project-workflow { display: block; }
  .project-step-nav { position: sticky; top: 0; z-index: 4; display: flex; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .project-step-nav button { flex: 0 0 auto; width: auto; margin: 0 4px 0 0; }
  .project-step-content { padding: 16px; }
  .cost-inline-grid { grid-template-columns: 1fr; }

  #regTable, #projectTable:not([data-ledger-view="full"]), #billingSummaryTable, #billingTable, #costTable, #reviewTable { min-width: 0 !important; display: block; }
  #regTable thead, #projectTable:not([data-ledger-view="full"]) thead, #billingSummaryTable thead, #billingTable thead, #costTable thead, #reviewTable thead { display: none; }
  #regTable tbody, #projectTable:not([data-ledger-view="full"]) tbody, #billingSummaryTable tbody, #billingTable tbody, #costTable tbody, #reviewTable tbody { display: grid; gap: 10px; padding: 10px; }
  #regTable tr, #projectTable:not([data-ledger-view="full"]) tr, #billingSummaryTable tr, #billingTable tr, #costTable tr:not(.cost-inline-detail), #reviewTable tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
  #regTable td, #projectTable:not([data-ledger-view="full"]) td, #billingSummaryTable td, #billingTable td, #costTable tr:not(.cost-inline-detail) td, #reviewTable td { display: block; min-width: 0 !important; padding: 0 !important; border: 0 !important; white-space: normal; }
  #regTable td::before, #projectTable:not([data-ledger-view="full"]) td::before, #billingSummaryTable td::before, #billingTable td::before, #costTable tr:not(.cost-inline-detail) td::before, #reviewTable td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 700; }
  #regTable td:first-child, #projectTable:not([data-ledger-view="full"]) td:first-child, #billingSummaryTable td:first-child, #billingTable td:nth-child(2), #costTable td:nth-child(2), #reviewTable td:first-child { grid-column: 1 / -1; }
  .table-pager { min-width: 0; flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .primary-metrics, .secondary-metrics, .billing-status-strip { grid-template-columns: 1fr; }
  .primary-filters { grid-template-columns: 1fr; }
  .primary-filters .search { grid-column: auto; }
  .project-modal-summary { grid-template-columns: 1fr; }
  .project-modal-summary > div:not(:first-child) { display: none; }
  .project-step-nav button { font-size: 12px; }
  .review-detail-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Online wide tables: one sticky model for Safari, Chromium and zoomed layouts. */
html,
body { min-width: 0 !important; max-width: 100%; overflow-x: hidden; }
.main,
.content,
.view,
.panel,
.table-wrap { min-width: 0; max-width: 100%; }
.table-wrap { position: relative; isolation: isolate; overflow: auto; overscroll-behavior: contain; }
.stable-data-table {
  width: 100%;
  table-layout: fixed !important;
  border-collapse: separate;
  border-spacing: 0;
}
.stable-data-table col.col-seq { width: 56px; }
.stable-data-table col.col-project { width: clamp(145px, 13vw, 185px); }
.stable-data-table col.col-owner { width: clamp(76px, 6.5vw, 92px); }
.stable-data-table col.col-date { width: 112px; }
.stable-data-table col.col-money { width: 122px; }
.stable-data-table col.col-invoice { width: 160px; }
.stable-data-table col.col-status { width: 126px; }
.stable-data-table col.col-note { width: 210px; }
.stable-data-table col.col-actions { width: 112px; }
#billingSummaryTable { min-width: 1435px !important; }
#billingTable { min-width: 1190px !important; }
#billingReceiptTable { min-width: 1045px !important; }
#costTable { min-width: 1535px !important; }
.cost-record-table { min-width: 1565px !important; }
#costTable th,
#costTable td { display: table-cell !important; }
.stable-data-table th,
.stable-data-table td { box-sizing: border-box; overflow: hidden; }
.stable-data-table tbody tr { height: 56px; }
.stable-data-table tbody td {
  height: 56px;
  vertical-align: middle !important;
  border-bottom: 1px solid var(--line);
  line-height: 1.3;
}
.stable-data-table .owner-col,
.stable-data-table .owner-cell { position: static !important; vertical-align: middle !important; box-shadow: none !important; }
.stable-data-table .project-cell,
.stable-data-table .owner-cell { min-width: 0; }
.stable-data-table .project-cell > b,
.stable-data-table .project-cell > .sub,
.stable-data-table .project-cell .summary-project-link > b,
.stable-data-table .project-cell .summary-project-link > span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}
.stable-data-table td.owner-cell {
  display: table-cell !important;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}
.stable-data-table .project-cell > .sub,
.stable-data-table .project-cell .summary-project-link > span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.stable-data-table .summary-project-link {
  display: flex;
  min-height: 38px;
  flex-direction: column;
  justify-content: center;
}
.stable-data-table .note-cell {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}
.stable-data-table .money-cell,
.stable-data-table .date-cell,
.stable-data-table .invoice-cell,
.stable-data-table .status-cell,
.stable-data-table .action-cell { white-space: nowrap !important; }
.stable-data-table .action-cell .row-actions { min-width: 0; flex-wrap: nowrap; }
.stable-data-table .seq-col { position: sticky !important; left: 0; z-index: 6; text-align: center; }
.stable-data-table .code-col { position: sticky !important; left: 56px; z-index: 6; white-space: nowrap !important; box-shadow: 6px 0 10px -10px rgba(23, 37, 52, .6), 1px 0 0 var(--line); }
.stable-data-table .project-col,
.stable-data-table .owner-col { position: static !important; left: auto !important; box-shadow: none !important; }
#billingSummaryTable .status-col,
#billingTable .action-col,
#billingReceiptTable .action-col,
#costTable .action-col,
.cost-record-table .action-col { position: sticky !important; right: 0; z-index: 5; box-shadow: -6px 0 10px -10px rgba(23, 37, 52, .6), -1px 0 0 var(--line); }
.stable-data-table thead .seq-col,
.stable-data-table thead .code-col,
#billingSummaryTable thead .status-col,
#billingTable thead .action-col,
#billingReceiptTable thead .action-col,
#costTable thead .action-col,
.cost-record-table thead .action-col { z-index: 11; background: #eef3f6; }
.stable-data-table tbody .seq-col,
.stable-data-table tbody .code-col,
#billingSummaryTable tbody .status-col,
#billingTable tbody .action-col,
#billingReceiptTable tbody .action-col,
#costTable tbody .action-col,
.cost-record-table tbody .action-col { background: #fff; }
.stable-data-table tbody tr:nth-child(even) .seq-col,
.stable-data-table tbody tr:nth-child(even) .code-col,
#billingSummaryTable tbody tr:nth-child(even) .status-col,
#billingTable tbody tr:nth-child(even) .action-col,
#billingReceiptTable tbody tr:nth-child(even) .action-col,
#costTable tbody tr:nth-child(even) .action-col,
.cost-record-table tbody tr:nth-child(even) .action-col { background: #f8fafb; }
.stable-data-table tbody tr:hover .seq-col,
.stable-data-table tbody tr:hover .code-col,
#billingSummaryTable tbody tr:hover .status-col,
#billingTable tbody tr:hover .action-col,
#billingReceiptTable tbody tr:hover .action-col,
#costTable tbody tr:hover .action-col,
.cost-record-table tbody tr:hover .action-col { background: #edf6f5; }

/* Final release: cost metrics and grouped summary headers. */
.cost-metric-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.cost-metric-group { min-width: 0; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.cost-metric-group > header { min-height: 47px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f4f7f8; }
.cost-metric-group > header strong,
.cost-metric-group > header span { display: block; }
.cost-metric-group > header strong { color: var(--text-strong); font-size: 13px; }
.cost-metric-group > header span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.cost-metric-group.plan > header { background: #fbf4e7; }
.cost-metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cost-metric-group.count-2 .cost-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cost-metric-group.count-3 .cost-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cost-metric-grid .card { min-width: 0; min-height: 100px; border: 0; border-right: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.cost-metric-grid .card .num,
.cost-metric-grid .card .num small { white-space: nowrap; }
.cost-metric-grid .card .num { font-size: 20px; }
.cost-metric-grid .card:last-child { border-right: 0; }
.cost-metric-group.plan .card { background: #fffdf8; }
#costTable thead th { top: 0; height: 52px; background: #f4f6f7; text-align: center; }
#costTable thead th.plan-cell { background: #fcf6e9; }
#costTable tbody td.plan-cell { background: #fffdf8; }
#costTable tbody tr:nth-child(even) td.plan-cell { background: #fcfaf4; }
#costTable tbody tr:hover td.plan-cell { background: #f5f1e5; }
#costTable thead .seq-col { left: 0; z-index: 42; }
#costTable thead .code-col { left: 56px; z-index: 42; }

/* Online release: independent project code/short-name columns and stable headers. */
.latest-project-link {
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.latest-project-editor {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 32px;
  gap: 6px;
  align-items: center;
  min-width: 0;
}
.latest-project-editor select {
  width: 100%;
  min-width: 0;
  height: 34px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.latest-project-open {
  width: 32px;
  height: 32px;
}
#peopleTable th:nth-child(5),
#peopleTable td:nth-child(5) { width: clamp(220px, 27vw, 390px); }
.field-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
}
.stable-data-table col.col-code { width: 104px; }
.stable-data-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
  background: #eef3f6 !important;
  background-clip: padding-box !important;
}
.stable-data-table thead .project-col,
.stable-data-table thead .owner-col {
  position: sticky !important;
  left: auto !important;
  box-shadow: none !important;
}
.stable-data-table td.owner-cell { position: static !important; box-shadow: none !important; }
.stable-data-table tbody .code-col { background: #fff; }
.stable-data-table tbody tr:nth-child(even) .code-col { background: #f8fafb; }
.stable-data-table tbody tr:hover .code-col { background: #edf6f5; }
.stable-data-table thead .seq-col,
.stable-data-table thead .code-col,
#billingSummaryTable thead .status-col,
#billingTable thead .action-col,
#billingReceiptTable thead .action-col,
#costTable thead .action-col,
.cost-record-table thead .action-col { z-index: 42 !important; background: #e7eef2 !important; }
.stable-data-table .project-cell > b,
.stable-data-table .project-cell .summary-project-link > b {
  display: -webkit-box;
  overflow: hidden;
  white-space: normal !important;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-overflow: ellipsis;
}
#billingSummaryTable { min-width: 1450px !important; }
#billingTable { min-width: 1220px !important; }
#billingReceiptTable { min-width: 1090px !important; }
#costTable { min-width: 1575px !important; }
.cost-record-table { min-width: 1610px !important; }

@media (min-width: 769px) {
  #regTable { min-width: 1500px; table-layout: fixed; }
  #regTable th,
  #regTable td { display: table-cell !important; }
  #regTable th:nth-child(1) { width: 56px; min-width: 56px; }
  #regTable th:nth-child(2) { width: 104px; }
  #regTable th:nth-child(3) { width: 180px; min-width: 150px; }
  #regTable th:nth-child(4) { width: 125px; }
  #regTable th:nth-child(5) { width: 90px; }
  #regTable th:nth-child(6) { width: 170px; }
  #regTable th:nth-child(7),
  #regTable th:nth-child(8),
  #regTable th:nth-child(9) { width: 105px; min-width: 0; }
  #regTable th:nth-child(10) { width: 125px; }
  #regTable th:nth-child(11) { width: 190px; min-width: 0; }
  #regTable th:nth-child(12) { width: 105px; }
  #regTable th:nth-child(13) { width: 72px; }
  #regTable .project-cell b,
  #projectTable .project-cell b {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  #projectTable[data-ledger-view="full"] { min-width: 4260px; }
  #projectTable:not([data-ledger-view="full"]) th:nth-child(2) { width: 100px; }
  #projectTable:not([data-ledger-view="full"]) th:nth-child(3) { width: 18%; min-width: 145px; }
}

/* Department entry and local data isolation. */
.app-shell { visibility: hidden; }
.department-entered .app-shell { visibility: visible; }
.department-gate {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef3f4;
}
.department-entered .department-gate { display: none; }
.department-gate-panel {
  width: min(440px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(23, 37, 52, .12);
}
.department-gate-panel h1 { margin: 8px 0 6px; font-size: 25px; letter-spacing: 0; }
.department-gate-panel p { margin: 0 0 22px; color: var(--muted); }
.department-gate-panel label { display: grid; gap: 7px; margin-bottom: 16px; color: var(--text-strong); font-weight: 700; }
.department-gate-panel select { width: 100%; min-height: 44px; }
.department-gate-panel .btn { width: 100%; min-height: 44px; justify-content: center; }
.department-gate-panel small { display: block; margin-top: 14px; color: var(--muted); line-height: 1.6; }
.department-switch {
  width: 100%;
  overflow: hidden;
  padding: 5px 4px;
  border: 0;
  background: transparent;
  color: #a9b8c6;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.department-switch:hover { color: #fff; }

@media (max-width: 1180px) {
  .cost-metric-groups { grid-template-columns: 1fr; }
}

/* Final release: one dashboard hierarchy with switchable monthly and stage views. */
.dashboard-metric-section { width: 100%; }
.metric-group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 0 2px 10px; }
.metric-group-title strong { color: var(--text-strong); font-size: 16px; }
.metric-group-title span { color: var(--muted); font-size: 11px; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: #fff; }
.dashboard-metrics .card { min-width: 0; min-height: 112px; margin: 0; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.dashboard-metrics .card:nth-child(4n) { border-right: 0; }
.dashboard-metrics .card:nth-last-child(-n + 4) { border-bottom: 0; }
.dashboard-insight-panel { padding: 0; overflow: hidden; }
.dashboard-insight-tabs { display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-bottom: 1px solid var(--line); background: #fff; }
.dashboard-insight-tabs button { min-height: 44px; padding: 8px 16px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font: inherit; font-weight: 700; }
.dashboard-insight-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.dashboard-insight-pane { padding: 16px; }
.dashboard-insight-pane[hidden] { display: none !important; }
.workflow-status-chart { position: relative; display: grid; gap: 14px; padding-top: 22px; }
.workflow-axis-label { position: absolute; top: 0; right: 58px; color: var(--muted); font-size: 11px; }
.workflow-stage-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 58px; gap: 12px; align-items: center; }
.workflow-stage-row > strong { color: var(--text-strong); font-size: 13px; }
.workflow-stage-row > em { color: var(--muted); font-size: 12px; font-style: normal; text-align: right; white-space: nowrap; }
.workflow-stage-track { min-width: 0; min-height: 40px; display: flex; align-items: stretch; overflow: hidden; border: 1px solid var(--line); background: #f3f6f7; }
.workflow-stage-segment { min-width: 28px; display: flex; align-items: center; justify-content: center; gap: 5px; overflow: hidden; padding: 0 7px; color: #fff; }
.workflow-stage-segment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.workflow-stage-segment b { flex: 0 0 auto; font-size: 12px; }
.workflow-stage-empty { margin: auto; color: var(--muted); }
.workflow-stage-legend { display: flex; flex-wrap: wrap; gap: 7px 14px; padding: 3px 0 0 104px; color: var(--muted); font-size: 11px; }
.workflow-stage-legend span { display: inline-flex; align-items: center; gap: 5px; }
.workflow-stage-legend i { width: 9px; height: 9px; display: inline-block; }

@media (max-width: 1100px) {
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-metrics .card:nth-child(4n) { border-right: 1px solid var(--line); }
  .dashboard-metrics .card:nth-child(2n) { border-right: 0; }
  .dashboard-metrics .card:nth-last-child(-n + 4) { border-bottom: 1px solid var(--line); }
  .dashboard-metrics .card:nth-last-child(-n + 2) { border-bottom: 0; }
}

/* Online authentication overlay. */
.online-login[hidden], .online-login [hidden] { display: none !important; }
.online-login { position: fixed; inset: 0; z-index: 4000; display: grid; place-items: center; padding: 24px; background: #eef3f4; }
.auth-pending .app-shell { visibility: hidden !important; }
.online-login-panel { width: min(440px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: 0 18px 46px rgba(24, 42, 55, .16); }
.online-login-panel h1 { margin: 5px 0 8px; font-size: 25px; }
.online-login-panel > p { margin: 0 0 20px; color: var(--muted); line-height: 1.65; }
.online-login-panel > label { display: grid; gap: 7px; margin-top: 13px; color: var(--text-strong); font-size: 13px; font-weight: 700; }
.online-login-panel select, .online-login-panel input { width: 100%; min-height: 42px; }
.online-login-panel .form-error { min-height: 22px; margin: 12px 0 0; color: var(--danger); }
.online-login-panel .button-row { justify-content: flex-end; margin-top: 12px; }
.online-app .department-switch { display: inline-flex; }
.account-match-list { display: grid; gap: 8px; }
.account-match-row { display: grid; grid-template-columns: minmax(210px, 1fr) 190px auto auto auto; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.account-match-row:last-child { border-bottom: 0; }
.account-match-row strong, .account-match-row small { display: block; }
.account-match-row small { margin-top: 3px; color: var(--muted); }
.connection-state.reconnecting::before { background: #d9a441; }
.connection-state.failed::before { background: #c9554d; }
.connection-state.online::before { background: #58b69c; }
@media (max-width: 980px) { .account-match-row { grid-template-columns: 1fr 1fr; } }
